Wikijunior:Raspberry Pi/Introduction to Electronics

What is electricity?

edit
 
Solar panels convert light into electricity.

Electricity is energy

edit

Electricity is one form of energy and most energy originates from the sun.

The law of conservation of energy states that that energy can neither be created nor destroyed; rather, it can only be transformed or transferred from one form to another. Such as:

  • sunlight to electricity – solar panels
  • sunlight to heat energy – solar furnace
  • chemical energy to electricity – batteries

Conductors and insulators

edit

Conductors

edit

Conductors are materials that allow electricity to flow through them easily. Electrons are tiny particles that orbit around the nucleus of an atom. In conductors, the electrons are loosely bound to the nucleus and can move freely. This means that when an electric current is applied to a conductor, the electrons can flow in the direction of the current.

Some examples of conductors include:

  • Metals such as copper, gold and aluminium
  • Water and other liquids that contain ions (charged atoms)
  • Graphite, a form of carbon

Conductors are used in many different ways, including:

  • To make electrical wires and cables
  • To make parts for electrical devices, such as appliances and computers
  • To make heating elements, such as those used in stoves and hair dryers

Insulators

edit

Insulators are materials that do not allow electricity to flow through them easily. Electrons in insulators are tightly bound to the nucleus and cannot move freely. This means that when an electric current is applied to an insulator, the electrons cannot flow and the current is blocked.

Some examples of insulators include:

  • Plastic
  • Rubber
  • Glass
  • Wood
  • Air

Insulators are used in many different ways, including:

  • To coat electrical wires and cables to prevent electricity from leaking out
  • To make electrical insulators, such as those used in power lines and electrical outlets
  • To make thermal insulators, such as those used in homes and buildings to keep heat in during the winter and out during the summer

Semi-conductors

edit

Semi-conductors are materials that have properties that fall somewhere between conductors and insulators. Their electrical conductivity can be controlled by adding impurities or by applying an electric field.

Semi-conductors are used in many different electronic devices, such as transistors, diodes, and integrated circuits. These devices are used in computers, smartphones, and other electronic devices.

Conductors vs. Insulators

edit

Imagine that conductors are like motorways and insulators are like country roads. Electrons are like cars. On a motorway, cars can travel quickly and easily. On a country road, cars have to go slower and more carefully.

In a conductor, the electrons can move freely, like cars on a motorway. With insulators the electrons cannot move freely like cars on a country road.

Current, Voltage, Resistance and Power

edit

There are 4 main units for measuring electricity. Each unit is named after a scientist who made significant discoveries related to it.

TypeSI UnitDiscovererDescription
CurrentAmp (A)
 
André-Marie Ampère
The current is the flow of electrons.
VoltageVolt (V)
 
Alessandro Volta
The voltage is the force that pushes the electrons.
ResistanceOhm (Ω)
 
Georg Ohm
The resistance is the force that reduces the current.
PowerWatt (W)
 
James Watt
The power is the energy consumption over a period of time.

Water flowing through a pipe:

  • Voltage is like the water pressure in a pipe. The higher the voltage, the more water will flow through the pipe.
  • Resistance is like the width of the pipe. The narrower the pipe, the less water will flow through it.
  • Current is like the amount of water flowing through the pipe. The more current, the more water is flowing through the pipe.
  • Power is like the amount of work that is being done by the water. The higher the power, the more work is being done.

Ohm's law

edit
 

Ohm's law states that the current (measured in Amps) is proportional (this means there is a consistent ratio) to the voltage (measured in Volts). From there, it is possible to calculate the resistance (measured in Ohms).

  • Voltage = Current × Resistance
  • Current = Voltage ÷ Resistance
  • Resistance = Voltage ÷ Current

Finding the current, voltage or resistance is easy. Just cover which of the three you are looking for with your hand! 🤚

Toy car example

edit
 
 

For example: ×2 AA batteries (which provide 1.5 Volts each) power a toy car. The voltage of the battery is 3 Volts, the resistance of the toy car's motor is about 1 Ohm, and the current is about 3 Amps.

  • The actual current and resistance of the toy car's motor may vary depending on the specific motor.
  • The voltage of the batteries will decrease as they discharge. This means that the current will also decrease as the batteries discharge – this will make the car drive more slowly over time.
  • The toy car's motor will draw more current if it is moving faster. This is because the resistance of the motor will decrease as it heats up.

SI prefixes

edit

Many of the units we use are defined and standardised by the Systems International (SI) institution in France including the Amp, the Volt and the Ohm.

The SI prefixes should be familiar as we use them every day for units such as the metre (m) and the gram (g). This prevents us from writing out a lot of zeros. Each prefix multiplies the unit (the capital letter prefixes) or divides the unit (the lowercase prefixes).

PrefixesValueStandard FormSymbol
Tera1 000 000 000 0001012T
Giga1 000 000 000109G
Mega1 000 000106M
Kilo1 000103K
deci0.110-1d
centi0.0110-2c
milli0.00110-3m
micro0.000 00110-6μ
nano0.000 000 00110-9n
pico0.000 000 000 00110-12p

The Greek letter mu (μ) is used for micro. You may be familiar with a kilogram (1000 grams) or centimetre (0.01 metres).

Electronic components

edit

Most of these components can be purchased inexpensively from hobbyist stores, eBay sellers or electronic component wholesalers such as RS Components and Farnell.

Breadboard

edit
 
 

A breadboard is used to build and test electronic circuits without having to solder the components in place. They are reusable, and the components are also reusable after being used on a breadboard.

All the vertical lines (usually lettered A–E and F–J) are connected in columns. So electricity going into point 1A also arrives at 1B, 1C, 1D and 1E. But there are no connections across rows – so electricity going into point 1A does not arrive at 2A, 3A and so on.

Some breadboards also have extra rows at the top or bottom which are connected vertically, used for positive and negative. We are not using that type of breadboard, and if you are using one then ignore the rows at the top and bottom of your board. Sometimes, these rows are marked with plus + and minus − or are coloured red and blue.

Capacitor

edit

A capacitor stores a small amount of electric charge, then when it is full it lets all the charge go.

  • If you connect it to a strong charge, it lets the charge go faster.
  • If you connect it to a weak charge, it takes longer to let the charge go.

The capacitor has a short and a long leg, and a stripe on one side. Like LEDs, they must be connected with the short leg and stripe to negative (ground).

DuPont jumper wire

edit
 

A DuPont jumper wire is used to connect components to a breadboard and is compatible with the Raspberry Pi's GPIO pins.

The colours of the jumper wires don't matter, though it's recommended to use black for ground.

Light-emitting diode (LED)

edit
 
 

A light-emitting diode (LED) emits light and is programmable meaning you can control them using software such as the GPIO on a Raspberry Pi. They also have other benefits:

  • they are much more energy efficient
  • they don't need to heat up first to produce light and most LEDs produce only a very small amount of heat
  • they are individually smaller than other lightbulbs
  • they are available in a wide variety of colours

Lower value (lower Ohm) resistors will allow more current through and will make the LED brighter; higher values will let less current through and make it dimmer.

Switch

edit

A switch completes the circuit by allowing electricity to flow while it is pressed down. When released, the electricity stops.

There are three types of switches:

  1. A momentary switch requires something to continually press it down.
  2. A toggle switch is held down once pressed and requires something to unpress it.
  3. A reed switch is a glass tube with two bits of metal separated by a tiny gap. When there is a magnet nearby, the two bits of metal touch and allow electricity through. Be very gentle and careful with reed switches because the glass can break easily.

Photocell

edit

A photocell or photoresistor, is a type of variable resistor which provides a different amount of resistance depending on how much light it detects. They let through more current when there is more light.

Piezo buzzer

edit

A piezo buzzer makes a beep when electricity goes through it. It has two "leg" connectors; one long and one short. The long leg must be connected to positive, and the short leg must be connected to ground (negative).

Resistor

edit
 
Above: American symbol

Below: IEC symbol (common in the UK)

A resistor is a simple coil of wire that reduces the current in a circuit, for this reason, it can wired to a circuit any way around without breaking. Resistance itself is measured in Ohms (using the Greek letter Omega Ω) and the coloured bands on each resistor indicate how much resistance each resistor is capable of adding to a circuit.

You may recognise the symbol for a resistor used in circuit diagrams:

  • The American symbol for a resistor is a zig-zag shape representing a coil of wire.
  • The IEC symbol for a resistor is just a rectangular box, often the resistance is written inside of it. IEC symbols are a British Standard which is used throughout the United Kingdom.

Resistor colour bands

edit

The colour bands on each resistor show exactly how much resistance it can provide. This includes tolerance which is good to know in case there is an unexpected change in the current.

 
Exercise: Can you find the resistance of this resistor?

The band colours are yellow, violet, red and gold.

 

  • 1st Band – the first significant figure of component value (left side).
  • 2nd Band – the second significant figure (some precision resistors have a third significant figure, and thus five bands).
  • Multiplier – the number of trailing zeroes, or power of 10 multipliers.
  • Tolerance – if present, indicates the value in percent (no band means 20%).

The example resistor above has red, violet, green and gold colour band rings. Let's find out how much resistance it can provide:

  • 1st Band – Red = 2
  • 2nd Band – Violet = 7
  • Multiplier – Green = ×100000 (×105)
  • Tolerance – Gold = ±5%

By referring to the table below we can see that the amount of resistance provided by this resistor is 2700000 Ohms or 2.7 MegaOhms (MΩ) with a tolerance of ±5%.

ColourCodeSignificant FigureMultiplierTolerance
None---±20%
PinkPN-×0.001 (×10−3)-
SilverSR-×0.01 (×10−2)±10%
GoldGD-×0.1 (×10−1)±5%
BlackBK0×1 (×100)-
BrownBN1×10 (×101)±1%
RedRD2×100 (×102)±2%
OrangeOG3×1000 (×103)±0.05%
YellowYE4×10000 (×104)±0.02%
GreenGN5×100000 (×105)±0.5%
BlueBL6×1000000 (×106)±0.25%
VioletVT7×10000000 (×107)±0.1%
GreyGY8×100000000 (×108)±0.01%
WhiteWH9×1000000000 (×109)-

This resistor colour code table has been simplified from the Electronic colour code article on Wikipedia.

Raspberry Pi's General Purpose Input Output (GPIO) pins

edit
 

Each Raspberry Pi model has a series of 40 pins that are referred to as General Purpose Input Output (GPIO) pins. GPIO pins can be used to power and control electronic components.

  • Board numbering – just starts from the bottom-left at 1, and works its way up and right, through to 40.
  • BCM numbering (Broadcom numbering) – is the way the Raspberry Pi's processor sees the pin connections.

You can run the pinout command in the   Terminal program on your Raspberry Pi for information about the GPIO pins (as well as the hardware specification of the particular Raspberry Pi model). Also, for more information see: https://pinout.xyz/pinout/pin40_gpio21/

Cotswold Jam also provided an A4 printout of GPIO pin references that you can put next to your Raspberry Pi: Paper-gpio-ruler.pdf

Further reading

edit

The books are recommended for further reading on the Raspberry Pi and for learning electronics as a whole.

Bibliography

edit
TitleAuthorYearISBN
Adventures in Raspberry PiCarrie Philbin2014978-1-11-899753-6
Practical Electronics for GCSEMichael McLoughlin1989978-0-09-173044-4
Practical Electronics: Complete IntroductionAndy Cooper, Malcolm Plant2016978-1-47-361407-1
Electronics for DummiesDickon Ross, Cathleen Shamieh, Gordon McComb2010978-0-47-068178-7
Raspberry Pi CookbookSimon Monk2014978-1-449-36522-6
edit

How Semiconductors Work

edit

This tutorial includes Diodes, LEDs and Transistors, gets Techy.

  1. http://engineering.nyu.edu/gk12/amps-cbri/pdf/Basic%20Electronics.pdf

Distance Learning – Tutorials

edit
  1. http://www.instructables.com/id/Basic-Electronics/
  2. http://www.electronics-tutorials.ws/
  3. http://www.electronics-tutorials.com/index.htm

Wikibooks

edit

Wikibooks has its own book on Electronics which goes into a lot more detail than this book does.