Introduction: Twinkle Toes, Movement Changing LEDs

About: I love making things. I have for as long as I can remember liked to make stuff. Now days I have two kids (Thomas and Emma) and most of the things I do are safe for them! I love electronics and Microchips, I ha…

Give your shoes some lights! And keep those feet moving to change the color!

This was a simple idea but took a couple of attempts to get it working. I started by using a Digispark device and I tried for a few evening to get the MPU 6050 to work but couldn’t. So I decided not to waste any more time and picked up a spare Arduino nano which in all fairness is only just a little longer then the digispark.

So the parts are as follows.

1) Arduino nano (clone).

2) 10 WS2812B full colour programmable LED’s.

3) MPU 6050 combined accelerometer and gyro 3 axis for both.

4) Small LiPo.

5) Small length of servo wire.

6) 10mm silicone tube.

So the idea is to have a circle of LED’s which you can loop around the top of the shoe and hold in place with a strap under the shoe. Obviously this needs to be durable and if possible water proof as I would also like to put this on welly boots.

So let’s start with the wiring up of the 10 WS2812B LEDs, if you have never seen these before they are well worth a look. You simply provide them with - and + power up to 5 volts and then give the first LED in the chain a data input wire. The data link then continues from the first LED to the second one and so on. What this means is that you only use up one pin from your processor to control 10 full colour LED’s.

You can see in the picture how I have wired these up with servo wire, but I should point out that in all but the first led the red wire is going to the data and the white is the positive supply, you can see I swapped the wires around for the first led so I didn’t forget which wire was which.. To wire up the LED’s cut sections of wire and very carefully strip the insulation of the last 2mm of wire. I do this by using a soldering iron and melt the insulation on one side first then turn it over and do the same on the other side and whilst still hot pull the melted insulation of the end of the wire. don’t bother trying to twist the wire together just separate the 3 wires using a scalpel and solder the wires. This will cause the insulation to shrink up a bit so try and solder each wire for the same time duration.

Next hold the little PCB in a vice and solder all the wires into place, in my case I always made sure the black was in the correct place. Then repeat for as many LED’s as you want in the chain making sure you always get the positive and negative correctly aligned and this will also mean the DATA OUT aligns with the DATA IN.

Now is a good time to check the soldering joints, I use an eyeglass to make sure all the joints look good, and that the positive and negative haven’t bridged to the Data pin. If you are happy there are no shorts you can connect the string to the nano and run a simple rainbow program as shown below.

The next bit to do is stick the MPU6050 onto the back of the mini and solder the wires into place. Take a look at the pictures, I have used double sided foam tape. There are 4 wires which need connecting between the Nano and MPU6050, the positive and negative are obvious. The Data from the MPU needs to go to A4 and the clock needs to do to A5. You don’t need to worry about the other pins.

The program is very simple, consisting of only a few steps.

1) Read the MPU6050 sensor

2) Determine if the reading is above a certain G force (in any axis so you don’t have to mount the sensor a certain way). you can change the value to what you like 20000 works well.

3) If the G force (movement) is detected change the colour. Again the amount the colour changes can also be changed, by changing "J" (j = j + 2;) in the main loop.

4) Small delay to slow things down (30)

5) Start again.

Other bits in the program allow for a flag to be set if no movement is detected and then after a certain number of loops turn off the LED’s and continue to check for movement.

So the last bit to wire up is the LiPo power, this should be suffocate to power the mini and the LED’s. The Nano should can run on a voltage from 2.7 – 5.5 Volts and the LED’s will operate less than 5 volts but just a little dimmer. Because we are using a lower than 5 volt (4.2 volts max fully charged) supply we must use the 5 volt pin and not the Vin.

To program the Nano you will have to connect it to a computer via an FTPI but otherwise it’s simple to do.

Step 1: The Program.

#include

#include "I2Cdev.h"

#include "MPU6050.h"

#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE

#include "Wire.h"

#endif

MPU6050 accelgyro;

int16_t ax, ay, az;

int16_t gx, gy, gz;

int j = 0;

int turnOff = 0;

#define OUTPUT_READABLE_ACCELGYRO

Adafruit_NeoPixel strip = Adafruit_NeoPixel(10 , 9, NEO_GRB + NEO_KHZ800);

void setup()

{

strip.begin();

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

#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE

Wire.begin();

#elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE

Fastwire::setup(400, true);

#endif

accelgyro.initialize();

j = 0;

rainbow();

}

void loop()

{

accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);

if ((gx > 20000)||(gy > 20000)||(gz > 20000))

{

turnOff = 0;

j = j + 2;

rainbow();

}

else

{

turnOff = turnOff + 1;

if (turnOff > 200)

{

turnOffLEDs();

}

}

delay(30); //this delay and the turnOff loop sets the total time turnOff = 200 and delay 30 = about 6 seconds

}

void turnOffLEDs()

{

uint16_t i;

for(i=0; i

{

strip.setPixelColor(i,0,0,0);

}

strip.show();

}

void rainbow()

{

uint16_t i;

for(i=0; i

{

strip.setPixelColor(i, Wheel((j) & 255));

}

strip.show();

}

uint32_t Wheel(byte WheelPos) {

if(WheelPos < 85) {

return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);

} else if(WheelPos < 170) {

WheelPos -= 85;

return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);

} else {

WheelPos -= 170;

return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);

}

}

Lamps and Lighting Contest 2016

Participated in the
Lamps and Lighting Contest 2016

LED Contest

Participated in the
LED Contest

Circuits Contest 2016

Participated in the
Circuits Contest 2016