HackerBox 0025: Flair Ware

Published

Introduction: HackerBox 0025: Flair Ware

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!

Step 1: HackerBox 0025: Box Contents

  • HackerBoxes #0025 Collectable Reference Card
  • LED Star Wearable Kit
  • Color-Cycling Sign 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!

Step 2: Express Yourself With Wearables

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!

Step 3: LED Star Wearable

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.

Step 4: Color-Cycling Sign Kit

This miniature "sign" 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

Step 5: Sign Kit Theory of Operation

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).

Step 6: Sign Kit Assembly

Use the schematic and the PCB placement diagram while assembling the sign 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.

Again, 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.

Step 7: Digispark

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.

Step 8: Digispark As USB Rubber Ducky

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.

Step 9: CJMCU LilyTiny and NeoPixels

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!

Step 10: USBasp - Atmel AVR USB Programmer

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.

Step 11: BitHead ATtiny85 Wearable Kit

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

Step 12: BitHead Wearable Assembly

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.

Step 13: BitHead Wearable Programming

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.

Step 14: Hack the Planet

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!

3 People Made This Project!

Recommendations

  • Casting Contest

    Casting Contest
  • Make it Move Contest

    Make it Move Contest
  • Clocks Contest

    Clocks Contest
user

We have a be nice policy.
Please be positive and constructive.

Tips

0

1. Save yourself a headache and forget about the USBasp if it dit not work, get an arduino and use it as Arduino as ISP. (some of these USBasp devices are not properly flashed)


2. Do not forget to perform the burn bootloader step every time you change mcu speed

3. my box had faulty switchs, best way to check is just to short the switch pins to turn on your device. (mine would turn on eventually when set to off and sometimes not turning on at all when you wanted to)

2 Questions

"LED_BUILTIN" is not in the blink sketch.

AT-tinyERR.jpg

0

What about the battery part of the LilyTiny? Can it work with one CR2032? will the neopixels work with it?

36 Comments

I have not been able to make Arduino IDe to detect the Programmer.

It keeps saying:
Arduino:1.8.1 (Windows 10), Tarjeta:"ATtiny25/45/85, ATtiny85, Internal 8 MHz"

avrdude: Warning: cannot query manufacturer for device: No such file or directory

avrdude: Warning: cannot query product for device: No such file or directory

avrdude: Warning: cannot open USB device: Function not implemented

avrdude: error: could not find USB device with vid=0x16c0 pid=0x5dc vendor='www.fischl.de' product='USBasp'

Already done the Zadigs steps and Windows is no longer reporting the device with no drivers.

6 replies

It's a driver issue try this
http://forum.arduino.cc/index.php?topic=415210.msg2862244#msg2862244

Thanks, although i am still not able to program it either.

now i get
avrdude: warning: cannot set sck period. please check for usbasp firmware update.

avrdude: error: program enable: target doesn't answer. 1

avrdude: initialization failed, rc=-1

Double check connections and try again, or use -F to override

this check.

I have tried the slow programming jumper and different attiny chips i had at hand, none are working. I am really unsure if the programmer still has driver issues, the Attinys are DOA. triple checked all connections already.

Remember.. pin 8 and 10 from the USBasp 10 pin connector are ground for the pin 4 of the ATTINY85 in Step 10. Relocate the green wire in step 10 to pin 8 or 10 on the USBasp. You WILL get the SCK period warning, it is fine, no need to mess with a firmware update for the USBasp, as programming works with out any troubles.

After attempting to reflash the firmware and reviewing all connections like a cazy one, finally found the issue.

A bad Solder joint (an inexistent one?) in my USBasp.

After getting my soldering iron fired up i had to desolder it and sand it a bit because for the love of tin and borax this pad wouldn't get wet whatever i did.

I am so ashamed i wasted so much to debuging this.

IMG_20180302_153911058.jpg

I never got the USBasp working, i guess it was DOA
i might find another time to try to reupload the firmware.

I used the ArduinoUNO isp method and it worked flawlessly

I was having this issue until I was able to get the driver to work. I ended up using the driver from https://protostack.com.au/shop/accessories/usbasp-...
Check if the driver is installed by pressing "win + x" then "m". That will bring up the device manger and you can see if it is installed. Mine is listed under libusbk devices
I rebooted windows as well for good measure. I still get an avrdude warning but the upload to the chip does work.

my skull has the eyes light up blue and not change. even when the ATTiny isn't plugged in. Anyone else seen this?

Is anyone else getting the star pcb to shine (slowly) even when switch is off?

I had to pull the battery off

3 replies

make sure that your solder joints are not bridging, you may need a magnifying glass to see it clearly. or one could use a multimeter to see where the power is not being turned off at.

thanks mate but it is not that.

I have soldered over +200 surface contact pcb's for my personal proyects and university's.

It seems it is a faulty switch, i changed it for a new one sourced localy and it no longer leaks.

All of my switches were faulty. If I didn't switch them off just right they would turn back on.

I tried every shown way to program the AtTiny85 and got errors every time I tried to upload. Finally found a link on YouTube showing how to use Arduino Uno as a programmer for AtTiny85. Super easy.

https://www.youtube.com/watch?v=VlUq2COFjj4

3 replies

RustinR. I used your video link. He is a fast talker but I've got mine running. Much easier and a lot less hassle. Thanks so much for sharing.

Hahaha...... I had to pause the video at every step because I couldn't keep up with him.

Got the programmer to work using the UNO too, yea he is a fast talker. Going to see if there is enough memory to put part of the Imperial march in place.

Hey guys i just started getting into this kind of thing would anyone be willing to maybe explain in layman's terms or point me in the right direction of some reading material and such that could help me understand? Cheers!

Anyone have any luck getting the Digistump connected on osx? I've got the board manager AVR selected, but the device never shows up under port.

Remember.. pin 8 and 10 from the USBasp 10 pin connector are ground for the pin 4 of the ATTINY85 in Step 10.
When I followed the wiring diagram ( Step 10: USBasp - Atmel AVR USB Programmer ) for the pluggable Dev board on this page, random results were happening during programming.
ATTINY85 had no ground on pin 4.
I could program the ATTINY85 with out the Pluggable dev board just fine using a breadboard.
So use the diagram ( USBasp to Pluggable Dev Board ), but ensure the green wire is going to pin 8 or 10 on the USBasp 10 pin connector.

USBaspAtmelAVRUSBProgrammer.jpg

Had issues as well with the ATtiny. Used Zadig and set the driver to winusb(vb6.1.7600) and installed the driver. Boom uploaded fine.

win10 machine