Tuesday, December 13, 2011

Finishing the suit

A lot of things ended up coming together at the last moment.

Kat had ordered the suit, and we had almost all the sensors, so we knew what we were working with, but because of a miscommunication, we didn't have an accelerometer. Consuelo said that it would actually probably work if we hacked the accelerometer in a Wii nunchuck and offered one for us to use (which we REALLY appreciated).

Ruth and I decided that the project probably wouldn't be done on time unless we spent most of the day Saturday working on it. Kat was busy so she couldn't make it, except to drop by a couple of times.

We ended up getting a lot done. Ruth worked on hooking up the light sensor, vibration actuator, and the LEDS, while I figured out how to hack the nunchuck. Hacking the nunchuck proved to be simpler than I thought. After extensive internet research, (the most difficult part of the process), I found out that it was really just a matter of stripping the main chord, which would reveal 4 inner wires. One of these was input (power), one of these was ground, and two were output. Hooking them up was pretty easy, too.

After stripping main chord

Wii nunchuck connected to Aruino baord

The really hard part actually came after that. The Wii nunchuck was giving us data, which appeared to respond to movement, but it appeared in gibberish. After several hours of trouble shooting, I figured out that the Wii nunchuck's output is at a different rate than the output we had been using. All we had to do was change the rate that the serial output read at.

We still kept running into silly hardware problems for the rest of the evening. Ruth had figured out how to wire in our button, vibration actuator, LEDS and light sensor while I had been troubleshooting the Wii nunchuck, but we still had to figure out the thresholds for the new liquid level sensor and program for the accelerometer in the Wii. Ruth decided to take on the liquid level sensor, while I started to make sense of the Wii data. The problem I kept running into was that the computer would stop recognizing the Arduino board after just a couple of minutes - not enough time to figure out any meaningful data. I kept trying different things - reinstalling drivers, plugging in the USB again, restarting the Arduino software - but the problem persisted. I finally gave up at 3 in the morning after hours of trying to troubleshoot the issue.

Luckily, Ruth's boyfriend ended up joining her in the lab to keep her company after I left and discovered that it was just a matter of the Arduino board not getting enough power. Within an hour, Ruth was able to figure out the Wii's data.

But, with the presentation on Tuesday, we still had a lot to do. The thee of us all ended up spending most of Monday night wrapping things up. Kat had meant to program the Phidgets program, to record when people enter the dining hall, but perhaps because of a misunderstanding, had only found code that printed out information when a tag was within range of a reader, and changed the information to let the person holding the tag know they were in the dining hall. The problem with this was that the computer had no memory of the tag once it was out of range (about three inches away from the reader), and we needed something that knew when you were in the dining hall, ad when you had left - even if you weren't within range of the reader.

I ended up spending the better part of Monday night trying to code that, which turned out to be much more complicated than anticipated. Unfortunately, I had forgotten most of the details of what I had learned in CS230, so my night involved a lot of looking things up to refresh my memory. The sample code that Kat found ended up being a really good basis for what I needed to write, since all the event handlers were already dealt with - all I had to do was modify the event handler that managed what happened when an RFID tag was within range of the reader. What I ended up doing was creating a new class that represented a tag passing the reader. When a tag passed the reader, the program would create a new instance of the class, then store it in an array. First, however, it would check to see if an object with the same RFID tag number was already in the array. If it was, then the program would know that the person with that tag was LEAVING the dining hall, and could remove the object from the array. If the tag wasn't already in the array, the program would add it.

The program would also beep when someone entered the dining hall, to alert people that a new person had arrived, and keep track of how many people are in the dining hall, to print out whenever someone came, to let them know how many friends they could expect to find.

If there was a way we could communicate between the suit and the Phidgets, the Phidget software could easily keep track of how many times a tag passes an RFID reader, and the suit could use that data to give the suit meaningful feedback.

We also got to solder some things together. Most of the sensors and actuators were intended for the lilypad, so Kat and I had to solder wires together to the sensors to make the connections more secure. I had taken a jewelry making course a couple years ago, and had quite a bit of experience using a soldering iron, so I ended up doing most of the soldering.

Meanwhile, Ruth finalized a lot of the sensor thresholds and got everything working well in conjunction, and Kat made a a box to hold everything.

The next day we still had quite a bit to do before we were ready for our presentation: everything still had to be installed in the suit! Because of another miscommunication, Kat had thought we didn't need super long wires connecting the many inputs and outputs to the board, since we were using a different strategy. The result was the we had soldered shorter wires to the sensors and actuators. In realty, we really needed those longer wires to get to the various parts of the suit. We frantically twisted wires together, and pushed them into the various parts of the suit, stuffing everything into the box that would contain everything (which ended up being a smidge too short, but worked out). We managed to get everything up and running in time to run through our presentation and deliver it on time!

By the way, I got another "what it like to be in a class with so many men" comment on the way to NY for Thanksgiving.

1 comment:

  1. Nice post. I was checking constantly this blog and I am impressed! Extremely helpful information specially the last part I care for such info a lot. I was seeking this particular information for a very long time. Thank you and good luck.
    Liquid Level Sensor