Sorry if my question is stupid but I'm an electronic passionate only during the weekend.

I had a talk with a friend, we want to bring the power supply to a box containing a microcontroller inside a garden. The cable that has to bring the electricity will be 20 meters long.

Both me and my friend do agree on the fact that we need to bring the 220V AC to the box and over there use a power adapter for transforming 220V AC to 5V DC in place.

But I think that the distance is difficult to cover with DC, he thought that the distance is difficult to cover with 5V (and if the voltage is 5V at the head of the cable could be 3V or less in the tail of the cable if the cable is too long).

What is the reality? Why is difficult to bring 5V DC in a 20 meter long cable? Well.. is it really difficult or not?

PS: the microcontroller is an Arduino, it has to read some sensors (light, temperature, humidity) and swhitch on some actuators (few LED and two or three servo motors mainly). It has to run all day long for all the summer.

  • 7
    \$\begingroup\$ You neglected to state the current draw pattern of whatever is at the end of the cable. If the microcontroller draws a very small current, it's not a problem. There are ways to handle a sudden current demand for a short period: namely, charge some reservoir capacitors located close to the microcontroller. For instance, if the microcontroller wakes up once in a while and actuates something. \$\endgroup\$
    – Kaz
    Commented Jun 25, 2013 at 20:37
  • \$\begingroup\$ question edited! \$\endgroup\$
    – nkint
    Commented Jun 25, 2013 at 20:45
  • \$\begingroup\$ Say you have a voltage regulator there which requires a 1V dropout, so it needs 6V. You charge a capacitor to 7 or 8V. How big does the capacitor have to be so that under the worst case situation which occurs, it will not drain below 6V? That's a calculation you have to do. \$\endgroup\$
    – Kaz
    Commented Jun 25, 2013 at 20:52

5 Answers 5


Unless you are prepared to dig a trench and bury an expensive weatherproof cable (or a conduit) to bring 220v across from the house or wherever to the garden, you should convert the 220v to DC beforehand.

However, you cannot just plug in a 220v AC to 5v DC adapter, and run a low-voltage line (which would not require a conduit or weatherproof wire), because the cable will have some resistance, and there will be a voltage drop. Can't say how much, without knowing the current draw and and the gauge of the wire.

So it would be better to transmit a higher voltage, say 12 volts, and then have a 5v regulator at the far end which would provide the necessary power.

This article has a table where you calculate of a wire of various gauges. Remember to double this, because you have two wires.

  • \$\begingroup\$ well, the microcontroller I'll gone to use (Arduino) can receive till 24V and has the internat 5V regulator so it is OK, thanks. But.. why the low-voltage line does not require the weatherproof wire? \$\endgroup\$
    – nkint
    Commented Jun 25, 2013 at 20:53
  • \$\begingroup\$ Low Voltage cabling can and does fall under electrical codes, sometimes needs a conduit or weatherproofing, or even burying. This varies by jurisdiction. \$\endgroup\$
    – Passerby
    Commented Jun 25, 2013 at 21:07
  • \$\begingroup\$ He said it has to work all summer. Nothing said about it being permanent. 20 meters at an amp or two is nothing; I'd just run the AC from an outdoors outlet to the box then use a local power supply. Local DIY home supply store will have lots of suitable extension cords. \$\endgroup\$
    – lyndon
    Commented Jun 26, 2013 at 0:12
  • \$\begingroup\$ Whether the cable is 5v or 240v you still need to bury it, and for low-current mains cable is not exactly expensive. \$\endgroup\$
    – John U
    Commented Jun 26, 2013 at 8:10
  • 1
    \$\begingroup\$ @nkint -- By low voltage, if you are referring to 220v vs 24v, burying a 220v line is technically going to run up against all sorts of electrical code regulations (such as requiring a conduit or heavy-duty weatherproof cable, it depends where you live). As someone pointed out, you can probably get by with running a 20m extension cord, since no one is probably going to be snooping in your back yard. A 24v line is not going to be regulated as much, or not at all. \$\endgroup\$
    – tcrosley
    Commented Jun 26, 2013 at 21:23

It is not difficult if you remember one thing. Cables/Wire act like small resistors. The longer the cable & the more current through the cable, the higher the voltage drop. So you might have 5v at the beginning, but you might have 4.5v or 4v at the end.

This is a common issue with Low Voltage installations, like outdoor landscaping lighting. You just need to plan ahead.

At 20m of cable, you actually have 40m, because the power has to the arduino, and then back.

At 5v, when that's the bare minimum an Arduino needs for it's ""standard"" operation without regulation, you will have too much of a voltage drop. A quick use of a voltage drop tool (there are hundreds on google), with 16awg wire, 5v, 40m, and 500mA/0.5A, the voltage drop is 0.58V. That means you only get 4.42V at the Arduino. At a smaller current, you would have a smaller drop, but I'm guessing 500mA as a standard usb power adaptor, and three non-specific servos.

So you need a higher voltage. But since

  1. You do not have a constant current draw
  2. You need a constant voltage
  3. You probably want some regulation

your best bet is to use the onboard regulator on the Arduino. Accounting for the minimum voltage needed for the regulator (The Drop Out voltage) which is nearly 2v, and the 40m of cable voltage drop, 9V would work better. At 10mA you only get a 0.011V drop, while at 1 Amp, you get 1.05V drop, which would still give the Arduino's onboard voltage regulator 7.95V which is plenty (and would avoid any heat concerns from the regulator dropping too much voltage). This would give you a nice stable 5v at the Arduino.

Just a heads up, this can also fall under the DIY.Stackexchange.com site, as outdoor landscaping lighting is a common question there, if you need some help on how to actually install the wiring or anything. But your best source of help for this would be your local hardware store, even something like Home Depot or Lowes. They tend to have an entire section (like half or a third of an aisle) dedicated to landscape wiring, cables, enclosures, etc. And they would probably be able to tell you if there is any electrical wiring code you need to follow, like if the cable needs to be buried or in a conduit or anything.

  • \$\begingroup\$ Sorry but I still don't understand why is better to start with low-voltage.. For security reason? \$\endgroup\$
    – nkint
    Commented Jun 26, 2013 at 10:07
  • \$\begingroup\$ @nkint because it's safer. Because low voltage cables are less restricted in electrical codes than high voltage. Smaller cables can be used. You're needs are so tiny (5v, 1 Amp) that running a high voltage cable for only the summer is just unnecessary. It's like asking why a simple battery pack is better than using a gasoline generator. Compare it to using a candle instead of using a flame thrower. \$\endgroup\$
    – Passerby
    Commented Jun 26, 2013 at 23:22

All depends from the current used by the box. A good idea could be measure the current used by your box with a multimeter. Ohm's law is your friend and, knowing the resistance of the wire, you can easily deduce if it is possible use 5 V without a big voltage drop. If you don't want to use 220 V AC, my advice is to use an higher voltage than 5 V, maybe 12 V or 24 V. With 5 V you are very limited in current usage.


I am not an engineer or something I just have some teenage-nerd-project-experience. My solution would be to send a higher voltage through the cable for example 12V with at least 1 amp, and in the other end you will have about 4V to 6V? from there you can change the current voltage and amp with a DC-DC and plug the output of the DC-DC to your Arduino? Be sure to measure the output DC with a multimeter before plugging it into your Arduino, it may take damage of to low or high voltages...


What is the reality? Why is difficult to bring 5V DC in a 20 meter long cable? Well.. is it really difficult or not?.

PS: the microcontroller is an Arduino, it has to read some sensors (light, temperature, humidity) and swhitch on some actuators (few LED and two or three servo motors mainly). It has to run all day long for all the summer... outside in the garden.

actually it is a piece of cake, if there is no load on the end of your wire... and it's an open circuit you can make it 100m long and you'll have 5vdc measured on the end of it.

It will be a matter of how much power your load is going to draw. A quick search on arduino says they pull milliamps at 5v or 9v dc so figure about 0.1 watts.

DC voltage drop over distance is proportional to power (current) and is why the world runs on AC... Tesla, Westinghouse, Edison figured that all out 100 years ago. The longer your wire the more resistance and more voltage drop with DC simply based on V=IR.

So the question for you becomes

  1. Run 120V or 240V AC wiring outside, which if you want a permanent style of installation assuming you are in the U.S. then there's NEC code to worry about running underground wiring. Otherwise run a decent weatherproof outdoor extension cord and use good judgement- and use an inline GFCI thing for safety. Then convert to DC at the arduino in your garden.

  2. Go from an inside the house wall outlet at 120/240 and plug in a $40 ATX computer power supply you bought online or scavenged to give yourself a good AC/DC converter and a reliable 5V; so you are converting AC to DC within the house. Then tap off the PSU 5V output and run suitable wiring from it out to your garden. Per NEC anything less than i think 50 volts is low voltage and not subject to the more stringent protection standards of 120v ac and above. Measure your voltage out in your garden if it dropped to 4v or whatever and is too low then you have the PSU 12V to work off of.

Arduino: The board can operate on an external supply from 6 to 20 volts. If supplied with less than 7V, however, the 5V pin may supply less than five volts and the board may become unstable. If using more than 12V, the voltage regulator may overheat and damage the board. The recommended range is 7 to 12 volts.

Based on that I'd say use the 12v output from a computer PSU.

ATX PSU: 5v=red, 12v=yellow

Other option: use a 24AC 40VA transformer that is used for HVAC. That connects indoors and runs off 120VAC doing suitable wiring from a wall outlet. Then that 24VAC output from that transformer would qualify as low voltage and not be unsafe and then being AC you would not be subjected to the voltage loss running wire however long (within reason) out to your garden. Then convert that 24VAC to your 5V DC and wire your arduino. A simple search of 24vac to 5vdc shows a $12 waterproof step down converter on amazon.

Don't run over your wiring with your lawnmower.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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