My first Digispark project was a hastily thrown-together name badge for the Edinburgh Mini Maker Faire.
The badge consisted of a Digispark, an I2C shield, I2C LCD and a SRF02 Ultrasonic Rangefinder.
The SRF02 was selected for it’s small form factor and the ability to communicate with it over I2C. Instead of taking up two pins for trig and echo like my other Ultrasonic Rangefinders this allows both the LCD and the rangefinder to share the two I2C pins of the Digispark’s I/Os, leaving me with 4 ‘spare’ pins.
Power for the Digispark was supplied by a 9V PP3 battery, though I considered alternatives such as 4x AA batteries, a stack of button cell batteries and a LiPo. The decision was made on a balance of weight and ease of use. The Digispark has a 5V regulator on board, taking any voltage over 6 or 7V and regulating it to the 5V which the three major components require. It isn’t necessary to use the regulator if your power source is going to remain at 5V, hence I considered 4x rechargable AA batteries (1.2V x 4 = 4.8V) unregulated. A mintyboost or similar voltage booster/converter would also have been a viable power supply and would have cut down on weight (I suspect), however I didn’t have the components to hand.
Mounting the Digispark, LCD and rangefinder on a simple plexi frame gave the badge a more finished look.
With the Digispark prominently displayed (albeit backwards) on the front of the badge I will be able to disconnect it for reprogramming or for showing it off… “oh look at me I’ve got a tiny Arduino”.
Software is rather primitive at present. The rangefinder is polled and different messages are displayed according to proximity. At maximum range the LCD is turned off, primarily as a power saving measure. Up close the message will scroll some text. As the LCD is powered by an HD44780 I was able to make use of up to 8 custom characters. I toyed with the notion of producing animations with the custom characters but quickly ran into stack heap collisions so I opted for a few simple graphics. Further custom characters could have been employed by updating the custom characters on-the-fly though they could not all be displayed at once.
Further features I would like to (would have liked to – depending on when you read this) include would be a few buttons to choose between different modes/displays. Perhaps some RGB LEDs to liven the display up a bit.
As I thought I might want to re-purpose the LCD I didn’t solder to the pins. Since there wasn’t much space for adding a jumper cable I coiled some single core wire around the pins and covered in heat shrink. Time will tell if this method is robust enough, I may find myself applying a spot of solder if the connection is ‘flaky’.