I recently picked up the new SparkFun LED Array – 8×7 to try out some hardcore charlieplexing, and so far it’s been working great.

Quoting Wikipedia, charlieplexing is

“…a technique for driving a multiplexed display in which relatively few I/O pins on a microcontroller are used to drive an array of LEDs. The method uses the tri-state logic capabilities of microcontrollers in order to gain efficiency over traditional multiplexing.”

Charlieplexing itself is a simple idea and can be an extremely efficient way of making an LED grid. However, laying out the wiring of a charlieplexed grid, whether on a breadboard or a PCB, can be complicated and require a bit of thinking. It’s easy to layout a grid with 12 or 20 LEDs, but once you start trying to make grids with 30 or more LEDs, it gets a little crazy.

I love SparkFun’s 8×7 LED Array because it eliminates the need to go through the long process of designing and wiring together the grid. Plus it’s in a neat compact module that can be easily embedded. Out of the box, all I had to do was solder on headers and plug it directly into the digital pins on my Arduino. I didn’t need to wire any external resistors, as they’re already built into the board.

SparkFun has made an Arduinolibrary for controlling the array that allows you to easily write text and draw shapes and do other interesting things on the grid. However, I wanted to use my array with my Raspberry Pi’s GPIO for the purpose of making an archaic internet-connected game system. I’ve written a single-file class in Python 3 for controlling the array with the Raspberry Pi’s GPIO, called pythonic-charlie, and you can find it here (my first legit GitHub repo! Woot woot!). It’s still under development, and still has bugs that need smoothing, but it allows you to display a list of coordinates, test the grid to verify that it’s wired properly, and display a neat little screensaver. I’m currently working on something that will display text.

If you ever wanted to learn how to charlieplex LEDs, SparkFun’s 8×7 LED Array is a really great place to start.

Here’s the perfect amateur maker project: a self-built giant seven-segment display that will awe all those who watch it in action! You only need a Raspberry Pi and a handful of regular LEDs and resistors, plus a breadboard. You can 3D print a case or you can use a paper template printout of the display. This project is versatile, I’ve provided Python 3 code for the Raspberry Pi, but you could use anything like an Arduino Mega or Beaglebone, you’ll just have to write your own software. Why, you ask, couldn’t I just use a standard 3 cm $0.99 seven-segment display? Because you can’t DIY and it’s not half as cool!

BoM (Bill of Materials):

3D printed seven-segment display case with seven segments OR if you don’t have a 3D printer, this paper printout here (I recommend cardstock or similar for opacity and durability) with a standard paper holepunch

Assorted wires and jumper wires

Small piezo buzzer (completely optional, just if you want countdown sound effects)

The wiring with the 3D printed segments in placeThe bare-bones wiring display

Steps:

The first step is to properly position the LEDs and their power and ground connections. Start by putting the Adafruit T-Cobbler to the far right side of the breadboard, all the in the last set of holes.

Next, we’ll wire each segment one by one. Refer to the diagram below, just starting with the LEDs and their resistors to ground; in the next step we’ll add the jumpers to the pins. The center three segments require a bit of maneuvering to get the resistors and jumpers into place. Make sure not to clip the resistor leads too short, and it may be helpful to use some needle-nosed pliers to get the resistors in place without ripping up other LEDs.

Finishing up the LEDs and their resistors to ground, now we can wire each LED to a pin on the Raspberry Pi. You can either copy the wiring shown here, or you can make up your own wiring. If you do your own pin wiring, make sure you keep careful track of which pin is part of which segment, either on paper in some working code variables.

Optional step: If you want to add a small piezo buzzer for countdown sound effects, now’s the time. Connect it to pin 21 and span it directly to the ground rail. Or, if you did your own pin-numbering connect it to any free pin.

Now for a bit of wire management: make sure all your jumper wires are underneath the LEDs so that they don’t get in the way of the segments and casing.

If you have a 3D printer: Print the casing and seven segments from here. Test fit each hole in each segment with an LED to make sure an LED fits. Put a segment over each set of three LEDs, and fit the casing over all the segments. You’ll have to bend the LED leads a bit so it fits, and the first time you put the casing on will be a bit of challenge.

If you don’t have a 3D printer: Print this seven-segment cutouthere. Cut it out on the dotted lines and then holepunch each symbol. Now fit the cutout over the LEDs. Note that it’ll be a bit tough to fit it over the LEDs the first time; you’ll likely have to bend the LED leads quite a bit to get it to work.

The hardware is all finished! At this point the display should be making you giddy with happiness, but it’ll be even better once it’s got some software! Warm up your Raspberry Pi and open up your favorite text editor to write some Python code!

Check out the code here. It’s got lots of comments that explain how the code works. Make sure if you wired your pins differently, you change the variables to reflect your wiring. When you get the code running you’ll be able to display numbers, do a 9-0 countdown, and do some cool animations!

Troubleshooting: if some of your LEDs aren’t working double check they could be burned out. Replace them and if they still don’t work check your connections to the pins. Finally, check your variable assignments; one error can make the whole display act strangely.

Now you’ve got a working XL seven-segment display, with five GPIO pins to spare! Now you can stare at the mesmerizing numbers all day…

The Origins of This Project Plus Future Developments

I was inspired to make this after seeing some 3D printable large seven-segment displays on Thingiverse. Because my Printrbot Play 3D printer has such a small build dimension, I designed my own, slightly smaller display and got to work with my Raspberry Pi. I made the display small enough that you can simply use a breadboard, which makes it different from other large seven-segment displays.

There is plenty of room in the back of the 3D printed case so that you can make a custom PCB if you like (I won’t attempt that now; I still have to develop my terrible soldering skills!), and there’s screw holes so you can also mount it to something. I’m currently working on a charlieplexing solution to reduce the pins used for the display from 21 down to 6. That way I’ll be able to use an Arduino Uno, add another display (another display would add a whole lot of potential), or add more components.

There’s a large number of different cloud based coding related websites and apps out there that can help make it easier to write, share, and run your code. Here’s a short list of websites and free software that I would recommend!

Codeshare – Codeshare is a cloud based site that allows you to share your code easily through a link. It’s also neat because it will update every time you change the code, so you can share in real-time without hassle. It’s also fun to change the syntactical highlight color scheme. I use Codeshare to share my Python code!

Enthought Canopy– Canopy is a full-fledged Python IDE that is intended for scientific and data analysis programming, that you install on your computer. I found out about it through MIT’s CS and Programming with Python MOOC that I’m currently taking through EdX. My computer has always had a problem with Python’s IDLE and running programs, but Canopy provides a Python IDE that is not dependent on IDLE. The free version is great for an IDLE substitute, especially when IDLE isn’t working.

Codecademy – Codecademy is one of the best ways to learn to code! It’s simple and completely cloud-based, so it’s easy to get started. There’s quite a few languages to pick from, plus it’s good if you need a brush-up on a specific language.

Repl.it – Repl.it is cloud based terminal editor that allows you to use the shells for a ton of different languages, from Python and Ruby to C++ and PHP. It’s great for function testing, experimenting, and learning on the fly or when you don’t have a language installed on your computer.

Drive Notepad – If you have a Google account, you can use this simple but useful app to create code files within your Google Drive. It’s just like Microsoft Notepad, but it has syntactical highlights, and it’s in the cloud. I use it to back up code files. Drive Notepad’s only drawback is that you currently can’t share files.

So these are a few of the apps I use on a regular basis. If you have any other apps or software that you use that I missed here, please feel free to comment about them!

You can probably tell from all the screenshots above that I’m biased toward Python. 🙂

I was absent mindedly looking through the the Python 3 function library documentation after looking for a specific function, and I came across an interesting Python poem called the Zen of Python. If you want to read it, type import this into the Python IDLE or go into a Codecademy Python lesson and type it. It’s sort of an interesting way to think about coding.

Here’s a simple Python 3 program that I made a while back, to help me with algebra. It’s a quadratic calculator that uses the quadratic formula to compute solutions based on inputs for a, b, and c. I made two versions of it, one with more condensed code. It’s rather simple, and it doesn’t handle complex solutions (It’ll give an error message). Feel free to make changes to the code if you like.

Programming is definitely a useful skill to have. With so many applications, from making games and data analysis programs to constructing software systems and building electronic circuits.

If your’re a beginning programmer, it would be a great idea to start learning using the Python programming language. Python is high-level, object oriented langauge (If you don’t know what that means, you’ll find out soon!) and uses easy-to-type-and-read syntax, which makes it a good first programming language. Python is widely used for both hobbyist and professional applications.

There are two versions of Python (2 and 3), they’re very similar but they’re incompatiable with one another. There’s much debate over which one is more useful or best for learning programming, but you’ll find that most lengthy tutorials and other media use Python 3.

One of the best resources to start learning Python is the Invent With Python series of books by Al Sweigart. The first book in the series Invent Your Own Computer Games With Python starts at the very basics, including installing Python, and moves into programming fairly complex text-based games. The next two books, Making Games With Python and Pygame and Hacking Secret Ciphers With Python, build off of the first book. These are well-written and easy-to-understand, and I defintely recommend using them to learn Python even if you don’t want to explicitly program games. Probably the best part is that these books are available for free as ebooks! Check out the books’ website below.

Another great resource is the official Python tutorial. It’s more technical than the Invent With Python books, but it’s definitely useful. If you ever need some quick info on any aspect of the Python Language, check out the documentation first.

I spent a bit of last weekend experimenting with the Raspberry Pi, and I came up with a fake candle! I used the cap of an old Christmas light, a yellow LED, some small dowels drilled with holes, and a lot of superglue. Then I programmed it in Python using the software PWM so it flickers realistically. I didn’t use any solder, I just kind of twisted the wires together. I also made an Arduino version as well.

#The Pi Candle Code

#Amanda Cole 2015

import RPi.GPIO as GPIO, time, random
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(26, GPIO.OUT) #26 is the LED