Raspberry Pi is a small, cheap computer on a circuit board the size of a credit card. I spent a very interesting day in training today, learning how to use a Raspberry Pi with Python programming, creating small embedded systems and connecting to servers, with applications (in theory!) for the Internet of Things. Today a little red light, tomorrow the world!
World domination aside, it was the first time in years that I had built an electronic circuit, or done any microcontroller programming, so it was a very hands on day and a really fun change from my usual work.
The Kit
The Breadboard
For me, the first challenges to overcome were in using electronic components with a breadboard again. The breadboards we used were very much like this:
The breadboard (as I learned) connects up the components whose legs you stick into it along rows and columns, except where there is a groove separating different blocks (didn’t realise that part so that tripped me up at one point).
On one side of the Raspberry Pi, there is a set of numbered connector pins called GPIO (General Purpose Input / Output). Some of them have different electronic characteristics, and they are all numbered so that they can be matched up with port numbers when you’re programming.
At this point, things did start coming back to me, with some happy memories of an Open University course in Microprocessor-based computers, in the days when they sent out a programmable temperature measuring kit. That was C and Assembler, this was Python; that was temperatures, this was lighting; this was Raspberry Pi, and that was, umm, something else. But hey, 2 out of 3 isn’t bad!
Raspberry Pi and Python Projects
-
Turning a Red Light On and Off with Raspberry Pi and Python
-
Traffic Lights with Python and Raspberry Pi
We used our Raspberry Pi and breadboard to build and control a small circuit modelling traffic lights.
Here is a photo of the Raspberry Pi and circuit, showing the green light lit up:
Here’s another photo, that also includes the Python code and text output:
Traffic Lights: Video 1
Traffic Lights: Video 2, with Python code and text output
Links
(Full-size Breadboard. Spark Fun's images are CC-BY-2.0)
Leave a Reply