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

Thread: Basic Clarification Needed

  1. #1
    Junior Member
    Join Date
    Oct 2022
    Posts
    14

    Basic Clarification Needed

    The teensy 4.1 is being powered through USB
    -A teensy with digital pins puts out a digital HIGH signal that is only +3.3V

    Powering 42 dotstar (apa102) pixels with an external power source that is connected directly to the pixel strip and NOT connected to the Teensy. The dotstars will only be connected to the microcontroller through pins 11 and 13 which support hardware SPI.

    ISSUE:
    -Dotstars need a 5V high signal for the clock & data lines
    -teensy will only put out data and clock signals that are 3.3 volts high
    SOLUTION
    Use a level shifter to bring the 3.3 volt high data and clock signals to 5 volt high data and clock signals.

    CLARIFICATIONS NEEDED

    Since the teensy is not powering the strips but only providing data and clock signals data to them will the ground of the teensy need to be connected to the ground wire that grounds the dotstars? Does the teensy need to be grounded at all if itís being powered through USB and only putting out data and clock signals?
    Will the level shifting from 3.3 volts to 5 volts cause an issue if the shared ground of the dotstars is shared with the ground of the teensy?

  2. #2
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    4,370
    Quote Originally Posted by Apa102 View Post
    The teensy 4.1 is being powered through USB
    -A teensy with digital pins puts out a digital HIGH signal that is only +3.3V

    Powering 42 dotstar (apa102) pixels with an external power source that is connected directly to the pixel strip and NOT connected to the Teensy. The dotstars will only be connected to the microcontroller through pins 11 and 13 which support hardware SPI.

    ISSUE:
    -Dotstars need a 5V high signal for the clock & data lines
    -teensy will only put out data and clock signals that are 3.3 volts high
    SOLUTION
    Use a level shifter to bring the 3.3 volt high data and clock signals to 5 volt high data and clock signals.

    CLARIFICATIONS NEEDED

    Since the teensy is not powering the strips but only providing data and clock signals data to them will the ground of the teensy need to be connected to the ground wire that grounds the dotstars? Does the teensy need to be grounded at all if it’s being powered through USB and only putting out data and clock signals?
    Will the level shifting from 3.3 volts to 5 volts cause an issue if the shared ground of the dotstars is shared with the ground of the teensy?
    In general, you always need to connect grounds if you connect devices to a microprocessor, even if the device is separately powered.

    The main exception is if you use something like an opto-coupler, then you don't connect the grounds. An opto-coupler is a device that has a LED and an light sensor bound together, so when one side powers the pin, the other side makes the connection, and there is no direct election connection between the two devices.

    I don't use apa102/dotstars that much, but in the realm of ws2812b/neopixels, things have gotten more fuzzy. In the old days, you pretty much had to do voltage translation using a fast enough converter to get ws2812b leds to work. But along the way, a new manufacturer started make leds with the same protocol. These new leds often did not need the voltage translation, particularly if you used a 3.7-4.2 volt lipo battery to power the unit, and feed VIN to the LEDs for power. A 3.3v singal from the Teensy would be able to trigger a ws2812b led running at 3.7-4.2 volts. However, with some leds, sending 3.3v to a led powered with 5v, might not work.

    The new ws2812b leds could also run at 3.3v (though it was officially out of spec), providing the total power was less than the Teensy 3.3v voltage regulator.

    However, the usage guides have not always mentioned these updates.

    So as I make new ws2812b projects, I often just connect things up directly, and test to see if it works. But at times I will do it 'officially' to use the same power source:
    • I might use either a Teensy LC or Adafruit ItsyBitsy to skip doing the voltage conversion (they both have one pin that is converted), but that doesn't help apa102 leds, since they only have 1 pin converted;
    • I would do appropriate voltage conversion from 3.3v to VIN voltage;
    • For ws2812b leds, you need a fast converter such as the 74AHCT125 (https://www.adafruit.com/product/1787). For neopixels, I moved to a surface mount converter, but the part I used only converts 1 pin, and is now hard to get.
    • In the past, I would sometimes use a Teensy prop shield, which does provide two voltage converters for pins 11 and 13.
    • I would put place a 100 - 500 ohm resistor between the converted voltage and the data pin of the LED;
    • I would attach a 500-1000uf 6.3 volt or higher capacitor as close to the ws2812b power/ground connection as possible;
    • This is the Adafruit guide, but I do feel it is a little out of date: https://learn.adafruit.com/adafruit-...best-practices
    • I even built up a rig to test if I needed doing all of the steps. I would plug in the power, ground, and data signal to the rig. I have various switches to use alternate power sources. I optionally do voltage level conversion. I optionally add the resistor. And I optionally used the capacitor. The funny thing is when I tried out the rig, I couldn't get the leds to fail, even if I didn't do any of the recommended guides. I've had grumpy leds in the past that needed to do all of the conversions, but I suspect over time, with things like solder accidents, I have weeded out those old strands.


    Now, whether the apa102 leds also can be powered without needing voltage conversion, I dunno.

    While pins 11 and 13 are hardware SPI pins, I know the normal Adafruit dotstar library doesn't use the SPI hardware. Maybe other libraries like FastLED does. In the past with Teensy 3.x processors, I did manage to run both neopixels and hardware SPI displays using the prop shield. I had to manually switch modes from SPI mode for the display to normal pin mode for the neopixels, and then switch back. But that is a lot of hassle, so nowadays, I use different pins for ws2812b leds than the SPI pins.

  3. #3
    Junior Member
    Join Date
    Oct 2022
    Posts
    14
    Quote Originally Posted by MichaelMeissner View Post
    In general, you always need to connect grounds if you connect devices to a microprocessor, even if the device is separately powered.

    The main exception is if you use something like an opto-coupler, then you don't connect the grounds. An opto-coupler is a device that has a LED and an light sensor bound together, so when one side powers the pin, the other side makes the connection, and there is no direct election connection between the two devices.

    I don't use apa102/dotstars that much, but in the realm of ws2812b/neopixels, things have gotten more fuzzy. In the old days, you pretty much had to do voltage translation using a fast enough converter to get ws2812b leds to work. But along the way, a new manufacturer started make leds with the same protocol. These new leds often did not need the voltage translation, particularly if you used a 3.7-4.2 volt lipo battery to power the unit, and feed VIN to the LEDs for power. A 3.3v singal from the Teensy would be able to trigger a ws2812b led running at 3.7-4.2 volts. However, with some leds, sending 3.3v to a led powered with 5v, might not work.

    The new ws2812b leds could also run at 3.3v (though it was officially out of spec), providing the total power was less than the Teensy 3.3v voltage regulator.

    However, the usage guides have not always mentioned these updates.

    So as I make new ws2812b projects, I often just connect things up directly, and test to see if it works. But at times I will do it 'officially' to use the same power source:
    • I might use either a Teensy LC or Adafruit ItsyBitsy to skip doing the voltage conversion (they both have one pin that is converted), but that doesn't help apa102 leds, since they only have 1 pin converted;
    • I would do appropriate voltage conversion from 3.3v to VIN voltage;
    • For ws2812b leds, you need a fast converter such as the 74AHCT125 (https://www.adafruit.com/product/1787). For neopixels, I moved to a surface mount converter, but the part I used only converts 1 pin, and is now hard to get.
    • In the past, I would sometimes use a Teensy prop shield, which does provide two voltage converters for pins 11 and 13.
    • I would put place a 100 - 500 ohm resistor between the converted voltage and the data pin of the LED;
    • I would attach a 500-1000uf 6.3 volt or higher capacitor as close to the ws2812b power/ground connection as possible;
    • This is the Adafruit guide, but I do feel it is a little out of date: https://learn.adafruit.com/adafruit-...best-practices
    • I even built up a rig to test if I needed doing all of the steps. I would plug in the power, ground, and data signal to the rig. I have various switches to use alternate power sources. I optionally do voltage level conversion. I optionally add the resistor. And I optionally used the capacitor. The funny thing is when I tried out the rig, I couldn't get the leds to fail, even if I didn't do any of the recommended guides. I've had grumpy leds in the past that needed to do all of the conversions, but I suspect over time, with things like solder accidents, I have weeded out those old strands.


    Now, whether the apa102 leds also can be powered without needing voltage conversion, I dunno.

    While pins 11 and 13 are hardware SPI pins, I know the normal Adafruit dotstar library doesn't use the SPI hardware. Maybe other libraries like FastLED does. In the past with Teensy 3.x processors, I did manage to run both neopixels and hardware SPI displays using the prop shield. I had to manually switch modes from SPI mode for the display to normal pin mode for the neopixels, and then switch back. But that is a lot of hassle, so nowadays, I use different pins for ws2812b leds than the SPI pins.
    Wow, lots of good info here and you very thoroughly explained many things to consider. Thanks so much, Michael.

  4. #4
    Junior Member
    Join Date
    Oct 2022
    Posts
    14
    Quote Originally Posted by MichaelMeissner View Post
    In general, you always need to connect grounds if you connect devices to a microprocessor, even if the device is separately powered.

    The main exception is if you use something like an opto-coupler, then you don't connect the grounds. An opto-coupler is a device that has a LED and an light sensor bound together, so when one side powers the pin, the other side makes the connection, and there is no direct election connection between the two devices.

    I don't use apa102/dotstars that much, but in the realm of ws2812b/neopixels, things have gotten more fuzzy. In the old days, you pretty much had to do voltage translation using a fast enough converter to get ws2812b leds to work. But along the way, a new manufacturer started make leds with the same protocol. These new leds often did not need the voltage translation, particularly if you used a 3.7-4.2 volt lipo battery to power the unit, and feed VIN to the LEDs for power. A 3.3v singal from the Teensy would be able to trigger a ws2812b led running at 3.7-4.2 volts. However, with some leds, sending 3.3v to a led powered with 5v, might not work.

    The new ws2812b leds could also run at 3.3v (though it was officially out of spec), providing the total power was less than the Teensy 3.3v voltage regulator.

    However, the usage guides have not always mentioned these updates.

    So as I make new ws2812b projects, I often just connect things up directly, and test to see if it works. But at times I will do it 'officially' to use the same power source:
    • I might use either a Teensy LC or Adafruit ItsyBitsy to skip doing the voltage conversion (they both have one pin that is converted), but that doesn't help apa102 leds, since they only have 1 pin converted;
    • I would do appropriate voltage conversion from 3.3v to VIN voltage;
    • For ws2812b leds, you need a fast converter such as the 74AHCT125 (https://www.adafruit.com/product/1787). For neopixels, I moved to a surface mount converter, but the part I used only converts 1 pin, and is now hard to get.
    • In the past, I would sometimes use a Teensy prop shield, which does provide two voltage converters for pins 11 and 13.
    • I would put place a 100 - 500 ohm resistor between the converted voltage and the data pin of the LED;
    • I would attach a 500-1000uf 6.3 volt or higher capacitor as close to the ws2812b power/ground connection as possible;
    • This is the Adafruit guide, but I do feel it is a little out of date: https://learn.adafruit.com/adafruit-...best-practices
    • I even built up a rig to test if I needed doing all of the steps. I would plug in the power, ground, and data signal to the rig. I have various switches to use alternate power sources. I optionally do voltage level conversion. I optionally add the resistor. And I optionally used the capacitor. The funny thing is when I tried out the rig, I couldn't get the leds to fail, even if I didn't do any of the recommended guides. I've had grumpy leds in the past that needed to do all of the conversions, but I suspect over time, with things like solder accidents, I have weeded out those old strands.


    Now, whether the apa102 leds also can be powered without needing voltage conversion, I dunno.

    While pins 11 and 13 are hardware SPI pins, I know the normal Adafruit dotstar library doesn't use the SPI hardware. Maybe other libraries like FastLED does. In the past with Teensy 3.x processors, I did manage to run both neopixels and hardware SPI displays using the prop shield. I had to manually switch modes from SPI mode for the display to normal pin mode for the neopixels, and then switch back. But that is a lot of hassle, so nowadays, I use different pins for ws2812b leds than the SPI pins.
    How do you determine which capacitor you need for your project?

  5. #5
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    4,370
    Quote Originally Posted by Apa102 View Post
    How do you determine which capacitor you need for your project?
    I just used the one that was listed in the Adafruit neopixel best practices page. But in the rig, I also added a 0.1uF ceramic capacitor. The idea is the big capacitor will handle larger power spikes that are relatively slower, while the 0.1uF capacitor will handle the very tiny micro jitters. Now, in general if you are only using a battery or a well regulated power supply, you don't need a capacitor. But perhaps somebody with more EE knowledge can chime in.

    I imagine that if you only have a single power source for both the Teensy and the LEDs that is well behaved, you could depend on the capacitors on the Teensy itself. But if you have a more complex setup where you have multiple power sources, it may help smooth things out.

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    27,361
    Quote Originally Posted by Apa102 View Post
    Since the teensy is not powering the strips but only providing data and clock signals data to them will the ground of the teensy need to be connected to the ground wire that grounds the dotstars?
    Just in case this specific question wasn't covered, absolutely yes, you definitely do need to Teensy GND and the APA102 LED GND connected together.

  7. #7
    Junior Member
    Join Date
    Oct 2022
    Posts
    14
    Quote Originally Posted by MichaelMeissner View Post
    I just used the one that was listed in the Adafruit neopixel best practices page. But in the rig, I also added a 0.1uF ceramic capacitor. The idea is the big capacitor will handle larger power spikes that are relatively slower, while the 0.1uF capacitor will handle the very tiny micro jitters. Now, in general if you are only using a battery or a well regulated power supply, you don't need a capacitor. But perhaps somebody with more EE knowledge can chime in.

    I imagine that if you only have a single power source for both the Teensy and the LEDs that is well behaved, you could depend on the capacitors on the Teensy itself. But if you have a more complex setup where you have multiple power sources, it may help smooth things out.
    Been reading lots about decoupling and bypass capacitors today. Several people have pointed out that it good practice to put a bypass capactior often a ceramic one that is as close to the IC as physically possible. So on a typical rig, would just a decoupling capacitor of 0.1uf near each pixel and then a larger capacitor near an external power supply suffice?

Posting Permissions

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