Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 11 of 11

Thread: Making a PCB using most of Teensy 4.1 pins

  1. #1
    Junior Member
    Join Date
    Apr 2019
    Posts
    16

    Making a PCB using most of Teensy 4.1 pins

    Im making a big project and need lots of pins, not sure what was the best way to go about it.

    I have some 20 cherry switches, 16 potentiometers and 1 ws2812B LED strip.

    Click image for larger version. 

Name:	Screenshot 2020-11-06 at 12.29.44.jpg 
Views:	81 
Size:	160.0 KB 
ID:	22334
    Click image for larger version. 

Name:	Screenshot 2020-11-06 at 12.07.04.jpg 
Views:	58 
Size:	89.3 KB 
ID:	22332
    Click image for larger version. 

Name:	Screenshot 2020-11-06 at 12.24.34.jpg 
Views:	65 
Size:	48.3 KB 
ID:	22333

    Questions:
    1) Does my led strip schematic and board placement look good?
    2) Is it okay to run traces underneath teensy like I am doing?
    3) Will 3.3v be able to run 16 ws2812b? I plan to not use much brightness or white, only reds and blue at low intensity.

  2. #2
    Senior Member
    Join Date
    Mar 2016
    Posts
    349
    It looks OK to me. It is fine to run the traces under the teensy. What kind of trace separation do you have there? Hard to tell from the image of the board. Unless you have to, I would not push the limits of your PCB vendor. If they say 5 mils, I try to do 7 or 8. Or at least push a test board through their fab to see how clean they are at the extreme limit.

    As to the ws2812b - you should do the full brightness current draw calculations. (you may want to crank up the brightness later) What does the datasheet say about 3.3V? If possible, I'd run them on 5V (ie. not through the Teensy's VR but don't know if the logic accepts 3.3 as a Vhi in that case.

  3. #3
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    4,055
    Quote Originally Posted by elemenofi View Post
    3) Will 3.3v be able to run 16 ws2812b? I plan to not use much brightness or white, only reds and blue at low intensity.
    I've done it (mostly using one or two 16-LED rings), but it really depends on the strip. You won't be able to do anywhere near full brightness. Some strips will not run at 3.3v, and you need higher voltages.

    Usually in my scripts I set the maximum for the sum of the R, G, B levels to be 30. This gives a value of about 75 mA for 32 LEDs when powered at 5v. Perhaps 113 mA at 3.3v, which is under the 250 mA that the Teensy's can supply for 3.3v (remember, you have to include the Teensy itself in the power calculations). IRC, blue LEDs take the most power.

    I would suggest incorporating something like a SN74LV1T126 into your design, and feed power from VIN instead of 3.3v to power the WS2812B LEDs. That way if you have to replace the LEDs or upgrade them, you won't run into the situation where the LEDs won't run on 3.3v power.

    Even if you use the VIN pin, you won't be able to do more than about 6 LEDs at full power. IIRC, WS2812B's tend to be around 60mA at 5v power at full brightness. You can generally get about 500mA from the VIN pin (assuming the USB power source delivers somewhat more than 500mA). Figure maybe 75-100mA for running the Teensy. That gives to 400mA power you can use for the LEDs. At 60mA per element, that gives roughly 6 elements that can be run at full power.

    I'm a software guy who hasn't designed a PCB, but I suspect you may need to think about things like ground planes and 3.3v to distribute the power.

    But in general, unless you are doing stage productions in a dark room, you want the brightness to be way down. I've had people say even the 30 level is too bright if I'm close to them.

    (note, in case it isn't obvious, these are all back of the envelope calculations, they might not be right in detail, but hopefully the spirit of them is correct). Over times the power draw for WS2812B leds has changed, and there are now at least two manufacturers of them. Also the amount of power that the Teensy draws can vary depending on the processor, battery saving usage, and cycle speed.

    If you are able to get the full 5 volts and 2.1 amps available from some power supplies (attaching the power before the USB connection), by my back of the envelope calculations, you might be able to get 32 LEDs at full power.

    <edit>
    And in terms of push button switches, it may make sense to use 2 MCP23017's to handle all of the digital inputs, rather than attaching 20 push buttons to 20 pins. You would have to reserve pins 18/19 to run the I2C bus, and possibly put 2 2.2K pull-up resistors on it. It would allow you to add more digital push-buttons (or simple LEDs) in the future. In terms of microprocessor speeds, I2C is a fairly slow bus, but for human reaction speeds they aren't bad. Obviously as you get to more inputs, you have to start thinking about optimizing the read speed of that many switches. For example, there is an interrupt pin to say a switch changed, and you can read the switches in groups of 8 instead of doing individual reads for each switch.

    <edit2>
    There are ways to reduce the number of analog input pins used as well, but I'm not as familiar with them.
    Last edited by MichaelMeissner; 11-06-2020 at 09:08 PM.

  4. #4
    Senior Member houtson's Avatar
    Join Date
    Aug 2015
    Location
    Scotland
    Posts
    175
    Hi
    I've also heard it depends on your brand / batch of WS281Bs but I've never had any issues. I had a Teensy 4 board with 8 (not 16) but not problems.
    I didn't put a cap on each one either and seems to run fine - i'm using it on an audioboard and doesn't seem to contribute much noise if that's your concern,

    cheers, Paul

    Click image for larger version. 

Name:	Screenshot 2020-11-06 at 22.13.05.jpg 
Views:	76 
Size:	179.8 KB 
ID:	22345

  5. #5
    Junior Member
    Join Date
    Apr 2019
    Posts
    16
    Quote Originally Posted by PhilB View Post
    It looks OK to me. It is fine to run the traces under the teensy. What kind of trace separation do you have there? Hard to tell from the image of the board. Unless you have to, I would not push the limits of your PCB vendor. If they say 5 mils, I try to do 7 or 8. Or at least push a test board through their fab to see how clean they are at the extreme limit.

    As to the ws2812b - you should do the full brightness current draw calculations. (you may want to crank up the brightness later) What does the datasheet say about 3.3V? If possible, I'd run them on 5V (ie. not through the Teensy's VR but don't know if the logic accepts 3.3 as a Vhi in that case.
    Paul recommends 5v external supply to and a voltage converter to use ws2812b but Ive seen some success stories here and there with straight up 3.3v and I wanna keep things simple. I usually abandon a project if I end up biting more than I can chew.
    Last edited by elemenofi; 11-10-2020 at 11:24 AM. Reason: add missing quote

  6. #6
    Junior Member
    Join Date
    Apr 2019
    Posts
    16
    Quote Originally Posted by MichaelMeissner View Post
    I've done it (mostly using one or two 16-LED rings), but it really depends on the strip. You won't be able to do anywhere near full brightness. Some strips will not run at 3.3v, and you need higher voltages.

    Usually in my scripts I set the maximum for the sum of the R, G, B levels to be 30. This gives a value of about 75 mA for 32 LEDs when powered at 5v. Perhaps 113 mA at 3.3v, which is under the 250 mA that the Teensy's can supply for 3.3v (remember, you have to include the Teensy itself in the power calculations). IRC, blue LEDs take the most power.

    I would suggest incorporating something like a SN74LV1T126 into your design, and feed power from VIN instead of 3.3v to power the WS2812B LEDs. That way if you have to replace the LEDs or upgrade them, you won't run into the situation where the LEDs won't run on 3.3v power.

    Even if you use the VIN pin, you won't be able to do more than about 6 LEDs at full power. IIRC, WS2812B's tend to be around 60mA at 5v power at full brightness. You can generally get about 500mA from the VIN pin (assuming the USB power source delivers somewhat more than 500mA). Figure maybe 75-100mA for running the Teensy. That gives to 400mA power you can use for the LEDs. At 60mA per element, that gives roughly 6 elements that can be run at full power.

    I'm a software guy who hasn't designed a PCB, but I suspect you may need to think about things like ground planes and 3.3v to distribute the power.

    But in general, unless you are doing stage productions in a dark room, you want the brightness to be way down. I've had people say even the 30 level is too bright if I'm close to them.

    (note, in case it isn't obvious, these are all back of the envelope calculations, they might not be right in detail, but hopefully the spirit of them is correct). Over times the power draw for WS2812B leds has changed, and there are now at least two manufacturers of them. Also the amount of power that the Teensy draws can vary depending on the processor, battery saving usage, and cycle speed.

    If you are able to get the full 5 volts and 2.1 amps available from some power supplies (attaching the power before the USB connection), by my back of the envelope calculations, you might be able to get 32 LEDs at full power.

    <edit>
    And in terms of push button switches, it may make sense to use 2 MCP23017's to handle all of the digital inputs, rather than attaching 20 push buttons to 20 pins. You would have to reserve pins 18/19 to run the I2C bus, and possibly put 2 2.2K pull-up resistors on it. It would allow you to add more digital push-buttons (or simple LEDs) in the future. In terms of microprocessor speeds, I2C is a fairly slow bus, but for human reaction speeds they aren't bad. Obviously as you get to more inputs, you have to start thinking about optimizing the read speed of that many switches. For example, there is an interrupt pin to say a switch changed, and you can read the switches in groups of 8 instead of doing individual reads for each switch.

    <edit2>
    There are ways to reduce the number of analog input pins used as well, but I'm not as familiar with them.
    Thanks Michael!

    The Leds in my case really dont have to be powerful at all so I will give it a go before I add the SN74LV1T126 to my circuit.

    I have a project in Teensy 3.6 in which I am using CD74HC4067M to multiplex both potentiometers and switches, it went quite good both the circuit design and the soldering. I got stuck tho because I was planning to use 595-TLC5940PWPR to control 16 leds but I forgot one trace connection and lost motivation when thinking about re-ordering the pcbs. It felt like I underestimated the complexity of adding chips to my designs.

    That is kind of the reason why I am trying to only use what the teensy offer without multiplexing until it is totally necessary!, maybe next iteration if I get this one to work 100%.

  7. #7
    Junior Member
    Join Date
    Apr 2019
    Posts
    16
    Quote Originally Posted by houtson View Post
    Hi
    I've also heard it depends on your brand / batch of WS281Bs but I've never had any issues. I had a Teensy 4 board with 8 (not 16) but not problems.
    I didn't put a cap on each one either and seems to run fine - i'm using it on an audioboard and doesn't seem to contribute much noise if that's your concern,

    cheers, Paul

    Click image for larger version. 

Name:	Screenshot 2020-11-06 at 22.13.05.jpg 
Views:	76 
Size:	179.8 KB 
ID:	22345
    Oh wow! thats great it works for you without caps I am not looking forward to soldering these, you reckon I could remove mine? All the LED strips seem to have one.

    Also why did you use Pin 31 for power instead of Pin 13?

  8. #8
    Senior Member
    Join Date
    Mar 2016
    Posts
    349
    Quote Originally Posted by elemenofi View Post
    I have a project in Teensy 3.6 in which I am using CD74HC4067M to multiplex both potentiometers and switches, it went quite good both the circuit design and the soldering. I got stuck tho because I was planning to use 595-TLC5940PWPR to control 16 leds but I forgot one trace connection and lost motivation when thinking about re-ordering the pcbs. It felt like I underestimated the complexity of adding chips to my designs.
    Even extremely experienced engineers make those kind of mistakes. But instead of trashing a board with a missing wire, they (we) get out the soldering iron and add a bodge wire. It's kind of a point of pride...

    I once forgot to connect 2 ground planes together and the only places I could get contacts were on opposite sides of the board. Had to run the wire around a big connector. Looked way ugly but electrons don't care!

  9. #9
    Senior Member houtson's Avatar
    Join Date
    Aug 2015
    Location
    Scotland
    Posts
    175
    Quote Originally Posted by elemenofi View Post
    Oh wow! thats great it works for you without caps I am not looking forward to soldering these, you reckon I could remove mine? All the LED strips seem to have one.

    Also why did you use Pin 31 for power instead of Pin 13?
    Hi,

    The number at the pin in red (pin31) are just the way that symbol is annotated in the schematic, I used the usual 3V3 pin (the Teensy pin names/numbers are in the green text).

    The decoupling caps are meant to be used, I don't know why I didn't fit them, it works fine in this application but it is a small number of leds - you should probably just fit them (and certainly design them into the board if you're getting a board made)

    cheers, Paul

  10. #10
    Junior Member
    Join Date
    Apr 2019
    Posts
    16
    Quote Originally Posted by houtson View Post
    Hi,

    The number at the pin in red (pin31) are just the way that symbol is annotated in the schematic, I used the usual 3V3 pin (the Teensy pin names/numbers are in the green text).

    The decoupling caps are meant to be used, I don't know why I didn't fit them, it works fine in this application but it is a small number of leds - you should probably just fit them (and certainly design them into the board if you're getting a board made)

    cheers, Paul
    But why did you use the 3v3 250mA instead of the one on the left side? Is there a difference between these two that I should be aware of?

  11. #11
    Senior Member houtson's Avatar
    Join Date
    Aug 2015
    Location
    Scotland
    Posts
    175
    The one on the left (in the schematic) is the one at the (short) end of the teensy and I donít have that connected to the board - Im not aware of any difference between them

    Cheers Paul

    PS remember the schematic is a teensy 4.0 not a 4.1
    Last edited by houtson; 12-03-2020 at 02:05 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •