HackerBox 0025: Flair Ware

by HackerBoxes in Circuits > Wearables

10064 Views, 20 Favorites, 0 Comments

HackerBox 0025: Flair Ware

WholeBoxInstruct0025.png

Flair Ware - This month, HackerBox Hackers are building a variety of electronic flair for use as wearables, demos, or even holiday ornaments. This Instructable contains information for working with HackerBox #0025, which you can pick up here while supplies last. Also, if you would like to receive a HackerBox like this right in your mailbox each month, please subscribe at HackerBoxes.com and join the revolution!

Topics and Learning Objectives for HackerBox 0025:

  • Assemble a simple coin-cell-powered circuit board with self-flashing LEDs
  • Explore cascaded analog oscillators to implement a wearable name badge
  • Experiment with multiple Digispark devices for miniature Arduino projects
  • Interconnect wearable LilyPad modules including NeoPixel full-color LEDs
  • Program blank ATtiny85 microcontrollers using USBasp

HackerBoxes is the monthly subscription box service for DIY electronics and computer technology. We are hobbyists, makers, and experimenters. We are the dreamers of dreams. HACK THE PLANET!

HackerBox 0025: Box Contents

WholeBox 0025.png
  • HackerBoxes #0025 Collectable Reference Card
  • LED Star Wearable Kit
  • Color-Cycling Name Badge Kit
  • BitHead ATtiny85 Wearable Kit
  • Pluggable Digispark DevBoard
  • Extra ATtiny85 8DIP Microcontroller
  • CJMCU LilyTiny Digispark Module
  • Three LilyPad NeoPixel Modules
  • LilyPad Coin Cell Module
  • CR2032 Lithium Coin Cells
  • USBasp Atmel AVR USB Programmer
  • Green Prototyping Board 4x6cm
  • Lapel Pin Backs
  • Shrink Tubing - 100 Piece Variety
  • Tin Project Box
  • Exclusive HackerBoxes Decal
  • Exclusive HackerBoxes Knit Cap

Some other things that will be helpful:

  • Soldering iron, solder, and basic soldering tools
  • Computer for running software tools

Most importantly, you will need a sense of adventure, DIY spirit, and hacker curiosity. Hardcore DIY electronics is not a trivial pursuit, and we are not watering it down for you. The goal is progress, not perfection. When you persist and enjoy the adventure, a great deal of satisfaction can be derived from learning new technology and hopefully getting some projects working. We suggest taking each step slowly, minding the details, and never hesitating to ask for help.

FREQUENTLY ASKED QUESTIONS: We need a really big favor from the HackerBox members out there. Please take a few minutes to review the FAQ on the HackerBoxes website prior to contacting support. While we obviously want to help all members as much as necessary, most of our support emails involve simple administrative issues that are very clearly addressed in the FAQ. Thank you for understanding!

Express Yourself With Wearables

HB Wearables.jpg

We need to talk about your flair. Wearable electronics can be a flashy way to learn about miniaturization, power-reduction, and aesthetic PCB layout. You can really express yourself with projects like these. Wear them, decorate your workspace, or even using them as holiday ornaments. Get creative and share your very own wearable winter wonderland with the world!

LED Star Wearable

Star Kit B.png
Star Schematic.png

Let's get started with a example that is quite elegant in its simplicity. This design features five self-flashing 5mm LEDs. Since these LEDs are self-flashing, no external control circuitry is required. The only other parts are a CR2032 coin cell clip and an on/off switch.

Assembly: Orient the coin cell clip and the five LEDs according to the markings on the PCB silkscreen. Note that each LED has a "flat side" shown on the board. Before placing the battery clip, entirely tin all three pads with solder. Even though nothing gets soldered to the center pad, some tinning helps to build the pad up a bit to ensure a good contact with the negative surface of the coin cell. After soldering, operate the switch several times to clear the contacts of debris or oxidation.

Color-Cycling Name Badge Kit

Sign Completed.png
Sign Kit.png

This miniature Name Badge features eighteen LEDs with color-cycling controlled entirely by analog oscillators. This analog design reminds us that microcontrollers, as much as we love them, are not always required to obtain interesting results. The completed circuit board assembly may be worn as a blinky name badge.

Kit Contents:

  • Custom Purple Printed Circuit Board
  • Two CR2032 Coin Cell Clips
  • Six RED 3mm LEDs
  • Six Orange 3mm LEDs
  • Six Yellow 3mm LEDs
  • Three 9014 NPN Transistors
  • Three 47uF Capacitors (note that there is also one 10uF Capacitor)
  • Three 1K ohm Resistors (brown-black-red)
  • Three 10K ohm Resistors (brown-black-orange)
  • Slide Switch
  • JST-PH Socket with Pigtail
  • Decal with Three Interchangeable Sign Faces

Name Badge Theory of Operation

Sign Schematic.png

The design features three cascaded oscillators to control the LED color-cycling. Each of the 10K resistors and 47uF capacitors forms an RC oscillator that periodically pushes the associated transistor on. The three RC oscillators are cascaded in a chain to keep them cycling out of phase which makes the blinking appear random around the sign. When the transistor is "on" current passes through its bank of 6 LEDs and their 1K current limiting resistor causing that bank of 6 LEDs to blink on.

Here is a nice explanation of the basic concept using a single stage (one oscillator and one transistor).

Name Badge Kit Assembly

Sign Part Placement.png

Use the schematic and the PCB placement diagram while assembling the Name Badge kit.

There are two different values of resistors. They are not interchangeable. In order to keep them straight, note the values on the schematic and the part numbers on the placement diagram. Resistors are not polarized. They may be inserted in either direction.

Note that there are three "banks" of LEDs D1-D6, D7-D12, and D13-D18. Each bank should be all one color in order to balance the current load and also for a nice visual effect. For example, LEDs D1-D6 could all be red, D7-D12 all orange, and D13-D18 all yellow.

The capacitors are polarized. Note the "+" making on the placement digram and the "-" marking on the capacitor itself. These indicate opposite pins, obviously.

The LEDs are also polarized. Note the "+" marking on the placement diagram. The long pin of the LED should be in that "+" hole. The "flat side" of the LED should be adjacent to the OTHER hole.

Entirely tin all three pads for each of the coin cell clips with solder. Even though nothing gets soldered to the center pads, tinning helps to build the pad up to ensure a good contact to the respective coin cell.

After soldering, operate the switch several times to clear the contacts of debris or oxidation.

One of the decals may be affixed to the center of the completed Name Badge.

Pin Backings or Magnets may be glued to the back of the Name Badge.

Take care not to short the two coin cell clips together while the Name Badge is being worn.

Digispark

DigiSpark Four.png
DigiSprk Schem.png

Digispark is an open source project originally funded through Kickstarter. It’s a super-miniature ATtiny-based Arduino compatible board using the Atmel ATtiny85. The ATtiny85 is an 8 pin microcontroller that is a close cousin of typical Arduino chip, the ATMega328P. The ATtiny85 has about a quarter of the memory and only six I/O pins. However, it can be programed from the Arduino IDE and it can still run Arduino code without a hitch.

Being an open source design, there have many variations on the Digispark. Some of the most common are shown here. We'll be working with a couple of these.

Review of the schematic should immediately beg the question, "Where is the USB chip?"

Micronucleus is the piece of magic that allows the Digispark design to work without a USB interface chip. Micronucleus is a bootloader designed for AVR ATtiny microcontrollers with a minimal usb interface, cross platform libusb-based program upload tool, and a strong emphasis on bootloader compactness. It is, by far, the smallest USB bootloader for the AVR ATtiny.

LIBUSB DRIVER

libusb is a C library that provides generic access to USB devices. It is intended to be used by developers to facilitate the production of applications that communicate with USB hardware. The functionality of libusb should be automatically available on Linux and OSX. A driver, such as zadig, is may be required for Windows machines.

Digispark As USB Rubber Ducky

rubber-ducky.jpg

The USB Rubber Ducky is a favorite hacker tool. It is a keystroke injection device disguised as a generic flash drive. Computers recognize it as a regular keyboard and automatically accept its pre-programmed keystroke payloads at over 1000 words per minute. Follow the link to learn all about Rubber Duckies from Hak5 where you can also buy the real deal. In the meantime, this video tutorial shows how to use a Digispark like a Rubber Ducky. Another video tutorial shows how to convert Rubber Ducky Scripts to run on the Digispark.

CJMCU LilyTiny and NeoPixels

LilyPad Schem.png

The CJMCU LilyTiny uses the same hardware design and bootloader as the Digispark. However, the LilyTiny is built on a purple, disc-shaped PCB reminiscent of the LilyPad boards. Read more about LilyPad wearables here.

FLASH LED BLINK

Our first step will be to flash the LilyTiny with the LED blink example just to make sure our tools are in order.

If you do not have the Arduino IDE installed, do that first.

Follow instructions here to load digistump support into the Arduino IDE.

Load the "Start" example code:

File->Examples->Digispark_Examples->Start

Hit the upload button. The IDE will instruct you to plug in your target board. Once you do so, the Digispark programmer will scan the USB ports for it and program the ATtiny85.

After the upload completes, the LED should be blinking.

As a test, you can change BOTH “delay(1000)” statements to be “delay(100)” and reflash.

Now the LED should be blinking ten times faster (delay changed from 1000 to 100).

LILYPAD NEOPIXEL MODULES

Wire up the three NeoPixel modules as shown here.

Load the strandtest demo code in the IDE:

File->Examples->(for Digispark)->NeoPixel->strandtest

In the code:
Change Parameter 1 (number of pixels in strip) to 3
Change Parameter 2 (Arduino pin number) to 3

Upload and enjoy the light show - all without any USB chips!

USBasp - Atmel AVR USB Programmer

USB Programmer.jpg

When you buy a raw ATtiny85 chip (like the two 8pin DIP chips in this box) from Mouser or DigiKey, it is completely blank. The chips do not have micronucleus or any other bootloader on on them. They will need to be programmed. For example using an ISP (in-circuit programmer).

USBasp is a USB in-circuit programmer for Atmel AVR controllers. It simply consists of an ATMega88 or an ATMega8 and a couple of passive components. The programmer uses a firmware-only USB driver, no special USB controller is needed.

Insert the ATtiny85 into the Plugable Development Board (mind the pin one indicator) and wire the board up the USBasp as shown here.

Add ATtiny support to your Arduino IDE (see details at High-LowTech):

Under preferences, add an entry to the list of board manager URLs for:

https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json

Under Tools->Boards->Board Mangers, add the board manager package from ATtiny by David A. Mellis.

This will add ATtiny boards to the board list, where you can now select...

Board: ATtiny25/45/85
Processor: ATtiny85
Clock: Internal 1 MHz

[IMPORTANT NOTE: Never set the clock to external clock unless the chip actually has an external clock source.]

Load the code example for "blink"

Change LED_BUILTIN to 1 in three places in that sketch and upload it to the ATtiny85 using USBasp.

The Pluggable DevBoard LED should now blink just as the LilyTiny LED did out of the box.

Footnote - Using the Pluggable DevBoard as a Digispark:

Technically, we are using the Pluggable DevBoard here as a breakout for attaching the USBasp, not as a Digispark. To user it as a Digispark, the microcontroller will need to be programmed with the micronucleus bootload which can be downloaded here.

BitHead ATtiny85 Wearable Kit

Skull Kit.png

BitHead is the HackerBox super-sexy mascot skull. This month, he comes in PCB-form ready to rock an ATtiny85 micro, a piezo buzzer, and a couple NeoPixel eyeballs.

Kit Contents:

  • Custom Black BitHead Printed Circuit Board
  • Two CR2032 Coin Cell Clips
  • 8pin DIP Socket
  • 8pin DIP ATtiny85 Integrated Circuit
  • Passive Piezo Buzzer
  • Two 8mm Round NeoPixel LEDs
  • 10uf Capacitor
  • Slide Switch
  • JST-PH Socket with Pigtail

BitHead Wearable Assembly

Skull Schematic.png
Skull Top Silkscreen.png

Since the PCB silkscreen is used for artwork, the typical silkscreen indicators are not present on the PCB. Instead, they are shown here as an assembly diagram. Carefully orient the buzzer, capacitor, DIP8 socket, and both NeoPixels according to the markings on this assembly diagram. The leads on the NeoPixels have a wide point a few millimeters down from the plastic dome. These are tough to get through the PCB holes, so it can help to cut the leads off just above these prior to insertion. Be sure to leave enough of the leads to extend through the PCB for soldering.

Remember to entirely tin all three pads for the coin cell clips with solder. Even though nothing gets soldered to the center pads, tinning them helps to build the pad up to ensure good contact.

BitHead Wearable Programming

Skull Complete.png

The attached sketch "WearableSkull.ino" demonstrates controlling BitHead's buzzer and LEDs from an ATtiny85.

Use the Pluggable DevBoard to program the sketch into the ATtiny85.

In oder to use the NeoPixel library, we need to bump the internal clock rate from 1MHz to 8MHz under Tools->Clock. Whenever you make a change to the clock rate you have to perform a "Burn Bootloader" operation under tools, so do that now too.

Upload the BitHead demo program to the ATtiny85, carefully pop the chip out with a little flathead screwdriver, plug the chip (mind orientation) into BitHead, flip the switch, and if everything is right... IT'S ALIVE!

You can play around with the lights and sounds. See how long it takes to get sick of the "burn and learn" cycle of popping the chip in and out. Welcome back to the 1980s.

Downloads

BitHead PCB Mini-Badge

ALTSKULL combined.png

This alternate application of the BitHead mascot PCB requires two 5mm self-flashing LEDs for eyeballs instead of two NeoPixels. Since the LEDs are self-flashing, no control circuitry is required.

PREP THE LEDs

The leads on the two LEDs have a wide point a few millimeters down from the plastic dome. These are tough to get through the PCB holes. Cut the leads off just above the wide points as shown in the image. Be sure to leave enough of the leads to just extend through the PCB for soldering.

BACK SIDE OF PCB

The self-flashing LEDs only require one of the two battery clips. Short the upper battery pads as shown in the image. Use one of the leads trimmed from the LEDs as a shorting wire.

Tin all three pads for the lower coin cell clip with solder. Even though nothing gets soldered to the center pad, tinning it helps to build the pad up to ensure good contact with the coin cell.

Orient the coin cell clip as shown on the silkscreen and solder the two tabs into place.

FRONT SIDE OF PCB

Carefully orient the trimmed LEDs according to the “flat spot” markings on the image. The leads go into the center two holes, leaving the two outer holes unused. Squeeze the leads together slightly to match the hole spacing and then rock the LED gently into place.

With the the LEDs and the switch inserted from the front of the PCB. Solder their leads at the back side of the PCB.

FINISHING TOUCHES

Flush-cut soldered leads from the back of the PCB.

Insert the coin cell.

Operate the switch several times to clear the contacts of debris or oxidation.

OPTIONAL TREPANATION

Because the upper coin cell clip is not used, there is space to drill a hole to attach a ball chain or lanyard.

Hack the Planet

HB Sqr Poster SMALL.png

If you have enjoyed this Instrucable and would like to have a box of electronics and computer tech projects like this delivered right to your mailbox each month, please join us by SUBSCRIBING HERE.

Reach out and share your success in the comments below or on the HackerBoxes Facebook Page. Certainly let us know if you have any questions or need some help with anything. Thank you for being part of HackerBoxes. Please keep your suggestions and feedback coming. HackerBoxes are YOUR boxes. Let's make something great!