09 April 2013

bringing the beats

shot of the horribly messy
prototype hardware
Getting audio working on Lightwalker has been a huge pain. I played around with a few electret microphones (like this guy from sparkfun) and had some bad luck with getting it to do what I wanted. In fact, I couldn't get it to do anything worthwhile. I even went as far as switching to using my android phone as the microphone and sending volume commands to my arduino over bluetooth. Doing so requires you to calculate root mean square and count zero crossings and all sorts of audio processing that I haven't done before. Was really cool to play with and tweak. But, in the end, doing the calculations in software and sending over bluetooth turned out to be way too slow.

I ended up landing on using a spectrum shield from sparkun in conjunction with their electret micrphone breakout board. Thought the whole thing was shot when I got it. And then I realized their documentation is incorrect and you have to run the mic at 3.3v instead of 5v. Has been great since I switched it. I might end up switching to just using an MSGEQ7 instead of the entire shield, but this is fine for now.

Another challenge I ran into was trying to figure out how to make it deal with the quiet of deep playa and being on the edge of a major sound camp. Once again, moving averages to the rescue! By keeping a moving average, I can compare the current volume to the average and adjust what the peak is as I go. So, moving from a quiet environment to a loud one or vice-versa will allow the lights to react visually well in both settings.

Check out the video. The lights and music are a little more synchronized in real life, but you get a good idea.


24 March 2013

Arm stilts. Engaged.

tall shadow walking
Took a break from the electronics today to turn the wooden crutches I found at the second hand store into arm stilts. Kinda nice to see that piece come together and be able to walk around on all four limbs three feet off of the ground.

The construction is super simple. I literally just unbolted the bottom of the wooden stilts and bolted in a five foot 2" x 2" with some homemade rubber feet on them. Spent about 30 minutes cruising around the park to check it all out. Overall I'm psyched. But, I'm definitely gonna have to put in some practice time as the arm stilts are fairly heavy and it's definitely a chore to keep them lifted most of the time. Will have to re-think whether or not wood's the right material for this.
bought crutches w/ custom stilt leg

19 March 2013

multiplexing working!

The TCA9548A soldered onto a
Schmartboard w/ male pins
Surfing, scuba diving, swimming with turtles, and downing boat drinks in Hawaii must go a long way towards making one smart and productive cause I've only been back from Hawaii for 24 hours and I've already finished a book (Something Wicked This Way Comes), got 8 hours of sleep, worked for 8 hours, ate two tacos, and gotten my multiplexing chip working!

I posted a while back about getting the TCA9548A I2C multiplexing chip and the Schmartboard and just now finally got it all soldered up and tested it out. The soldering was ridiculously easy for a chip this size. Got to hand it to Schmartboard for finding a slick, easy to use design. Literally took me 10 minutes from start to finish including heating up the iron and soldering a test chip. In retrospect, I should have soldered female connections onto this board or even gotten the Schmartboard arduino shield, but I'm definitely a noob and this is what happens. It'll work for now.

The longest part of the whole ordeal was figuring out how to wire the thing up, but in the end, I got it all working and was even able to hookup two ADXL-345 accelerometers to it and get readings from both. Again, the main point of this chip is that I want to hook 4 accelerometers up to my board over I2C but all the accelerometers have the same I2C address hardcoded. So, with the TCA9548A, I can control which one I'm talking to at any point in time.

Here's the sample Arduino sketch I threw together to demo things:
#include <Wire.h>
#include <ADXL345.h>
#include <SPI.h>
#include <TCL.h>

#define TCA9548AADDR 0x74 //1110100

// For now, one object works...
ADXL345 adxl;
unsigned long lastStatus = millis();
double xyz[3];
 
void setup()
{
    Serial.begin(9600);

    Wire.begin();

    Serial.print("initing adxl0...");
    selectI2CChannels(0x1);
    adxl.powerOn();
    Serial.println("done");

    Serial.print("initing adxl1...");
    selectI2CChannels(0x2);
    adxl.powerOn();
    Serial.println("done");
}
 
void loop()
{
    unsigned long currentTime = millis();
    bool printStatus = false;

    if (currentTime > (lastStatus + 500))
    {
        printStatus = true;
        lastStatus = currentTime;
    }

    selectI2CChannels(0x1);
    adxl.getAccelemeter(xyz);
    if (printStatus)
        printXYZ("ONE");
 
    selectI2CChannels(0x2);
    adxl.getAccelemeter(xyz);
    if (printStatus)
        printXYZ("TWO");
}
 
void selectI2CChannels(int channels) 
{
    Wire.beginTransmission(TCA9548AADDR);
    Wire.write(channels);
    Wire.endTransmission();  
}

void printXYZ(char label[])
{
    Serial.print(label); Serial.print(": ");
    Serial.print(xyz[0]); Serial.print(",");
    Serial.print(xyz[1]); Serial.print(",");
    Serial.println(xyz[2]);
}
Credit for being able to figure out the code and switch between the two accelerometers should go to Kerry Wong as the basis for my test is from his blog.

I'm pretty excited about things at this point, they are really starting to come together. I think I'm past due for a cool video update showing a lot of what I've done come together. Back with that as soon as I can...

17 February 2013

multiplexing hardware


TCA9548A and a dime. Yes, I have
to solder that to a circuit board.
So... I got this chip in the mail from Texas Instruments the other day (if you ask nice, they will ship you free samples...). Looks cool, but it's not even half the size of a dime! How the hell am I supposed to solder each little pin coming off of this damn thing?!

The chip is the TCA9548A 8 channel I2C switch. It was recommended to me by Kerry Wong on his blog article about multiplexing I2C chips. The point of the chip is to be able to connect 4 of my ADXL345 accelerometers to the single I2C input line on the arduino. Now the whole point of I2C is to be able to connect multiple sensors to a single set of input lines; but, to do this, the sensors all need a unique hardware address. My accelerometers all have the same address, so I have to put the TCA9548A in between my I2C input lines and my accelerometers. The TCA9548A allows you to select one pair of input lines as the line to listen to (one out of the 8 supported that is).

28 pin 0.65 pitch TSSOP compatible
prototype board from Schmart Board
I made a quick trip to the local electronics shop and to Radio Shack and all the prototype circuit boards I could find looked like a rhinoceros compared to my little ant of a chip. A little ol' googling of the interwebs led me to SchmartBoard, a little company up in San Ramon that makes prototyping circuit boards that noobs like myself can use to deal with chips this small (That's a Thin-Shrink Small Outline Package or TSSOP for those in the know). And it turns out I was cruising the motorcycle right by their shop on business the next day! So, I stopped in and met up with Neal Greenberg, the VP of sales and marketing. Neal was fantastic and gave me the run down on what I needed to do and hooked me up with this little SOIC prototype board that will fit my TSSOP integrated circuit perfectly.

My next battle is that I've gotta find a soldering iron conical tip with a point that's smaller than 0.65 mm...

14 February 2013

Android, bluetooth, and arduino oh my.

[most of this was originally written and posted to FB on 10feb2013]

An onslaught of anti-social sentiments from an overly active couple days coupled with a ridiculous amount of caffeine spurred quite the productive Sunday. What you see here is an android powered HTC incredible 2 (AKA my playa calendar that tells me when to go to what event), paired with a BlueSMiRF bluetooth modem hardwired to a seeeduino v2.21 (basically an arduino). The phone is showing a prototype chat application I wrote that allows me to communicate with the arduino over bluetooth.

This is cool cause it proves that my phone can be used to control my entire suit! So, from my droid, I can tell my entire costume to change from green to purple or switch from being gravity sensitive to being sound sensitive. I'm pretty psyched because this means I (or you!) can change a lot of things about my suit while I'm out wandering the playa and I'm not stuck with just a handful of hardware switches controlling a limited set of options. The flip side is that my arduino can also send real-time info to my phone. With that, I can see the sensor data in real time and have an easier time of figuring out how to make the lights react the way I want.

Most of what I'm doing is on github. The android app I'm showing is here: https://github.com/gerstle/LightWalker/tree/master/tests/android/BluetoothChat and the code that's communicating back and forth with it on the arduino is here: https://github.com/gerstle/LightWalker/tree/master/tests/arduino/bluetooth

Next step? I'm about halfway through creating the first shot of my android app that will control the costume. I've also got all the material I need to make my first modified stilt setup. Well, not all of it... I still need to find some almost see-through white spandex or something. Anybody got any ideas?