Hug-Time Bracelet

Introduction: Hug-Time Bracelet

About: Electronics engineer in San Diego

I wanted to make my daughter a bracelet that she could wear that would tell her when it was Hug-Time so she could pretend to be one of the characters from Trolls. For those of you that don't know, the trolls spend all their time singing and dancing, but once an hour they have hug time. All the trolls are synced up with a flower bracelet that lights up when its time to hug.

This seemed like a pretty quick project that incorporated mechanical, electrical, and software designs. Parts were easily found on Adafruit. They have a line of very small kits based on the ATiny85 that were designed to be integrated into a wearable, Gemma is the smallest.

The M0 version of the kit can be programmed with CircuitPython. Adafruit provides some example code that was exactly what I needed to get the project programmed.

Step 1: Parts and Feature List

Parts

Adafruit Gemma M0

Adafruit MicroLipo Charger

Adafruit 150mAh Lipo Battery

Package of Velcro cable ties

3D printed case and flower top, files on Thingiverse

Features

  • Hug indicator is the RGB LED on the Gemma board
  • Programmable Hug indicator turn-on time
  • Hug indicator slow ramp turn on
  • Capacitive touch reset
  • Removable flower lid to access the on/off switch
  • On-board USB charger
  • No need to remove electronics to charge, USB connects through the case

Step 2: Prep and Wire the Electronics

The Gemma board is perfect for this project, but to keep the bracelet small enough for a 3 year-old's wrist, I needed to choose a very small battery. The 150mAh battery is just the right size but needs to be charged every day. 3 year-olds can't put caps back on markers so we can't expect them to turn electronics off when not in use.

This realization forced the need for an on-board charger.

Looking at the Gemma schematic and the charger schematic I could see how to connect these two together. See the schematic snips.

Prep the Charger Board

To make the charger board fit inside the case you have to first remove the micro-USB jack and the battery connector. Carefully take a heat gun and warm the board. Don't blast away at it or you could desolder the passives. You just want enough heat to get the solder on the USB jack and battery connector's large pads to almost melt. Then quickly take a soldering iron and move from pad to pad melting the solder while prying the connectors up with small pliers.

Pulling the jack mounting pads off the board is ok because you are going to use the thru-hole test point vias provided on the board.

Wire the Boards Together

The charger board has convenient little thru-hole vias that make wiring easy. Take two twisted pairs of short wire and solder them as shown.

Charger 5V ------>Gemma Anode D2

Charger BAT----->Gemma Anode D1

Charger GND pads ----->Gemma board edge GND pad

Wire routing is shown in the pictures

Protect the Charger Board

Take some non-conductive tape, I used Kapton, to insulate the electronics from the getting shorted. This is just a precaution.

Step 3: Connect and Test the Battery

The battery has a 150mAh capacity. The documentation for the Gemma has the current consumption at about 9mA. So that roughly means that if the Gemma is on, the battery will drain in 16.7 hours

9 * t = 150 ----> t = 150/9 = 16.7

The documentation for the charger states that it comes pre-configured with a 100mA charge. A fully drained battery will charge in 1.5hours (150mA/100mA=1.5)

Connect the battery to Gemma's battery header. The battery comes with the mate to the connector so connection is super easy, just snap it in. Then connect a micro-USB cable to Gemma's USB jack and the other end of the cable to a USB wall charger or USB port on a computer. The charger's red LED will be on, indicating the battery is charging. There is a green LED that will signal the charge is complete.

Protect the Battery

The battery seems to be wrapped in mylar. I used the same Kapton tape to insulate the battery.

Quirk...

One thing to note is when VBUS is NOT connected, the red charging LED on the MicroLipo board will be slightly on. This is due to the reverse leakage of the blocking diodes on Gemma. A small current will be flowing from cathode to anode on the VBUS diode from the battery. This small current flows through the charger's red LED enough to turn it on a little. There will be no damage to the charger chip in this mode.

Standby current draw is minimal. I've had the bracelet OFF for a week and it still has enough charge to run. So I'm ok with this small draw.

Step 4: Program Gemma With CircuitPython

I used CircuitPython to program Gemmo. A tutorial can be found HERE.

First I modified the example main.py file that comes loaded on Gemma by default. The example code employs a capacitive touch sensor and an RGB LED driver.

Below is the code:

# Hugtime Bracelet
# mcencinitas

from adafruit_hid.keyboard import Keyboard from adafruit_hid.keycode import Keycode from digitalio import DigitalInOut, Direction, Pull from analogio import AnalogIn, AnalogOut from touchio import TouchIn import adafruit_dotstar as dotstar import microcontroller import board import time

# One pixel connected internally! dot = dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=0.1) dot[0]=0x000000 #Init to OFF

#Cap touch on A2 touch2 = TouchIn(board.A2)

###################CONSTANTS###################################

HUGLITE = 0x0040ff #HUGTIME = 60 * 60 #One Hour (60s * 60min) HUGTIME = 60 * 2 #Debug, 2min

######################### HELPERS ##############################

#Fade dot in and out def fade(pixel): i=0.2 while i<=1: pixel.brightness=i time.sleep(0.075) i+=0.1 print(i) return

######################### MAIN LOOP ##############################

time_zero = time.monotonic() while True: cur_time=time.monotonic() - time_zero if (cur_time > HUGTIME): #Loop until HUGTIME is reached dot[0] = HUGLITE #Set LED to the desired color dot.show() #Program the LED fade(dot) #Fade in the LED while touch2.value==0: wait=1 #Hold here till the sensor is touched

dot[0]=0x000000 #Turn off LED after reset dot.brightness=0.1 #Reset brightness so next time LED turns on it can fade up time_zero = time.monotonic() #Reset zero time #print(cur_time)

CircuitPython is quite clever in that you edit this file in your favorite editor (Idle, notepad, Mu, etc...), name it "main.py", and just copy it to the Gemma. Gemma shows up as a hard drive, you just drop your main.py on the drive. Gemma reboots automatically and runs the code... Simple!

Step 5: Print the Case and Assemble

Case

Download the .stl files from Thingiverse

3D Printer settings are on the Thing page. I used ABS, you can use whatever you are comfortable with.

The full case is two parts

  1. The flower top
  2. The electronics case

Assembly

The case has slots at the bottom to feed the Velcro cable tie through to act as a wrist band. Feed the band through the slots before putting the electronics into the case.

Next you want to make an electronics sandwich. I found that if you had the Gemma board on top, you could fit the battery in the middle and the charger on the bottom in a nice stack up. The battery wire is rather long. It probably could be trimmed up, I just didn't want to mess with it. It wraps around on the top.

After you have your sandwich, snap it into the case using the hole for the USB port as a guide. Plug a USB cable into the Gemma board through the case, but don't connect the other end of the cable. This will hold the board in place as you find a good spot to drill a small hole for the capacitive reset "button"

I used a short but thick piece of wire as my reset "button". The wire was taken from a single in-line header, but you can use any type of wire. Figure out the best place to put the hole on your case, mark it, then drill.

Leave the wire longer than the final length. You will want to trim to the side of the case with the electronics all in their final place.

Take the electronics out, unplug the battery, and solder the wire to Gemma's A2 pad.

Reassemble the electronics back in the case with the wire fed through the hole and the USB jack in place. Snip the reset "button" to be almost flush with the case.

Step 6: Test

Turn on Gemma and wait for the LED to turn on.

The turn on is a ramp on, so it gradually gets brighter.

Receive your hug

Touch the "button" to reset the timer

Enjoy All Your Hugs!!!

Share

    Recommendations

    • Fix It! Contest

      Fix It! Contest
    • Tiny Home Contest

      Tiny Home Contest
    • Water Contest

      Water Contest

    Discussions

    Interesting idea. I make projects from my kids favorite shows too. Its a lot of fun.