Behavior, Content, Money – 3 Things you should never give away for free!!!

BCmoney MobileTV

Raspberry PI 2 – Hardware kit unboxing & first circuit LED experiments

Posted by bcmoney on July 24, 2016 in IoT with No Comments


No Gravatar
English: Logical 4-bits adder where sums and l...

Logical 4-bits adder where sums are linked to LEDs on a breadboard. (Photo credit: Wikipedia)

Hard to believe its been over 6 months since I finally decided to buy into the IoT hype train and pick up my own Raspberry PI, to try my hand at creating some useful IoT-ish experiments of my own. I’d like to say its been interesting just tinkering around and seeing what the possibilities are, but thus far I’ve really only been scratching the surface and playing around mostly with the software and on-board peripherals side of the PI’s capabilities, which is really only half of its true potential.

One of the biggest strengths of the Raspberry PI and similar “open hardware” Microprocessor platforms (Arduino, BeagleBoard, etc) is that they enable you to connect what is essentially a “cheap but fully-funtional computer” to the broader physical world. In the Raspberry PI’s architecture, this takes the form of the GPIO expansion slot, which stands for General Purpose Input Output and as the name suggests, provides a number of raw inputs/outputs to be used by ambient sensors (temperature, pressure, air, water, motion, etc) in the more complex use-cases and basic indicators like lights (LEDs), speakers, etc in the more straightforward use-cases.

If you are like me, coming from a predominantly software-based development background, and as we are in the software world often far removed from the “nuts and bolts” of the systems we build thanks to high-level programming languages, levels of abstraction and working mostly in the “application layer” of the OSGI stack; then even setting up the basic use-cases with a blinking light can seem a little daunting at first. This is compounded by the stories online of people who admit they really didn’t know what they were doing (and sometimes even of those who did) and managed to make a little mistake somewhere which resultied in frying their entire PI due to incorrectly wired circuits, overloading with incorrect power supplies/balances, or in some cases even static electricity introduced by an improper work surface not properly grounded.

To help anyone in a similar situation I will attempt to share the few things I’ve picked up in the first few weeks of owning a hardware kit for my Raspberry PI, and some experiments/resources that can come in handy for learning to teach yourself, which is arguably the most important skill of all.

 

CanaKit Breakout Board bundle

This “CanaKit Breakout Board” bundle is what you would get if you just pony up the additional $10-20 USD and get the Ultimate PI kit rather than Starter Kit (which omits these extra components):

  • CanaKit GPIO to Breadboard Interface Board (40 Pin T-Shaped)
  • GPIO Ribbon Cable
  • Breadboard
  • RGB LED
  • 32 x Jumper Wires
  • 2 x Red LEDs
  • 2 x Green LEDs
  • 2 x Yellow LEDs
  • 2 x Blue LEDs
  • 2 x Push Button Switches
  • 10 x 220 Ohm Resistors
  • 5 x 10K Ohm Resistors

It also includes printouts of a couple key guides which are available freely online:

The internals of the Breadboard are laid out like this:

The +/- Columns in A & D are the “power rails” and the electricity going into them runs the length of the entire column. Rows shown in B & C are “connector rails” that have any electricity coming in run the length of their entire row (but insulated from rows above, below, or beside).

Connecting power source to the Breadboard

The best approach is to take it slow, rather than jumping right in by connecting the Raspberry PI until you’ve gotten comfortable enough with the electronics. First try connecting together a basic circuit totally independently of the RaspberryPI, such as by attaching two 1.5 volt AA or AAA batteries (or a 9 volt battery) but be sure to check the Ohms of your resistors to ensure they can handle the voltage.

In getting up to speed and to get a refresher to my lone Digital Systems “applied/electrical engineering” type of course I got to take in my Computer Science bachelor degree, I sifted through a ton of videos on YouTube, Vimeo, etc as well as tutorials on the web. This set of videos were the best I could find on Breadboards and should help you to understand the basics of creating circuits, controlling the circuit via switches, reading inputs and sending outputs, proper power supply/resistor balance and avoiding short-circuits:

Just do yourself a favor and actually watch those before experimenting too much with the electronics (unless you’ve got an Applied Engineering degree or are already a licensed Electrician)!

To re-iterate a little hint I gave earlier, the important take-away from the above is that each jumper point with a line in between it will be bridged, meaning that everything you place along the same bridge will be connected. Thus your power rails will be along the edges, then all your other pins should go along the length of the board in the middle (as well as some extra for more components and ICs which you’ll see labelled in the breakout board when it come time to actually connect the Breadboard to the PI).

 

Experiment #1 – LED lights up
The first experiment my son and I did (he really enjoyed seeing something happen in the real-world when he just connected the wires, or “pushed a button”, and of course, for safety’s sake I always tested the experiments myself before I let him touch it) is depicted below:

LED Always On

Its really just the simplest possible light circuit, however you can see how I as a beginner still managed to mess up the typical color-coding one would use for the wiring, for example the power rails should always be Red for positive (+) charge, Black or Blue for negative (-) charge. I also didn’t know that using a jumper wire for every little connection point was not required and that resistors could go directly to the negatively charged power source column. Lastly I’m not sure if using a 9 volt battery is a good idea when using only 220 ohm resistors because it seemed they were advising to use the 3.3 volt power supply pin on the GPIO when hooking this basic example to the Raspberry PI via GPIO.

Experiment #2 – Multiple LEDs all lit up

The same thing as the above, but my son wanted to see how to hook up multiple lights on the board. Its a little half-size board though so our space is somewhat limited:

Multiple LEDs, always on

Both experiments 1-2 are examples of a Normally Closed (NC) or “always on” circuit.


Experiment #3 – LED Push button

This is like the first experiment but adds in a Push Button component as the “controller” for whether or not the light should be on:

Single LED with Push Button – OFF

Single LED with Push Button – ON

The press of the button closes the open circuit allowing electricity to flow through to the LED rather than dissipate off to the “ground”.


Experiment #4 – Multiple LED Push button

This is like the second experiment but again simply adds in a single Push Button component to the Multiple LEDs as the “controller” for whether or not the light should be on:

Mutiple LED Push Button (OFF)

Multiple LED Push Button (ON)

Both experiments 3-4 are examples of a Normally Open (NO) or “always off” circuit.

 

Conclusion
At first I tried both AAA and then AA batteries (which are 1.5 volt each) but got no light, so it seems the LED would need 3 volts minimum. Sure enough I later found lots of tutorials of people using a battery pack that holds two AA or AAA batteries getting lights fine on the Breadboard, which I don’t have right now (and don’t feel like cobbling something together by taking apart some other electronic device… although I’m certain there’s an easy way to just wire the batteries together without a proper cap/case). I would highly advise you (and I will as well) do the math or use some kind of Ohm’s Law Calculator tool to figure this out properly going forward, but seems like the 9v setup is sending 4.5 ohms through the LED circuit which is likely not enough to blow it because I believe the ones I received support up to 5 ohms based on the documenation provided.

After a good bit of time tinkering safely with the Breadboard by itself, I’m starting to definitely get the hang of this stuff, but I’m glad I didn’t do something stupid like fry my PI (surely I would have hah, I always seem to learn the hard way). Most importantly, I’m really starting to see the appeal of the platform and the potential it holds to connect to just about anything.

Leave a Reply

No trackbacks yet.

No post with similar tags yet.

Posts in similar categories

BC$ = Behavior, Content, Money

The goal of the BC$ project is to raise awareness and make changes with respect to the three pillars of information freedom - Behavior (pursuit of interests and passions), Content (sharing/exchanging ideas in various formats), Money (fairness and accessibility) - bringing to light the fact that:

1. We regularly hand over our browser histories, search histories and daily online activities to companies that want our money, or, to benefit from our use of their services with lucrative ad deals or sales of personal information.

2. We create and/or consume interesting content on their services, but we aren't adequately rewarded for our creative efforts or loyalty.

3. We pay money to be connected online (and possibly also over mobile), yet we lose both time and money by allowing companies to market to us with unsolicited advertisements, irrelevant product offers and unfairly structured service pricing plans.

  • Archives