Browsing Category Open Hardware Advent Calendar

Light Paintbrush: Open Hardware Advent Calendar Day 8

Today’s project is a really fun one: a Trinket-based LED paintbrush for light painting.


The Light Paintbrush lets you do light painting in different colours. Light painting is a technique where you take a long-exposure photo in a dark area while moving a light source of some sort, and you wind up drawing with the light source.

The Light Paintbrush uses an RGB NeoPixel LED, a dial, and three buttons to let you choose the colour you draw with, and paint your heart out. The buttons select the mode, and the dial has different functions based on the mode.

It has three modes:

  • Paint mode – where the dial selects the colour, and the colour is shown at full brightness
  • Preview mode – where the dial selects the colour, and the colour is shown at half brightness. This is to let you see what colour you’re going to draw with, without affecting the picture you’re drawing as much.
  • Colour wheel mode – where the colour automatically fades from one to the next, and the dial chooses the speed that it changes at.

To actually take the picture, you can use any camera or app that supports long exposure or bulb exposure. I used an app called SlowShutter on my iPhone, and set it for Light Trails, and Unlimited Exposure. That way, I set when it should start the exposure, and when it ends, by tapping a button on the screen. You can also do timed exposure. You’ll have to find out what works with your phone or camera.

Parts list

Three buttons
One 5V Adafruit Trinket
One 8mm through-hole NeoPixel
Three 10K ohm resistors
One 100 ohm resistor
One 10K potentiometer
One 3xAAA holder with switch
One Adafruit 1/4 size prototyping board

Hardware setup

The hardware setup is pretty simple – three buttons to ground (Paint on pin #0, Preview on pin #4, Colour whele on pin #2), each with a 10K pull-up resistor, a 100 ohm resistor between the Trinket (pin #1) and the data in pin of the NeoPixel, and the potentiometer connected from 5V to Ground, with the wiper connected to pin #3 on the Trinket. The Fritzing diagram below shows the setup on a breadboard.

All Photos-2416

The Fritzing file and Arduino code can be downloaded from our GitHub.

I prototyped it on a breadboard, and eventually transferred it to a prototyping board to be more permanent. Photos can be seen in the gallery above.

Software setup

First, you’ll need the Arduino software on your computer set up to use the Trinket. Also, you’ll need to set up your Arduino software on your computer to use the Adafruit NeoPixel library. The Arduino sketch for this project can be downloaded from our GitHub. Load the code into your Trinket as per Adafruit’s instructions.

Note that your Trinket cannot be connected to the rest of the circuit when you’re loading code to it, as we’re using the pins that it uses for USB for other things. So unplug your Trinket, connect it to USB, load the code onto it, unplug it from USB, and put it back in the circuit.

The software does some interesting things – it does not, for example, work directly with Red, Green and Blue colours, as a lot of systems do, but rather manipulates them as HSV – Hue, Saturation and Value. This lets us maintain a consistent brightness between colours, and fade between them much more cleanly. Darcy White has a good article about why you want to use HSV/HSI, and about colour mixing in general. I borrowed some code from Kasper Kamperman to do the conversion on the Trinket.

Future plans

This project is TONS OF FUN to use, but there are a few things to improve. I’d like to make the overall form factor a little easier to work with, and maybe make the power source (currently 3 AAAs) a bit smaller. Also, the 10K resistor – which is what I had, and had a nice knob on it – is too close to the internal impedance of the ADC in the Trinket’s microcontroller. What this means is that microcontroller heavily affects the reading of the dial, and we get non-linear behaviour. There’s an easy fix for that – use a 500 ohm or 1K ohm potentiometer instead – but I don’t have one on me.

I do plan to make a Version 2 of this project, so watch this space. Maybe some colour preset buttons for faster switching?


This was a lot of fun to build, and a ton of fun to test – I really hope you try it out yourself.

Category : Open Hardware Advent Calendar

USB Bee: Open Hardware Advent Calendar Day 7

Today’s project is a handy little board for working with Arduino projects that use XBee radios.


The USB Bee is a small circuit board that can take the place of an XBee radio, but rather than having a wireless communications module, it has a USB port.

XBee radios are often used as a serial data link, with another radio connected to a computer. In the field, this is awesome. In the lab or on the workbench, it can be a bit of a pain – especially when you design the board to leave out the Arduino serial programming interface to save space, and only have the connection to the radio module. As I have done.

By putting the USB to Serial module in the same size module as the radio, we can leave just the radio connector on the board, and save some space – just swap in the USB Bee when you need a direct connection, and put the XBee back when you’re done.


The system is a very basic FT232RL-based USB to Serial converter, using a Micro USB connector and a thin PCB to match the XBee radios. It has two solder jumpers to select if the board is simulating an XBee, or connecting to an XBee – so it can be used either to replace the radio in the system, or to connect to the radio on a computer.


The I/O on this board runs at 3.3V, just like a normal XBee module. PCB designs and schematic can be downloaded from our GitHub page.

Future enhancements

Already, the design has had one minor modification – I got RX and TX backwards. Switching some labels and connections fixed this easily in version 1.1. I’d like to add a voltage regulator to power the XBee’s 3.3V supply, as well, so that it can actually be used as an interface to connect an XBee to USB.


I don’t think this is a board that anyone but me would have had a need to build – most people just leave an FTDI serial header on the board so they can program it, but I didn’t. Still, it solves the need nicely, and might be useful for people developing systems with XBees in environments where there’s too much interference to test.

Category : Open Hardware Advent Calendar

USB Shield: Open Hardware Advent Calendar Day 6

Today’s project is a safety device to protect against malicious USB charging ports. We’re calling it the USB Shield.


The USB Shield is a device to protect against malicious USB charging ports. Essentially, USB charging ports in places like airports and bus terminals aren’t supposed to be connected to computers, but if they are, and you plug your phone or tablet into them, they could seize control of your device and install nasty software on it. By breaking the data connection between the device and the port, the USB Shield prevents this from happening.

Other devices have been designed for this – a few have made it to Kickstarter – but I wanted a small one for very little money. So I built my own.


The hardware design is very simple. We’ve got a USB socket and a USB plug, with the power and ground connected between them. The data lines on the socket are connected to a switch. For Android devices, the data lines are connected together, making the port a Dedicated Charger Port. For iOS devices, the data lines are connected to a pair of voltage dividers. The resistors are selected to limit the charging current to 500mA so as to not overload the charger.


The PCB design files can be found at our GitHub site.

Building one isn’t too difficult – the hardest part is installing the four resistors (two 49.9K ohm 0603 resistors and two 75K ohm 0603 resistors), because they’re surface mount. The USB connectors and switch are easy to install.

Future improvements

There is one issue with the board as is – the Dedicated Charging Port is meant as a 1A charge limit, and I’d prefer to have it limited to 500mA for safety reasons. There are also no mounting holes on the board, which makes it more difficult to mount it in an enclosure. I’m working on a new version that addresses both issues, but the existing one does work.


If you’re going to use charging ports in public places, it’s probably a good idea to use something like this to keep your mobile device safe.

Category : Open Hardware Advent Calendar

USB Wildcard: Open Hardware Advent Calendar Day 5

Today’s project is more of a tool that I’ll be using in future projects: what I call the USB Wildcard.


The USB Wildcard is a basic breakout board for developing USB systems using AVR microcontrollers. It’s basically the USB to Serial section of an Arduino Uno, but on its own circuit board.

The main configuration for this board is as a USB to Serial adapter for my own Arduino experiments, but the back has pads for connecting to the other I/O lines on the ATmega16U2 chip on the board.


The board is a double-sided PCB with parts only on the top side. It’s a really basic setup – the microcontroller, some capacitors, the crystal, a handful of LEDs, and a USB connector.


The schematic and PCB files can be downloaded from our GitHub. This includes a version of the board that merges two of the boards into one, so you can get 20 boards from an order of 10 5x5cm boards.

Software setup

The software for this one is really basic so far. For the USB to Serial board, I use the Arduino Uno HEX file, so it looks exactly like an Arduino Uno’s serial port to the computer. The hex file can be download from here.

To load the firmware, you either need FLIP (Windows) or dfu-programmer (Linux and OS X). Instructions can be found on the Arduino site here, but the basic steps for programming the board on a Mac or Linux machine are to plug the blank board into the computer, and run the following from the command line:

sudo dfu-programmer atmega16u2 erase –force
sudo dfu-programmer atmega16u2 flash Arduino-usbserial-atmega16u2-Uno-Rev3.hex
sudo dfu-programmer atmega16u2 reset

Unplug it, plug it back in, and you’ve got a USB to Serial adapter.

Future projects will expand on this one, and present some more detailed usage instructions.

Future plans

This is the basis of a few future projects, as it gives us an easy, pre-made platform for building USB gadgets. I have a lot of plans for it, is what I’m trying to say.


This isn’t the best writeup of this project – I’m writing it on the way to a concert, so I’m rushing it – but the details will be filled in later.

Category : Open Hardware Advent Calendar

Ringtone Doorbell: Open Hardware Advent Calendar Day 4

Today’s project is something new. Really new. Working as of an hour ago, new. It’s a customizable doorbell for kids to build.


The Ringtone Doorbell is a doorbell based on the Adafruit Trinket, meant for kids to build for their bedroom. They can customize the ringtone played by the bell using just about any RTTTL ringtone. For anyone who didn’t have a cell phone before about 2005, these long sequences of characters were how we used to add new ringtones on our phones. We’d sit there, keying them in on a numeric keypad, inevitably making a mistake so that it sounded completely wrong – but we’d eventually have the theme song from Beverly Hills Cop on our phones. (I’m old).

The project consists of a button, a Trinket microcontroller from Adafruit, some batteries, and a speaker. When you push the button, the ringtone you program into it plays. You can put in whatever ringtone you want, as long as you have a computer running the Arduino software, and a USB cable.

This is actually an updated version of a project I designed for McMaster University’s Venture Science and Engineering camp a number of years ago. Improvements in the tools available to us – like the Trinket – mean that this one is much easier for kids to customize and build.

Parts list

1 Half-size breadboard
1 Adafruit Trinket 5V
1 PCB-mount speaker
1 470 ohm resistor
1 10K ohm resistor
1 Button (I used a Pink arcade button)
1 3xAAA battery holder with switch (and batteries)
Some hookup wires
A computer running the Arduino software

Building the hardware

Since this is another breadboard-based project, I again went with Fritzing for the connection diagram. Note that the resistor going from the pin marked #0 on the Trinket is the 10K, and the one going from the pin marked #1 to the speaker is the 470 ohm. I used a piezo speaker on the Fritzing diagram, but a small 8 ohm (or higher) speaker, or a PCB-mount speaker, should work OK.

Ringtone Doorbell_bb

Frizting files and source code can be downloaded from our GitHub page for the project.

You’ll need to solder some wire to the button’s pins – I twisted together a few feet of stranded 24 gauge wire. Stranded wire is better for something like this, since putting the button wherever it needs to go probably means it’s going to have to bend. You’ll want to tin the ends of the wire that plug into the breadboard with solder, to make sure they stay in the breadboard better.

Software setup

The Arduino sketch for this project requires that you install the Bounce library. Adafruit has good instructions on installing libraries. The Bounce library is used for debouncing the button – a common problem with buttons is that they don’t switch cleanly between on and off, and the bouncing around in between can cause software issues. We use special software to take care of this problem so that the bouncing doesn’t mess up our program. You’ll also need follow Adafruit’s instructions for setting up the Arduino software to work with the Trinket.

The source code for the Arduino sketch can be downloaded from our GitHub page for the project.

The software uses code borrowed from the Arduino RTTTL library coupled with some tone generation code for the Trinket. I may clean up this library at some point and make it available separately.

To customize the ringtone, you’ll need to find another ringtone to use. Right now, it’s loaded with the theme song from the movie Rocky. (I’m old). You can find other songs here, and here, and here, and many other places with RTTTL ringtones. Googling should find you a bunch. Open the Arduino sketch, and find the place in the code that reads:

const char song_P[] PROGMEM =
“(a bunch of stuff)”;

and put your ringtone in between the quotation marks.

Then, you should be set to load the code onto the Trinket. The Blink section on this page goes over the steps required for that.

Once it’s done loading, you should be able to press the button and have it play your ringtone! The red LED on the Trinket will blink along with the music.

Future improvements

I don’t have any future improvements planned for this project, but there’s plenty that could be done to make it cooler. The USB interface on the Trinket could be used to send a message to your computer, showing you a message that someone’s at the door if you have headphones on or something. You could also hook up a servo motor to it to wave a flag if someone’s there. There are a lot of possibilities for enhancements.


I’ve seen kids have a lot of fun playing with this project in the past, so I hope it’s one that more can enjoy in the future. It doesn’t have a lot of parts, but does open a few doors for electronics and programming.

Category : Open Hardware Advent Calendar

USBTinyISP alternate PCB: Open Hardware Advent Calendar Day 3

Today wound up being dominated by getting a parts order in for more interesting projects, so it’s another boring one for the day. This is basically just an alternative circuit board design for Adafruit’s USBTinyISP AVR programmer.


Electrically, this is identical to Adafruit’s board – uses the same schematic and everything. The actual board layout is vastly different, however. The biggest change is that rather than a double-sided layout with wiring on both sides of the board, this one is single-sided. This is because while I was at McMaster University, and didn’t have tons of money, I did have access to a circuit board milling machine. This takes a copper-clad circuit board, and uses a rotating milling bit to carve grooves in the copper to isolate the printed circuit pattern. This let us make our own boards for not a lot of money.

The catch of this machine, though, was that doing both sides of the board was really complicated. There was a lot of work making sure that things would line up properly when you flip the board over, and the system for adding a metal plating to the holes going through the board so that both sides connect was tricky. Normally, when you get boards made at a factory, this is handled chemically. So sticking with single-sided designs on the milling machine was for the best.

Building the hardware

Adafruit has put together good documentation on this programmer, including parts list, assembly instructions, and usage instructions. The only difference between theirs and this one is that this one is the single-sided board. Our GitHub has the EAGLE CAD files for this project, from which you can make the Gerber and Excellon files to build the circuit board.

Note that there are three top-side wires near the programming connectors that need to be added when building this project.

Software setup

Again, consult the Adafruit directions linked above for usage. The biggest problem with building this AVR programmer is that it needs a programmed AVR. The HEX file for programming an ATTiny2313 for this is available from this Adafruit page. You can use an Arduino as an ArduinoISP programmer to program this chip, or get a friend with an AVR programmer to do it for you.

Future improvements

I’m not doing anything further with this project, aside from maybe cleaning up the schematic a bit. The USB implementation used here is pretty messy – it’s software-based, outside of the USB spec, and has some issues with USB 3.0 hosts – so I’d prefer to go with other methods nowadays. Other options are much cheaper now than they used to be.


Another boring project, that won’t be updated in the future. Sorry for that. Tomorrow should be better.

But if you’re looking to build a cheap, fairly reliable AVR programmer at home – and aside from some issues with newer USB ports, mine’s been reliable – this is a decent one.

Category : Open Hardware Advent Calendar

Mini I2C LCD Backpack: Open Hardware Advent Calendar Day 2

The second project in our Advent Calendar is a quick, simple, and old one – mostly because I had some phone repair issues today that wound up taking more time than originally planned. This project is a small circuit board to put on the back of a character LCD module, to allow it to be controlled over the I2C bus.


The Mini I2C LCD Backpack is a clone of part of the Adafruit LCD backpack. Theirs works with both I2C and SPI, while this one only uses I2C. This one is also about half the size, and rather than using the standard 1×16 LCD pinout, it uses the 2×8 (or something close to it).

I made this one because I’d picked up a bunch of 8×2 character LCD modules, and wanted to use them on I2C. Doing so means that you can chain a bunch of LCDs or other things off of one microcontroller, and use only two I/O lines to do so. The Adafruit module didn’t fit the pinout of these modules, though, so I designed this. I also had issues with the Adafruit module’s schematic – it was a bit tricky to read, because the data lines aren’t labelled well.

The board is done with the smallest surface mount parts I was comfortable using without magnification equipment, to keep it small – 0603 resistors and capacitors, and the SSOP package of Microchip’s I/O expander.

Parts list

1 polarized 4 pin header
1 MCP23008 in SSOP package
4 10K 0603 package resistors
1 100nF 0603 package capacitor
1 10uF B-package electrolytic capacitor
1 10K potentiometer
1 MMBT3904 transistor
Optional: 0.100″ socket header

Building the hardware

This one’s a mostly surface mount job – the parts are labelled on the board, so it should be easy to go together.


You can download the schematic and PCB files (including Gerber and Excellon data) from GitHub. Boards were ordered from Seeedstudio’s Fusion PCB service for this project.

The tricky bit comes in attaching it to the LCD. I did something weird with the pinout on this one – most LCDs with the 2×8 pinout have the backlight on pins 15 and 16. A few of the modules I had, however, had the backlight on pins 1 and 2. So that the same board would work on both styles, I used a 2×9 connector, and put the backlight on both ends. This way:

  • If you have the standard pinout, you line up pin 1 on the LCD with pin 3 on the board
  • If you have the weird pinout, you line up pin 1 on the LCD with pin 1 on the board
  • If you have no backlight pins at all (a 2×7 connector), you line up pin 1 on the LCD with pin 3 on the board.

You can add a set of header pins on the LCD, and put sockets on the backpack board, or just use pins to solder the two together permanently.

Software setup

I don’t provide any software for this one – you can use Adafruit’s modified LiquidCrystal library or use the LiquidTWI library to drive it.

Note that you can connect up to 8 devices based on the MCP23008 to one I2C bus (such as this board) – use the address solder jumpers to configure the address for each board. Completing a jumper on this board sets that address bit to 1.

Future improvements

I don’t think there are much in the way of future improvements for this project – it’s really a building block for making other projects. I used it in my New Year’s Ball Drop project last year, for example.


Again, a simple project – and an adaptation of another one, too. Don’t worry, more exciting things are afoot.

Category : Open Hardware Advent Calendar

Passcode Lock: Open Hardware Advent Calendar Day 1

Our first project in the Open Hardware Advent Calendar is the Passcode Lock. This is a project I recently completed for the Next Super Geek Challenge at Maker Faire Toronto 2014.


As part of the challenge, the participants had to find a code, and make sure they had the correct one at the challenge’s booth. The system that the organizers had wasn’t quite finished, so I offered to try and put something together with parts I had at home.

The project has a keypad, an LCD screen, an Arduino, and some RGB LEDs (WS2812s / NeoPixels, to be more precise). The LCD shows a message asking the kids to enter their code with the keypad. When they’re finished entering the code, if they’re right, they see a message and some blue lights. If they’re wrong, they see a different message, and some red lights.

Parts list

1 Arduino (I used a USB Boarduino, but just about any Arduino should work)
1 20×4 Character LCD with parallel interface (using the HD44780 or compatible controller – if it has 14 or 16 pins, it’ll probably work)
1 100 ohm resistor
1 10K ohm potentiometer (this comes with the Adafruit LCD)
1 4×3 or 4×4 keypad
1 Breadboard
A bunch of hookup wires
4 NeoPixels (I used my own design, but the Adafruit ones will work just as well)

Building the hardware

This is a fairly simple project, so I’m just going to present a Fritzing project showing the breadboard setup. I’ve used a 16×2 LCD in the Frizting project, because that’s all I found in the parts included. You should use a 20×4 LCD.

Passcode Lock Breadboard Diagram

You can download the Fritzing project and Arduino code here, or check it out on GitHub.

The basic setup is this:
LCD pin 1 to ground
LCD pin 2 to +5V
LCD pin 3 to the middle pin on the potentiometer
LCD pin 4 (RS) to Arduino Digital Pin 2
LCD pin 5 (R/W) to Arduino Digital Pin 3
LCD pin 6 (E) to Arduino Digital Pin 4
LCD pin 7-10 not connected
LCD pin 11 (DB4) to Arduino Digital Pin 5
LCD pin 12 (DB5) to Arduino Digital Pin 6
LCD pin 13 (DB6) to Arduino Digital Pin 7
LCD pin 14 (DB7) to Arduino Digital Pin 8
LCD pin 15 to +5V
LCD pin 16 to the 100 ohm resistor
Other pin of 100 ohm resistor to ground

NeoPixel +5V to +5V (for all of them)
NeoPixel ground to ground (for all of them)
NeoPixel #1 DIN to Arduino Digital Pin 9
NeoPixel #2 DIN to NeoPixel #1 DOUT
NeoPixel #3 DIN to NeoPixel #2 DOUT
NeoPixel #4 DIN to NeoPixel #3 DOUT

Keypad Row 1 to Arduino Digital Pin 10
Keypad Row 2 to Arduino Digital Pin 11
Keypad Row 3 to Arduino Digital Pin 12
Keypad Row 4 to Arduino Digital Pin 13
Keypad Column 1 to Arduino Analog Pin 0
Keypad Column 2 to Arduino Analog Pin 1
Keypad Column 3 to Arduino Analog Pin 2
Keypad Column 4 (if you have it) to Arduino Analog Pin 4

Software Setup

The software makes use of the Keypad library, Password library, and Adafruit NeoPixel library. You’ll need to install them in your Arduino software – some instructions are available here. It also uses the LiquidCrystal library, which is included with the Arduino software. You should use a relatively recent version of the Arduino software – I was using 1.0.5r2.

The software is based on some other examples I found online – specifically and I made some modifications to clean up the menus a bit, to use the keypad for the “enter code” button, and to add the NeoPixels.

One interesting thing about this project is that it uses the Arduino’s Analog lines as Digital lines. Not many people know this, but they can be used for Digital I/O, so if you need more than 13 Digital I/O lines, just remember that Analog 0 is also Digital 14, Analog 1 is Digital 15, etc.

You can download the code from here along with the Fritzing project. You can check out the GitHub project here. After installing the libraries above, open the sketch in the Arduino software, customize the code, and download to your Arduino. You can change the code in the following line:

Password password = Password( “2008” );

Change the 2008 to whatever number you want – I’m not sure how long it can be, but 10 digits should be no problem.

Future improvements

I don’t have any future improvements planned on this project at the moment, but there are definitely some places it could be taken. Most improvements would probably require freeing up some I/O lines, as we’re kind of using all of them. Using an I2C LCD backpack like this Adafruit one would do the trick – note that Analog 4 and Analog 5, which are also the I2C port on the Arduino, have been left free for this reason.

Once some I/O lines are freed up, it would be pretty easy to add more lighting, some sound effects, and maybe even a servo to control a locking mechanism. More NeoPixels can easily be added just by chaining them onto the ones already there – some software changes are all that’s needed for those.


This is a pretty simple project – I put it together in a little over an hour by pulling together some spare parts and some pieces of other peoples’ code. The parts that it’s made of aren’t too intricate, so it’s fairly easy to assemble, but still a lot of fun.

Category : Open Hardware Advent Calendar

The Open Hardware Advent Calendar 2014

When I was a kid, we used to get advent calendars, with a chocolate for every day from December 1 to Christmas Day. Often, the chocolate tasted terrible, but the anticipation of a treat every day was one of the best parts.

For a while now, I’ve wanted to do the same kind of thing, but with electronics projects. This isn’t an entirely new idea – vk2zay does the Avent Calendar of Circuits on YouTube – but I wanted to do my own version. This year, I’m trying it: the Open Hardware Advent Calendar. Every day between now and Christmas, I’m going to try and release a different open-source hardware project.

Some are going to be very simple, and some are going to be things that have been sitting on the shelf for a year or so, waiting for me to document them. Either way: every day, my goal is to put up a circuit board, schematic, piece of firmware, or whatever, so that people can build it themselves and enjoy screwing around with electronics.

I warn you in advance, some of these are going to be much simpler than others, and some are going to be much more complicated to build than others. I’ve got a wide range planned, from breadboardable projects to tiny surface mount-only PCBs. I hope everyone will be able to find something interesting in what’s coming over the next few weeks. I’ll try and keep this post updated with a list of projects as we go.

Onward with the first project!

The Projects

Category : Open Hardware Advent Calendar