For the past six years at Maker Faire Orlando, members of FamiLab have taught attendees how to solder with a cool little Makey pin with 2 self-flashing LEDs. We’ve been asked for more advanced soldering training, and we responded with the addition of a PIC-microcontroller-based board twinkling several LEDs, and with a switch that can be used to change the LED display pattern.
Here are some technical details:
The first thing was to find a low-cost microcontroller for this project that’s available in both DIP and SOIC (surface-mount) packages, as we’d like to offer a surface-mount kit in the future. To keep parts count low, we located one that had an internal oscillator and enough output drive current so that we would not need to use output drive transistors. The kit would have 6 LEDs initially, but expandable to 12, so the LEDs were multiplexed in 2 rows of 6 LEDs each. For this we need 8 outputs.
Another consideration is power requirements. To further reduce parts count, we looked for a microcontroller with a wide power-operating range, so that we could maximize power without a regulator. Since LEDs generally require about 2.0Vf to 2.2Vf (forward voltage) minimum, we could run the circuit from say 2.5V. With an LDO regulator, we’d need a 3V battery, which is common with button-cells, such as the popular CR2032. But as the battery starts to deplete, we run the risk of dropping below the LED forward voltage quickly, and we’d waste a lot of the battery’s capacity. Worse, we have no headroom for a reverse-protection diode.
Instead we opted to go with 2 batteries in series, with a reverse-protection diode, and we’d get about 5.4V to the microcontroller. We chose a PIC16F54 microcontroller which will operate at up to 5.5V, and all the way down to 2.0V, so we can maximize the battery usage. Note however, that with the LEDs 2.2Vf, we need to have at least that much. But the battery is way beyond depleted at that point anyway.
From here, we chose to use Red, Yellow, and Green LEDs, which all have forward voltages in the 1.9V to 2.3V range. Blue or white LEDs have forward voltages in the 3.3V to 4.1V range, so as the battery depletes those would drop out first and look odd.
The only remaining components are a resistor and capacitor for setting the PIC microcontrollers operating frequency (we’re operating at about a few Mhz), a tactile switch, a pull-up resistor for the switch, and a bypass capacitor.
For this project, we wanted to keep things simple, as the code will be made open-source so anyone can tweak it as they wish. And we wanted anyone to do with with as little expenditure as possible. To this end, we chose assembly language using Microchip’s free MPLAB IDE/assembler. Yes, a PIC programmer is required, but those are relatively inexpensive nowadays. The programming pins for the microcontroller are exposed on the board with 0.1″-spacing pads. These are in the order V,G,M,C,D (5V, Gnd, Mclr, PgC, PgD).
We opted to design the board such that it can be used as a pendant on a necklace (lanyard) or as a keychain (especially for those of you who like large keychains). The design is a scalloped 2.7″ circle with LEDs on the outside circle, and a hole at the top for a keyring. Batteries are on the back of the board.
For all components (except LEDs), we added mounting pads for using surface-mount components instead. As much as possible, the pads are overlaid and inset so they’re mostly occupying the same space on the PC board. The schematic looks a bit confusing due to this, but it’s really just alternate parts.
To minimize the pins on the back snagging clothing, the back-mounted batteries help keep some separation there, but also, clipping the pins before soldering keeps the soldered joints more as small domes rather than as sharp pins with menisci.
Assembly instructions: MFO-SK-Instruction-Sheet-v04
Base assembly code: main.asm