This was one of the first projects I ever did in BITS Goa. It’s not documented well, but it was truly a life changing experience for me. I got introduced to many concepts of C, OpenCV, Electronics Micro controllers like Arduino , RF interfacing, etc. This project sure formed a good base of what I am today. I had participated in an event “Catch me if you can”. The event’s main purpose was to find three bots with different shapes drawn over them. Once identified, the bot had to catch it in real-time.
The different shapes, ie the circle, star and square denote the enemy bots while the multicoloured rectangle is my bot.
I used OpenCV 2.1 for vision, to detect different shapes using the function CvFitEllipse ( Installing OpenCV ). I threshed the Black colour of the image , passed that through the canny function, determined the shape of the object. Once the shape was recognised, I calculated the centroid of the image. The centroid would be the about centre of the bot. The lighting conditions were adjusted in such a way that it didn’t generate a lot of noise. I did not use any specific filters to filter out the noise in the image ( It was my first time with coding in C and using OpenCV! ). So once the approximate centroid for all the shaped bots was known, I would then save the co-ordinates. The co-ordinates for my bot were too calculated and saved. The problem statement directed to catch the bots in a specified order. So the distance between the enemy bot and my bot was calculated and directions and distances were calculated and given to the bot via cheap radio communication! I used rf transmitter and receiver with an Arduino Duemilanove ( with ATMEGA328) :
These simple rf transmitters and receivers can be brought at any cheap local hardware store.
The transmitter was attached to my Linux box which was doing all the computation using OpenCV. All the decisions made by the computer were sent across to a receiver circuit put up on my moving robot.
This was the overall design of my robot.
Check list to build such a robot:
A chassis preferably like this : You should be able to easily drill holes in the chassis to adjust the motors and the wheels. The chassis should have enough space to keep an arduino board along with the receiver circuit and connections to the motor for the wheels.
Simple DC Motors . These motors are again easily available in hardware stores. Also their data sheets are easily available on the Internet. To interface these kind of motors to an Arduino Duemilanove, we use a current driver circuit, namely using L293D IC. The pin numbers 4,5,6,7 are connected to the Arduino board which gives digital outputs to this circuit. The data sheet of the L293D, current driver circuit can be found here.
The rf transmitters as shown above work on 433 Hz. The RF transmitters and receivers can be used with Arduino board using the library “VirtualWire.h”. The library has a ready-made template for sender and receiver. The template can then be modified and used so! The Arduino board can be ordered from different portals, and it costs a bit. But the board is very user-friendly and is open source. It has a great and an active discussion forum and community!
Apart from these basic electronics, some electronics like resistors, leds, wires , wire stripper and pliers are always handy. 😀
P.S.: If you are starting to learn a new micro controller, using Arduino will be the best option! Though other micro controllers can also be used, Arduino is my personal favourite. 🙂