Trying to switch 31V/116mA though a ULN2803 with RaspberryPi GPIO

Thread Starter

Paul Hollis

Joined Dec 14, 2018
3
Hi, I'm playing around with trying to make a set of LED xmas lights flash using a Raspberry PI GPIO pin. I've purchased a cheap set of lights from Target. The power supply states: Output 31V 116mA 3.6W. I figured I would just snip the wire about a meter from the output and wire it into a breadboard with a ULN2803 and have the power supply output +ve 31V hooked up to COM, the -ve 31V hooked up to GND. Then hook the LED light side +ve to the +ve 31V from the power supply and the -ve side to O1 of the ULN. I would then connect a GPIO to I1 and use this to flash the lights. See the attached figure 1 for my wiring. This doesn't seem to work. If I look very closely to the LED lights there may be a slight very dim flicker occasionally.

Since this didn't work I wanted to make sure the principle would work, so I wired up a single LED using 5V from the PI as the voltage. See attached figure 2. This seemed to work fine. I can measure a voltage between O1 and COM alternating from 5V to 0V. Whereas on the original circuit there is just a continuous 0V between O1 and COM.

Am I doing something wrong here? Also attached a photo of the power supply, which powers the LED lights fine when directly connected.

Any suggestions would be welcomed.

Regards Paul.
 

Attachments

dl324

Joined Mar 30, 2015
12,871
Welcome to AAC!

I suspect a problem with the connections to the power supply used in figure 1. Change the resistor to 5.6k in figure 2 and use the 31V supply instead of 5V from the Pi.
 

danadak

Joined Mar 10, 2018
4,057
The common in this case, just leave open. The ground of the ULN2803 does not
appear to be common with Raspberry Pi, they should be tied together.

Connections

1) LED + to +31 supply.
2) LED - to one of the ULN2803 outputs whose input is connected to GPIO of Pi.
3) ULN ground and Pi ground tied together.
4) ULN2803 COM leave open, unconnected.

Basically you are switching the ground side of the LED string.

For safety sake trial put from Pi GPIO to ULN2803 input a 1K R in series, just in case
you make a wiring error so Pi is not hosed. Once up and running eliminate the
1K.

When GPIO of Pi goes high LED string turns on.

Regards, Dana.
 
Last edited:

Thread Starter

Paul Hollis

Joined Dec 14, 2018
3
Thanks for the replies.
dl324: I may not have explained it clearly, but figure 1 is what I am trying to achieve. Figure 2 was just an experiment to make sure I fully understood how the ULN works.

Dana: I tried the connections you suggested. Added a new figure 1A with what I tried. Still nothing. Thanks for the safety suggestion:).
 

Attachments

danadak

Joined Mar 10, 2018
4,057
You schematic does not look right

Pwr + >> LED +
LED - >> ULN2803 output
Pwr - ground & Pi ground & ULN2803 ground all tied together
ULN2803 input >> 1Kohm R >> Pi Gpio

Regards, Dana.
 

jonj27

Joined Dec 11, 2019
1
Ahhhh. Thanks so much for the help Dana. I have flashing lights :).
Are you able to post the final drawing based on the recommendations?
I am looking at doing the same. I think there are 2 channels i need to control. I would also like to change the brightness of the lights (presumably) by reducing the current supplied.
Thanks in advance.
 
Top