I have been working on automating my house and i was looking to dim and brighten the lights (not only led) using ballasts which require input voltage of range 0 to 10v DC depending on which the light output is given 0V-off, 10V-on and anything in between changes brightness levels.

Now, i am getting a 0V and 3.3V supply from PI's GPIO pins and i can control the duty cycle of the output (PWM) but how can i use this output to get a voltage range anywhere from 0V to 10V DC? Any reference is appreciated.

Here is the flow: User input->PI->PWM Output->Amplifier and filter->0 to 10V Output voltage->Electronic Ballasts

What i assume is using a non-inverting amplifier of gain 3 to amplify the output signal but i am not sure if it will work or am i missing something. Or should i use DAC or something?

I went through this: http://www.raspberrypi.org/forums/viewtopic.php?f=37&t=85549 and http://forum.arduino.cc/index.php?topic=60785.0 but i am not able to understand it since some people mention that i have to use filters, some say dac and some say pwm.

The user will give the brightness level he wants in his phone which is received by the PI and then it should generate appropriate voltage as input to ballast with the help of some amplification circuit. eg: if duty cycle is 50%, i want to generate 5V, if 100%, 10V if 0% 0V and so on..

Please help me out. I would like to have the simplest solution possible. Thanks in advance.

  • 1
    You have not really supplied enough information to actually answer. Firstly what are the requirements of the "ballast"; impedance, does it need pure dc or can it be pulsed? Secondly you question implies that you want to power from the Pi; do you plan to have an additional 10/12V power supply. It is not impossible to boost voltage, but if you just want to use the Pi to control an external supply this is trivial. Either way this is not really a Pi question. If I wanted to do this I would be more inclined to use an Arduino. – Milliways Jan 29 '15 at 7:42
  • Agreed, the Pi itself is irrelevant to the question. – joan Jan 29 '15 at 9:01
  • @Milliways Sorry for not being clear. The user will give the brightness level he wants in his phone which is received by the PI and then it should generate appropriate voltage as input to ballast with the help of some amplification circuit. eg: if duty cycle is 50%, i want to generate 5V, if 100%, 10V if 0% 0V and so on.. – Vignesh T.V. Jan 29 '15 at 17:36
  • @joan edited my question. sorry for not being clear – Vignesh T.V. Jan 29 '15 at 17:40

I use the term LED driver rather than ballast, but I believe that they mean the same thing. It sounds as if you have gotten some nice dimmable drivers for your lighting project. These have a 0-10V analog input to control the dimming, which is meant to play well with standard lighting controllers having such outputs.

The irony is that the driver uses the 0-10V input to control the duty cycle of a PWM oscillator that dims the LED lamp by switching it rapidly on and off. So you are faced with constructing a sort of Rube Goldberg chain to run your lamp

  1. Program a Pi GPIO PWM (digital) output based on user input
  2. Convert the PWM to a 0-10V DC (analog) signal, using say an extra power supply and an OP amp circuit
  3. The LED driver converts the DC (analog) input into its own (digital) PWM drive signal
  4. The LED driver dims the LED by turning it on and off according to this (digital) PWM signal

Wouldn't it be nice if you could avoid the digital to analog conversion in step 2 and the analog to digital conversion is step 3 and just jump from step 1 to 4? You may be able to this if your driver has separate ON-OFF and DIM inputs. If so you could perhaps ignore the DIM input to the controller and dim the lamp by modulating the ON-OFF input. You may need buffer the Pi's GPIO signal with a level shifter if the LED driver does not take 3.3V digital in its ON-OFF input, but that is much easier than providing a 0-10V analog signal. If not, perhaps you'd want to consider replacing the driver you now have with one that simply switches the lamp on and off according to 3.3V logic. This is less complex than your current setup and should be more reliable and cheaper. Your LED spec sheet or application notes may have more on this. Also check out LUXdrive for lots of interesting products for, and information on, this topic.

  • sir, what you think is exactly what i meant. but i am just having a doubt if having just an amplifier will do to convert the 0 to 3.3V digital signal to 0 to 10V. Should I also use any filters along with the circuit? Thanks in advance. – Vignesh T.V. Feb 1 '15 at 22:23
  • @T.v.Vignesh an OP amp circuit of the right configuration can be used to convert the 3.3V PWM signal to a 0-10V DC signal. As you thought the amp will have something close to 3. It will also need a capacitor of the right sort and value to smooth out the PWM. I hesitate to make specific recommendations without playing around with a circuit. One pain of this solution is that you'll need an extra power supply, 12 would probably work. That 10 V has to come from somewhere. Similar alternatives would be a DAC or Frequency to Voltage converter. Judicious web searching will provide hints – Mike Satteson Feb 1 '15 at 23:56
  • @T.v.Vignesh I was stunned that your question was judged to be off topic. It seems that interfacing PIs to hardware via GPIO fits right into the mission of the forum, which is: "Raspberry Pi Stack Exchange targets usage and development of hardware or software for Raspberry Pi". Perhaps there was concern that your question was too general. I'd suggest editing your question to add an introductory paragraph describing your project so that it is clear that control of your lamps is an important part of an interesting Pi project. The edit will trigger an appeal process. – Mike Satteson Feb 2 '15 at 0:12
  • I just got some amplifier circuits which works well for my project. Thanks. I will edit my question with an introductory paragraph as you said. – Vignesh T.V. Feb 2 '15 at 4:21
  • i think this was a great question. can you follow up to let us know which amplifier circuit you built exactly? – user391339 May 12 '16 at 17:37

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