More from the Modular Teensy Project

Status
Not open for further replies.
Please ask onehorse, the boards are HIS design. But chiming in, I have used a SPI OLED 128x128 Color Display & SPI SD reader w/o problems. I was running into occasional issues with i2c and SPI though. Good luck, would love to see what you get working. M
 
Can you have two SPI devices at once

If you use the Mini/Micro MPU9250 add-on boards or one of the LSM9DS0 micro boards, the (one and only) SPI port on Teensy 3.1 is accessible. I believe Paul's latest SPI library allows multiple devices to alternatively take control of the SPI bus and send or receive data before handing off to some other device (SD card to rf Radio to ... for example) I am just now starting to use SPI-dependent rf radio (nRF24L01+) with these add-on boards on Teensy 3.1 and everything works and plays well together so far. However, I haven't tried to hook up more than one SPI device yet and the issues that Paul and Bill are discussing have to do with latency on the SPI bus; that is, if one device needs to use it before the other device is ready to give it up. I suspect this is application dependent, but SD card writes seems to be particularly problematic since if not properly configured they can take a looong time. But I am no expert on SPI or SD cards...
 
One more piece of the puzzle; a DC motor controller add-on for Teensy 3.1. This is a design copied from the circuit used in CrazyFlie (I am using the same mosfets) but of course the board layout is original. The board uses the PWM signal from pins 3,4 and 22,23 to control power from VIN and GND via control of the mosfet gate voltage. Pretty standard stuff but it works well and can be integrated into an add-on board of "appallingly small" dimensions. I chose single mosfets and 0805 components, which seem gigantic after working with 0402 passives. This board could be made smaller still with dual mosfets and 0603 passive components. But since the board has to stretch from VIN/GND to pins 23/4 to reach at least 4 PWM pins there is not much point unless the DC motor control function were to be integrated with, say, a LiPo charger and some other stuff too. I am resisting the temptation to integrate since it defeats the original modular concept. However, the pull is strong and I already know I will end up doing it eventually.

Here are the OSHPark boards naked and populated:

DCMotorController.jpg

I delight in a well-designed board and I find this one particularly pleasing. Please forgive my self-indulgence. The 2 x 4 motor outputs are at top and bottom, the underside of the board has the PWM and power labels. I mounted the board atop a Teensy 3.1 which already had an LSM9DS0 micro board soldered to the pads underneath. I intend to use this kind of setup for various robotic and autonomous vehicle applications but I still need to perfect the LiPo power board and get the dang rf radio board to work. Still, I verified I can drive four motors; don't know just what I'll do with the contraption though...

DCMotorController2.jpg
 
Last edited:
I've been wondering about a small way to add motors to the Teensy 3.x. I look forward to seeing the finished product at your tindie store (along with the lipo shield).
 
Does it support polarity inversion to spin the motor backwards ?

Only in the sense that you can wire up the motors "backwards", but you cannot switch dynamically back and forth between the directions on this board. I recognize that more advanced motor control applications require this capability. It will likely require some kind of "H" bridge, not the simple FET gate method used here. This just means instead of a single FET per motor one would need two or more to allow the switching. Possible and even straightforward but would require a redesign.
 
I look forward to seeing the finished product at your tindie store (along with the lipo shield).

I ordered some more of both boards from OSHPark and will likely have them on Tindie by next weekend. I also broke down and made an nRF24L01+ adapter board for the cheap Chinese radios I bought on Amazon just in case I can't get my own board to work (Jinx!). These might be a very low cost solution for those who want to add a 2.4 GHz rf radio to their Teensy. If they work as expected I'll report here and put those on Tindie too.
 
Last edited:
I am so glad to find out my nRF24L01+ radio actually works and the design is not flawed. This board is tough to assemble in that I had to take greater than normal care to apply the solder paste and place the components. This partly because there are a lot of components and they are very small (0402). The care paid off when I finally got the board to respond as it should. Here is what it looks like:

nRF24L01+1.jpg

Naked board between the populated board on the left and the $3 competition. It is impossible to create a board and sell it for $3 and make any money so I encourage everyone who wants nRF24L01+ capability for their Teensy to buy from Amazon and use an adapter. It is a point of pride for me to make this thing work especially after failing once. Still, small size is a premium for my applications and the custom made board at even 5 times the cost is worth it to me. Here is a close up so you can see all the lilliputian passive components:

nRF24L01+2.jpg


Note the crystal pads are wrongly sized because I chose a smaller crystal for this attempt. I will be redesigning the board to accommodate properly this smaller crystal.
 
Last edited:
A brief update from the world of appallingly small.

LSM9DS0Micro1.jpg

I managed to redesign the LSM9DS0 Micro Add-On board to avoid use of pin 33 (new one on top, old one on bottom). I also was able to add an MS5637 pressure sensor by reducing the size of some of the passives to 0402, replacing the large Ta cap with a smaller one, and getting rid of the solder jumper by permanently connecting the 4K7 pullups. This LSM9DS0 Micro Add-On pcb board is shared at OSH Park and the Micro Add-On has proved surprisingly popular at Tindie.

MAX21100BOB.front.jpg

I assembled and started testing my first MAX21100 (+ LIS3MDL magnetometer + MS5637 pressure sensor) motion sensor breakout board. I designed it to be two boards in one, either a Teensy 3.1 Mini Add-On board like others in this thread, or a conventional breakout board for use with any old (3V3) microcontroller via solder jumpers on the back. It took some inspired guessing since the data sheet and register map for this device are terse, to say the least. But I got most everything working. So far I can say that it is true! This chip seems to perform 9 DoF sensor fusion in hardware in the 3 mm x 3 mm sensor package without any binary blob upload or microcontroller filtering of any kind. Amazing! I am still learning how to use it but there is a lot of potential here for motion sensor nuts like me. You can read more about this sensor and my doings with it here and you can order the pcb from OSH Park if you want to make your own.

VL6180X.front.jpgVL6180X.back1.jpg

Lastly, I am just starting to play with ST Microelectronics' VL6180X proximity sensor. This sensor uses IR laser range finding to measure absolute distance from ~0 out to 100 mm or maybe twice as far depending on the ambient lighting and reflectance of the surface. Wow, I can measure distance out to a foot, you say, ought to be great for any applications the ants are planning! The value here is in gesture recognition and control of stuff through the microcontroller via touchless gesture recognition. I think this is pretty cool. There is already an electric field solution that can do this, but it requires a special built grid of electrodes to do the recognition. This VL6180X board is likewise designed to be mounted directly on the Teensy 3.1 or used as a conventional breakout board. Since this is a very low power sensor (2 mA max average current, maybe 24 mA peak) I am hoping to power it directly from GPIO pins on the Teensy. If this works, it would make this add-on board a very useful way to add touchless buttons and switches to any Teensy project. Here is the pcb at OSH Park if you want to build your own.

Edit: I tried using the GPIO pins to power the VL6180X and it works like a champ. This very useful since the board can be top mounted or bottom mounted on the Teensy 3.1. It just needs to align with the SDA/SCL pin pairs on 16/17 or 18/19. The 2.5 mA average current draw even when using the interleaved light sensing/range finding mode is no problem for the GPIO pins to supply.
 
Last edited:
Wow, that ST Microelectronics' VL6180X proximity sensor looks great! Thanks for the tip.

David
 
Wow, that ST Microelectronics' VL6180X proximity sensor looks great!

There is a similar and somewhat cheaper device made by Vishay that does the same thing that I want to try out also. The ST device works as advertised. The hard part is writing the algorithms for gesture recognition. I have the VL6180X program in good enough shape to start...
 
A brief update on 2.4 GHz radio add-ons for Teensy 3.1.

I thought the range of the first nRF24L01+ radio design I built with the ceramic antenna was not very good so I redesigned the board with an on-board antenna. One design used that recommended by Nordic, just a long, thick metal line. The other I shamelessly copied from the $3 Chinese boards I have been buying. I also made an adapter for these cheap boards so I can test them against my own in the same test rig. Unfortunately, I don't have an RF scope so I can't test the antenna gains and matching properly. I just did a qualitative test through walls and at distance in my house.

Here is what I am working with:

nRF24L01+.pic1.jpgnRF24L01+.pic2.jpg

My two designs with two different pcb antennas on the left, the $3 competition on the right with the Teensy 3.1 adapter soldered into place. You can see in the second picture how the adapter mounts to the Teensy 3.1 in the same way the custom made boards do. It was rather difficult to solder the adapter into place; it's not a great design but I made it work.

nRF24L01+.pic3.jpgnRF24L01+.pic4.jpg

I added headers to the boards so I could exchange them on the Teensy 3.1 test rig, which has the extra long machine pin headers from Schmartboard. In actual use I would just solder the boards directly to the Teensy, probably underneath.

I used the yaw output from the MAX21100 + LIS3MDL motion sensor suite as a transmit variable, and monitored receipt from the stationary test rig to a mobile battery-powered 3.3 V Pro Mini + nRF24L01+ with a display to tell when I lost the signal, etc. The remote broadcast a PWM thrust variable in exchange. Successful transmission was receipt of the yaw and confirmation of send of the thrust. That way I know the two radios are still talking to each other. It's clunky, but it works and mimics the real application; remote control of a motorized vehicle.

The weird thing is I didn't get any yaw value returned with the $3 version of the nRF24L01+ in its adapter when mounted to the Teensy 3.1 no matter how close it was to the receiver, but I did get verification that it was receiving the thrust transmission.

The custom made boards both reported yaw and confirmed thrust out to 40 feet with at least one wall between the sender and receiver. I couldn't really tell the difference between the two antenna performances; it looks like either one is better than the ceramic antenna I used previously. I prefer the Chinese design since it is smaller, and I think, looks more interesting than the straight thick line. Both custom boards are difficult to build, requiring some patience to get the tiny 0402 passives in place. I noticed that the Chinese board uses 0603 components, but the build area is also 50% larger than my custom boards.

I don't know if it makes sense for me to try to sell these since these custom boards will never be price competitive with the $3 imports. They are more for me to get used to using the Nordic technology in preparation for the next level; building an add-on board for the Nordic nRF51822 bluetooth LE chip.
 
Last edited:
If you need more range, and as you may know, the sub-GHz radios (as PCBs from HopeRF/Anarduino), or as chips from Si Labs or Semtech, will have much longer range due to the frequency and higher RF power.

The ceramic (chip) antennas are made for Bluetooth apps where range is short. I've worked with those antennas. At 2.4GHz, they are rather directional and have about -10dBi "gain".
 
Last edited:
... PCBs from HopeRF/Anarduino...

It is on my list of things to do to get some of these radios and see how they work. It will be somewhat of a tangent for me since my real target is the low-power bluetooth technology, starting with the nRF51822.

My plan was to first prove to myself I could design (really copy Nordic's design) and build an nRF24L01+ board that would work. Next step is to do the same with the nRF51822.

The latter is interesting because it has the 2.4 GHz radio function embedded in it, so is backward compatible with the nRF24L01+. In addition to having bluetooth LE, it also has a Cortex M0 ARM processor embedded in it, so this is really a system-on-a chip and, in principle, similar to the Teensy 3.1 Freescale processor plus the radio and bluetooth. Of course, it seems to be much more difficult to program since it doesn't benefit from Teensyduino! Although I have an mbed enabled nRF51822 board that is pretty easy to program. In any case, I expect this departure from Teensy and Arduino to be painful and slow.

I knew the ceramic antenna would be an underperformer but I had no idea how bad it is. The on-board antennas take no more space and seems to produce ~twice the gain. At least in my rough experiments.
 
I agree i played a bit with the VL6180X and it's great the only drwaback i find is the resolution, i would have apreciated a 0,1mm resolution even with a 1mm accuracy to be able to play a bith with math with the data.
I've succefoully used it to measure the rideheight of a race car and it worked great up to 280 km/h of speed. i've used the sparfun library but i slightly modifyed it to wait for the convergence instead of wating a fixed time of 10ms that's in the orginal function.

Code:
uint8_t VL6180x::getDistance()
{
  int dt,t1,t0=0;
  t0=millis();
  while  ((VL6180x_getRegister(VL6180X_RESULT_RANGE_STATUS)&0x01)==0);
  {
	// Serial.println(VL6180x_getRegister(VL6180X_RESULT_RANGE_STATUS)) ;
  }
	
  VL6180x_setRegister(VL6180X_SYSRANGE_START, 0x01); //Start single shot mode
  // delay(10); 
  
  while  ((VL6180x_getRegister(VL6180X_RESULT_INTERRUPT_STATUS_GPIO)&0x04)==0)
	  {		 
      }

  return VL6180x_getRegister(VL6180X_RESULT_RANGE_VAL);
  VL6180x_setRegister(VL6180X_SYSTEM_INTERRUPT_CLEAR, 0x07);
  //	return distance;
}
 
Of course, you could average multiple readings and/or integrate longer to improve resolution. But you're right, I think the data bits limit to ~ 1 mm. Still, a remarkable device performance!
 
Of course, you could average multiple readings and/or integrate longer to improve resolution. But you're right, I think the data bits limit to ~ 1 mm. Still, a remarkable device performance!
I've used a 5 sample runaverage to increase the resolution even if is not the right way to do it, i should have used oversampling but it would have lowered to mouch the dynamic response of the sensor.
Did you tryed the sparkufn library for the sensor on the teensy ?
I've tryed to implement the continous reading but i'm wrong someware can you have a look to it ?


Code:
uint8_t VL6180x::getDistance_cont()
{  
  uint8_t temp=VL6180x_getRegister(VL6180X_RESULT_RANGE_STATUS);

  while  ((temp&0x01)==0);
  {
	temp=VL6180x_getRegister(VL6180X_RESULT_RANGE_STATUS);
	Serial.println(temp) ;
  }
  Serial.println("Uscito1") ;
  VL6180x_setRegister(VL6180X_SYSRANGE_START, 0x03); //Start Single shot mode
  temp=VL6180x_getRegister(VL6180X_RESULT_INTERRUPT_STATUS_GPIO);
  while  ((temp&0x04)==0)
	  {
		temp=VL6180x_getRegister(VL6180X_RESULT_INTERRUPT_STATUS_GPIO);
		// Serial.println(temp);  
      }
  return VL6180x_getRegister(VL6180X_RESULT_RANGE_VAL); //or return temp to avoid one more reading
  VL6180x_setRegister(VL6180X_SYSTEM_INTERRUPT_CLEAR, 0x07);
 
  //	return distance;
}
 
As a rule I prefer to write my own "libraries", really a sketch to make the device work the way it should and that I understand. My experience with Sparkfun and Adafruit libraries is that they don't and I don't. So you may use mine for comparison and see if it does what you need. I am running continuous interleave mode by default so I get both ALS data and proximity data out at a 1 Hz rate to the serial monitor. Enjoy!
 
As a rule I prefer to write my own "libraries", really a sketch to make the device work the way it should and that I understand. My experience with Sparkfun and Adafruit libraries is that they don't and I don't. So you may use mine for comparison and see if it does what you need. I am running continuous interleave mode by default so I get both ALS data and proximity data out at a 1 Hz rate to the serial monitor. Enjoy!

I had a look to your sketch and the main difference is that it's a sketch and not a library for a newbie like me can be a bit confusing looking in that big code (but i have to admit that sometimes is usefoul to read code behind the functions you call), while the sparkfun (with its limits of course) is very clean since most of the code is in the library but i understand what you say about dooing libraries yourself, i had to modify the library becouse instead of looping and checking range_status they were just watiing 10ms loosing a lot of dynamic of the sensor, on a dark environment with an high reflectance target is easy to get convergence after 3ms.
 
Status
Not open for further replies.
Back
Top