This guide shows how to build a simple circuit which is the equivalent to a 'hello world' program. It is part of #100DaysofHardware - A challenge, I pioneer to help other's like me to learn about electronics, microcontrollers and eventually IoT.
Everyone is welcomed to join the challenge! I'm available on twitter just approach me if you need any help along the way or just share your own progress under #100daysOfHardware.
Planning my deep-dive into electronics, did feel overwhelming to me, till I found a pathway to cut through the complexity. The result is this guide which let me start in very shallow water.
The beauty of this very first circuit is, is that everyone can complete it without any deeper understanding of electronics. It's very easy to reason about too. It consists only of three components:
- Power source (Battery or power adapter)
How to connect the components is the only this we need to find out today.
To start-off smoothly, I recommend to get an electronics starter kit. There is plenty of brands out there, any of them will do. It's most importantly that you get a bread board, a power source and a selection of basic electronic components and jumper wires.
While I got lost couple of times in the scientific depth of electronics theory, Here comes the parts which really matter for today's project:
In order to plug in the LED correctly, it is important to understand that electricity is basically just electrons flowing through a circuit from one terminal of the power source to the other.
The two terminal can be differentiated by their charge. One is always more positive than the other. Hence, the terminals are normally marked with a red plus and a black minus.
Many electronic components do only work when the current flows through them in the right direction. The LED, is one of them.
An LED comes with a two legs, one is longer than the other. This is the positive side of the LED, called the 'anode', while the shorter leg is the negative side, called the 'cathode'.
If you want to learn about LEDs in much more detail, I can recommend a great article. You find it in the resources below!
With this first basic learning about electronics, I was already able to setup 75% of this first circuit.
When you have your bread board in front of you is should look similar to the graphic here.
Make sure you connect the cathode (long legged side) of the LED with the positive rail of the bread board. If you want to understand better how a breadboard works, you find another link in the resources below.
As you see in the graphic, I use a standard 9V battery as a power source. Some start kits also ship with a power adapter. Those come with a variety of features which you should all ignore for now, it is only relevant how much Voltage it supplies. I have seen some with 3.3V and 5V. The reason, why it doesn't which power source you are using is the third component - the resistor.
My first instinct was to simply close the circuit with a regular wire, let the current flow - done.
Well, it's almost as easy as that. If you simply close the circuit with a wire, the LED is likely to blow up immediately, depending on the voltage of your power source.
This is because the LED couldn't withstand the voltage which comes straight from the power source. That's why need need to add the the resistor.
Now, we need to find out which resistor to put in place in order to protect the LED.
Therefore we use a simple mathematical formula, which is key to understand all this electronics basics - it is called "Ohm's Law".
R-resistor = (V-powerSource - V-led )/ I-led
To find out about the voltage and the current of the LED, I did have to look into the data sheet which was supplied by the starter kit brand as a pdf.
depending on your power source, and LED you will end up with a different value.
The resistance we are looking for measured in Ohm.
R = (9V - 4V) / 0.02A
R = 250 Ohm
For me, each learning was rising more questions, now it is all about how to find out how resistance a resistor has?
There is two methods to find out about it. You can measure it, if you have a multimeter or you can read the colored ribbons - they tell experienced makers the resistance. Since I had neither experience nor a multimeter, I simply tried out different resistors.
This is something, I can really recommend. As long as you are playing with simple circuits try out things. There is no expensive equipment you can break. Test theories you have read about, validate your mental model and break thing so you learn that details matter in electronics.
Guess what, LEDs to have a tolerance when it comes to voltage. If you pick a resistor with to little or to much resistance, it's not going up in smoke instantly. In case you accidentally pick an resistor with close to zero resistance your LED might goes up in smoke. But hey, that's a great experience to start learning more about picking the right resistor.
Complete today's project with a glowing LED!
To wrap up, we have successfully build our 'hello world' circuit. Thereby, we have learned about the electricity flow, how to wire an LED, about the capability of resistors to use of current within a circuit.
Try to plug-in the resistor before and after the LED. Both will work! That's confusing, isn't it? Can you find out why this is the case?
Was this guide helpful to you? Do you have questions? Talk to me on twitter to keep learning about electronics, microcontrollers and IoT.
And if you feel supportive, make sure to follow and support me on Twitter! Thank you! 🙏