I have a string of LEDs that run off of 110V DC and I would like to control them with the arduino.
I first used the octocoupler included in the starter kit to turn them on and off.
No issues there.
But then I decided I would like to make them fade in and out.
I found that the octocoupler couldnt switch fast enough to do this, so I instead tried to use a transistor, and grounded the arduino to the 110v ground.
Well.. I must have done something wrong because the arduino exploded :-[
Could anyone suggest a circuit diagram for wiring an arduino uno to pwm a 110v string of LEDs?
Could anyone suggest a circuit diagram for wiring an arduino uno to pwm a 110v string of LEDs?
No! Not a good idea to encourage beginners to meddle with mains voltages! You are lucky you were not injured, James.
You can't use optocouplers or transistors to switch mains ac voltages. But there is probably no need to anyway.
The led string itself, I'm guessing, does not run directly from the mains voltage. There will be a voltage adaptor in the plug or in a box on the wire. A much lower safer dc voltage will be produced by the adaptor, and its this voltage you want to switch to achieve fading.
Can you post a link to the led string? Or look for this adaptor and take a photo of any writing on it?
Yes, 110VDC.
It was originally rectified using the circuit board that came with the lights.
The lights are almost identical to this:
But their circuit diagram is not quite the same as mine.
Theirs has 4 transistors, while mine has only 2.
I have attached my attempt to map out the circuit board on mine.
From what I can tell (and of course please correct me if Im wrong, thats what im here for), the circuit rectifies 110V AC to DC, then sends 110V through the LED lights, and uses the microcontroller to pulse the transistors to switch the 2 LED strings (well 3 strings actually but 2 are connected to one of the transistors).
.... so the LED lights are taking 110V DC as fas as I understand it.
The first thing I did was to remove the microcontroller and then connect the arduino's octocoupler such that it was pulsing the gate of the first transistor.
This worked fine,. but as I said earlier, it wouldnt allow me to fade them in and out.
I then scrapped that circuit board entirely, and ran all 3 LED strings using 110VAC using just a full wave bridge rectifier. This worked as well.
I appreciate the comments so far, but am still looking for some constructive advice to help me PWM these LEDs.
PS,.. the diode directions are partly wrong on my image where I show the 5 LED wires.
The bottom two wires have no diodes and just supply the power for the LEDs.
All 5 wires are connected together at the end of the string.
You have no isolation from the mains. The fact that you rectified it to DC is no account, it is still a very dangerous thing to do. You at least need an isolation transformer.
Grumpy_Mike:
You have no isolation from the mains. The fact that you rectified it to DC is no account, it is still a very dangerous thing to do. You at least need an isolation transformer.
Ok thanks, I will look into an isolation transformer.
But just to help me understand, how is it any less safe than the original ciruit board?
Where is the isolation?
That board is a stand alone system it is not meant to be connected to anything else. But as soon as you start attaching an Arduino or any other equipment to it then there is a danger.
Do you yet understand what you did wrong? Do you know why it exploded?
Connecting any equipment to a circuit that has a direct path to the mains is illegal in most countries as well as being potentially lethal.
Unless all the things you connect to a non isolated mains circuit are floating then you will short out the mains to ground and get a big bang.