what i am...???

Once upon a time, I,
dreamt I was a butterfly,
flittering hither and thither,
to all intents and purposes a butterfly.....
suddenly I awoke......
Now I do not know whether
I was then a man dreaming I was a butterfly,
whether I am now a butterfly dreaming I am a man

Friday, June 6, 2008

matlab robot

i got a mini project to be guided on the topic remote controlled robot from the mes college of engg. but the students told me that they want to do a different project which must be noticed even though the IR remote controlled devices are very common project.

hence i discussed it with kake. kake told me to avoid the remote part and interface the robot with a PC via serial port. i was afraid since i only know the serial communication using the turboC which has many tedious works to be done.

kake suggested me to try with matlab which has a lot of toolboxes. he was sure there will be toolbox for serial communication via serial port.

i googled with the hope to complete the project at least in one month. but i got a set of statements with we can transmit a single byte or even a file itself serially

so tried with sending some byte of data for each action to takeplace such as '0' for forward motion, '1' for turning left, '2' for turning right and '3' for stopping all actions.

the code was having just 8-10 lines and i made it in conditioned infinite loop. if i am entering any byte other than the mentioned one the program will exit.

in the robot side i used a microcontroller AT89C52 to control the motion of the robot. it can serially communicate with the outside if the communication is in CMOS logic. but the RS232 is TTL logic which won't respond with our microcontroller. so we have to use a new ic to convert TTL logic to CMOS and vice versa.

to avoid data loss we have to assign a fixed baud rate at the transmitter side and at the receiver side. the baud rate i used is 4800 bps

i programmed the microcontroller to frequently check for the reception of data. on the basis of the received bit, i switched the control to different operations as already mentioned.

but the difficulty with this was, we have to type each byte inside single quotations. for example while the robot is traveling at any edges, we want to stop the robot, we type '4' and press enter. this will take some time and the robot may fall down. my students also requested to make the program larger. so i went for using GUI in matlab.

it was very simple to make GUI in matlab using guide command. i made five buttons namely forward, left, right, stop and close. while we press the any button the corresponding byte will be serially sent to the robot. close is used to close the GUI window.

to have more details on this project please get to my wiki page.

No comments:

Post a Comment