• Make: Electronics

    03/13/2021 at 05:25 0 comments

    Originally published in 2012, this marked the start of my electronics journey.

    This Christmas, I received a copy of Make: Electronics (First Edition) by Charles Platt, along with the accompanying Make: Electronics Components Pack 1a from Maker Shed. Just like that, I had a new obses^H^H^H^H^H hobby.

    The book can be divided into three parts of roughly equal length. The parts in the first kit correspond to the first two chapters of the book. The kit comes with batteries, a solderless breadboard, hookup wire, a DC power supply and the various electronic components covered by the first section of the book. This part of the book covers basic theory of electricity and fundamental components such as batteries, switches, relays, resistors, capacitors, LEDs, and transistors. The kit and the first two chapters culminate in a siren circuit made only from transistors, resistors and capacitors.

    I completed the projects covered by Component Pack 1 in about a week and ordered Component Pack 2a. The second kit, consisting mostly of soldering supplies and integrated circuits, includes the all the parts necessary for the next two chapters of the book. The third chapter starts by covering basic soldering skills. It then builds upon the siren circuit from the first section, eventually building it out into a full-fledged burglar alarm with magnetic window/door switches. Unfortunately, the burglar alarm did not survive the transition into a permanent project — a victim of my fledgling soldering skills. The lead-free solder in the kit may be the environmentally correct choice, but it didn’t make learning to solder very easy.

    The fourth chapter delves into integrated circuits in the form of timers and discrete logic. It guides the reader through several projects including a reaction timer, a combination lock, a game show buzzer, and an electronic dice roller. All in all, the second kit took me another two weeks to complete. My favorite project from this section was the reaction timer, built from 555 timers, 4026 counters, and a seven-segment display. I’m pretty sure my partner thought I was building a bomb.

    I really didn’t enjoy building the electronic dice out of 74LS TTL chips. The circuit was very flaky and I had to alter the resistor values given by the book to make it work. Maybe the point of this project is that TTL sucks (sorry old-timers). Apparently Charles Platt got this feedback from a lot of people, because the TTL chips have been replaced with CMOS HC chips in the second edition.

    The fifth chapter starts by giving advice on how to set up an electronics workshop and suggests some additional books for further reading. It then covers an eclectic variety of topics including electromagnets, motors, generators, audio electronics, robotics, and microcontrollers. Maker Shed does not offer a kit to go along with this part of the book, but by this point, I felt confident enough in my skills to branch out on my own without slavishly completing the remaining projects in the book.

    Overall I recommend both the book and the kits highly. The book provided a great hands-on introduction to hobby electronics by walking me through fun experiments without getting bogged down in theory, and the kits saved me the intimidation of placing my first order to Digi-Key or Mouser before I knew anything about the components I was ordering. While Make: Electronics definitely left me with some fundamental gaps in my understanding of electronics theory, it kept my interest long enough to get me hooked, and I believe that was precisely Mr. Platt’s goal.


    With this blog, my aim is to bring you along on my journey as I learn electronics and share the interesting projects that I work on along the way. I have been working on a lot of great stuff since completing this book, and I hope to share more with you soon. I hope that others who are starting out will find my experience useful as my understanding grows.

  • My LED Matrix Needs a Little TLC

    03/13/2021 at 05:22 0 comments

    Originally published in 2012.

    I picked up a set of 10 Sure Electronics 8x8 red/green LED matrices for about $13 on eBay. I figured I could build an Arduino-powered 24x24 LED sign to show messages, run Conway’s Game of Life, and play simple games, and still have one more 8x8 matrix left over to experiment with. I did eventually get a working prototype, but I had no idea of the rabbit hole that it would take me down.

    False Starts

    The easiest way to get a matrix running on an Arduino is to drive the rows and columns directly from its I/O pins. For a quick introduction on how this works, refer to the Arduino row-column scanning tutorial. Although it’s very straightforward, this approach has two major deal breakers:

    1. The LEDs in a typical matrix are rated at 20 mA, so if all the LEDs in a row are on at once, the pin attached to the row would have to supply 160 mA to light the LEDs at full brightness. The Arduino can only source 40 mA per pin, so this limits us to 5 mA per LED, resulting in a dim display. Since only one row is lit at a time, the display is even dimmer.
    2. It requires 16 I/O pins just to drive a single color 8x8 matrix, so forget about driving multiple colors or scaling up to multiple matrices using this approach.

    Another approach I investigated was to use the Maxim MAX7219 or MAX7221 LED display driver chips. The chip was originally intended to drive an eight digit, seven segment display, but can also drive an 8x8 matrix. Both Beginning Arduino and Arduino Cookbook cover this technique in depth. Arduino inherited a library from Wiring to drive matrices using these chips, so getting it working was very easy. Since these chips are purpose built for driving LEDs, they also provide plenty of current to drive the matrix at full brightness. Unfortunately, they also have several drawbacks:

    1. They’re expensive — the cheapest I found the MAX7219 was for $5.25 at Digi-Key.
    2. The chips were originally designed to drive eight digits on a seven segment display, so scaling up to multiple matrices is awkward. Driving multicolor matrices likewise requires multiple chips and is not straightforward.
    3. Each LED is either on or off using this chip, so it’s not possible to have multiple shades of color.

    The Hardware

    This brings me approach I finally settled on. I’m using a Texas Instruments TLC5940 16-channel LED sink driver for the columns and a Micrel MIC5891 8-bit serial input latched source driver for the rows. The TLC5940 has a number of advantages that sold me on it:

    1. This chip is a current sink, meaning that it attaches to the LED’s cathode and lights the LED by pulling the cathode toward ground. Since it can drive 16 channels, it is a perfect fit for an 8x8 bi-color common anode matrix like the ones I am using.
    2. It supports greyscale control using PWM, so the brightness of the red and green LEDs can be finely tuned to produce red, green, or any shade in between.
    3. It’s not exactly cheap, but it only requires three TLC5940s ($4.20 each) and six MIC5891s ($2.50 each) to drive a 24x24 bi-color matrix versus eighteen MAX7221s ($5.25 each). Therefore, at the best prices I could find we’re looking at a total of $27.60 for the driver chips with the TLC5940/MIC5891 combo versus $94.50 for the MAX7221s.

    The MIC5891 is basically a standard shift register (a la 74HC595) which has PNP Darlington transistors built into its output stages, allowing it to source up to 500 mA per output. A standard 74HC595 could be substituted, but each of the eight outputs would need to be attached to an external PNP Darlington or P-channel MOSFET in order to source enough current for the rows. 

    One TLC5940 and one MIC5891 can drive one 8x8 red/green matrix or two 8x8 single-color matrices side-by-side. It is possible to add an arbitrary number of columns and rows by chaining together additional TLC5940s and MIC5891s. Eventually, my plan is to scale up to a single 8x8 matrix to a 24x24 matrix composed of nine individual 8x8 tiles.

    ... Read more »

  • LEDs, Take Two

    03/13/2021 at 05:15 0 comments

    Originally published in 2013.

    This blog post has been languishing half-written in my blogger account for a long time. I have since found an even better solution for driving a 32x32 LED matrix called SmartMatrix (more on that later), but I wanted to share what I had already written about my second attempt along the way.

    With the red/green matrix I shared in my last post, I never got past the single 8x8 prototype that I demonstrated in my video. I eventually tired of the tedium of endless soldering and the frustration of trying to find a way to route all the wires required to connect the 216 pins of the 9 8x8 panels together. 

    I had taken a break from electronics for a while, but was looking for an excuse to dive back in. Then I found this video made by Henner Zeller, who has written some software to drive an RGB matrix from the Raspberry Pi.


    This matrix is already fully assembled so the only wiring required is a power cable and 16-pin data cable. The pins were not labelled on the matrix I got, so I looked at Adafruit’s instructions to get the pinout for the matrix. I found the GPIO pinout of the Raspberry Pi on the eLinux wiki, which is a great resource for all kinds of information about the Pi. 

    With this information in hand, I wired up a prototype using breadboard jumper wire to connect the appropriate pins on the Raspberry Pi’s 26-pin ribbon cable to those on the 16-pin ribbon cable provided with the matrix. I connected each pin from the matrix’s cable to the corresponding pin on the Raspberry Pi’s cable as documented in the software’s README. The important thing to remember when making these connections is that the pinout is flipped when looking at the connectors of the ribbon cables.

    Once I had the prototype working, I wanted something a little more permanent, so I got some female to female pre-crimped wires plus some 2x8 and 2x12 connector housings from Pololu. To make a custom cable, you just snap the end of the wire into the appropriate place in the housing. Before doing this, I decided to move OE- from pin 2 to 27 on the Pi and CLK from pin 3 to 11 so that pins 2 and 3 remain free for the I2C expansion bus.

    Adafruit now offers a Raspberry Pi LED Matrix Hat that is a much tidier solution, but if you don’t like to solder, you may find the technique I used above more to your liking.


    I started with Henner Zeller’s original code is on Github. I have forked his code on Github and made a few changes:

    • Swap blue and green pins so they match wiring shown in Adafruit’s documentation
    • Changed OE- from pin 2 to 27 on the Pi and CLK from pin 3 to 11 so that pins 2 and 3 remain free for the I2C expansion bus.
    • Added support for the TPM2.net protocol for streaming video from your PC to the matrix over UDP.
    • Compiled against the Xenomai real-time kernel. Instructions for building a Raspberry Pi linux kernel with Xenomai support are here. There is also a Github repository with some helpful scripts here.


    It works pretty well, but because Linux is a multitasking operating system, getting precise timings is not always possible, and when the loop gets preempted, it causes noticeable flicker on the display. Compiling with Xenomai helps this somewhat but it’s still noticeable at times. Also, a bare Raspberry Pi with a wire connected to a bare matrix doesn’t really feel like a finished project; however, it’s a lost farther than I ever got with my last attempt.

    Eventually, I found a better solution the SmartMatrix kit that I mentioned at the beginning of the post. I’ll talk more about that in my next post.