﻿ Robot Gestation : Electrical

# Electrical Systems

No robot can function without an energy source of some kind. Traditionally, this energy is electrical power, although steam-powered robots have been built and used!

Electrical power is the rate at which electrical energy is transferred or consumed by an electric circuit.

Electrical energy is defined by two measurements, voltage and current. If you multiply your voltage potential (in Volts) by your current (in Amperes), you get the amount of power available - it's that easy! This is called Joule's Law, and it's written simply as :

P = VI

where P is the electric power in Watts,

V is the supply voltage in Volts, and

I is the current in Amps.

When we're working with typical robot circuits, we can restate Joule's Law as just :

Electrical Power = Volts * Amps

## What is power, exactly?

When electrical current flows in a circuit, it's able to perform useful work. It could be turning a motor, flashing an LED, or powering an integrated circuit. It can also be wasted in wiring and connection losses. This work is called power.

So power is expressed in terms of the amount of work done (in Watts) over a period of time (typically an hour). This is expressed as Watts per hour, or W/h. It's exactly equivalent to :

Power (work done) = Volts * Amps / hour

We normally just call this value 'watts', or sometimes the 'wattage' of the circuit. You may be familiar with the ratings for light bulbs. A 60W (watt) bulb consumes 60 watts of power every hour it's on. So 'watts' and 'Watt/Hours' are generally understood to mean the same thing.

It's crucially important to know how much power your robot is likely to need in order to operate normally. If you underestimate the power required, your robot's power source will be unable to supply enough power for long enough to do anything useful. On the other hand, if you overestimate the power required, you could end up with a robot that's too heavy (because of the extra battery weight) to work properly. In case of doubt, however, it's usually best to overestimate the power needed.

By way of example, let's say your robot has motors that are rated at 6W, and your electronic circuits use 250mA (milliAmps, or thousandths of an Ampere) at 5 V. The electrical power consumed by your electronics is then calculated like this :

P = V x A

= 5V x 0.25A

= 1.25 Watts

So with your motors, this robot will use 6W + 1.25W = 7.25 watts every hour, assuming the motors are running all this time. It's that simple!

That's quite a reasonable figure for a small mobile robot using small 6V motors and a small control circuit, say a Basic Stamp or PICAXE controller. Other robots may need larger motors, and/or more circuitry to manage the robot, and more sensors, and so on, which all have to be added in to the equation.

Rocky, for example, has a total worst-case power consumption of 1,560mA from a 12V battery. So Rocky's power consumption is 12 x 1.56, or 18.72 Watts per hour! But that's only the case when he's climbing stairs or a very steep slope. More typically, across a flat floor or lawn, Rocky draws 0.52A (520 mA) from the same battery, which works out to be 12 x 0.52, or 6.25W/h. So even though Rocky's motor is rated at 12W, in normal use it needs less than a quarter of that power. But if I'd assumed that I only needed a 6.25W supply, if Rocky then had "a bad day" and spent most of the time going over rocks or up stairs, the power supply would fail after only 20 minutes!

As you can see, sometimes you do need to know 'worst case' figures, and you'll still need to measure a more reasonable figure to allow you to estimate typical, light, and heavy power consumption!

#### How many watts are in a battery?

To give some examples that might help you understand and compare typical power sources, here's a partial list of some battery power sources and their equivalent in Watts per hour. Please note, these figures are for all sizes of batteries, so they're listed to give you an idea of the available types of power ratings from various types of batteries.

There are multiple places on the internet where extremely detailed information on battery and power technology is available, so I'm not going to duplicate that here.

 Dry Cell AAA batteries 0.7 W/h Dry Cell AA batteries 1.8 W/h NiMH AA batteries 3.0 W/h NiMH C cells 9.6 W/h LiPo 25C cells 36 W/h SLA batteries (12V, 7.2Ah) 86 W/h Typical Car Battery (12V, 55A) 660 W/h

### A More Typical Cell Comparison

As a comparison of the various cell chemistries, we'll look at the four main types of AA cell in use today. This will give us a better idea of their power-supplying capacities, given the same package size.

 Cell Chemistry Full Voltage Discharge Rating Power Rating Carbon-Zinc 1.5V 1100 mAh 1.65 W/h Alkaline 1.5V 2900 mAh 4.35 W/h NiCd 1.25V 1100 mAh 1.35 W/h NiMH 1.25V 3000 mAh 3.75 W/h

These figures show that a non-rechargeable Alkaline AA battery will provide around 4.35 Watts for an hour (or 0.435W for 10 hours, and so on).

Now, 4.4 Watts doesn't sound like a lot, but given that most modern microprocessors draw typically less than 250 mW - so a pair of alkaline AAs would power a fairly typical PIC microprocessor for around 17 hours straight! By comparison, a pair of NiMH cells would power the same processor for only about 15 hours before their voltage dropped to the point where the CPU would stop working.

But that only takes into account the microprocessor itself.

In most mobile robots, most of the power (up to 98% or more) is used by the electric motors. The power consumed by a robot's electronics tends to be one or two orders of magnitude less than the motor power consumption.

A typical 6VDC motor capable of moving a typical robot around would draw around 3 Watts per hour or more, giving you a total running time of a bit over an hour. That sounds OK to start off with, right? But larger or heavier robots will take much more power to move them; a typical 2-5kg robot may need motors with a power rating of 10W to 20W or more - which means our AA cells would be flat in just over 13 minutes, not 17 hours!

You also need to calculate for every part of the robot that uses (or loses) power - such as LEDs, sensors, resistors, even wiring dissipates power, especially in the motors and sensors.

So you can see that power consumption and battery life can be quite difficult to estimate without knowing exactly how each part of your robot uses power. That's why electrical design is crucial to a good robot.

## Robot Power Sources

When most constructors think "power", they immediately think batteries. However, as we've just seen, there's much more to an electrical system than just batteries. You also need to consider power losses, regulation, regulation efficiency, distribution, and filtering, if your robot is to last for more than 20 minutes on a set of batteries!

Now, Terminator movies not withstanding, nuclear power cells are still some way off in the future, so we need to deal with the kinds of power sources that are available to us right now!

For now, it's safe to say there are 4 main sources of power for a typical robot. These are

1. Mains Power
2. Primary cells (non-rechargeable)
3. Secondary Cells (rechargeable); and
4. Solar Power

## Mains Power Options

On a cost-per-electron-used basis, mains power is by far the cheapest option of all the power sources available at the present time. Unfortunately, mains power is not mobile-robot-friendly, so it's really only useful in terms of recharging batteries and testing circuits before they're put into use in your robot.

There are some makers of extremely long extension leads, which can be useful when a robot is fixed in place a long distance (tens of metres) from any other power source, or where the robot's power needs would flatten any existing battery technology; but even in that case, car batteries or a mobile generator (petrol or diesel powered robots are starting to appear in niche markets) may be a better option.

Mains power does have to be stepped down and rectified (there are very few 240V or 110V robots navigating around the world!), so they do require bulky and heavy stepdown transformers where high power levels are required. More recently, some amazing IC technologies are appearing that are able to step down and regulate mains voltages to provide significant amounts of power very safely. With a handful of components, you can make a mains-powered 5V 5A (25 Watt) supply that fits in a matchbox sized area! But you're still tethered to the power point.

## Primary Cells

Primary cells, as we've already seen, are non-rechargeable batteries. This is their greatest drawback, and really limits their use to simple, very low-powered robots.

Of course, when these batteries go flat, you have to toss them out and buy new ones.

Here you'll find the one advantage of primary cells - they're relatively cheap to replace, so it doesn't cost all that much to replace a pack of 4 AA alkaline batteries. You can buy 10 or more good-quality alkaline batteries for less than \$20 in many convenience stores, and large international stores have even cheaper brands, although you do get what you pay for!

No serious robot builder would even consider using non-rechargeable batteries in their designs, even for smaller designs. The cost versus lifetime differential makes it completely untenable to use primary cells these days, even if you could obtain single cells of a reasonable size any more. So let's look at secondary cells, and why they've taken over nearly all uses in robotics.

## Secondary Cells (Rechargeable Batteries)

The great advantage of secondary cells is that once they go flat, they can be recharged. This significantly extends the useful life of the battery - as long as the correct type of charger is used.

Perhaps the biggest drawback to rechargeable cells is the cost - these types of batteries can cost upwards of 10 times as much as a primary cell of roughly the same size and power rating. However, given that some secondary cells can be recharged up to 500 times, this is really only a problem when first buying the batteries!

One of the biggest questions you'll need to ask when choosing a rechargeable battery type for your robot, is "How will I recharge the battery?".

Many versions of mains-powered battery chargers exist, so it's usually not a huge issue to pop the battery/batteries out, pop them in the charger overnight, and put them back in the robot the next day. This works well for many robots.

However, for an autonomous robot, there usually needs to be some kind of battery charger circuit designed into the robot itself. That way, you can either manually hook up an AC adapter and recharge, or (as is used in Rocky), the robot can be programmed to find a recharging station and recharge itself. This allow the robot to roam a lot longer, and doesn't require manual intervention. You can even program the robot to only recharge at night, etc.

The obvious drawback to using the robot itself to recharge itself is finding the charger! Many designs are available on the internet for charging stations with multiple beacon types (see Sensors for the types of sensors used), to allow the robot to find and correctly orientate itself for reliable recharging. However, there's no reason a robot couldn't be sufficiently sophisticated to identify mains outlets by camera, then plug itself in appropriately! This negates the need for dedicated charging outlets, but of course there are significant dangers in this approach, which must be taken care of.

### What Type of Rechargeable should I use?

At the present time, there are two fairly significant battery groups used in robotics.

The NiCd and NiMH cells are often used for low-to-mid powered robots, where the total power is less than about 10 Watts, and the usual supply voltage is around 6V or so. This allows the use of just 4 - 6 cells in series to provide the regulated 5V DC for logic circuits, sensors, and microprocessors. Use of 6V motors means you don't have to have a regulator for the motors, and by paralleling the cells, you increase the current (power) available, while not adding to power losses by having too high a voltage.

For larger and more mobile robots, the lead-acid battery (also called "Gel Cell", or Sealed Lead Acid (SLA) is more typically used, as these batteries are available in power ratings of up to many hundreds (even thousands!) of watts. This allows a very long usage time for smaller robots before recharging, and will also power extremely large robots if needed.

#### What's "Energy Density" and why is it important?

The biggest drawbacks with SLA batteries are the size, weight, and "energy density". Energy density is the amount of power available, divided by the weight (mass) of the battery. SLA batteries have a fairly low energy density, but because they can be made physically very large, they can also supply an enormous amount of power. Unfortunately, a lot of that power is wasted carrying around the weight of the batteries!

As you can see from the graph, SLA (lead-acid) batteries have the lowest energy density of all battery types. So why use SLA at all? The biggest factor is cost - at the moment, SLA batteries cost the least per watt of all the battery types. In fact, you can use the vertical axis on the graph to represent the relative cost of the battery technology, as well as the energy density!

If you're powering a large robot (perhaps one with an embedded PC, display screen, hard disk drives, and hundred-watt motors), SLA is by far the least expensive option for powering it. No-one makes commercial NiCd, NiMH, or LiPo batteries of an equivalent power output. You'd have to buy many LiPo or LiIon batteries to provide the equivalent raw wattage available from a single large SLA battery, at tens to hundreds of times the cost. But it would most likely result in a significantly lighter robot!

#### Comparing SLA and LiPo for typical robot requirements

If you're making your own rover or small robot, with low- to medium-power consumption (say, 6 to 35 watts total), then the cheaper alternative is still SLA, although if you shop around, you can pick up LiPo batteries at very reasonable cost.

 A typical 20W/h SLA Battery. This battery is around 40% larger (and twice as heavy) as the LiPo batteries shown below A more typical 12V 60W/h SLA battery. This weighs more than three times as much as the 60W LiPo shown below - and is nearly 3 times the size!

More recently, LiPo (lithium polymer) batteries are being used more and more instead of SLA. As we've seen, LiPo batteries currently have the highest energy density of any battery technology. This means that while they're physically smaller, and therefore you need more of them to achieve the same power rating as SLAs, they weigh up to 5-10 times less than the equivalent SLA battery. In fact, they're so light and efficient, they've single-handedly enabled electric-powered aircraft of all types - from those that sit in your hand, to massive 30-scale helicopters with a rotor span of up to 2 metres! So they're a pretty good option for mobile robots of all kinds.

 A typical modern 40Wh LiPo Battery with dimensions A "shrink wrap" 60Wh LiPo battery pack. Note the relative size and power packed into a smaller case - this is high energy density!

Unfortunately, LiPo batteries are extremely fussy about recharging, and incorrect recharging will result in explosion every time. And they can cost hundreds of dollars for a reasonable power rating, so even though they repay the investment over time, they're horribly expensive to start with!

#### Recharging Options

So the type of battery you choose will determine the type of charging circuit (or standalone charger) you use.

While NiCd and SLA batteries can often be recharged using a simple diode and series resistor, NiMH and LiPo batteries will explode and catch fire - and worse! - if the wrong charging circuit is used. What's worse, even if they aren't visibly damaged by an incorrect charging circuit, you'll definitely shorten the battery's lifetime, by a significant amount.

Many manufacturers now provide a large number of different ICs that can be used with various different battery types (also called "multichemistry" or "universal" charger ICs). Typically, one or more pins on the IC is tied to ground or the power supply to switch the IC into the appropriate mode for charging.

NiMH and LiPo type batteries require a temperature sensor in order to determine the peak charge. You can use charger ICs without the thermal sensor, instead using an internal timer to pre-time the various charging stages. This type of charger option can work well with new batteries, but as the batteries are repeatedly used and recharged, the timer-type rechargers tend to undercharge the batteries, leading to shorter usage times and longer recharge times.

#### Cell Memory

It's common knowledge that NiCd cells, if repeatedly charged to the same level, will eventually become incapable of storing more charge than that level. This is referred to as "cell memory" or "charge memory". This is one of the most important reasons (along with the hazardous nature of the cadmium compounds used in these batteries) why NiMh, SLA, and LiPo batteries are generally the battery type of choice these days.

Not only that, but the newer batteries have far higher energy densities than the old style NiCd batteries, and weigh less as well.

## Solar Power

These days, you can't drive down a typical street without seeing solar power in everyday use. Whether it's as a simple heat-storage device (solar hot water heaters), household electricity generation, or just powering streetsigns or garden night-lights, there are solar cells just about everywhere you look!

Solar cell technology, after remaining stagnant for many decades, is really starting to take off. So what options does that give you as a robot builder?

#### They're out there!

You'll find some really interesting uses for solar powered robotics in various places these days. Small, totally self-powered robots are called "Photovores", since that's the only kind of power they use. Typical modern lightweight solar panels can generate surprising amounts of power - up to 3-4 watts for larger panels, and many tens or hundreds of watts for huge, window-sized panels.

However, when it comes to robotics, solar power ain't really there yet for the mainstream builder. This is due to a couple of factors.

First, solar cells only generate power when they are directly illuminated by a light source. If your robot wanders into a dark room or cupboard, it ain't coming out again!

Second, solar cell efficiency is still well under 2% for reasonably-priced solar cells. This means that, for instance, if your solar powered rover is in a room illuminated by a 60W lightbulb, less than 1.2W of power will be generated. Period. Unless your robot is outdoors only, and only runs on sunny or slightly overcast days, it's not going anywhere fast.

Many robot builders stop at this point and say "What about the Mars rovers? Spirit and Opportunity are solar-powered, and they travel all over a distant planet!". While this is true, and both rovers have astonished researchers by operating so well for so long, you do need to consider the mission parameters.

 The Mars Pathfinder Robot in all its glory! The "brains" of Pathfinder. What a real robot can look like!

The rovers are both exclusively outdoor-only robots. They simply can't operate in any kind of shade or even light cloud cover without relying on their non-rechargeable primary battery. Next, their top speed is in the vicinity of a centimetre per second - even on a flat, level ground. This is a painful pace for any robot - try showing one off to your friends or colleagues, and they'll be bored within a minute. If such a robot discovered an "interesting" place to visit, by the time they got there, whatever it was would be gone. They can't even keep up with a human being - even if they're in direct overhead sunlight!

Unlike any solar cells available to us humans on Earth, the Pathfinder solar cells have nearly an 18% efficiency rating. Compare this to typical commercial-grade (not toy) solar cells, with a typical efficiency of between 0.6 and 4%. And the cost of even the 4% efficient cells would be astronomical (pardon the pun). The Pathfinder solar array can generate a maximum of 16 watts, peak, on a clear Mars day, with the Sun directly overhead. While the same cells would generate considerably more power on Earth (probably up to 70 watts), they're not designed to deliver that much power.

The smarts built in to the Pathfinders is extremely limited due to the lack of constant power. A large proportion of the programming is designed to figure out what parts of the circuit can be used and at what speed - otherwise the power budget goes out of the window! Still, it's very exciting to see so much autonomy designed into such a limited processing design!

Finally, the cost for each of the rovers is around \$25,000,000 (yes, twenty-five million dollars) per robot! This includes the specialised solar panels, the ultralight and ultra-efficient motors, chassis, and suspension, and the ultra-low-powered electronics. There aren't many robot builders on the planet who could design using any of those materials or technologies, unless you have a really rich family...

Don't get me wrong - the Mars rovers are one of the most exciting and original experiments the human race has ever engineered. But in terms of what they mean for typical robot builders here, and more specifically, for solar-powered ideas, they're not something we could normally consider as doable by any hobbyist.

So unfortunately, solar power is still a bit of a joke in robotics. There are plenty of ideas circulating that will help to rectify this situation, and I hope to be proven totally wrong in less than a decade - but for now, save your money and buy a battery.

By all means get hold of a photovore kit and build it, it's great fun and seriously good engineering - but you won't find one big enough to carry a cup of coffee, without using solar sails bigger than your bed!

### Power Losses - the I²R Gremlins

So you've estimated your power consumption for each component and device, added everything up carefully, added a bit extra for safety, got your batteries, charged 'em up, plugged 'em in, debugged your routines, and now - the robot lasts less than 4/5 as long as you calculated. What gives? Welcome to the power loss gremlins!

OK. The problem is heat. Heat (which is a form of power, although not terribly useful from a robot's perspective) is produced when a wire's (or any other part of a circuit's resistance) is too high. Typically, the problem is in motor wiring - since the most current is used by the motor(s), the highest power losses occur in the wiring to and from the motor.

Don't worry - normal IC circuits can also dissipate large amounts of power. However, since the ICs tend to consume less than 1- 5% of the power, only a very small amount is lost in the connections between the ICs and the power supply. Most is lost in the motor (and other high-current wiring, such as the battery charge circuits).

Power losses are related to Joule's law. Remember that Power = V x I ? Well, it turns out that Power also equals the current squared times the resistance, or

P = I²R

This means that thin wiring equals high resistance. And, since high resistance equals high power, much of the power to and from the motor(s) is lost - as heat. You can easily demonstrate this by connecting your motor to your power source with hookup wire. While the motor spins freely, there are no problems. But as soon as the motor slows down - by pinching the shaft between your fingers - the current increases, and soon the wire will be smoking hot to the touch, and may even literally melt!

With larger motors and thin wiring, the wiring resistance is higher - and so are the power losses. Using short, thick wires to connect your motor(s) to your power supply can minimise this power loss, and therefore maximise your battery life, and your robot's reliability.

What it means in practice is that you need to keep your power wiring - whether the wiring is in the form of actual wires, or in traces on the circuit board - thick and short, and preferably both. This minimises the power losses, and will result in power consumption much, much closer to your calculated power. (You did calculate your power consumption, didn't you?).

As discussed in the various sensor pages, the signal lines are not nearly as critical in terms of power loss as the power lines to and from those sensors. Keep the power lines to and from the sensors as short and wide as possible, and you'll minimise the power gremlins.

While all this power talk may not apply to every robot, once you start expanding and improving your robot, shortcuts taken in the early design stages will come back to haunt you. That's a promise.

So minimise your use of thin 'hookup' wire at every stage of your robot's development. Keep all the signal lines short (this will eliminate signal losses and interference), and keep your power lines short and thick (this will eliminate power losses AND transference to signal lines).

I can't emphasize this enough - it can catch you out at nearly every stage of development! If you're using a circuit emulator or other simulation software, very little attention is paid to power line design. So while it looks great on the computer screen - or on the printout - you'll find that gremlins creep in as soon as you try to realise the circuit. Don't worry - it catches out developers at every level.

So, at the risk of repeating ad infinitum, he basic rule of thumb is :

Use the thickest, shortest wires you can easily handle when designing your power circuits. This includes both VCC lines AND ground connections. This also includes printed circuit board (PCB) tracks, but this is sometimes beyond your control.

By paying strict attention to wiring, you can beat wiring power losses. But if you pay enough attention to the details, you'll have no problems with the I²R gremlins.

 At this build revision (1.7.7), Rocky uses the following electrical system: A fully rectified and filtered 45W AC/DC mains connection (for battery charging and testing). A National Semiconductor LM3722 LiPo battery charger/manager An 8.6V 9Ah (75W/h) Lithium Polymer (LiPo) battery A Maxim 4070 High-side current sensor Automatic battery/mains electronic (contactless) switchover 2 linear LDO Regulators for 5V (250mA) and cascaded 3.3V (150mA) A Motormind-C dual output 5A motor driver (30W for the main motor, 20W for the steering servos) Suppression filters for external servos, wheel encoders, and sonar rangefinders Motor power is straight unfiltered battery terminal supplied, since the LDO regulators filter all the hash out. Eventually, the linear regulators will be replaced by a high-efficiency Maxim MAX1771 Boost regulator, plus a MAX16922 multi-output buck regulator. This will increase the power supply efficiency from about 37% to over 92%, resulting in a minimal power loss under all conditions. Note that most of the regulator efficiency is applied to the electronics, which take less than 8% of the power budget. So a change from 37% to 92% will result in over one watt less power dissipated by the electronics! And a watt saved, is a watt extra later on...