Electricity is the flow of energy (in the form of electrons), through conductive materials like metal.
The three most important properties of electric circuits are Voltage (V), Current (I), and Resistance (R).
It’s sometimes quite useful to compare electronic circuits to water being pumped through a piping system, as in the diagram below (from the hyperphysics website, a super useful resource for all things science!):
In this comparison, Voltage (V) is like the pressure generated by the pump, it tells us how much energy the battery can give electrons to do their stuff with.
Current (I) is like the flow of water through the pipes, it tells us how many electrons are passing through the circuit every second (the more electrons, the more powerful!).
Resistance (R) is like a measure of how difficult it is for the water to get through the pipe system - If the pipes are small then the resistance is high (and so the current is low, because less water can get through every second).
The mathematical relationship between these properties is:
V = IR
Which is called Ohm’s law. What’s helpful to know to understand this is that Voltage is normally fixed (it’s written on the side of the battery), Resistance depends on the electronic components you’re using (lamps, switches, motors), and then you can calculate the amount of current using Ohm’s law!
Another look at the contact switch
Last week, we had a quick look at how to make a physical contact switch to control S4A and the Arduino. Let’s have a look at the circuit again, and try and find out what’s really going on. First of all, here’s the S4A code you need to get it working with the on-board LED:
And here’s the circuit:
Circuit ON
The switch is ON when the input pin (which measures voltage) is connected directly to the 5V. Using our water-pipes comparison, our pump is connected directly to the device that measures the pressure being generated by it. There’s a resistor going off to some other part of the circuit, but it’s not really doing anything right now - it’s so large (i.e. it’s so difficult for the electricity to get through it, that it makes almost no difference to the Voltage measured.
Circuit OFF
The switch is OFF when the input pin is disconnected from the 5V. This is where our clever little the resistor comes in: If we were to disconnect the 5V without using this resistor, the electrons at the detector would have nowhere to go (imagine water stuck in a basin). What the resistor does is “drain off” those electrons (like opening a plug-hole in that basin), so that they can escape into the ground.