I am planning to control a RGB lamp using Arduino. The lamp is 24V and I want to be able to control the brightness of the lamp. I found a relay that will let me control the 3 channels (red green and blue), but will only let me turn it on and off (Not control brightness)

I am looking for a way to control the lamp both on/off and brightness. What component will do the same as my relay, but also let me use the varying voltage from the arduino to control my 24V lamp? (Just like a transistor)

I have an external 24V powersupply along with 5V for the arduino



No, you can't vary the voltage with a relay. The only way you could do it with a relay would be to have a selection of different voltages available, and then use multiple relays to select which voltage is used. Less than ideal.

You need to use PWM to create a square wave with varying duty cycle. The duty cycle (the percentage of time the power is on within a given period) defines the average voltage of the output. That PWM needs to be fed into a MOSFET which will in turn control the 24V power to the lamp.

It's exactly the same as driving RGB LED strips, except it's in the shape of a lamp not a long strip.

| improve this answer | |
  • Should be noted that this also can control the LED to be on/off so it it removes the need for a noisy relay completely. With the PWM output off, the LED is off, and then it can be ramped up to full brightness using higher duty cycle, all the way to fully on. – Chad G Nov 27 '18 at 17:41
  • This is what I have been looking for. Do you reckon I can find a premade PCB that can do this for me on eBay (preferably from China)? – Nicolai Grymer Nov 27 '18 at 20:14
  • More than likely, yes. – Majenko Nov 27 '18 at 21:56
  • Would you be a champ and confirm that I can vary the voltage using this: ebay.co.uk/itm/… – Nicolai Grymer Nov 27 '18 at 23:18
  • Probably. As long as you have the ability to switch the ground (cathode on an LED) connection. If it's a "common anode" arrangement (like most LED strips are) then that's fine. – Majenko Nov 27 '18 at 23:34

Yes it is possible to vary voltage with a relay. A relay is simply a 2 way 3 pole switch.


simulate this circuit – Schematic created using CircuitLab

By switching in a resistor to the supply voltage you have lowered the voltage and will dim the 24V light source. The actual resistor value will depend on how dim you want to go. Make sure the resistor is rated for the load you plan to place on it.

| improve this answer | |
  • This is assuming there is already some resistance in your LED device, you would not normally want to hook a bare LED up to the supply with no resister in series. But this is a viable option when/if you only want OFF/DIM/FULL. The PWM signal and transistor gives more control. – Chad G Nov 27 '18 at 17:44
  • 1
    That would only give on or dim, but no off... – Majenko Nov 27 '18 at 17:57
  • Yes, the purpose of the schematic was to illustrate how to use a relay to adjust voltage. It wasn't intended to be a complete schematic. – Jeff Wahaus Nov 27 '18 at 19:34
  • The LEDS I'm using are actually a board with 12 powerful LEDS. The lamp looks a bit like this: thomann.de/dk/stairville_quad_par_profile_5x8w_rgb_ww.htm My lamp broke (control board broke), so now I am planning on using it for a party-project and plan to take the lamp apart and keep the PCB-board where the LEDS, a heatsink, plastic housing and LED-lenses are on. I am almost sure that there are resistors on the board already. I can check to be sure, but if I burn it, it doesn't really matter. The LEDS has no value. – Nicolai Grymer Nov 27 '18 at 20:06
  • Do you reckon I can find a board on eBay (preferably from china) that will do this for me? – Nicolai Grymer Nov 27 '18 at 20:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.