# 5v to 12v converter circuit

I need to make circuit which can convert 5v to 12v. I searched this on google and found many amplifying IC but I my requirement is a bit different.

I need to control 100 leds with arduino. I am planning to connect 3 leds in a string so a total of 33 strings would make it complete. Now arduino pin can only supply 5v. I tried connecting 3 leds in series and gave them 5v with resistor of 100 ohm but they didn't glow. I tried reducing the resistance value but no effect. This is why I am looking for a circuit which can boost 5v to 12v. But as I have to give PWM pulses to these leds to control their brightness level so using any IC which will give fixed output of 12v will not be a proper solution for this. I want some circuit whose output 12v can vary according to the PWM.

analogWrite(PWMPIN, 254) --> 4.8v //Leds brightness full
analogWrite(PWMPIN, 50)  --> 1v   //Leds brightness low


so the output voltage should vary according to the input.

Leds forward voltage is 2.2v with 20mA of current. I am connecting leds in this fashion: Edit: I am sorry. I posted half of the question because I thought that would solve the problem. I am actually using 555 timer to control the blinking rate of the leds. I cannot write this inside arduino code because arduino is busy in doing other things which will be increase the delay in blinking & we cannot do multitasking. So I thought using 555 timer would be a great idea. Following is the schematic : Earlier I was giving 12v instead of arduino pwm. But because I have to control the brightness level of leds so I connected this pin to the pwm pin of arduino. But as @dim suggested in comments that arduino cannot drive 100leds, is there any other solution for it.

• This is an XY problem. You need a 12V supply and a MOSFET connected to your PWM pin. Many tutorials as well as questions on this site and Arduino.SE exist about that topic. – Asmyldof Sep 20 '16 at 11:26
• Did you make a few basic computations to estimate the power consumption and current requirements? As I understand, you plan to drive the 100 leds directly from a single arduino pin. No way it works. The arduino pins can just provide enough current to control things (e.g. an external supply), but it won't provide enough power for 100 leds. – dim Sep 20 '16 at 11:28
• I don't get how using a 555 would solve the problem of Arduino multitasking. – Wesley Lee Sep 20 '16 at 11:48
• @WesleyLee arduino will be busy in doing other things and then will blink the leds so that will increase the delay. I only need to control the brightness level if any condition gets true. 555 timer will keep on going and if condition gets true it will make high/low intensity to leds. – S Andrew Sep 20 '16 at 11:50
• Ok, so specifically you want to convert a 0-5V signal from the Arduino to 0-12V? – Wesley Lee Sep 20 '16 at 11:52

## 2 Answers

You are approaching the problem incorrectly. First of all, if you get too much power from the D/A converter, you are risking to burn it. I would recommend you not to try to get the power from the Arduino board but from a second power source and use an Arduino digital output as a switch. simulate this circuit – Schematic created using CircuitLab

I'm showing only three LEDs in series. However, in this way you can connect the LEDs any way you need. Taking care, of course that the external power source can provide enough current and the sum of the voltages of the LEDs, the transistor and the resistor are less than 12 V.

Now, if you need to variate the light intensity, you can control it by means of PWM at the digital ouput.

If, as you are asking in your post, you need the combined control from a 555 and Arduino, one way is to use a logic AND gate: simulate this circuit

Or you could use the following circuit. Whenever the PWM and 555 ouputs are Low, both Q1 and Q2 are open thus Q3 is closed causing the LEDs to lit. If any one of Q1 and Q2 (or both) are High, the base of Q3 will be driven down causing Q3 to open which will turn off the LEDs. With this setup, the LEDs brightness is porportional to the widht of the Low state of the PWM. simulate this circuit

• Thankyou. I edited the question with more information. Please have a look at it – S Andrew Sep 20 '16 at 11:48
• Can you explain your 2nd circuit? – S Andrew Sep 20 '16 at 12:46
• Always put a resistor in series with base to limit the base current. What you show would either damage the chip or bjt or both. – JIm Dearden Sep 20 '16 at 13:08
• I'll edit the diagrams – Krauss Sep 20 '16 at 15:00

May I suggest the following:

1 - Instead of trying to convert 5V to 12V, use a 12V power supply to start with (the Arduino will most likely have an onboard converter to its own 5V needs).

2 - Instead of trying to control 100 LEDs directly with your Arduino pin (energy wise its not viable), use an external switch (i.e.: MOSFET).

So, it would be something like this: simulate this circuit – Schematic created using CircuitLab

Calculating R-LED:

Vf = 2.2V

If = 20mA

At 12V you can easily have 4 LEDs in series (for a Vf of 8.8V total).

12V - 8.8V = 3.2V on the limiting resistor.

U = R * i

So 3.2 = R * 0.02A, R = 160R (I used 150R in the sch)

Description of components:

D5 is optional and protects your FET in case you use an inductive load. Its not necessary for LEDs but its good practice.

R1 limits the current into M1 gate. R2 turns off M1 when Arduino PWM pin is high-impedance (Reset, programming, defined as input, etc). (Actually, R1 and R2 are kind of optional as well, but I'd recommend using them.. only 2 extra resistors..)

p.s.: your LEDs didn't "glow" when you put 3 of them in series on your Arduino's pin because they require at least 6.6V (if each Vf is 2.2V). The 2.2V value not a brick wall limit but it's enough for this explanation. If you tried with 2 they would probably have light up.

EDIT:

After updates on the original question, OP wants to convert a 0-5V signal to 0-12V.

So, one of the ways of doing this is quite similar to the solution above: simulate this circuit

There are some simpler and more elegant solutions but anyway.

So, you have a 0-5V signal. When input is LOW, M1 is off and R4 turns M2 on, driving the output LOW.

When input is HIGH, it turns M1 on, M1 pulls M2's gate to ground, turning it off. R5 then pulls the output to 12V (a bit less if you take the resistors on your schematic into consideration).

This schematic only uses two FETs because the first one inverts the signal, the second inverts the signal back. If you can invert the logic in the software, then R5, M2 can be omitted. None of the resistor values are critical.

• Thankyou. I edited the question with more information. Please have a look at it – S Andrew Sep 20 '16 at 11:47