I am designing a robot using the PIC16F877A microcontroller that will avoid walls and obstacles. I plan to have it run off of 4 AA batteries. I was wondering how i would convert the 6 volt input voltage to the 5 volts that the pic needs. I need to use 6 volts because the h bridge circuit/the motors that I am using require it. I also need exactly 5 volts, because i need a 5 volt reference voltage for my ADC and to run my sensor off of. Using two batteries is an option, but I would hope to avoid at all costs. Finally SMD products won't work, because I would like to build this on a breadboard. I did ask a similar question here How to get input voltage of 5 and 6 volts but my needs have changed since then and the answers wont fit my problem. How would a normal project overcomethis problem.

  • \$\begingroup\$ Refer to electronics.stackexchange.com/a/86274/33841 \$\endgroup\$
    – alexan_e
    Feb 5, 2014 at 0:28
  • 1
    \$\begingroup\$ Typical end-of-life for 4 x AA cells is more like 3.6~4.8v than 6V, so "dropping" probably won't work for you. \$\endgroup\$ Feb 5, 2014 at 0:34
  • \$\begingroup\$ the robot chassis that i am building comes with 4 AA holder so i would like to use them \$\endgroup\$ Feb 5, 2014 at 0:46
  • 3
    \$\begingroup\$ "Finally SMD products won't work, because I would like to build this on a breadboard." So then get an adapter PCB. \$\endgroup\$ Feb 5, 2014 at 1:08
  • 1
    \$\begingroup\$ See electronics.stackexchange.com/questions/27403/… for some solutions. \$\endgroup\$
    – Passerby
    Feb 5, 2014 at 4:43

4 Answers 4


Easy way is to connect a diode in series with your batteries (voltage drop across diode is around 0.7V). If you dont dissipate too much power you should be fine.

For example: if you use a general purpose diode 1n400x (x = 1 to 7) You have to look in datasheet for voltage drop at max. current you want to draw

example datasheet: www.diodes.com/datasheets/ds28002.pdf‎

it says: Forward Voltage @ If = 1.0A -> 1V

so if you draw 1A out of your battery it will drop the voltage 1V and will dissipate 1V*1A = 1 Watt of power.

Thermal resistance of this diode is 100K/W and maximum operating temperature is 150 degree Celcius.

So if you ambient temperature is 25'Celsius the diode temperature will be 125'Celsius. this is high but within specs. if you want lower diode temperature you should look for diodes with lower thermal resistance (usually diodes with larger package have lower thermal resistance)

  • 4
    \$\begingroup\$ That's fine provided your batteries produce exactly 6V. Which they won't. Brand new AA batteries produce slightly more than 1.5V. Old ones will produce less. \$\endgroup\$
    – Simon B
    Sep 12, 2015 at 8:38
  • 1
    \$\begingroup\$ Also the volt drop of a diode varies massively with current draw and the current draw of a microcontroller also varies massively. \$\endgroup\$ Oct 30, 2015 at 14:56

The actual voltage available from 4 x AA alkaline cells would vary widely, between 6 Volts for fresh batteries with no load, to as little as 0.7 x 4 = 2.8 Volts under load or as the batteries deplete. The voltage could fall further, but it is convenient to select 3 Volts as a lower operating limit.

For a requirement such as described, one solution is a SEPIC converter that will produce the nominal 5 Volts desired, despite the supply voltage changing from greater than 5 Volts to less.

Most SEPIC converters these days appear to be available solely as SMD parts, which the question precludes. Therefore, an alternative solution is to use a pre-built SEPIC module that can be plugged into a breadboard. For example, this module on eBay (US $6.85 with free shipping) offers to 0.5-30 Volt adjustable output, from a 3-15 Volt input supply:


Searching your preferred vendor site would yield many other such options.

Note, though, that realistically the battery voltage will drop significantly the moment the motors are turned on: AA cells have a significant internal resistance, which causes this voltage drop. The options are to use a LiPo / LiFePo4 battery instead, or use lithium non-rechargeable (primary) high current cells.

The SEPIC module above will work with those as well.

It is also worth verifying whether the H-bridge / motor actually requires 6 Volts to operate: If this is a hard limit, then 4 x AA will not be viable anyway, so see the above alternatives.


There is a nice solution that requires a slightly larger battery holder. There are 4 cell holders on eBay for Ultra Fire Li-ion 18650 type batteries. These are 3.7V each and 5000 mAh - the Ah rating is a little ambitious but they come close on applications that do not draw high current. 4 cells will give about 14.5 volts freshly charged and 11 when nearing exhaustion.

What so much? Use a high efficiency DC/DC converter to get your 5V. I use these from MuRata http://www.digikey.com/product-detail/en/OKI-78SR-5%2F1.5-W36-C/811-2196-5-ND/2259781 7V to 36V input and 5V 1A output. Very cool device fits TO-220 footprint.

Will your motor driver really suffer from running at 5V? You could tap the first 2 cells for 6 to 7.5 volts for the motor.

I don't see a way to use the 4 cell holder you have with typical batteries (without a DC/DC up converter). They will drop too low in voltage.


you may try. connect the 6V output to series with zener 5.6V and resistane (resistance power calculate) connect your output(between zener diode) to feedback of ADC Ref terminal.(ADC won't need exact 5V , you need some changes in programming) The resistor will dissipate excess voltage.

Connection diagram like this:-

(6V positive)---> resistance<--->zener5.6V>--- (6v negative) | | output + - Zener diode direction is most important.


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