In the beginning…
As a budding electronic engineer, where should you start? This might be a question with many correct answers, but I decided to start with a simple single LED circuit. I bought the following equipment to get me started (all from Oomlout):
I knew there would be a learning curve with this, so I figured a multimeter is an essential bit of kit. After all, you wouldn’t get far attempting to write software without using a debugger.
When I received the delivery I immediately realised I’d forgotten to buy some essential kit – female to male jumper wires, in order to breakout from the Raspberry Pi GPIO to the breadboard. Luckily I remembered I had some old IDE cables lying around which I used as a stand-in replacement. As the cable supports 40 pins, and the Raspberry Pi only has 26 pins, some of it hung over the end of the board (notice I haven’t actually pressed the cable down properly in the following shot).
Once the IDE cable was connected I was able to use the male-to-male jumper wires to breakout onto the breadboard. This was a bit tricky and took a bit of trial and error to get the correct pins connected. I used the multimeter to make sure I was connected to 3.3V and ground pins. Following this I connected up one of the LEDs and the associated 270 ohm resistor. Here’s the first circuit:
Any seasoned electronic engineer reading this may already have spotted a problem – but I was stumped, why wasn’t the LED lighting up?! It turns out that you can’t blindly use any resistor you like, even if they were shipped with the LEDs.
Use the science!
After a little bit of Googling around, I got re-acquainted with an A-Level physics formula which had fallen out of my memory.
V = IR
[Where V = Voltage, I = Amperage, and R = Resistance]
It’s important to note that V refers to the voltage differential, meaning the source voltage minus the device voltage (i.e. source voltage – LED voltage). This means I need to find out the specifications of the LEDs I’ve purchased and plug them into the above calculation. Luckily Oomlout provide the specifications for the LEDs on the purchase page.
Red - 20mA@2.0V (max 2.5V)
Green - 20mA@3.2V (max 3.6V)
Blue - 20mA@3.0V (max 3.6V)
White - 20mA@3.0V (max 3.4V)
If we plug the values for the red LED into Ohm’s law, we will see the that the 270 ohm resistor is overkill for the Raspberry Pi’s GPIO pins (we use the red LED because it has the lowest power requirements, therefore the largest required resistance).
R = V ÷ I
R = (3.3 – 2.0) ÷ 0.02
R = 65 ohms
This confirms that you will need a set of resistors with much lower resistance than the ones provided with the LEDs. Time to break open the wallet again!