I'm so glad we came up with such clean code to use for the water level sensor because it was very easy to change the code to check for sleep and exercise. Coding got a bit complicated every now and then, especially thinking about how to check the difference between walking and exercising, but once I was able to come up the idea of using thresholds and checking to see if the y-coordinates of the accelerometer are above and below typical walking y-coordinates for a sustained period of time then it was very easy to implement. Sleeping was also quite simple. I only had to use the z-coordinate to check to see if the person was lying down versus sitting up. Since there may be times when the wearer is reclined but not sleeping I also added the light level sensor to check if it's dark in the room. If the wearer is both lying down and the lights are off I assume the user is sleeping. While I know this is not the most accurate way to measure sleep, especially because someone could be lying in bed unable to actually fall asleep for a while, this does ensure that the wearer at least gets eight hours of rest per day and it would be fairly easy to add additional sensors to determine whether the user is actually sleeping.
The more difficult aspect of the project, not surprisingly, came with using the hardware. I spent a lot of time bent over the breadboard putting the correct wires in the right locations and following schematics online for each sensor and actuator. While struggled with getting the light sensor to read in any data Sophie tried to hack the Wii Nunchuck for its accelerometer. After our feasibility prototype presentation Orit had encouraged us to find a more affordable way of measuring exercise level and sleep instead of using a heart-rate monitor. We decided to use an accelerometer instead but for some reason, even though we thought we had asked for it, we discovered only about four or five days before our presentation that there had been a miscommunication and the accelerometer hadn't been ordered from SparkFun. Consuelo ensured us that it is possible to hack Wii remotes for their accelerometers and that she even had a Nunchuck for us to use that she could spare. The Nunchuck proved to be relatively straightforward to hack but much more difficult to actually read the data from in a way that we could understand.
While Sophie was struggling to understand the remote, we also began experiencing problems with our Arduino board. Whenever we tried to upload data it wouldn't recognize the serial port or we would be reading the output on the computer and all of a sudden it would freeze. Sophie and I both hit a point of exhaustion and frustration so I told Sophie to head to bed and called up my boyfriend (the same friend who had helped to explain breadboards and resistors to me). He actually drove all the way to Wellesley to look at our circuits and try to figure out why the Arduino had stopped working.
As it turned out, the Arduino had reached its limit in the amount of energy it could get from the computer so we needed to find an additional power source for it. Once Zac unplugged the power source from the stereo system and plugged it into our Arduino it started working again, no problem. Sophie and I would have never thought to do that. At the same time Zac showed me that the light sensor actually was working, it just wasn't getting enough light to show any changes. I had been working in a fairly dimly lit corner or the room and it hadn't even occurred to me that the light sensor wasn't getting enough light. So basically, in less than fifteen minutes, Zac was able to fix two of our incredibly frustrating problems. This is a picture of what my breadboard looked like at this point. It ended up getting incredibly more cluttered by the time it was actually finished.
After already saving the day twice, Zac explained we needed to figure out the x, y, and z coordinates on the Nunchuck in order to understand the data. Once that was done, it was extremely easy for me to program and complete the rest of the circuits. It was also around this point that I accidentally fried our buzzer. I was following the diagram provided online for our buzzer from SparkFun and it surprised me that the schematic didn't include a resistor but I figured maybe the buzzer needed more current in order to work. I should have followed my instincts because once I completed the circuit I heard a terrible crackling sound, saw a tiny bit of smoke rising from the buzzer, and new it was over. Poor buzzer. I felt so terrible, especially because I was super excited to use it and was really curious as to what it sounded like. The next morning Sophie told me she still had hope for our buzzer to work but I had seen the smoke and I knew that it was the end. Unfortunately it was too late to order a new buzzer so we decided to use a beeping sound from the computer to simulate a buzzer instead. It would have been extremely easy to add a real buzzer to to our suit, though, if we had it.
Orit had also told us not to worry about installing an Arduino RFID reader into our suit because we only have Phidget RFID readers and we would have already demonstrated the feasibility of our suit with our other sensors and actuators. Instead we simply needed to include an RFID tag in the suit and show that the Phidget reader could track the suit's location on the computer. Sophie decided to work on the RFID reader and was able to get it to keep track of not only if people had entered or exited a dining hall but how many people were in the dining hall as well. This shows that it would be possible for our suit to track the location of its wearer and tell if the wearer had been close to other people or was just by herself all the time. If the suit had its own long-range RFID reader and each building/room had a tag in the doorway, the suit could track if the wearer was in the library or a social area like a dorm living room. If the suit realized the wearer hadn't been to a dining hall or a social location in an extended period of time it could give the wearer feedback.
Once all the circuits were complete we were able to solder them and install them into the suit. We had to come into the engineering lab the morning before the presentation in order to do installation because we didn't want Kat to have to wear the suit all night. That was probably the most stressful part because we knew we had a time crunch and we couldn't have any mistakes take place during the installation process. Fortunately, we were able to get the suit completely on and working just in time for the presentation to start and ultimately I think it went fairly well.
The more I think about this suit, the more excited I get about other things that could have been added to it. We could add so many more sensors to make it more accurate and so many other kinds of feedback. It also would have been really cool if we could have LEDs in different shapes to explain the meaning behind them. For example, instead of a yellow LED it would have been cool if the LED was the shape of Zzzz's and the off switch looked like a pause button of some sort. That would make it easier for the user to understand the suit without needing a great deal of prior instruction. At any rate, it feels great to finally have the project complete! I now have much more respect for anyone who makes anything electronic work.
This is a link to the video of our final high level prototype: