Week Nine: Input Devices

dance dance revolutionizing


Measure something: add a sensor to a microcontroller board and read it.



This week I wanted to make ballroom dance partner peace mediating system. When dancing, you need to know what foot your weight is on and disagreements on this often cause arguments between partners. Pressure sensors in each shoe would determine how the dancer was standing and LEDs on the dancer's shoulder and wrists would make that information visible to both people.

I took a twisted path towards this system, with a few side-results along the way, including a light sensor, a stretch sensor, a pressure sensor, and the final(ish) system:


Here are the board and code files for the various sensors:



I created my board using Eagle and building from the light sensor design. I wanted to add multiple sensors and output pins, so I switched from the ATtiny45 to the ATtiny44. I also made the original ATtiny45 light sensor board and vinyl cut traces for a few sets of LEDs in parallel.

I milled and stuffed the board with the Roland Modela as usual. I vinyl cut the traces for the LEDs...this was a learning experience, possibly one I would not repeat.

I had to do some system prep before running the code. First I installed tkinker though "sudo apt-get install python-tk" and added execution privileges to the python scripts. A few sticking points here--the files were in my Windows partition and running "chmod +x hello.light.44.py" had no effect and gave no error! Relocating them to the Ubuntu partition solved this.

To compile, upload, and run the codes I used:
sudo make program-usbtiny
python python filename /dev/ttyUSB0

I used the CBA code for the light sensor board without any trouble. I altered this code in steps for my pressure/stretch sensing board with python-serial/LED output off the ATtiny44. This took some (much) debugging--thanks to Dan Novy and Valentine for help and advice! See Trials and Tribulations for details. A few highlights of re-coding process:

Trials and Tribulations

I misassigned my ADC pins on my first attempt at modifying the light board for the ATtiny44. Despite a post-it note from myself warning against this, I didn't pay attention to whether the ATtiny44 pins I was selecting for the sensor I was selecting were ADC and of course they were the few that weren't. Lesson: don't trust late night Eagle files. At Valentin's advice, I Frankenstein-ed the board by cutting traces and adding wires to reassign the pins. This was a soldering challenge and I got worried that I overheated the chip in the process so I ended up re-doing the board.

Vinyl cutting the LED board extensions was an adventure--thanks to Sam for sharing the suffering. It's definitely worth cutting many boards while tweaking the blade height, force, and speed instead of trying to weed a board that's not nicely cut. As you can see from the picture, my tweezer skills improved with practice. I found cutting through the Linux work-flow was more straightforward that Windows.

The connections between the board and the LED and pressure sensor extensions did not hold up in real life deployment. I connected the parts by soldering wires and enforcing the attachments with hot glue and tape. Soldering on the wires was a (literal) huge pain--I frequently burned myself trying to hold everything in place. I need a new technique for this. Additionally, even small movements of the wires and board caused the traces to quickly peel up. Perhaps altering soldering and hot gluing would have prevented this, but I'd probably go with formal connectors the next time around, as well as boards instead of vinyl cut circuits.

A few other notes on problems: