Inspiration

Our idea for the project came from the hardware. Sean had an Arduino Uno, a small chassis, motors, and various sensors. We really wanted to make use of the various sensors, including some photo-sensitive resistors. We started programming the robot to recognize the level of light in the room, and behave differently according to the relative dark or light it sensed. As we were programming we started to ask ourselves, what reacts differently in a light room than it does in a dark one? Well, a roach does. So that's when we got the idea. We could use our robot to emulate a roach.

What it does

The robot we built is designed to emulate a roach. It scurries around in the light, turning left and right at random until it finds a dark place to stay. As it's scurrying randomly about the room, the bot will turn to avoid collisions with any objects 10 cm in front of it.

How we built it

All of the coding and control of the robot was done using an Arduino Uno. We had a small kit of robotic parts including the two motors, wheels, chassis, photo-sensitive resistors, a motion sensor, LEDs, speakers, and various other electronic components. We assembled all of the parts, then went to Arduino Playground for examples of code usage and access to various libraries. We would basically pull one of the sensors out of the box, Google a pin guide and some example code, then try to run it.

Challenges we ran into

One of the hardest parts with hardware coding is connecting everything properly. Lose connections or mis-connections can be very difficult to diagnose. One of our initial problems using the photo-sensitive resistor was that it didn't seem to be responding to light differences. We changed resistors and ran the code multiple times in different ways, but it still didn't respond. We finally realized when looking at a pin diagram that we connected the resistor to a digital pin instead of an analog one, which it needed. We were also one off on all of our pins for the motion-sensor and it took us a while to discover why it was malfunctioning.

We also struggled with some of the timing requirements of the code. For some portions of the code we implemented delays so that it would fully execute before moving on to the next task. The problem here is that when a delay is implemented, the robot is basically on standby; it is completely unresponsive to the environment around it. We eliminated as many delays as we could, but some were still necessary to dictate the flow of code. Researching the problem we discovered the use of the millis function. The millis function tracks the current time since the initialization of the program. Using a couple extra variables to store values and operate delays in increments of the millis, we switched all of our major delays over to timers.

A major timing issue we had at the end of our project was an apparent stall in hiding mode. We spent several hours troubleshooting the code and trying to track down the delay. After implementing the millis function and eliminating all major delays, there was no apparent cause for this delay. We checked all of our connections and traced back through old versions of code, but were still puzzled by the way the robot was executing the code. On some occasions the robot stopped running completely. At this stage we had just finished integrating all of the various components of the project, and so the code had grown very complex. All of the components worked individually, and we checked all of the connections multiple times, so we were truly lost as to what may be causing the delay. Thanks to one of the mentors we managed to trace the problem to sound file that wasn't working. The best mentor, by the way! Thanks so much!! Even though no sound was actually emitted, the small delays for each note compiled into a noticeable delay in hiding mode. We removed this sound file from the final project code.

Accomplishments that we're proud of

For three of the four of us, this was our first hackathon. We came into Dirac with little idea what we wanted to do, and only basic coding experience. We ended up taking the Arduino board and robot kit and making a very integrated design out of it. A lot of our ideas were scattered, so I'm very proud that they all came together so well into the final project. I think it smoothly integrates the usage off all the different sensors into an elegantly simple concept.

What we learned

While working on the project we learned the basics of hardware coding with Arduino. I think we troubleshooted through some of the most common errors in hardware coding, so we will definitely know how to avoid those in the future. Working with each other definitely proved helpful. It showed us that it's always useful to have someone else to troubleshoot through your code with you. They can provide a different perspective, and maybe think of or notice something you wouldn't have.

What's next for Blue Roach

For us this project was a very valuable learning experience. We had a lot of fun putting this robot together. We're definitely looking forward to doing more hackathons in the future, especially hackFSU. We'll see you guys next year! :)

Built With

  • arduino-uno
Share this project:

Updates