Tuesday 28 April 2015

2 Wheel Self Balancing Robot - Robot body

So there are three general components to this project:
1) Electronics hardware
2) Robot body
3) PID
4) Code  (other than PID)

I will be making more posts going into details about topics (1) (3) and (4).
For this post I will speak about the easiest part, part (2).

So by this point I had tested everything individually. Had to put it together then start tuning the PID. 


Got a battery holder from Sim Lim tower that could hold up to 8 * AA batteries. Thats a grand total of 12 possible Volts. 



I used solder to complete the circuit, since I was using less than the maximum number of batteries. 



Had ran out of wire so I just used jumper cable everywhere.

 Because I refused to pay $30 for the robot body kit, I had to improvise and build a body from things I had lying around. The major contributors were foam, zip ties and blue-tack. 


The final product.


This made me realize how much resources are at our disposal all around us; we just need to use our creativity. That's the reason why I classified this process as a major section of the project, although it was done in just a few hours. Currently I took this apart so that I could savage the foam and Arduino for other purposes, but I think over the summer I will revive it with a better body. Will take a video then and upload it.

Arduino based webcam face tracker

So for this project I used processing, openCV, Arduino and an old webcam.
The Arduino code is from Adafruit and the processing code is written by me and (soon to be) hosted on my Github. For the code, skip to the end. 


 
I decided to used my (10+ years?) old webcam.

 
The base was very heavy so I decided to remove it. Then I decided to open it up as I was curious to how its inside looked. 


 
This is how it looked like on the inside. The round black rubber thing makes sure light is tunneled though to the lens and does not get in from angles. 


As the rubber cover was in place due to pressure, and the pressure was removed, I tired to fashion another cover out of things on my table. What worked in the end was foam (as usual). 




Managed to get the code working with an external camera device.

 
While I had a servo(on the left), I wanted to make it work on two axis so I purchased another one and also a First Person View(FPV) cradle.


 
 
Honestly the cradle was hard to put together as it did not come with instructions and I had to figure out how to assemble it on my own. And to make matters worse, I was not provided with the correct arm size(the white thing). Cutting its length was fine but the width was very troublesome.  



 And tad-da! The final product! 

I took a video demo of it. One video of the webcam face tracker in motion and another screen recording. However the screen recording was not captured properly. Hence I cannot upload those videos. 

About the code:
So initially I took two files from Adafruit. One was for the Arduino and the other was for processing. 
While the Arduino code worked well, the processing one was broken. It was based on a library that could not be found anywhere on the net. 

I then took a look at some of the openCV examples. Based off the examples, I managed to put together some code that did the trick. I will be uploading it on Github soon and will update this post with the link.