Legos, Walls, and Occam

I have been pretty busy since my last blog post. For one, we now are working with the new 6-volt motors, these can work much better with our motor shield and will last longer with higher voltages applied to them. The same day we applied the new motors, Dr. Goadrich and I built the stand-offs to create the upper deck of the robot out of Lego blocks. The Legos allow us to easily remove the top portion of the robot for access to the Arduino and motor shield placed on the bottom deck.

The last video I posted had the robot (named Centegheny for the competition) running a basic program which did not use sensors. Thus, the first step I took was to add three IR sensors to the top deck: one of the right, middle, and left. I then wrote a program in C which used the sensors to avoid walls. If the left sensor was tripped, the robot turned to the right, and vice versa for the right sensor. If the middle sensor sensed something, it asked the left and right sensors which was farthest away from something, and turned in that direction. The video for this is shown below. (Please excuse my make-shift arena…)

Because we wish to use the parallel language Occam-pi with Plumbing, I began to translate this wall avoidance code into that language. Once the motor shield was able to work with the Plumbing libraries, it was fairly simple to translate the code, once I understood a few things I had to take into consideration that I didn’t with other languages. For instance, I learned that the If statement required a final condition just in case all other conditions were false. Otherwise, if all the condition are false, the code crashes, causing the program to restart completely.

Another odd thing that was discovered was the Plumbing code did not work with a low battery. The Arduino we are using has a recommended input voltage of 7-12 volts, thus I had plugged a 9-volt battery into it. After a few runs of the Plumbing code, the robot appeared to simply stop working despite nothing seeming to cause it. Baffled, we decided to run the old C code, code we knew without a doubt worked, and it did. After acquiring a multimeter, we set about trying to figure out what the problem could be. Eventually we tested the 9-volt battery to the Arduino. It was at about 5 volts and thus lower than the recommended voltage. However, the C code seemed to run fine on a lower voltage! I am still a bit puzzled on how this is possible.

Presently I am working on integrating the newly received IR sensors from Molly. I sent her longer range sensors and she sent me shorter range sensors. I will also be working on the code for the state diagram Molly posted. I also want to integrate the flame sensors into the robot at the same time. After that, we will simply need to attach our fan to the top.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>