Tuesday, May 17, 2011

NXT Projects: Line Follower

Our next assignment with the NXTs was to build a line following robot using only one reflector sensor. This made things difficult, but my partner and I went to work.




The first order of business was building the robot. We put a pivoting wheel in the front so that it could turn as the line turned. After building the robot, we started working on the code.
This program says to go at 50% speed until the reflector sensor reads less than 15 at which point the right motor coasts and the left motor keeps going until it finds the line, then the left motor coasts and the right motor keeps going.

 Our program gives the robot a jerky movement, but it follows the line rather well so we were happy.
 

NXT Projects: Silly-Walking Robots and Going the Distance


This was our first day working with LEGO NXTs, and our first assignment was to make them walk. Which, as it turns out, is not as easy as it sounds. This was a really quick, in-class assignment so I didn't remember to take video, sorry!
The next part of the class we built robots with wheels (a little bit more elegant than the jerking, walking robots). We had to make these robots drive a certain distance and stop before hitting a pedestrian:
My partner as I used ultrasound to detect where our pedestrian was. As we got closer, the car stopped. At first, we had the car go directly up to the pedestrian and stop. The car's momentum made it hit the pedestrian, so we made it stop further away from our little guy.





Final Project: Game Time

PROBLEM!!
We got to the lab a little over an hour before the showing of final projects in the science center, and our puppet is completely broken! Sometime in the night it fell off the table and all of the motors fell out and the strings were utterly tangled. It was a stressful disaster. And to top it all off, we ran out of glue sticks for the hot glue gun, which was how we attached the motors to the box. So, duct tape came to the rescue. It wasn't pretty, but it worked and that's what counts.
The exhibition went very well, and our puppet danced his pants off. Other than a slightly gimpy right arm, everything worked really well and people really enjoyed playing with it. My partner took some great video of me and another girl using the Man-ipulator. They are on her blog, http://jchevallier.tumblr.com/, but we had some difficulty downloading them because they were taken with her phone, which is why I don't have them. My camera died a few minutes before the exhibition and I don't have a smart phone to download the videos. We had an awesome time showing people how everything worked, and anyone who had played DDR was impressed by our homemade pad.
Unfortunately, after two hours of vigorous play, our little Harvard boy wasn't holding up so well. The duct tape couldn't hold up one of the motors and it was hitting another, making a little grinding noise. Very unpleasant.
So that was the end of our final project! We were really happy with how it turned out, and impressed with ourselves for following through with out idea.

Final Project: Finishing Touches

Now that the main parts were done, all we had to do was make it look good. This was a fun part.
We decided to call our little game the Man-ipulator, in true Wellesley fashion, and we made our guy a nice, preppy Harvard boy. With a bright yellow baseball cap (I thought his head looked empty).
We spray painted the box black, and then added a little bit of sparkly spray paint. Voila! Instant party atmosphere.

Because we were done with a few days to spare, we decided (after prompting from our professor) to make the program better and tweak a few little things. I rearranged the motors so there was more space and changed the string from nylon thread to floss. The string had been slowly unraveling, and looked generally messy. Because the floss is already coated in wax, we knew that it wouldn't unravel.
As for programming, things became a little bit more complicated. This is where we ran into some trouble. At first, the motors would just keep rotating, pulling the puppet right into the little spools we had attached to kept the thread in place. It was a little stressful. However, after a few hours of work, we had a working code!




These new codes worked REALLY well, and we were super excited about them. Now, instead of the puppet moving a limb to its full extension when a pad is pressed, the limb moves only when the pad continues to be pressed. So now we could have little movements. To prevent someone from reeling the puppet all the way into the motors, we put a cap on how much they could rotate. That way, even if someone stayed on the pad, the puppet would just stay at its full extension. This way, two limbs could be moving at the same time, making for a much more dynamic dance.

Final Project: Programming

Now that we had everything put together, it was time to program. Here's where I thought we would run into major snags, but while I was building the body and pad, Juliette had pre-written the code she though would work, and all we had to do when everything was put together was plug in the amount of rotation each motor needed to do. Of course, it wasn't that simple--there were a few kinks to work out about which NXT was communicating with another, and which mailbox it was sending data to, but that was so minor compare to what I thought we were going to have to go through with the programming. Thank goodness for Juliette!
These codes are for the NXTs attached to the pads. They are the codes sending the resistance measurements to the NXTs attached to the motors. In a nutshell, it says that if the resistance reads more than 50, send that data to the NXT controlling the motor. All of theses codes are in "while" loops so that the NXTs are constantly checking the numbers they are receiving.



These programs are for the NXTs attached to the puppet. What they tell the NXT is if they receive a number over 50 in a certain mailbox, the motor associated with that mailbox rotates a certain number, pauses for a short time, and then returns to where it started.

Monday, May 16, 2011

Final Project: The Making of the Pad

So far in our project, everything was running smoothly. We weren't having any technical or mechanical difficulties, we were ahead of the schedule we set for ourselves, and the only thing to do for a few days was wait for the materials we needed for the dance pad.

This was a really fun part. We ordered copper taffeta and conductive foam, bought some carpet padding, and Juliette's mom sent us some FABULOUS fabric to cover everything. So we got to work. First, we tested a miniature version of the pad:
Our pads consisted of conductive foam sandwiched between copper taffeta that has a wire soldered to each side. pressing on the pad changes the resistance between the wires, and we can measure that change using LEGO NXTs. We choose to use NXTs for our project because of the Bluetooth capability because the pad and the dancer are separate. Bluetooth gave us flexibility in where we could set up our project, because the pad could be quite far away from the dancer, and if we decided to put it in a display case that would not have been an issue.



We made a mock pad on the floor with masking tape so we could get a feel for how big it should be. 


To measure resistance on the NXT, we had so trick it. It actually doesn't have a way to measure resistance, so we connected the wires to its light sensor. The numbers it collects read from 0, when the pad isn't pressed, to 100, when the pad is pressed. The wires that read the "light" are the black and white wires, so we just soldered wires onto a connector and it plugs right in! We were good to go!
HI JULIETTE!!
Duct tape is GOD



As you can see, we have seven sensors connected to 2 different NXTs. Each pad controls a different motor. We have pads for the elbows, knees, and hands, and another for the right hip, so he can do a little hip action.

Final Project: The Making

Our first task was to make the body of the puppet. First, I drew a sketch which was roughly the size of that we wanted:

After sketching, it was time to design in SolidWorks!

 Now, I'm a huge fan of splines in SolidWorks, so most everything in this design is made with splines! I don't know why, but I find using splines and auto-dimensioning is really quick and easy. This design only took about 15-20 minutes, including a few iterations of shape until we found the "perfect bod."
Next, and this is my favorite part, we sent the file over to the laser cutter to be printed. We used relatively thin Delrin because our puppet did not have to be particularly resilient. After the printing, we drilled holes for hinges. We wanted the puppet to have easily movable joints and be authentically marionette-ish, so we used some stripped wire soldered into loops as hinges.
TADA!!