View this page in: Deutsch | Français | Italiano | Portuguese | Japanese | Korean | Chinese | Español (Courtesy: google.com)

Friday, January 28, 2005

Zero to micromouse in 14 days

Well, almost!

Micromouse is a competition in Yantriki, IIT mumbai Techfest.

What we did:

We (Gaurav Parikh,Gaurav Tater, Sanjay Panchal and myself Mandar Mulherkar) started from scratch, read off the internet and had invaluable help from my school friend Nihar Mhatre.

Initially i did not know how to write embedded C code, (to be more precise, where) and how to compile it. Did not know how a microcontroller is programmed, did not exactly know which algorithm and software we will be using, had no idea about infrared sensors, no idea how to precisely interface RAM, and worse , how to access it, how to write absolute code, while keeping the code size to a minimum. These were known issues, and the best problems were yet to come. We still took the plunge and am very happy we did. Turned out to be an immensely learning experience. Research Project of sorts.

The challenge:
To build an autonomous, maze solving robot.

The aim is to make an autonomous robot that navigates to the center of a maze. The maze is an array of cells, 16x16 and each cell is 18x18cm. Each cell can have walls to the N,S,W,E.
The outside border is closed.
The robot knows nothing about the maze except the starting and the end cells.
The starting cell is any of the 4 corners.

The Robot:

The hardware:

We used an atmel 89c52 microcontroller, which is an 8051 derivative.
The sensors used were the TSOP 1738(receiver) with IR LEDs(emitter) emitting at 38 KHz with a 555 timer. the reflected IR from the walls will be detected by the TSOP.
Stepper motors were used to control the robot's movements precisely.
We also used 8K external RAM, 8255 for more ports, etc.

The software
The algorithm used to solve the maze was the modified Floodfill.

The modified flood fill algorithm works as follows:
In software,
initialise maze considering no walls.
Starting at the target cells numbered zero, number cells with their right angle distance from the starting cells, ie, the cells next to the target cells are 1, next to them are two etc.
like this:

3 2 1 2
2 1 0 1 2
3 2 1 2
etc.

do:
check the sensors, and map the cell walls.
move with priority NESW.
Always move from a cell with a higher number to a cell with a lower number. if this is not possible, update the maze values as:
Check if all the cells are one more than their smallest acccessible neighbours in value. If not, update (make it one more).
Move to a cell with a smaller value,
while goal not found.

The mouse uses Depth First Search + the floodfill values to navigate around the maze, and to backtrack.

The above Algorithm always finds the center.
Then Floodfill can be used to find the shortest path.

Implementation
Well, the actual physical implementation complicates things a lot.

Issues:
We have to consider the following things.
The mouse moves only 90 degrees left or right, to keep matters simple, and not diagonal.

The mouse must keep track of the direction it is facing, and the direction it has to move, like, facing south and to move east, move 90 degree left.

Facing WEST, to go EAST, make a virtual 180 degree flip, as an actual 180 turn might misalign the mouse if anything goes wrong. Then update the directions.

The walls read must be entered into the walls array considering which direction the mouse is facing, ie when facing NORTH, the left sensor reads the WEST wall, but when it makes a 90 degree left turn, the left sensor now reads the SOUTH wall. The read values must be entered after rotating. Also it can make any number of right and left turns, so I used the % operator, and a count of the left-right turns.

The mouse must not be stuck trying to move between cells, with updating them and lost in a loop. More values must be pushed on stack, if possible, all visited nodes.

Motors should move properly considering the direction they are facing.
Motors must make good 90 degree turns.
The robot must make sure it can make the turn (is completely in the cell), and not bang into a wall.

Another was the embedded sytem issue of memory constraints. But 8K of external memory was more than enough for the application. So, a lot of improvements are possible for efficient route finding. 89c52 (89c51) has 256 (128) bytes of onchip SRAM.
Memory:
wallmap[256], cellvalues[256], visited[256], stack[256]=1K!,
but all this can fit in :
wallmap(4 bits, N,E,W,S) + cellvalues(4 bits, max value 14) [256], visited[32], +10 etc = ~300 bytes!

Development Tools:
We used the Keil (microvision2 eval version) software as our cross compiler, for creating .hex files from our C code, and the ucFlash programmer to burn it into the ROM.

We ran into hardware problems the last minute, and were frustrated as we could not make it in the Elims. A few more days would have solved all the problems, but we did not have the luxury.
At minimum, a month is necessary for completing the project properly and for improvment.

The micromouse is a very famous international competition, and when our mice might solve an easy maze in 7-8-minutes, the record times are...well 20 seconds for compilcated mazes internationally!!
They use all sorts of distance sensors, ultra sound sensors, can move diagonally, and have speeds of (1.5+) ft/sec.

About 100 improvements can be made in what we did, but I am glad we made a start.
This is my 8th sem though(*sigh*). I hope others start early, as robotics can go on and on.

(I am also interested in Beam robotics).
Comments, discussions and questions are more than welcome.

-Mandar Mulherkar
BE COMPS.
---
The sky is the limit...the lower limit.

65 Comments:

Anonymous Anonymous said...

sir can you please send me the .c or .asm code for miromouse using just 3 sensors?
My email id is bujji.phanikiran@gmail.com

I'm a beginner and the code you send will be very useful to us...

5:05 PM  
Blogger Ashok said...

as far as i know TSOP does not work on continuous 38Khz... u need to use 2 555 sensors for making it work... can u please send me the circuit of the sensor... ma mail id is ashok.guy@gmail.com....

5:57 AM  
Anonymous Anonymous said...

hey.. i think i am in same condition. we are making micromouse at techfest this year and i have just started with the work. i dont know how i am going to complete this.. but i felt better on reading your blog.
Shraddha
TY ENTC, COEP

6:43 AM  
Anonymous Anonymous said...

I have tried using the IR sensors for the micromouse but the o/p was not as we have accepted. Can you please send me the circuit of the sensors . My mail id is jdr30@rediffmail.com

11:40 PM  
Anonymous Anonymous said...

as far as i know TSOP does not work on continuously u need to use 2 555 sensors for making it work can u please send me the circuit of the sensor.My email id is bhaskarh123@rediffmail.com

1:34 AM  
Anonymous rahul shah said...

can u pls provide me the code for micromouse as soon as possible?
i m using three sensors, one to left,one to right and other in front.
microcontroller is 89c51.
port2 as input/output port.
pin cofiguration below:
p2.7-photodiode1
p2.6-photodiode2
p2.5-photodiode3
p2.4-IR emmiter through a transistor(for some definite frequency)
p2.3 to p2.0 for stepper motor(unipolar,1.8 degree step angle)
n what frequency shout i transmit to sense approximately a distance of 4 cm?
Rahul
pls mail me to rbs7388@yahoo.com

8:17 AM  
Anonymous Anonymous said...

sir can u send me the code?
my mail ID alwar.manoj@gmail.com
thanks in advance.

10:13 PM  
Anonymous Avinash Dubey said...

sir can you please send me the code..
i am downloaded one from net but its almost unreadable and useless without any explanation and comments...
im a begginner and participating in iit roorkee techfest on 28th..

my id is av.dubey@gmail.com

2:09 PM  
Blogger chanmyay said...

it is interesting u made it within 14 days!can u pls share the code?@camelacml@gmail.com

1:44 AM  
Anonymous Anonymous said...

i really appreciate ur efforts !!
i am in the 5th sem n ive just started wid this stuff. but ur blog has helped me a lot ...especially wid the "14 day" part!! :)
quite an achievement it was!

8:51 AM  
Anonymous pranav said...

iam a beginner to micromouse. i am done with the design and the electronic part . i am using ir sensors to detect the top of the wall . i am using atmel avr contrllr . CVAVR PONYPROG to burn the prgm.
i have no idea abt the positioning of sensors and the c code can u please mail me on pranav169@gmail.com
thnks for any help....

7:08 AM  
Blogger w3iling said...

This comment has been removed by the author.

8:24 PM  
Anonymous Anonymous said...

sir i cant understand how does the mouse know the cell numbers, find out the smallest no. and move in that direction

6:51 PM  
Blogger mandar said...

"sir i cant understand how does the mouse know the cell numbers, find out the smallest no. and move in that direction"

Its all stored in the memory map.
the cell numbers are assigned in memory, and the cells are of a standard size...
So you will actually have to know that ok, there were revolutions of the stpper motor, and the distance traveled is 18 cm... so the mouse is in the next cell...
there is a lot of mechanical analysis you willl need to do just to know the place of the mouse in the maze.

1:06 PM  
Blogger amitraj said...

plz send me the micromouse c code.

3:07 PM  
Blogger Amey Dharwadker said...

Can you send me the .c code for micromouse using 3 sensors only??
I am a beginner and m in urgent need of it..
My email ID is ameydhar@gmail.com

1:41 AM  
Blogger Gaurav said...

i need the micromouse code...
i am trying to make a micromouse... stepper motors, 3 sensors, avr atmega 32. still searching for sensors. suggestions invited.
mailme.gaurav@gmail.com
Gaurav Kukreja

10:44 PM  
Blogger pUnj said...

sir could you send me the sensor circuit and code in .c to punj33@gmail.com

8:34 AM  
Blogger nidz said...

hello sir...
can u give me the specifications of stepper motor used and how much it actually costs??

5:31 AM  
Blogger amitraj said...

sir can you please send me the .c or .asm code for miromouse using just 5 sensors?
My email id is amit262971@gmail.com

I'm a beginner and the code you send will be very useful to us...

2:17 PM  
Anonymous harsh said...

sir plz send me the c & pcb layout code for micromousea at harsh12_4u@rediffmailcom
plz its urjent i need it for majar project

12:45 PM  
Anonymous Anonymous said...

sir can you please send me the .c or .asm code for miromouse using just 3 sensors?
*
and ckt diagram for sensor???
on ------aksh305@gmail.com

5:11 AM  
Anonymous Anonymous said...

sir can you please send me the .c or .asm code for miromouse using just 3 sensors?
*
and ckt diagram for sensor???
on ------aksh305@gmail.com

5:11 AM  
Anonymous Anonymous said...

hi, sir, would you like to send me the C code of your micromouse....my email. yorgio_s@hotmail.com (ERA Colombia)

8:46 PM  
Blogger Shankaran said...

hello sir,
can u send me the sensor circuit and the c code for the micromouse..as i am a beginner in c..it would be a great help...your micromouse in14days was a great morale booster..please email me at s.akash279@gmail.com

6:26 AM  
Anonymous Harshal said...

sir can you also send me your c code so that i can check it on my hardware my programming skills are weak so i need some help
my email id is harshal_2505@yahoo.co.in

2:35 AM  
Anonymous Anonymous said...

sir can you please send me the .c or .asm code for miromouse using just 3 sensors?
My email id is bond89s@gmail.com

I'm a beginner and the code you send will be very useful to us...

11:44 AM  
Blogger sooraj said...

sir i am a beginner and want to take part in competition as it is also my college project
so pls send me .asm code of micromouse and also how it counts d cell
my id is sooraj.tr@rediffmail.com
i wud be very thankful to u

2:53 AM  
Blogger sooraj said...

Blogger sooraj said...

sir i am a beginner and want to take part in competition as it is also my college project
so pls send me .asm code or .c of micromouse and also how it counts d cell
my id is sooraj.tr@rediffmail.com
i wud be very thankful to u

3:02 AM  
Blogger piyush said...

hii sirr..
i m in 2nd yr n jst strted micromouse for techfest.i don't kn wt's wrong with ir sensors bt dey r nt wrking properly.....cn u pls send me ckt of sensor.
my id is piyush.singh16@gmail.com

12:34 PM  
Blogger Renu said...

this is so very encouraging..unlike other searches that i've made..i wish you would help me out with the hex file ..for the micromouse...
my id is renubargale@gmail.com

3:10 AM  
Blogger Priyamvada said...

ur blog was very inspiring....i am a third year student and i am making a micromouse as my minor project...can u please send me the sensor circuit and the code...i could use it as a refrence...my id is priyamvada.1987@gmail.com

7:22 AM  
Anonymous Anonymous said...

helloo sir...
Myself Jaimin shah appreciate ur effort a lot..
sir, am a beginer and am in need of some guidance from your side to make micromouse as i am willing to participate in iit mumbai techfest this year.. sir, can u please guide me and send me some information about how to proceed along with ckt diagram for sensors. and drivers... with the code.. i wil be very gratefull to u sir,.. my mail id is jaldhara89@yahoo.co.in

9:58 AM  
Anonymous Anonymous said...

hi my name is salil. iam in 2nd year . iam making a micromouse in iitb techfest. iam in gr888 trouble, most of the hardware is complete . i had reg with my friends but now they r not helping me and they hav not done program. could u plzzzzzzzzzzzzz plzzzzzzzzzzz help me in prog as i am in 2nd year.my conn r p1.0=frnt sens , p1.1=left sens , p1.2=right sens..and iam using p89c51rd2fn.i m using ir led tsop 1738, and uln2003 driver and stepperson p2.

11:25 PM  
Anonymous Anonymous said...

could u plzzz mail me at salilpn@gmail.com

11:26 PM  
Anonymous Anonymous said...

it ws really encouragin to go thru ur blog...cud u pls send me the code..my id is nsharan1111@gmail.com

5:33 AM  
Blogger priten said...

sir plz give me circut diagram of sensor using TSOP and IR led

8:46 AM  
Blogger priten said...

sir plz send me circuit diagram of sensor using TSPO and IR led
my email id is pritensavaliya3@gmil.com

8:50 AM  
Anonymous Anonymous said...

Hi, all.
Dear I appreciate this beautifull Project,Congrates....!
1 thing ..you can use your MuC to generate the pulses, TSOP can recon..its simple and u dont need any 555 like ICs.at all!.
I am interested to know "How many of you" got the CODE...? !
73s

6:45 AM  
Blogger nibbles said...

hello! i would be really grateful if you could please send the code for micromouse at nibbles08@gmail.com.
thanks

3:55 AM  
Anonymous sumit pandey said...

hey........i m crazy bout the micro-mouse.............i m trying to make it but there is a flaw in my code........................so plzzzzzzz guide me regarding dis project.........plz send me the code of c for micromouse...




my id is sumitpandey.nitj@gmail.com

11:31 PM  
Anonymous Anonymous said...

sir plz send me circuit diagram of sensor using TSOP and IR led
my email id is
rethrekar.2.11@gmail.com

2:14 AM  
Anonymous Anonymous said...

sir we r d biginner at micromouse. will u plz send me d code??
my id is
tejusawakhande@gmail.com

9:47 PM  
Blogger vasim said...

can u send me ur micromouse code using 3 sensors...plz.. i m waiting for reply...
mail add..vasimshaikh39@gmail.com

9:19 PM  
Blogger varun said...

can u pls provide me the code for micromouse as soon as possible?
i m using three sensors, one to left,one to right and other in front.
microcontroller is 89c51.
port2 as input/output port.
pin cofiguration below:
p2.7-photodiode1
p2.6-photodiode2
p2.5-photodiode3
p2.4-IR emmiter through a transistor(for some definite frequency)
p2.3 to p2.0 for stepper motor(unipolar,1.8 degree step angle)
n what frequency shout i transmit to sense approximately a distance of 4 cm?
Rahul
pls mail me to varun1cbz2bikerboy3@yahoo.com

3:26 PM  
Anonymous Anonymous said...

[url=http://tinyurl.com/y9qxher][img]http://i069.radikal.ru/1001/35/75e72b218708.jpg[/img][/url]



Related keywords:
Tramadol rx
Tramadol hcl 500mg
Tramadol cod search list
fda approved Tramadol
50 mg Tramadol
Tramadol perscriptions
Tramadol no prescription overnight delivery
Tramadol cod 180ct
[url=http://www.zazzle.com/AlexanderBlack]order Tramadol cod overnight delivery [/url]
[url=http://seobraincenter.ru]http://seobraincenter.ru[/url]
what does Tramadol look like
Tramadol pain management
Tramadol buy
cheap Tramadol without perscription
buy Tramadol free fedex shipping
buy cheap overnight Tramadol
Tramadol cod search list

7:40 AM  
Blogger arpit said...

This comment has been removed by the author.

12:11 AM  
Blogger arpit said...

hey i know to make a linefollower robot by using 8051 microcontroller........but wanna make a micromouse for it what i have to do...its algo is so complex to understand......

12:12 AM  
Anonymous Anonymous said...

Sir can you please send me c language code for micromouse which uses 3 sensors. I want to know the behavior of fllod fill algorithm
my email-id:
ameya-d@in.com

5:27 AM  
Anonymous Anonymous said...

Yes undoubtedly, in some moments I can phrase that I agree with you, but you may be considering other options.
to the article there is stationary a definitely as you did in the decrease publication of this request www.google.com/ie?as_q=rapidshare downloader 2008 ?
I noticed the catch-phrase you have not used. Or you partake of the pitch-dark methods of helping of the resource. I take a week and do necheg

8:23 AM  
Anonymous Kenneth said...

Good day, I stumbled across your blog and was amazed at how your team managed to achieve what you guys have done in only 14 days. Kudos to the team.
I myself, also building a micromouse for my college project, but only to prove the theory of the flood-fill algorithm. I'm thinking of maybe a maze size of 6x6. I am facing quite some trouble dealing with the hardware but its the algorithm that is giving me the most headache. I do not fully understand how the memory stack works in storing the maze map, how the mouse determines from which memory array holds the info of the cells around it.

If you may, I would love if you could email me at Kenneth_koo23@hotmail.com, maybe send me the source code or a short explanation of how the program works. I just need some pointers to help me finish the micromouse.

Thank you very much

7:33 AM  
Anonymous Anonymous said...

nice post...well i m a second year student n i m very much intersted in making dis autonomus maze solving robot..i have made line follower n obstacle sensor robots...wuld b glad if u'll guide me thru the procedure......
plz mail me @ preeniks@gmail.com

8:33 AM  
Anonymous neelu said...

sir can u plz send me .c or .asm code for micro mouse my e mail id is
er.neelu.m@gmail.com

I'm the beginner

8:07 AM  
Blogger micromouse said...

sir i want to create high speed micromause so please send the required informaion on my id
thank you
my id is devendra.dhande9@gmail.com

12:13 AM  
Blogger micromouse said...

sir i want to create high speed micromause so please send the required informaion on my id
thank you
my id is devendra.dhande9@gmail.com

12:13 AM  
Anonymous Anonymous said...

Sir can you please send me the C-code..
i have downloaded one from net but its almost unreadable and useless without any explanation and comments...
im a begginner and participating in one of the college fests and its also my project-work

My email id is :

pramod.paddy@yahoo.com

3:03 AM  
Blogger ajantha said...

sir plz send me d code and schematic(ckt dia).. juz 4 days left for me.. motors,sensor parts are ready but can't write code now.. plz plz help.. thanks in advance... plz help sir.. its urgent..

ajanthabhat@yahoo.com

7:50 AM  
Anonymous Anonymous said...

Hii sir can u plzzz send me code of micromouse. ..Plzz its my clg project nd i jst hv very few days... My id is supriyasobti21@gmail.com
thnku in advnc...

10:19 AM  
Blogger vishnu said...

sir,can u plz mail the code to my mail address vishnu.anits@gmail.com

9:09 AM  
Anonymous Anonymous said...

unlock iphone 4
how to unlock iphone 4


unlock iphone 4 unlock iphone 4 unlock iphone 4
how to unlock iphone 4

unlock iphone 4 how to unlock iphone 4 [url=http://theunlockiphone4.com]unlock iphone 4 [/url] unlock iphone 4

12:22 AM  
Blogger Ashish Saraf said...

Respected Sir, i am naive to microcontrollers,basically we choosed with AVR as its user friendly.my basic question is if one has studied embedded c where 8051 processor is considered ,is that embedded c still tolerable with the AVR family

8:03 PM  
Anonymous Anonymous said...

mentioned nearly everybody repayment his or her personal loans in timely manner and without the need of penalty charges
A respected financial debt charity can possibly expect the volume of people today looking towards these products regarding assistance above payday cash advance debt to 2x this approach. consumer debt charitable organisation claims near purchase your temporarily, huge attraction financial loans the year of 2010. Any a good cause suggests 3 years back numerous shoppers with them ended up being trivial.
szybki kredyt przez internet
kredyt na dowód od 18 lat
chwilówki ruda śląska ul.niedurnego
pożyczki na dowód bez dochodów
pożyczki tylko na dowód

http://szybkapozyczkabezbik.org.pl
http://kredyty-bez-bik.org.pl
http://pozyczki-prwatne.com.pl

10:13 PM  
Anonymous Anonymous said...

100 free asia sex dating http://loveepicentre.com/taketour.php free dating chatting sites in us

5:50 PM  
Anonymous Anonymous said...

drivers software for blue soleil bluetooth http://buysoftwareonline.co.uk/fr/product-37088/AVS-Document-Converter-2-1 what tax line software license [url=http://buysoftwareonline.co.uk/product-10103/RegVac-Registry-Cleaner-v5-0]golf league handicap software[/url] windows language conversion software
[url=http://buysoftwareonline.co.uk/product-37225/Notepad-Pro-3-2]Notepad Pro 3.2 - Software Store[/url] google picture to dvd software
[url=http://buysoftwareonline.co.uk/product-36971/DeskSoft-BWMeter-6-0][img]http://buyoem.co.uk/image/2.gif[/img][/url]

6:26 PM  
Anonymous Anonymous said...

Replica Hermes2013 Hermes Bags sawp 2013 Hermes BagsReplica Hermes iymt

7:39 PM  

Post a Comment

<< Home