Introduction: Arduino - Rotating Led on Movement - Wearable Item (inspired by Chronal Accelerator Tracer Overwatch)
This instructable will help you to connect a Accelerometer and a Neopixel Led-ring.
I will provide the code to read de accelerometer and get this effect with your neopixel animation.
For this project I used the Adafruit 24bit Neopixel ring, and the MPU 6050.
The MPU 6050 combines a gyroscope with an accelerometer. I only used the last one for this project.
Step 1: Assemble Materials
Materials required are:
- Arduino Uno
- Adafruit 24 bit Ledring (I used 24bit, but if you desire a smaller or bigger one, there are more sizes available.)
- MPU 6050
- 9 Jump Wires
- Battery pack (9V)
- A circular plastic tray
- different bagstraps
- really sturdy cardboard or triplex
- some felt fabric
- spray paint in the desired colour. (I used silver)
Step 2: Soldering the Necessary Parts
Before you can use either your Neopixel Ledring or your MPU 6050, you have to sold them.
The Neopixel LedRing needs three connections.
It's recommended to sold the wired on the inside of the ring to make the finished product a lot easier to package.
- sold a Red wire to the 5V connection on your Neopixel LedRing
- sold a Black wire to the Ground connection on your Neopixel LedRing
- sold a Yellow wire to the DI connection on your Neopixel LedRing
The MPU 6050 should come with a connector consisting out of several pins. You have to sold these to your MPU 6050, like the picture above, before you can use it.
Step 3: Setup
The photo's attached show the way to setup this project.
IMPORTANT: Avoid connecting Jump Wires to a powered Arduino. If you really must, always start with connecting the Grounds.
The circuit should be set up like this:
(I suggested some colours for the wires to keep it clear and easier to work with.)
- Connect the Red wire from the 5V pin on your Neopixel Ledring to pin 13 on the Arduino Uno. (we're using a digital pin as power supply for the Neopixel Led Ring.
- Connect the Black wire from the Ground on your Neopixel Ledring to one of the Ground pins on the Arduino Uno.
- Connect the Yellow wire from the DI connection on your Neopixel Ledring to pin 4 on the Arduino Uno.
- Connect a Red wire from the VCC pin on your MPU 6050 to the 5V pin on the Arduino Uno.
- Connect a Black wire from the Ground pin on your MPU 6050 to one of the Ground pins on the Arduino Uno.
- Connect a Yellow wire from the SCL pin on your MPU 6050 to analog pin A05 on the Arduino Uno
- Connect a Green wire from the SDA pin on your MPU 6050 to analog pin A04 on the Arduino Uno
Step 4: Assembly - Neopixel LedRing
In the picture above you can see how you have to connect the Neopixel LedRing
5V = Pin 13
GND = GND
DI = Pin 4 (digital)
Step 5: Assembly - MPU 6050
In the picture above, you van see how to connect the MPU 6050 to the Arduino.
VCC = 5V
GND = GND
SCL = Pin A05 (analog)
SDA = Pin A04 (analog)
(Make sure to use rahter long wires. you're gonna need to shake and move the MPU 6050 around to test your project in the early stages.)
Step 6: Code
Now that you have finished the setup and assembly, its time to code the Arduino. All you have to do, is to open the Arduino program on your computer and then copy and paste the code from below.
To get this code to work, you might have to download the following libraries:
You can find both of them through here. Or just download the two Zip files I included.
To test the Arduino MPU 6050, first download the Arduino library for MPU 6050, developed by Jeff Rowberg.
Next, you have to unzip/extract this library and take the folder named “MPU6050” and paste it inside the Arduino’s “library” folder. To do this, go to the location where you have installed Arduino (Arduino –> libraries) and paste it inside the libraries folder.
You might also have to do the same thing to install the I2Cdev library if you don’t already have it for your Arduino. Do the same procedure as above to install it.
If you have done this correctly, when you open the Arduino IDE, you can see “MPU6050” in File –> Examples.
Next, to get the MPU 6050 and Neopixel LedRing to communicate and correspond with each other download my own code here as well. It's included in the attachments.
In this code, I explained severals variables which you can play with and change to your own preferences.
Step 7: Creating the Packaging
To make the exterior of this project I used different materials.
I tried to hide the hardware as efficiently and as beatifully as possible.
For this I started with a circular plastic tray with a diameter of 10 centimeters and a height of ... cm
This is as small as the tray can get, regarding you won't be able to fit the arduino inside if you get a tray that is any smaller. The Arduino uno will fit inside perfectly with these measurements.
My tray wat transparent green, as you can see in the picture above. I didn't want this for my final look, so I spray painted it silver. Keeping in mind not to paint the top of the lid, because it wil still need to let the light from the Neopixel through.
The tray I used has a extra sort of lid, which came in handy to use as a bottom to hold my Neopixel LedRing. Inside my tray the Arduino is on the bottom together with the MPU 6050 and the Neopixel Ledring lies on top of that supported by the extra lid.
To make this work I drilled a hole in the middle of the extra lid to allow the wires from the Neopixel LedRing through.
Besides that, I sewed a little sack of felt fabric to protect the MPU 6050 from hitting against the Arduino ot the sides and top of the tray.
Of course we shouldn't forget about the power supply of the Arduino Uno. For this I used a 9V power pack in a holder with a on-and-off switch. Due to the size of the tray the battery didn't fit inside anymore. That's why I hid the battery behind the straps. To connect the battery to the arduino while it's inside the tray, I had to drill a hole in the side of it.
Next step is to actually make it into a wearable item. To be able to attach the tray with the arduino to straps later on, I made a base plate out of very sturdy cardboard. I punched four holes in it, equally divided over the circle.
To make these straps I collected shoulderbands from old bags lying around the house. I cut these and used them to make the straps. It was very useful that the shoulderbands already has clips on them, so I could reuse those to attach it to the base plate by clipping them in the holes I punched in the base plate.
The only thing left is to attach the tray itself to the base plate. To do this, i drilled holes in the bottom of the tray and screwed it on the base.