# Basic electronics theory

This is a short tutorial from a series of small tutorials on basic electronics for robotics.  Basically it covers the basics you need to know to start learning robotics. I am not covering topics usually covered in the usual beginner textbooks for example the atom, charge, electric fields, electrostatics etc

To have a basic electronic circuit we need to have a power source usually a battery, a path i.e. the wires and a load i.e. a motor, bulb etc.

For mobile robots and mains power for stationary such as industrial robots. Imagine the power source as the beginning of the electricity and the end of its journey.  The electricity starts its journey from the positive of the battery passes through a path do it’s job for example light a bulb, or turn a motor and return to the negative of the battery.  I recommend to read the admin tutorial on batteries because it is very informative.

This is bit theoretic but assume that electricity needs a force in order to flow from the positive to negative.  This force is called voltage and is measured in volts (V). I suppose you have heard of 9 volts batteries and 115/230 volt main electricity.  By nature voltage creates a force when applied to a load through a path it forces the particles of that path to move or flow, this flow of particles of better the electrons is called the current which is measured in amps (A).  The more the voltage the more the current, and this fact is known as ohms law which states that current passing through a path (conductor) is directly proportional to the voltage applied. Which mean that doubling the voltage will double the current and reducing the voltage will reduce the current. Skipping mathematics we know that voltage is directly proportional to current, to form an equation we need a constant and this constant is called resistance which Is measured in Ohms , this is the opposition to current thus we can conclude that voltage is equal to current x resistance or V=IR.

Another rule called Kirchhoff’s voltage law tells us that all voltage must be distributed among the load thus if we have two identical loads and applied a 10 V voltage we except to have a 5V on each load.

Kirchhoff also told use that if the circuit has one path the current is the same everywhere in the circuit

An example we have a 9 volt battery and connected to it is a heating element (which is basically a resistance) of 9 ohms we can re arrange the formula to find the current.  So Current = V/R = 9/9 = 1 Amp

Another useful example is to calculate the resistor that is needed for an L.E.D.  We know that L.E.Ds for some reason do not obey ohms law and usually have a voltage drop of around 2V and can sustain a current of 0.02 A or 20mA..  We now these facts, that all the voltage must be dropped thus if the L.E.D drops 2 volts and we applied 9v we know that the resistor has 7 volts applied on it, we also know that in a series circuit the current is equal everywhere in the circuit    thus if we want a current of 20mA to flow in the circuit.  We know that resistor obey ohms law thus the current flowing through it is (9-2)/0.02 = 350 ohms. Thus if we connect a 350 ohm resistor to an LED with a 9v battery we know that the current flowing through the LED is 20mA which is a safe current for an LED to operate.

AttachmentSize
diagram 1.png59.69 KB

# Theory of digital and analog signals (basic)

To start this topic we should know the basic definition of a sensor, a sensor is a device that converts real world quantities such as temperature and light into electrical signals, these signals can be either analog or digital. A signal is an electrical quantity such as voltage that changes over time.

Just for teaching purpose we can assume we are using 5 volt supply, this is just an arbitrary value and nothing special about it, so the voltage cannot get higher than 5.  An analog signal can take any value between 0 and 5 so 0.00000002, 4.998, 3.51, 1.56, 0.5 are all valid values, assuming we are reading temperature, the temperature is no just 32 C/F but in reality it is 32.something. So analog signal are precise but unfortunately computers cannot process any value but only discreet values call digital signals

Digital signals have definite values. Assuming this signal has a “resolution” of 5 volts we would only have 5 values, 0,1,2,3,4,5. It cannot recognize nothing in between.  So 4.5V is an invalid value.  An example would be a stairs,  If you a have a floor 3  meters  (about 11 feet) high and we  have 20 steps (resolution) you could only go up by 15 cm at a time so you can be 30 cm off the ground buy it is impossible to stand 50 cm of the ground because a digital signal can only hold discreet steps.  Digital is the only way we can talk to a computer or microprocessor.

A graph of analog (black) versus digital (yellow) is found attached

AttachmentSize
analog vs digital.png37.2 KB