Archive for August, 2017

7 Segment Pixel library for Arduino

Photo Credit Jeff Jassky. World Maker Faire 2016

 

Are you dissatisfied with the small size of the largest 7 segment digital displays that are commercially available?  Me too!  The good news is that if you have access to a laser cutter, it’s pretty easy and extremely fun to build your own obnoxiously large, 7 segment displays from scratch, using smart RGB LEDs. Arguably, the most popular of these are the WS2812 variety, AKA NeoPixels from adafruit.com  The laser cutter can help you to cut a backer board to precisely mount your LED lamps inline with the segments.  Most importantly, the laser can be used to cut a baffling layer out of a sheet of some opaque material. In this layer, each segment of every digit is cut out. Imaging the numeral 8 removed from a sheet of material for each digit.  This layer gets samwiched between the lamps layer and the face of the panel, if you choose to add a face.  The baffling layer not only creates the shape of the segments, but it baffles the light from each segment. It keeps the light in one segment from leaking over into adjacent segments.

But I digress!  Way back when I made my first 7 seven segment display, I was surprised that I couldn’t find an Arduino library to help make it easier to show digits on a custom built display such as mine.  There were plenty of 7 segment libraries to drive off the shelf parts, but nothing to help drive a pixel based custom made display.  If you’ve had the same concerns, YOUR SEARCH IS OVER! 😀 I’m pleased to announce the release of my Seven Segment Pixel library for Arduino which can be found on github:

https://github.com/h-c-c/Seven_Segment_Pixel

The library uses the awesome Adafruit_NeoPixel library as a dependency.  You can instantiate a display object like so:

Seven_Segment_Pixel display1 = Seven_Segment_Pixel( DIGITS, PIXPERSEG, NUMDELIMS, PIXPERDELIM, NUMPIXELS, PIN, NEO_RGB + NEO_KHZ800 );

Then use the updateDigit function to manipulate a specific digit and it’s color:

 display1.updateDigit( 1, 1, 255, 0 , 0 );
 display1.show();

This would display a red, numeral 1 in the first digit position.  The show() function is just  calls the Adafruit_NeoPixel show() function.

 display1.updateDelimiter( 1, 255, 0 , 0 );
 display1.show();

If I had wired in a colon for a clock, the above would make the colon red.

Please take it for a spin and let me know what you think!