How to properly wire a power supply to a Teensy to control Servos/LEDs

nicnut

Well-known member
Hi,

I am consulting with the forum as a precaution before I connect everything, just so I don't damage my servos, LEDs, computer or Teensy.

I have a Teensy 4.1 and I have 2 servos that require 7.4-6 volts. I also have 4 LED displays and 9 LEDs that require 5 volts.
I have a variable external power supply that I set to 7.4.

What I think I should do is connect the power and ground of the power supply to a 1000 uf capacitor. Then after that, connect the ground of the Teensy to the ground of the power supply , after the cap, to tie them together. And, also after the cap, I connect the power and ground to my two servos. I also connect the servos to the pins I am using to control the servos.

Then I connect the power supply power, after the cap, to a buck converter, converting it down to 5V. I connect the power from this to my LED displays and LEDs. I think I can connect the vin from the Teensy to this as well.

Does this sound correct? I am not connecting the vin from the Teensy to the servos. Also, I want to make sure I am not going to damage my laptop while controlling the servos, as it will be connected to the Teensy via USB cable. It's a newer Mac M2 so I am guessing I should be fine, but just asking.

Let me know if you have any suggestions. Thank you in advance for any input or suggestions.
 
I think a picture might help. Perhaps sketch something, scan/photograph it, and post it?
 
HI,

Ok I connected everything and took a photo, but it's not powered or plugged into a computer yet. It might not help much, as it's a lot of wires.
The breadboard on the right is powering the servos. The breadboard on the left is powering the LEDs, and has the Teensy 4.1

Another description: The variable power supply is at 7.4 V. It's going into the breadboard on the right, then going into a 1000 uF capacitor. The power and ground from the servos are plugged into this. The ground from the Teensy is connected to the ground from the power supply. The power from here is going into Vin of a Buck Converter. 5V from the buck converter is going into the power rail of the breadboard on the left, where it connects to vin from the teensy.

The Breadboard on the left has the Teensy. The SCL and SDA from the Teensy is controlling the LED Displays ( only 2 for now). The + and - from the LED displays is connected to the power and ground rails that are coming from the buck converter and the Teensy. The pins controlling the servos, 9 and 10, are connected to the servos.

I haven't connected the power supply yet. The power from the power supply is only connected to the Vin of the Teensy through a Buck converter, so I am guessing it's safe.

If anyone has any suggestions please let me know.
 

Attachments

  • circuit22.jpg
    circuit22.jpg
    574 KB · Views: 44
Could you sketch out a schematic? I know for me, that will work better than a photo of wires and a text description.
 
Hi Shawn,

Actually I don't know how to draw a schematic. I understand, it's kind of confusing to look at the photo of wires.
 
Hi,

I plugged everything in and it seems to work and everything is powered ok. The LEDs were fluctuating in brightness so I put a 1000uF capacitor after the buck converter that is powering the LEDs. It did help a little but they LEDs, if all lit up, do fluctuate in brightness a little. It's not a big deal, but I was hoping to not have any power issues.
 
You are using I2C to control the LED displays. I2C uses open drain outputs (pins that can only drive low) with pull ups to bring the pin up to the high voltage when nothing is pulling it low. If the display has those pullup resistors fitted then it may be pulling the signals to +5V, more than the teensy likes on it's IO pins. The voltage is being supplied via a resistor so it's not going to instantly damage anything but could shorten the life of the part.
This is easy to check for - power the display up without connecting it to the teensy. Connect a very weak pull down on one of the I2C lines (1M or so, all you want to do is ensure a completely un-driven pin reads low) and then check the voltage. If you read anything over 3.3 V then you shouldn't really be connecting those pins directly to the teensy. A simple fix is to add a schottky diode from the signal pin to 3.3V, this will prevent the signal from going over 3.3V and protect the teensy. Normally when doing this you would also want a series resistor to limit the current but since the signal is already from a resistor this isn't needed. In theory the teensy already has diodes like this internally on the input pins which is why it doesn't immediately go pop but those should be considered emergency protect for catching mistakes rather than something your design counts on.

Are your servos OK with a 3.3V control input?
How well can your power supply cope with sudden changes in LED brightness's? Your buck converter will presumably have a large capacitor on the output. If this is a ceramic cap then you're probably OK. If it's an electrolytic then maybe add a smaller ceramic one to help with rapid changes and transients.
 
Hi Everyone, thanks for the input, it is greatly appreciated.
I was under the impression that if Mac M2 computers get too much voltage in the USB port, they dispaly a warning. And to fix the problem all you need to do is restart the computer. For now I won't cut the trace on the Teensy and see if I get any warnings.

My servos are all working fine with the setup I have. There are some minor fluctuations in brightness with the LEDs, but only if they are all lit up to maximum capacity, which I will almost never do.
 
Back
Top