Motion Controlled Wearable LED Dance Harness
Solder, Rinse, Secure, Test, Code, Repeat...
Well, we have one accelerometer calibrated for one dancer. Which is great. Except there were a total of 8x dancers. The process outlined above needed to be repeated 7x more times.
I was not sure what to expect until after observing each accelerometer. Rather than having multiple sketches for each dancer, it was decided to make a condition statement that jumped to a modular function called calibrationADXL335()
that contained each calibration just before uploading the code. Here's part of the code written for the MinionAccelerometerV2.1.ino sketch.
language:c
//...
void calibrationADXL335() {
//function to calibrate ADXL335 accelerometers due to manufacturing tolerances
//read the values sent through the Arduino serial monitor to determine the values
//when calibrating. adjust the values accordingly. the values in the brackets are
//the min/max values used for the condition statements
if (calibration_M == 1) {
xUp = 540; //xRead > xUp, ...~ [550]-580 at REST
xDown = 488; //xRead < xDown, it's ~437-[488] at REST
yUp = 544; //yRead > yUp, it's ~[544]-580 at REST
yDown = 480; //yRead < yDown, it's ~445-[480] at REST
zUp = 608; //zRead > zUp, it's ~[608]-642 at REST
zDown = 435; //zRead < zDown, it's ~414-[435] at REST
}
else if (calibration_M == 2) {
xUp = 570; //xRead > xUp, ...~ [570]-607 at REST
xDown = 436; //xRead < xDown, it's ~405-[436] at REST
yUp = 610; //yRead > yUp, it's ~[610]-610 at REST
yDown = 430; //yRead < yDown, it's ~407-[430] at REST
zUp = 613; //zRead > zUp, it's ~[592]-619 at REST
zDown = 440; //zRead < zDown, it's ~410-[440] at REST
}
else if (calibration_M == 3) {
xUp = 590; //xRead > xUp, ...~ [590]-607 at REST
xDown = 436; //xRead < xDown, it's ~404-[436] at REST
yUp = 601; //yRead > yUp, it's ~[601]-610 at REST
yDown = 419; //yRead < yDown, it's ~405-[418] at REST
zUp = 592; //zRead > zUp, it's ~[592]-619 at REST
zDown = 430; //zRead < zDown, it's ~410-[430] at REST
}
else if (calibration_M == 4) {
xUp = 585; //xRead > xUp, ...~ [585]-604 at REST
xDown = 424; //xRead < xDown, it's ~407-[424] at REST
yUp = 598; //yRead > yUp, it's ~[598]-607 at REST
yDown = 420; //yRead < yDown, it's ~405-[420] at REST
zUp = 615; //zRead > zUp, it's ~[615]-622 at REST
zDown = 441; //zRead < zDown, it's ~421-[441] at REST
}
else if (calibration_M == 5) {
xUp = 590; //xRead > xUp, ...~ [590]-607 at REST
xDown = 437; //xRead < xDown, it's ~408-[437] at REST
yUp = 598; //yRead > yUp, it's ~[598]-610 at REST
yDown = 412; //yRead < yDown, it's ~407-[412] at REST
zUp = 600; //zRead > zUp, it's ~[600]-620 at REST
zDown = 431; //zRead < zDown, it's ~421-[431] at REST
}
else if (calibration_M == 6) {
xUp = 580; //xRead > xUp, ...~ [580]-610 at REST
xDown = 413; //xRead < xDown, it's ~404-[413] at REST
yUp = 601; //yRead > yUp, it's ~[595]-605 at REST
yDown = 411; //yRead < yDown, it's ~405-[411] at REST
zUp = 607; //zRead > zUp, it's ~[607]-625 at REST
zDown = 430; //zRead < zDown, it's ~418-[430] at REST
}
else if (calibration_M == 7) {
xUp = 585; //xRead > xUp, ...~ [585]-607 at REST
xDown = 429; //xRead < xDown, it's ~407-[429] at REST
yUp = 603; //yRead > yUp, it's ~[603]-611 at REST
yDown = 419; //yRead < yDown, it's ~407-[420] at REST
zUp = 605; //zRead > zUp, it's ~[605]-618 at REST
zDown = 434; //zRead < zDown, it's ~411-[434] at REST
}
else if (calibration_M == 8) {
xUp = 585; //xRead > xUp, ...~ [585]-607 at REST
xDown = 436; //xRead < xDown, it's ~405-[436] at REST
yUp = 593; //yRead > yUp, it's ~[593]-615 at REST
yDown = 420; //yRead < yDown, it's ~407-[420] at REST
zUp = 595; //zRead > zUp, it's ~[595]-614 at REST
zDown = 440; //zRead < zDown, it's ~411-[440] at REST
}
else {
xUp = 585; //xRead > xUp, ...~ [585]-607 at REST
xDown = 436; //xRead < xDown, it's ~405-[436] at REST
yUp = 601; //yRead > yUp, it's ~[601]-615 at REST
yDown = 419; //yRead < yDown, it's ~404-[419] at REST
zUp = 616; //zRead > zUp, it's ~[616]-642 at REST
zDown = 440; //zRead < zDown, it's ~410-[440] at REST
}
//
/*
* //calibration with tech support ADXL335.
//default calibration_M = 0
//default calibration for quick test of the adapter board
xUp = 605; //xRead > xUp, it's~[600]-604 at REST
xDown = 411; //xRead < xDown, it's ~399-[411] at REST
yUp = 607; //yRead > yUp, it's ~[607]-612 at REST
yDown = 409; //yRead < yDown, it's ~395-[409] at REST
zUp = 610; //zRead > zUp, it's ~[610]-618 at REST
zDown = 425; //zRead < zDown, it's ~ 410-[425] at REST
*/
}
It was interesting to see that most of the values were close to the first calibration. However, there were a few values that deviated slightly and needed to be adjusted with respect to the accelerometer. When testing the controller during a rehearsal, I noticed that the accelerometer was not positioned perfectly on each dancer. Depending on how tightly the harness was tied, the accelerometer was sometimes loose and not moving perfectly with the dancer. I also noticed that the dancer was not moving perfectly onto their sides as planned. The moves that I imagined to be on their side were actually more at a 45° angle with respect to where the sensor was attached. Certain patterns started triggering as if the dancer was on the left side, stomach, or right side.
With all these conditions in mind, I had to add some padding instead of using the exact maximum/minimum values to trigger the LEDs as expected. I also had to be aware of how tightly the harness was secured for each dancer. Whew, that was exhausting.