Monday, July 14, 2014

Birthday surprise

It was 20 Nov (My birthday) and I was at the school where my wife works. Was planning to   spend a day with kids at school. After lunch i was chatting with director of the school, Mr Anand. Mr Anand  mentioned that the kids are going to participate in First Lego League competition   sponsored by Caterpillar. Since the Capterillar Coordinators were from non circuit background, they were actively looking for some one who has electronics back ground to mentor the kids and asked me if i would be interested. Note this, i will come to this later. I looked at my wife (who generally cries at me for my crazy electronics hobby)  and was giving a "So called Indian Nod" and the director was in confusion if it was a no or yes .To my surprise my wife smiled at me which was a firm "Yes". In order to mentor these kids I had to sacrifice (not really) my weekends for about three months.If not this one then I would have been  meddling with some crazy electronics stuff in weekends. In this task  my wife would accompany me happily, instead of crying at me for not spending weekend time with her.


Then came the first weekend, We drove to the home where these kids were sitting with pile of Lego blocks and making some models.
I was sitting with Rajkumar the caterpillar guy, we were trying to read some 100 page document to understand the rules.

Who reads manuals now a days, so we looked at this video to understand the rules. http://youtu.be/Hb5xj0FUSPY

If you have patience go through this video. On a higher level the theme for this year challenge is Nature's fury and the robot we design should help the flora and fauna in the so- called play-field mat.

What you see in the mat are pre-built properties. Our task is to just design robot which will solve the following tasks built using these properties.
Some tasks are
  1. Collect all the pets and kids which are scattered and in solitary and keep them with community of people.
  2. Remove branch of tree carefully that is about to fall on high voltage line 
  3. Take the milk truck and emergency supplies truck to correct places
  4. Safely land the flight that is in final stages of landing
  5. Simulate tsunami and earthquake
  6. Relocate a movable building to non earthquake prone zone.
  7. Finally cross multiple obstacles and reach destination.
Robot can be launched only from base and robot should return to base once it completes tasks. User is not supposed to touch it outside base.


We found that single design cannot achieve all these tasks and we divided all these tasks into five missions. Where we will have common base robot and have five different attachments or Addon for each mission. For example, robot will complete mission one and come to base and we will remove the mission one add on and attach mission two add on and like this it will continue until mission five is complete. I will not go in to details of how each mission was achieved, if you want more details ,then post here, I am happy to reply.

Before going into challenges, I will explain a bit about the Lego mind-storm
  1. Senses of this robot include ultrasonic, touch and color sensors.
  2. Locomotion using servo motor.
  3. All this is controlled by CPU called brick that is programmed using visual programming tool similar or lab-view or scratch.
Some big challenges we faced were
  1. Tracking and locating the robot in the field. This was done using line tracking and wall following. I even used PID algorithm here.
  2. Friction of mat so we have to do continuous correction to robot position using properties around.
  3. Creating mechanical add-on. I am not very great  mechanical engineer, But my child hood experience with Lego blocks helped.
I feel if I explain the whole design it will be more monotonous, as said earlier interested pals ping me here.

This design went on weekends for the next two months. I taught the students the rules, usage of Lego mind-storm, programming software and finally some Physics / Maths concepts like friction, color sensing, circumference - radius, car steering concepts etc. That was a  steep learning  for everyone. The kids were good enough to catch concepts and came out with innovative ideas.

We designed first revision of our bot. But on trial we found we need two light sensors to correct our bot . But the shocker was, we had only one. We placed an overseas order and it would reach us very late. With no way to expedite we were worried.To our surprise we found a Lego enthusiast who had association with the school. He loaned us the light sensor. Note this place I will come to this later. With that sensor, our final design was done and our robot started completing missions.
Some videos of our robot in action.




Then came the second shocker.Our kids have to do a presentation on any natural calamity that they have experienced and preventive measures for the same. We completely overlooked this  as it was only in the last few pages of that 100 page document. My wife who is a civil engineer turned school teacher pitched in and took the responsibility of training the kids for presentation. Note this place I will come to this later. The kids selected storm rain and after effects. Every Bangalorean  would know this, remember "potholes"?

Everything was ready and we were at Caterpillar Chennai for the event. First half was presentation and robot design explanation, where the kids were asked if they are fine in speaking English. Perhaps the judges thought these kids cannot speak English well because they are from school for  privileged and  poor  which was ran by aid from Germany. But the kids surprised the judges with their accent, even I was surprised by the self-confidence of the kids. 

Next event was the robot playing actual mission in the play field. Our robot behaved bit like Indian young cricketing team touring overseas and surprised by bouncy tracks. The mat used in final was very old/rough. I had used too much of my engineering brain and had so many feedback mechanisms and  tuned it for nice smooth mat. There were chances we would have scored good if that extra implementation was not there. At that moment I thought even too much of knowledge is dangerous. I though we lost the battle.

Our dugout was silent as grave during the next few hours. Then, came the final results and our kids were sitting there with frown faces. There came the announcement for the  best robot designed and it was us, everyone was jumping to sky and we collected the trophy. Until that moment  we were not aware  that there was a category for Best robot design. We knew that there were awards only for the best presentation and high scoring team in field.




I believe you will remember  places I asked you to mark and here I come again 
  1. The probability of me going to the school on my birthday was 1/100 and it was my better half who pushed lazy me.
  2. The probability of guys who come and spend their birthdays with kids being a crazy stupid electronics engineer is 1/100.
  3. Probability of kids getting second light sensor is 1/100.
  4. Probability of these kids getting mentor  for presentation whom is a civil engineer turned school teacher is 1/100.
  5. Probability of the too much engineered design getting prize for category for which we never designed robot is 1/100.
The total probability of these kids getting this experience and finally the award is 1/10^10. Think for a moment why this was possible. I am firm believer that "God will put right people at the right spot in the right time to help the right people". Many times I have regretted for things I missed in life, but later I have realized that miss was a right one and it indeed helped me in some other way. I want to finish this with Shakespearean quote "All the world's a stage, And all the men and women merely players". Agree with me? Was it to Philosophic?



Sunday, June 30, 2013

My first post

My love for electronics started around 5-6 grade at school. From my childhood i was fascinated about robots and electronics. During those days, there were not even a single gadget (CRT TV, Tape Recorder i am talking about electronics in 90s) at my home which escaped my screw drivers. With more curiosity, i used to open every one of them to find what's there inside with an expectation to learn how they function. Most of the times i have ended up spoiling them. Ok enough i don’t want to bore you any more with my childhood love for electronics. It's been 2 decades  and nothing has changed,  except for my latest tech(CRT TV to LCD TV, Tape recorder to medic enter etc). In this post i am going to share one of my hobby electronics Project. Real courtesy should go to my partner who bears all my crazy hobby. At times i sit starring at nothing or sit producing smoke out of soldering iron or being an insomniac. But i don't have patience if she stares at TV for a movie or creates smoke(aroma )in pooja(worship) room with incense sticks or doing art /craft leaving me behind without snack while i sit and watch 1983 cricket world cup finals for the 100th time.

This blog post is about my latest attraction called Raspberry pi(RPi) a credit card size computer for 25$. I believe this will be soon a revolution in world of computers because of its price and open source nature. This had already reached  schools in every nook and corners in Europe and some African countries . There have been many similar small computers but the price puts a spot light on it, thanks to Eben upton and his raspberry foundation for such a wonderful solution. The day  i heard about this product i fell in love with that.The name Raspberry Pi rings a bell in my mind  in the world apples ,desserts and windows. Some refresher about Raspberry Pi(Copy and paste from some where)
The Raspberry Pi has a Broadcom BCM2835 system on a chip (SoC), which includes an ARM1176JZF-S 700 MHz processor (The firmware includes a number of "Turbo" modes so that the user can attempt overclocking, up to 1 GHz, without affecting the warranty), VideoCore IV GPU,[12] and originally shipped with 256 megabytes of RAM, later upgraded to 512MB. It does not include a built-in hard disk or solid-state drive, but uses an SD card for booting and long-term storage. It is to offered in two versions, priced at US$25(Version A-No Ethernet and One USB Port) and US$35(Version B-512MB RAM, 2 USB port and an Ethernet port.) 
 Following are some of the working distributions for Raspberry Pi
1.     Raspbian “wheezy” -Debian distribution
2.      Soft-float Debian “wheezy”- Debian distribution
3.      Arch Linux ARM- Arch Linux ARM is based on Arch Linux, which aims for simplicity and full control to the end user.
4.      RISC OS
5.      RASPBMC- Raspbmc is a minimal Linux distribution based on Debian that brings XBMC to your Raspberry Pi.

With any of the above distribution in SD card, Monitor (RCA/HMDI), USB keyboard, WIFI/Ethernet cable this can become a mini PC.This has become very popular in less than a year because it’s cheap and all the interface including GPIO, I2C, SPI, UART are easily accessible.

In Raspberry Pi forum i have seen people using RPi like microcontrollers in all over their projects starting from Robotics, PC to media center. The only drawback is RPi doesn’t have any analog interface. Any micro controller with configurable Analog and digital Resources could easily fill the analog and some missing digital parts of RPi and form a complete solution.
People use python, java , C and various languages to build systems using RPi. Librararies for using RPi can be found in below sites
Java- http://pi4j.com/
C- http://www.airspayce.com/mikem/bcm2835/
Python- https://pypi.python.org/pypi
My choice was to use Java running in Debian Wheezy.If you think i might be good at java ,you are wrong but I  i have a neighbor called Sridhar who is an Java expert.

My idea was to create Robot which will act as steward @my Home. Below will be some of it's features. First four of them are implemented and other features are under development.
1.      Obstacle detection and estimation of object distance.-Done
2.      Four wheel drive with differential steering.-Done
3.      Power through battery pack and will have self charging.-Done
4.      Control all the devices in home using IR communication (Universal remote control which can be operated via voice.).-Done
5.     Ability to find its acceleration, angular movement, Ambient light, temperature as motion feedback.-Done
6.      Speech Recognition using Google API
7.      Speech synthesis.
8.      Gesture and object recognition.
9.      Maping of particular room or area using Kinect and OpenCV.
10.  Control my entertainment system, Download and stream music/Video from network/internet using DLNA.
11.  Interface with mobiles phone using Bluetooth and on receiving a voice call/ message will deliver it to correct person through it speaker/microphone.
12.  Display emails to the concerned person.
13.  Touch screen interface with display
14.  Thermal management of the system.
And the list keeps growing with my imagination. This may look too ambitious. But i don't want to limit my dreaming.
Here are some pictures of my RPi Based Robot and video of it in action. I call this π-Bot


Pic1-Full assembled π bot


Pic2- Motors and Cypress PSoC Microcontroller controlled my master RPi


Pic3-The RPi on the the Bot


Pic4-Obstacle distance measuring sensors



Pic4- RPi in close up 
 Pic5- Android App to control Pi-Bot (Early stages)



A short video of it in action-finding obstacles and navigating

 I will present more details on implementation in next post.