ALL LEVELS
Robot Forum
Parts List
Contact

BEGINNERS
How To Build
A Robot
Tutorial

Batteries
Electronics 101
Funding
Mechanics 101
Microcontrollers
RC Robots

INTERMEDIATE
Actuators
Algorithms
Competitions
Materials
Schematics
Sensors

Robot Theory  Robot Journals

BASIC ELECTRONICS TUTORIAL FOR ROBOTS

 Power Resistors Potentiometers Capacitors Transistors MOSFETs Diodes Relays

Electronics can at first seem extremely complicated to understand and learn. One look at a circuit board with all those little blinky LED's and black chips and unidentifiable circle pointy things can make anyone quit before starting.

But actually electronics can be much simpler than you think. Learning electronics is more like learning a foreign language alphabet. At first glance it is all a bunch of squiggles. But actually each letter has its own pronounciation and its own rules of use. And certain combinations of letters in a certain order form a word of some meaning. And a combination of words forms a sentence. This is the same for a circuit board. Each tiny component, such as a resistor or capacitor or transistor, has special rules and abilities. Combining a few into a circuit can create interesting effects. Combine a bunch of unrelated circuits together and suddenly you have a robot. So your first step would just to be to learn and understand the smallest of the components. Once there you can learn about combining them. Just like learning a foreign alphabet, no?

Ok first a quick crash course in electron physics.
All electronics is designed to manipulate a flow of electrons. Electrons have mass and volume so you can almost think of electrons in circuits as water flowing through plumbing. The analogy is amazingly helpful if you think about it. Also note, the more electrons you have in one place, the higher the voltage. The more electrons moving together, the higher the current. The same as with water.

Ground and Source
Source is the positive part of your circuit. The plus end of your battery would go here. Ground is the negative node of your circuit. When you design your circuit, imagine a flow of electrons coming from the source, and heading to the ground. A quick note, in reality electrons move from gound to source. The confusion has historical reasons I dont want to get in to. But just know this fact, and pretend electrons move from source to ground.
Now think of this as water. Water flows down the easiest quickest path between these two points. More resistance to flow, less will flow.

POTENTIOMETERS (VARIABLE RESISTORS)
There are also neat things such as variable resistors (called potentiometers) that can change resistance at your will. Quite often you can change the resistance by simply turning a dial. A great way for experimenters to tweak, no? Most robot sensors are actually resistors that change resistance based on some environmental effect.
Photoresistors are perfect examples. A change in resistance changes the current crossing the sensor. A change in current causes a change in voltage - voltage is what computers measure to detect the environment.

So how can you use resistors for you robot? Well LED's require resistors in series or they burn out. Voltage Amplifiers will need them. Almost every circuit you build will require them for some particular reason. Even if you do not put a resistor in the circuit, theoretically your circuit will still have resistance as all wires carry resistance.

How do capicitors charge over time? This Capacitor Charge Curve Chart should help. The discharge rate would be the direct inverse. Theoretically (as made obvious by the graph) a capacitor can never be fully charged or discharged, but in reality this is never the case.

So how can you use capacitors in your robot?
Power surge/drainage management.
The problem with using robot components that drain a large amount of power is sometimes your battery cannot handle the high drain rate. Motors and servos being perfect examples. This would cause a system wide voltage drop, often reseting your microcontroller, or at least causing it to not work properly. Just a side note, it is bad to use the same power source for both your control circuitry and your motors. So don't do it.

Capacitors can also be used to prevent power spikes that could potentially fry circuitry. Next to any on/off switch or anything that that could affect power suddenly should have a capacitor across it.

Capacitors can eliminate switch bouncing. When you flip a mechanical switch, the switch actually bounces several times within a microsecond range. Normally this is too small of a time for anyone to care (or even notice), but note that a microcontroller can take hundreds of readings in a single microsecond. So if your robot was counting the number of times a switch is flipped, a single flip can count as dozens. So how do you stop this? Use a small ceramic capacitor! Just experiment until you find the power capacitance value.

Capacitors can improve efficiency and longevity of electric motors up to 100%. Place a small ceramic capacitor of like 10uF across the two leads of your motor. This works really well with el-cheap-o motors. Not much effect with high-end expensive motors however. These capacitors will also signficantly reduce EMI (Electro Magnetic Interference) and system noise too.

MOSFETs
The operational theory required to use a MOSFET is not much different from a simple mechanical on/off switch. But instead of flipping a switch, you apply a binary signal to it straight from your
microcontroller. Apply a 0 (for zero volts) to the Gate (or Base) and it is turned off, apply a 1 (for usually 5V or more) and it is turned on. It is somewhat like a water spicket. By turning a small valve, you can control huge flows of water through a pipe.

If a Transistor is turned on, current will flow from the Collector to the Emitter. If the MOSFET is turned on, current will flow from the Drain to the Source. Yes, the names are counter intuitive. What makes transistors more complex is that Collector to Emitter current is not just dependent on Base voltage but also on Base current. All quite complicated . . . then you got Darlington Pairs which are just crazy and stuff . . . MOSFET's are just simple on and off. There is however MOSFETS designed for various applications. But usually a PWM optimized MOSFET would be what you want.

Another note on MOSFETS, they are more efficient with higher Gate voltages. So you probably do not want to just apply a simple binary 5V. Instead you should amplify it with say an operational amplifier or even better, a MOSFET Driver IC. All are quite cheap and easy to implement. I highly recommend amplifying the Gate voltage because it would save on battery power, and significantly reduce overheating. Which reminds me of another point . . .

DONT FORGET TO PUT A HEAT SINK ON ALL POWER MOSFETS!!!!!!!
They heat up pretty quick and burn you when you touch them. A typical MOSFET is rated for about 300F, but its quite easy for them to reach that temperature.

So what can you use a transistor for? Well it is required for an H-Bridge. Also, the concept works for Photoresistors and DC Motor Braking.

------------------------------------