24×24 LED Matrix Build

This project was briefly teased before, but it seemed like a good time for more details. Originally conceived as a coffee table build, it quickly morphed into what will eventually become a wall hanging and has been a test-bed for a lot of my LED work. Having worked a great deal with a variety of these digital LED strips, I noticed that in most cases they were manufactured in 0.5m sections and soldered together to form 5m strips. This is usually fine, but also means that the distance between pixels at the solder joint is 2-3mm shorter than the rest of the pixels. Being the type of person that wouldn’t be able to stop twitching over a few pixels in a matrix being misaligned from the rest, this just wouldn’t do. So the best solution was to make each row out of exactly one of these sub-sections so that all pixels are perfectly aligned. Not wanting to un-solder all of the joints to get at the 0.5m sections, I reached out to the manufacturer I typically order from in China about getting the strips in the raw sub-sections. Fortunately, they obliged. Armed with 24 half meter sections of LPD8806 strips, each with 24 pixels, I got to work laying out an evenly spaced grid on a sheet of acrylic.

After a couple laborious hours of laying out a perfect grid with a 24″ square and a lot of patience, I taped each of the LED strips with a rubber adhesive based strapping tape which I’ve found adheres extremely well to acrylic. Since it had to be wired as one continuous strip, the direction of each was alternated for every row. But first, power buses need to be created to provide the almost 34A (@5V) current the 576 pixels could draw. Originally, I wanted to design a 0.5m long PCB that would handle all of the power and signal routing. But I quickly figured out that I would need two separate designs (the signal pins are farther apart on one side than the other) and that a PCB that long, even a thin one, would cost nearly $75, per design, from OSHPark. $150 for power and signal routing was just too expensive for this project, so I had to find a simpler solution. Using large gauge wire seemed logical at first but stripping all of the insulation in the right place and soldering would be finicky. Copper tape came to the rescue; providing enough of a current capacity, in an extremely low profile. Not enough to carry all of the current on a single bus, but this many LEDs always works best with many small power buses since 5V doesn’t allow for much voltage loss over the length of the power run. The copper tape was laid out in 4 separate buses at the end of each row so that I could use very short jumpers to wire each strip to the bus. Soldering each jumper to took a bit of finesse, since each strip acted as a huge heat sink meaning heat had to be held to the joints for a long time, but not so long as to melt the adhesive or the acrylic beneath. I started by scuffing up the copper with some 100 grit sandpaper and then held my iron to the top of the wire (or the small bit of copper tape I used for the ground bus) and melting the solder into that from the top until it adhered to the bus.

Next up was wiring up all of the data and clock lines. Since the strips alternate directions with each row, one side of the matrix had data and clock pins right next to one another and the other required longer wires that jumped over the power lines. If you start twitching looking at the wire colors on each side… yes, I totally switched data and clock colors between sides. Oops. But with nearly 300 intricate joints to solder in total, it took me three long evenings and a couple movie trilogies to complete. Last was to connect the power bus wires that would connect to a 40A @5V supply and the input signal lines for hookup to the controller. The power lines were connected using some 10 gauge stranded core wire and the signals lines with a long length of phone cable. On the signal wire I also hooked up the ground, for a common signal ground, and 5V line to use for a level converter reference. I always use this converter from Adafruit for prototyping.

On top of all this, at least for now, was placed another sheet of acrylic to make sure nothing touches the power buses or signal lines (especially curious small fingers at the NC Maker Faire!). Matrix Display on Stand Check the video at the top of this post for an example of some of the animations I have programmed for the display. It is capable of being driven from an Arduino, Raspberry Pi, Beagle Bone, or similar. In the case of the above example, it is being driven directly by the SPI port on a Raspberry Pi Model B using a ground-up rewrite of my RPi-LPD8806 Library that has been modified to handle all of the hard tasks related to controlling matrices made of LED strips. More info on that new library will be coming soon in an exciting update!

Open Source PCB: ATTinyX5 Dev Board

While the standard Arduino (especially variants like the Pro Mini) truly is a lilliputian computing device, even it sometimes seems like trying to swat a fly with a sledgehammer. Sometimes you just need a few I/O pins for a status light, timer, tiny sensor, etc. Enter the ATTinyX5 series of chips.

The ATTiny25, ATTiny45, and ATTiny85 have 8 pins, 6 I/O and 2048/128, 4096/256 and 8192/512 bytes of flash/RAM respectively. The ’85 can be had for just over $1 from sites like Mouser. There’s even an Arduino core available for them so you can use most* of the code and libraries you already know and love. The only problem is that, without a complicated setup and boot-loader, they require an ICSP device like the AVR ISP MkII to upload your code.

After getting sick of having to wire up the 6-pin ICSP header of a breadboard every time I wanted to use one I finally decided to create this:

This tiny PCB takes some of the pain out of all the hookup needed for prototyping with the ATTinyX5. It only requires 2 components, the IC and a 0.1uF decoupling capacitor. On the underside of the board, there is an ICSP header that uses offset pin holes so that the 2×3 header doesn’t actually need to be soldered on. Simple press fit the header into the holes and then connect the ICSP cable. When you are done programming you can remove the header and the cable. The headers on the side are spaced to fit nicely on a breadboard and are also offset so that they can be press fit and work without permanently soldering them on.

By placing the board onto your breadboard up-side-down, you have easy access to the ICSP header for programming. Once the code is good, you can then easily remove the press fit headers and solder everything on permanently.

Best of all, you can have 3 of these made by OSHPark for only $1.65, shipped. They can be easily ordered directly from their project page here.

Also, you can grab the KiCad design files from our GitHub repository.

*Many libraries require features the ATTiny series simply is missing or more RAM/Flash than available on the chip. However, there are also many libraries written specifically for these chips.

**Note: The silkscreen labels has been tweaked since what you see in the picture (see the OSH Park renders) as they were not very visible. They have been increased in size and re-oriented for better visibility.

NeoPixel Glass Skull Lighting Effect (A.K.A Mr. BlinkySkull)

Awesome skull-shaped vodka bottle plus Arduino Pro Mini plus NeoPixels equals:

 

 

I’ve had this (empty) bottle of Crystal Head vodka for a while. Admittedly I mostly bought it because the bottle was really neat and I wanted to make it light up. Up until this point, I was using a small version of the RGB clock to illuminate it. It was a neat effect, but not very bright. It was time for an upgrade.

I have used before and really like the Arduino Pro Mini. All the Arduino power and flexibility in a cheap, tiny package. I picked up a 16 LED NeoPixel Ring not too long ago, and I really like how neatly the APM fits inside of the ring (held in place with some solid-core wire. I can definitely see using this combination in other projects. For this project, the wiring is pretty basic. The ring power and ground are soldered to extra VCC and Ground pins respectively on the APM, and a barrel jack is soldered to the RAW (voltage regulator input) pin and another extra ground pin. Yet another nice thing about this configuration: the APM has enough extra pins to attach a peripheral and an extra power tap. The ring Data pin is connected to digital pin 7.

As you’ll notice, the “enclosure” is a re-purposed SparkFun box. For quick enclosures where heat dissipation an looks aren’t a top concern, these work pretty well. Note that I did end up cutting vent holes in this one since the LEDs can generate a bit of heat if the animation has the lights on all the time. The hardware is held in place by a piece of clear packing tape over the cutout and another piece across the back as a bit of insurance.

The animations are all done in code, with help from the Most Excellent FastLED library. If you do anything with programmable LEDs on the Arduino, this library is worth a look. The code (such as it is) for this project can be found here. This was a quick one-off thing, so please excuse the crudeness of the code. I didn’t have time to build it to scale. Or paint it.

I guess the main take-away from this how well the Arduino Pro Mini and the NeoPixel ring work together. And glass vodka bottles are cool.

-Dan

Sunrise Alarm Clock – Prototype

While I rarely sleep past 6am, or sleep at all for that matter, my wife does require an alarm clock from time to time. After a recent few days of her alarm going off right in the middle of a R.E.M. sleep cycle she mentioned a desire for a more gentle alarm. I’ve seen those sunrise alarm clock lights many times before, but they but they are a bit pricey and she didn’t want a light that would be right next to the bed. Rather, something more subtle.

After a call to Dan to see if he had the few parts I was lacking, I realized a prototype should be an easy build with no need to buy anything new. Here’s the parts list:

The parts hookup looks like this:

WakeupLight_bb

Or, in the real world:

WakeupLight Breadboard

WakeupLight Power Board

The green board exists purely because I couldn’t fit the MOSFET on the breadboard with everything else. Ignore the L7805 regulator (the TO-220 package with the capacitors); I forgot that the Pro Mini had a built in voltage regulator capable of up to 12V.

The MOSFET is used to drive the LED strip since it can draw a couple amps at full brightness. For more information on how to hook up high current LED strips (the “analog” kind where you control the whole strip, not each pixel) Adafruit has a great tutorial. In this case, its gate pin is connected to pin 6 on the arduino since it is one of the PWM capable pins. Setting the strip brightness is as easy as calling analogWrite(6, brightness) where brightness is 0-255.

The DS1307 Real Time Clock and 7 Segment display both use I2C so they are hooked up to A4 and A5 (SDA and SCL). The two tactile switches are connected to pins 2 and 3 which correspond to INT0 and INT1, the external interrupts, which makes the button handling much easier (see the code for more info).

That’s really all there is to the hookup. The alarm functionality works by storing an alarm time in EEPROM (which is loaded into RAM in setup()) and in each pass through loop() checking how long it is until the set alarm time. In this case, it is actually looking for 15 minutes before the set time because my wife wanted it to reach full brightness by the set time and fade in slowly. If it is within that time span, it starts at minimum brightness and increases by one every 3 seconds (15min / 255 = 3 seconds).

I installed the strips in 4 rows, wired in parallel, onto a scrap 1×3 board I had lying around. As you can see from the picture below, they are quite bright, but only draw about 10W. I even added a function where you can press and hold one of the buttons to just turn the light on or off since it’s now the brightest light in that room.

WakeupLight On

The board with the LED strips was then installed directly behind the headboard of our bed so that it would provide bright, ambient light, but never be directly in your face. The picture below is of the strip at full brightness, having just completed the fade-in from testing the alarm.

WakeupLight Installed

For now, this is just a very rough prototype to see if it even works for my wife. If it does, I will be making a bespoke PCB for it and a nice case, probably with some big, arcade style buttons.

For more details, check out the GitHub Repo which includes all of the source code as well as the fritzing schematic seen above. If I design a proper PCB and case for it, I will upload them there as well.

Finally, A Windows Package Manager – With Chocolate!

To the chagrin of the open source community, I’m a Windows guy. I do really like Linux based systems, but much of my professional career has remained at least partly in the Windows world. 15 years of using Visual Studio (the only Microsoft product I truly like) have brought me to prefer it greatly over any IDE out there. I even use it for all my Arduino/AVR work, but that’s another post.

But if there is anything from the Linux world that I miss when using Windows, it is a proper package manger, a command line one like apt-get on Debian and Ubuntu. As someone who has installed Windows enough to have once had a Windows 98 serial key memorized I can say that a graphical installer is just too much of a pain. Being able to type “apt-get install vlc” (which would install the popular VideoLan Client) and do nothing else is great. Most of the time you can even just guess at a package being available and it usually is.

The first to try to fix this on Windows was Ninite which is great for most people and has a very concise, curated list of available applications. But it’s web-based and, well, has a curated list of applications… it has the common 90%, but I’m the type that uses that other 10%. Enter Chocolatey.

If you can forgive the odd name, Chocolatey is fantastic. Not quite up to the level of apt-get but it’s pretty darn close. Essentially it works in an almost identical fashion to apt-get. It is fully command line (though there is a GUI availabe if you want to be lame) and has community added application packages that span an wide range of interests (1971 in total as of this writing). First off, let’s get Chocolately installed.

Installation is super simple, just paste the code below onto your command line and hit enter (you’ll need Windows 7 or greater):

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin

Give it a minute to download and install and you are all set to get going. The official documentation makes things a little confusing by having way too many aliases for all the different commands. There are at least three ways to install a package: “cinst “, “chocolatey install “, and “choco install “. For the sake of simplicity and to keep things as similar to apt-get, I’m going to use the “choco” base command from here on. Typing “chocolatey” is just too much to type and I don’t want to remember all of the aliases for the sub-commands like install, update, etc.

First up, finding a package with the “list” command, which is good for if you aren’t quit sure what the exact name of the package is you want to install since you must specify the name exactly.

choco list  #find available packages matching 
choco list  -all #show all versions for the specified pacakge
choco list  -localonly #find already installed packages matching 

c:\>choco list arduino
arduinoide 1.0.5.20140625
arduinoidegalileo 0.7.5

Note that it displays the package name followed by the latest version number, which can be useful if you need to install an older version. Use the “-all” flag shown above to see what other versions are available. In this case, we also see two packages; the first is the standard Arduino IDE and the second being a special version for the new Intel Galileo boards.

So, now install Arduino using:

choco install arduinoide

Note how  you can specify the package version as well as multiple packages that will all be installed at once. By default, Chocolatey will automatically install any needed dependencies.

choco install arduinoide -version 1.0.5.20140625 #install specific version of arduinoide
choco install arduinoide python2 kdiff #install Arduino, Python 2.7, and KDiff at the same time.

You can also use Chocolatey to update packages using the update command, even updating all packages on your system at once.

choco update arduinoide #update just Arduino
choco update all #update every package currently installed with Chocolatey

Last of all is the ability to uninstall packages which is quite simple:

choco uninstall arduinoide

If you are unsure of the name of the packages you already have installed, simply use the list all local command:

choco list all -localonly

That’s the basics of using Chocolatey, though there are many more advanced features like package sources, missing dependency installation, python and ruby integration, and many others that can be seen on the Chocolatey Command Reference page.

But last, to show why Chocolatey is so awesome, here’s a one-liner that installs nearly everything I use for all of my development work:

choco install arduinoide python2 notepadplusplus kdiff make mingw Sudo GnuWin SublimeText3 ConEmu githubforwindows tortoisesvn

That’s it! I save this and can just paste it into my console on any new machine. In the above order, the tools are:

  • Arduino IDE
  • Python 2.7
  • Notepad++ – Awesome Windows text editor
  • KDiff – file diff/merge tool
  • make – Windows port of the “make” build tool
  • MinGW – Minimalist GNU for Windows (mainly used for GCC)
  • Sudo – just like Sudo on Linux but for Windows
  • GnuWin – Windows native ports of GNU tools like ls, sed, awk, grep, wget…
  • SublimeText3 – Another great text editor with more project management
  • ConEmu – Best Windows console terminal I’ve ever used
  • GitHub for Windows – GitHub’s official Windows GUI client.
  • Tortoise SVN – Windows GUI for Subversion

Think of how long that would take to download and install off of these programs manually! Hopefully this will save you a great deal of time the next time you need a new application.