Wearable Robotic Propeller Hat with Programmable Lights


Make a programmable wearable

How we made a wearable project by combining Smartibot with a propeller hat and some fairy lights. This was a very quick and simple build with some interesting JavaScript programming to make the three sets of fairy lights pluse at different rates. 

Looping video of a hat with a motorised propeller on it and some lobster shaped fairy lights being controlled form a smartphone appLooping video of a teenage male covered with pulsing lights walking past the camera

Not just a robot

When we designed Smartibot we wanted to make something that made it really easy to build programmable robots and other things that move around, but we never thought that was all it could be for. We put four outputs (M1 to M4) on the circuit board which can supply up to 1.5A of current in either direction so that it would be really easy to hack existing toys and other battery operated items. Basically anything that runs on 6 or fewer AA or AAA batteries can be connected to one of those outputs and powered and controlled by Smartibot.

Hacking toys

During our take over of the OKIDO shop in Hammersmith my cousin Daniel and I ended up with some free time in the mall so went looking for some cheap items we could hack together into something fun. We found a propeller hat and three sets of lobster shaped, battery operated, fairy lights. We realised we could motorise the propeller using a Smartibot motor and set the lights so they would fade and flash in a sequence we programmed onto the Smartibot.

Looping video of young man wearing spinning the propeller on a multicoloured hat he is wearing

 

Motorising the hat

As we wanted the propeller to spin quickly we realised we didn’t need the gearbox that comes with Smartibot motors so we removed it by unhooking the little plastic strap that holds the motor into the gearbox and pulling the motor out. The motor has a small pinion gear fixed to the shaft which is ideal for attaching the propeller to using some hot glue. We removed the propeller by straightening the end of the stiff wire it is attached to and then we reattached all the beads and bent the wire back again. Then we hot glued the side of the motor to the side of the beads so that it would stick up out of the top of the hat. Finally we hot glued the propeller onto the pinion gear on the top of the motor.

Photo of small electric motor attached to a line of beads sticking out of the top of a multicoloured hat

Looping video of a propeller being rotated

Making the hat smart

To control the motor and the lights we needed to attach the Smartibot circuit board to the hat and also put the battery box somewhere to power everything. We decided to put the battery box just inside the top of the hat and made a small hole in the front to push the power cable through. This allowed us to plug the power cable into the top of the Smartibot board which we stuck to the front of the hat using four sticky pads (it could also be sewn on using the four mounting holes in the corner but we didn’t have a needle and thread and were in a hurry).

Connecting up the fairy lights to the robot

As they are powered by by little battery boxes connecting the lights to the Smartibot board was very easy. We just cut off the battery boxes and stripped the end of the wires so we could wire them into the screw terminals on the ‘M’ outputs on the Smartibot board.

Photo of a wire leading to a battery box being cut with some wire cutters

Photo of wires connected to screw terminal on Smartibot circuit board

Programming the wearable

We wanted the propeller to run continuously whilst we wanted to have the fairy lights gently fade in and out to give a kind of pulsing effect. Because we had three strings of lights that we could control independently, we thought it would be nice if they pulsed at different rates. To achieve this we opened up Espruino and wrote some code in JavaScript with a function called fadeLights() which runs every 5 milliseconds as it is called by setInterval(fadeLights, 5). Within the fadeLights function we needed some logic to keep track of whether each set of lights was fading up or down and to reverse that when they got to full brightness or full darkness and then some logic to increase or decrease the brightness of each set depending on whether they were fading up or down. We made the rate of fading different for each set of lights by varying the amount that gets added or subtracted from the brightness value each cycle. The code is below and here is a guide on how to load it onto your Smartibot using Espruino.

 



//We connected the motor to M2 and the lights to M1, M3 and M4

var smarti = require("Smartibot");

let ledBrightness1 = 0;
let ledBrightness3 = 0;
let ledBrightness4 = 0;
var oneup = 'TRUE';
var threeup = 'TRUE';
var fourup = 'TRUE';
var mototwo = 0.5;
smarti.setLEDs([255,0,0], [255,0,0]);

let fadeIn = false;

function fadeLights() {
 
//Works out if any of the sets of lights have reached full brightness (0.5) or dull dimness (0)

 if(ledBrightness1 >= 0.5){
   oneup = !oneup;
 }
  
if(ledBrightness1 <= 0){
   oneup = !oneup;
 }
  
   if(ledBrightness3 >= 0.5){
   threeup = !threeup;
 }
  
  if(ledBrightness3 <= 0){
   threeup = !threeup;
 }
    if(ledBrightness4 >= 0.5){
   fourup = !fourup;
 }
  
if(ledBrightness4 <= 0){
   fourup = !fourup;
 }

//Adds or decreases brightness for each set of lights depending on which direction they are fading in 
 
  if(oneup == 'TRUE'){
     ledBrightness1 += 0.02;
     }
     else
     {ledBrightness1 -= 0.02;
     }
  
    if(threeup == 'TRUE'){
     ledBrightness3 += 0.01;
     }
     else
     {ledBrightness3 -= 0.01;
     }
    if(fourup == 'TRUE'){
     ledBrightness4 += 0.04;
     }
     else
     {ledBrightness4 -= 0.04;
     }
  
  //Writes the brightness values to the ports the lights are connected to

  smarti.setMotor(1, ledBrightness1);
  smarti.setMotor(3, ledBrightness3);
  smarti.setMotor(4, ledBrightness4);
  smarti.setMotor(2, mototwo);
}
//Makes the fadeLight function run evert 5 miliseconds
setInterval(fadeLights , 5);

What we learned

Photo of some lobster shaped fairy lights around the neck of a male teenager

The actual build for this project was quicker and easier than we had expected and we were really happy with the way it looked. Getting the code right was actually the slowest and most difficult part of the project but were were really happy with how the lights looked pulsing so it was worth the effort. I’d like our next wearable project to look a bit more intentional (and less like a collection of things we found in a cheap shop) and ideally include both the AI (which means housing a smartphone) and I think using some servo motors would also be really nice. I think a hat was a good piece to make as it’s fairly contained and fits lots of people so the next project may be another hat, just hopefully a bit more ‘fashion’ and a bit less £1/$1 store.

Looping film of a teenaged man in a motorised propeller hat and motorised lobster lights saying "You can'r really get much better, really"

 

0 comments

  • There are no comments yet. Be the first one to post a comment on this article!

Leave a comment

Please note, comments must be approved before they are published