How to output 5V from 3.3V MCU/Arduino/Raspberry Pi?

Thread Starter

jonass

Joined Mar 27, 2016
5
Big picture: I want to control a LUXdrive 3023 BuckPuck LED driver (3023-D-E-1000) from a Particle Photon (essentially an ARM Cortex M3 microcontroller). I have tried a few things but fail to get it to work (see below).

This seems like a very trivial problem to me but even here my very basic EE knowledge seems to be insufficient.

The LED driver has a control pin where a voltage of 0-5V can be applied to adjust the constant current the driver provides. At 0V it outputs 1A and at 5V it outputs nothing. The 5V can be taken from the driver's own reference pin or supplied externally, in which case a common ground between that external source and the driver's LED ground pin has to be established. According to the docs, the control pin draws less than 5mA.

On the microcontroller side I have a 3.3V PWM output at 500 Hz. The idea is to dim the LEDs by brining the PWM signal to the driver's control pin and essentially very quickly alternate between current and no current output; I could also dim the LEDs by using the microcontroller's DAC to vary the voltage at the driver's control pin, which would cause it to vary the current to the LEDs. But I have read somewhere that LEDs are happier with being run at their designed current rating and instead switched on/off for dimming purposes.

Anyway, the question is how to get from the MCU's 3.3V PWM signal to the 5V needed for the driver's control pin.

What I have tried so far:

Switch the driver's reference/control pin connection with a FET
Using a 2N7000 FET where the MCU's PWM output pin is connected to the gate pin, the driver's 5V reference pin to the drain pin, and the driver's control pin to the source pin.

Nothing was being switched though. I am not sure whether I was not able to open the 2N7000's gate with the 3.3V or whether there is a conceptual problem here.

Bring the 3.3V PWM signal to 5V with an op-amp
I tried to increase the 3.3V signal to 5V with a LM358 op-amp I had lying around. I set the gain to 1.5 with a pair of 330k Ohm and 220k Ohm resistors (giving the ratio 330k/220k = 1.5).

While this dimmed the LEDs, I was not able to fully switch them off, i.e. providing a full 5V at the driver's control pin. I am not sure what the problem is here though. I do not fully understand how an op-amp works and I would not be surprised if a PWM signal cannot be put through an op-amp without affecting the signal in a negative way, or that there is going to be some timing issues/considerations at the very least.

Any tips or recommendations? Please be as specific as possible in your answer and do not assume that I know my way around EE.

Many thanks!
-Jonas
 

Dodgydave

Joined Jun 22, 2012
11,285
You're going to need a 5v or higher supply for your op amp, you cant amplify 3v to 5v with a 3 v supply. I would use a buffer transistor on the 5v supply fed from the Arduino.
 

crutschow

Joined Mar 14, 2008
34,284
An op amp output voltage can be no higher than the supply voltage so you need a supply voltage of at least 5V.
But your suspicions are correct. The low frequency response of a typical op amp will not transmit a high frequency PWM signal with good fidelity.

You can use a MOSFET to amplify the signal but the 2N7000 requires at least 5V Vgs to fully turn on. You need a logic-level type that fully turns on at 3.3V (look at the voltage used to specify the ON resistance in the data sheet).
Note that you were connecting the transistor as a source follower, which does not amplify the voltage.
It needs to be connect as a grounded-source amplifier with a 10k resistor connected from the 5V Buck-puck reference to the drain and the output to the BuckPuck from the drain.
Note that this inverts the signal.

You could also use an NPN transitor such as the 2n3904 as a grounded-emitter amplifier to do the amplification.
 

jpanhalt

Joined Jan 18, 2008
11,087
You might be able to do it with a voltage doubler driven by one of the MCU pins.
The alternative you mention of using a small signal mosfet would also work, but the 2N7000 would not be my choice for that. I would use a logic level version wit better turn on at 3.3 V.

John
 

Thread Starter

jonass

Joined Mar 27, 2016
5
You're going to need a 5v or higher supply for your op amp, you cant amplify 3v to 5v with a 3 v supply. I would use a buffer transistor on the 5v supply fed from the Arduino.
I did supply the op-amp with 5V. But the LM358 is not a rail-to-rail op-amp, so maybe that was the issue.
 

Thread Starter

jonass

Joined Mar 27, 2016
5
Sounds like you just need a level-shifter. What is the supply voltage for the BuckPuck and LEDs?
As VIN for the BuckPuck I use 24V (to drive 6 LEDs in series at ~3.15V). The BuckPuck's control pin expects 0-5V though; which can be externally provided or taken from the BuckPuck's own reference pin (I assume the driver has an internal voltage regulator that produces those 5V).
 

Thread Starter

jonass

Joined Mar 27, 2016
5
You might be able to do it with a voltage doubler driven by one of the MCU pins.
The alternative you mention of using a small signal mosfet would also work, but the 2N7000 would not be my choice for that. I would use a logic level version wit better turn on at 3.3 V.
Like the 2N3904 crutschow mentioned? I am going to give this a try.
 

ian field

Joined Oct 27, 2012
6,536
Big picture: I want to control a LUXdrive 3023 BuckPuck LED driver (3023-D-E-1000) from a Particle Photon (essentially an ARM Cortex M3 microcontroller). I have tried a few things but fail to get it to work (see below).

This seems like a very trivial problem to me but even here my very basic EE knowledge seems to be insufficient.

The LED driver has a control pin where a voltage of 0-5V can be applied to adjust the constant current the driver provides. At 0V it outputs 1A and at 5V it outputs nothing. The 5V can be taken from the driver's own reference pin or supplied externally, in which case a common ground between that external source and the driver's LED ground pin has to be established. According to the docs, the control pin draws less than 5mA.

On the microcontroller side I have a 3.3V PWM output at 500 Hz. The idea is to dim the LEDs by brining the PWM signal to the driver's control pin and essentially very quickly alternate between current and no current output; I could also dim the LEDs by using the microcontroller's DAC to vary the voltage at the driver's control pin, which would cause it to vary the current to the LEDs. But I have read somewhere that LEDs are happier with being run at their designed current rating and instead switched on/off for dimming purposes.

Anyway, the question is how to get from the MCU's 3.3V PWM signal to the 5V needed for the driver's control pin.

What I have tried so far:

Switch the driver's reference/control pin connection with a FET
Using a 2N7000 FET where the MCU's PWM output pin is connected to the gate pin, the driver's 5V reference pin to the drain pin, and the driver's control pin to the source pin.

Nothing was being switched though. I am not sure whether I was not able to open the 2N7000's gate with the 3.3V or whether there is a conceptual problem here.

Bring the 3.3V PWM signal to 5V with an op-amp
I tried to increase the 3.3V signal to 5V with a LM358 op-amp I had lying around. I set the gain to 1.5 with a pair of 330k Ohm and 220k Ohm resistors (giving the ratio 330k/220k = 1.5).

While this dimmed the LEDs, I was not able to fully switch them off, i.e. providing a full 5V at the driver's control pin. I am not sure what the problem is here though. I do not fully understand how an op-amp works and I would not be surprised if a PWM signal cannot be put through an op-amp without affecting the signal in a negative way, or that there is going to be some timing issues/considerations at the very least.

Any tips or recommendations? Please be as specific as possible in your answer and do not assume that I know my way around EE.

Many thanks!
-Jonas
With PWM, it could be as simple as a common emitter switching transistor with its collector pull up resistor to 5V - but that inverts the signal, so you need 2 stages to invert it back again.

If it had been linear, I would have suggested hanging a common base stage on the output in the manner of a casc_o_de amplifier. Its non inverting, so you only need the one stage, but it has no current gain so the MPU output has to handle all the load current. That will also work with PWM - but VCEsat and Vbe can be a little inconvenient when absolute voltage levels have to be maintained.
 
Top