Connecting an Analog Joystick to the Raspberry Pi (and using it with an RGB LED to simulate a color wheel)

One of the coolest things about the Raspberry Pi is its GPIO pins. They’re just sitting there, waiting to be connected to all kinds of useful peripherals so your Pi can interact with the world around it. Power an LED to signal the user. Place a button in the path of a circuit and detect when a user presses it. Attach sensors to read temperature and humidity, and plug other cards like the Sense HAT over top of the pins. A few months ago, I got a set of 37 sensor modules on Amazon. I knew they wouldn’t »

Creating a Flickering Candle Using an RGB LED on the Raspberry Pi

After getting PWM (pulse-width modulation) to work with an RGB LED last week, I was trying to think of what else I could do with an LED that demonstrated changes in color as well as intensity. I’m not sure why – maybe it was because we lost power in our neighborhood recently – but I thought a flickering candle could be an interesting little challenge… Materials In order to test this out, you’ll need a few things. An RGB LED A button A breadboard A T-cobbler (optional, but makes life easier when wiring up to GPIO pins) A range of »

How to Use an RGB multicolor LED with Pulse Width Modulation (PWM) on the Raspberry Pi

If you buy a kit with random LEDs, wires, switches, etc, like this one I purchased from CanaKit, you’re likely to end up with one or two of those funky little LEDs that appears to be white, and has 4 wires instead of 2. I had set mine aside and made a mental note to figure it out later… well, I’m bored with regular LEDs so that time has come! It’s a special kind of LED that consists of 3 separate LEDs… red, green and blue. By adjusting each color independently, you can create any color (similar »

Creating a "Simon" Game Clone on the Raspberry Pi

Have you been around long enough to remember the popular Simon game from the 70s and 80s? There’ve been plenty of remakes over the years, but I had one of the originals when I was younger. It’s a game of patterns that tests your memory. It flashes a color and sounds a corresponding tone, which you repeat. Then it repeats the same color/tone and adds a new one. The pattern keeps getting longer and longer. Technically, it could go on forever, but I think you “won” after 20 or 30 colors… not that I ever got close! »

Creating Music with Sonic Pi on the Raspberry Pi

Back in May, I was fortunate to attend the Stir Trek conference in Columbus OH (it sold out in under a minute). There were a lot of great presentations, but one that really stood out for me was one on Sonic Pi. Scott Fradkin live-coded Sonic Pi for nearly an hour, not only explaining what it was capable of, but showing us too. He kept building it up as the session went on, and everyone in the theatre had a chance to see and hear what he was creating. By the end of the session, he had a good beat »

How to Flash an LED on Your Raspberry Pi When You Get New Email

This week we’ll create an email notification system using the Raspberry Pi. The idea is to check for new email, and flash an LED when we get one. Connecting to Gmail The circuit will be extremely straight-forward, so let’s focus on the more difficult part first – connecting to an email service. We need to create a secure connection to our email provider, so we can find out when new mail arrives. Do a quick search, and you’ll likely find scripts like this one where you just connect with your username, password and a few other pieces of »

Generating Morse Code on the Raspberry Pi Using a Button on a Breadboard

Last time, I created a morse code generator. It took user input from the console, translated it into morse code, and blinked an LED to “transmit” the message. I decided to build on that a bit, adding a button to the circuit that allows me to generate morse code from a button click. The clicks are read in by a GPIO pin, and interpreted by a Python script. Defining the Rules We should always figure out what a program is going to do before we start writing it, so here are a few rules to guide us: Dots and dashes »

Building a Morse Code Transmitter on a Raspberry Pi

Last week, I made the Raspberry Pi blink an LED a few times. As thrilling as that was ;) I almost immediately wanted something more. Note: Source code for this project is available on GitHub. Goals Setup a simple circuit (LED and resistor) using a breadboard Learn about Morse Code in order to correctly translate a sentence Manipulate the GPIO pins on the Raspberry Pi to send signals at intervals Get familiar with basic Python constructs, like dictionaries, functions and loops Setup To do this, a few things are necessary: Install Raspbian on the Pi (comes with Python 3 preinstalled) Get »