Sarah’s Final Project: Slither

Slither is a desk pedometer, it tracks your steps and displays them visually. It is the perfect product for people who spend too much time at their desk. Instead of relying on your iPhone or Apple watch to remind you to get up from your desk and start walking Slither takes care of those reminders in sleek way. This decorative desk piece lights up to show you your progress towards walking your 50,000 step/week goal.

Slither’s form came from…a snake. Slither actually started as a painting I made for fun it evolved into a vector and now a pedometer. I definitely pushed my boundaries trying to create such a complex shape that contained several pieces.

The Materials

  1. Passion fruit Acrylic
  2. Hall effect sensor + Magnet 
  3. Adafruit HUZZAH ESP8266 wifi Breakout
  4. Wires
  5. Soldering Kit + solder
  6. 2 x Adafruit NeoPixel LED Side Light Strip – Black 90 LED 
  7. Hot Glue gun (with glue) + Gorilla glue
  8. IFTTT + Adafruit IO accounts
  9. Scrap wood
  10. 5V 2A switching power
  11. .75″ PVC pipe
  12. Edge tape
  • Machines
    1. CNC (wood)
    2. Laser Cutter (acrylic)
    3. Sander

The Build
Construction started with the CNC machine. We spent a lot of time together. Probably too much.

Once I calculated the dimensions I would need I CNC-ed my shapes out of plywood. I made sure to add dowel holes so the wooden frames would align properly.

I had to do some extra chiseling and sawing to get the shapes out. I also cut some PVC pipe that would be my on/off switch.

My wood frames needed lots of sanding. Next, I used the dowels to stack the frames on top of each other. Each frame had a layer of wood glue. I clamped that together for 30 mins.

Next I used the laser to cut the same shape out and also some circles for the PVC piece.


My feather huzzah board was connected to both a hall effect sensor and two strips of LED lights. The hall effect sensor is a sensor that turns on in the presence of a magnet.

Not pictured: lots of soldering…and resoldering…and oh no it broke soldering.

Next up, start trying to fit the huzzah board and LEDs.

I glued the acrylic piece to the top wood frame

Next, I glued an acrylic circle to cut PVC pipe. Wet wood strips and molded it to the cylinder volume before gluing.

The Code & Circuit
I used IFTTT to create a trigger for the Fitbit app. Every day the Fitbit app would fire a notification to my Adafruit IO feed with a step count. I set a goal for 50,000 steps. Slither would continue to light up until 50,000 steps was hit. When it hit the goal slither would go dark and reset.

Challenges

The CNC proved to me very time consuming. I think I will be more aware of the time it takes in the future and the problems that may arise with working with a machine like that. Lots of testing had to be done and many of the frames I wasn’t super happy with I ended up using for times sake. Sanding these frames was difficult because of the small spaces between.

If I were to do this again I would definitely probably try not to fit everything into the snake. Trying to fit it all inside caused lots of electrical issues and broke my circuit a few times. If I did try and fit it all inside again, I would make the head larger. I wasn’t able to finish the back pieces because the gap wasn’t large enough.

I wasn’t able to UV print on the acrylic because it was broken. Funnily, the placement for the dowels ended up looking like eyes anyway. If I could make this again I would add a layer of matte clear plastic so you didn’t see the gaps for the LED channel so much.

What I learned

  • 3D print probably would have been easier
  • Don’t get so complicated with shapes for the CNC machine
  • Compressed boards would probably have been better than plywood in terms of chipping
  • Mini LEDs are very difficult and time consuming to solder
  • Hall effect sensors aren’t as sensitive as you’d think
  • Laser cutting is pretty easy
  • You can do weird dancing when PoD is empty

Instructables:
https://www.instructables.com/Slither-a-Visual-Pedometer/

The Code

#define IO_USERNAME    "YOUR IO USERNAME"
#define IO_KEY         "YOUR IO KEY"

#define WIFI_SSID       "PUT WIFI NAME HERE"
#define WIFI_PASS       "PUT PASSWORD HERE"

#include "AdafruitIO_WiFi.h"
AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS);

/************************ Main Program Starts Here *******************************/
#include <ESP8266WiFi.h>
#include <AdafruitIO.h>
#include <Adafruit_MQTT.h>
#include <ArduinoHttpClient.h>

// #define BUTTON_PIN 4
//#define LED_PIN 13


#include <Adafruit_NeoPixel.h>

#define PIXELS_PIN 15
#define NUM_LEDS 180
#define BRIGHTNESS 50
#define HALL_SENSOR 2

Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIXELS_PIN, NEO_GRB + NEO_KHZ800);

int state = 0;
int TotalSteps = 0;
int ledlevel = 1;


// button state
//int current = 0;
//int last = 0;
//int sensorValue = 0;

// set up the 'command' feed
AdafruitIO_Feed *slither = io.feed("slither");



void setup() {

  // set button pin as an input
  // pinMode(BUTTON_PIN, INPUT_PULLUP);
 // pinMode(TotalSteps, INPUT);
  pinMode(HALL_SENSOR, INPUT);


  strip.setBrightness(BRIGHTNESS);
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'


  // start the serial connection
  Serial.begin(115200);

  // connect to io.adafruit.com
  Serial.print("Connecting to Adafruit IO");
  io.connect();
  
  // set up a message handler for the 'command' feed.
  // the handleMessage function (defined below)
  // will be called whenever a message is
  // received from adafruit io.
 slither->onMessage(handleMessage);

  // wait for a connection
  while(io.status() < AIO_CONNECTED) {
    Serial.print(".");
    delay(500);
  }

  // we are connected
  Serial.println();
  Serial.println(io.statusText());

}

void loop() {

  // io.run(); is required for all sketches.
  // it should always be present at the top of your loop
  // function. it keeps the client connected to
  // io.adafruit.com, and processes any incoming data.
  io.run();
  ledlevel = map(TotalSteps,0,50000,0,strip.numPixels());


  state = digitalRead(HALL_SENSOR);
  if (state == LOW){
    Serial.println("Hall Effect Sensor Activated");
    Serial.print("LEDs to light up: ");
    Serial.println(ledlevel);
for(int i=0; i<ledlevel; i++) { 
   strip.setPixelColor(i, strip.Color(100,0,30)); //on
   strip.show();
}  
delay(10);

  }
  else {
    Serial.println("no magnet detected");
for(int i=0; i<strip.numPixels(); i++) { 
strip.setPixelColor(i, strip.Color(0,0,0,0)); //off
   strip.show(); 


    }
  }
}






// this function is called whenever a 'command' message
// is received from Adafruit IO. it was attached to
// the command feed in the setup() function above.
void handleMessage(AdafruitIO_Data *data) {

  //int command = data->toInt();
  TotalSteps = TotalSteps+ (data->toInt());


Serial.print("steps counted: ");
    Serial.println(data->value());
    

if (TotalSteps >= 50000){
  TotalSteps = 0; 

}

// else {

    //Serial.println("no steps");
    
  

//
//
//  //change NeoPixel color here using format strip.Color(R,G,B,W)
//     strip.setPixelColor(0, strip.Color(0,0,0,100)); //turn off NeoPixel
//     strip.setPixelColor(1, strip.Color(1,0,100,0)); //turn off NeoPixel
//     strip.setPixelColor(2, strip.Color(2,100,0,0)); //turn off NeoPixel
//     strip.setPixelColor(3, strip.Color(3,100,100,0)); //turn off NeoPixel
//     strip.setPixelColor(4, strip.Color(4,0,80,40)); //turn off NeoPixel
//     strip.setPixelColor(5, strip.Color(5,90,0,20)); //turn off NeoPixel
//     strip.show(); //always remember to call strip.show() to display changes
//
//     
//     delay(500);
//
//     strip.setPixelColor(0, strip.Color(0,0,0,0)); //turn off NeoPixel
//     strip.setPixelColor(1, strip.Color(0,0,0,0)); //turn off NeoPixel
//     strip.setPixelColor(2, strip.Color(0,0,0,0)); //turn off NeoPixel
//     strip.setPixelColor(3, strip.Color(0,0,0,0)); //turn off NeoPixel
//     strip.setPixelColor(4, strip.Color(0,0,0,0)); //turn off NeoPixel
//     strip.setPixelColor(5, strip.Color(0,0,0,0)); //turn off NeoPixel
//
//     strip.show(); //always remember to call strip.show() to display changes
//     
//  } 
}
%d bloggers like this: