Monday, September 22, 2008

Driving I-robot using C#

I will be more specific and focussed in this post! no no to all the philosophy and lectures! :D

If you don't have a i-robot, not a problem! You can learn serial port programming using C# in this tutorial, You can implement it for your own device if you know the hardware specifications.

Requirements :
Procedure :
  • Connect your I-robot to the serial port of your comp. and go to device manager click on Ports and know the port number (eg :COM9, COM11....)
  • Open Visual C# Express Edition/Visual Studio , Start>New Project>Windows forms application
  • Drag and drop two buttons from toolbox window, Name them "Sing" and Square".
  • Double Click on sing, write the following event handler code
  • In the code "COM11" , key in your COM#.
//
SerialPort robotport = new SerialPort("COM11",57600, Parity.None, 8, StopBits.One);

robotport.Open();
robotport.Write(new byte[] {128, 132},0,2);
robotport.Write(new byte[] {140, 0, 4, 62, 12, 66, 12, 69, 12, 74, 36},0,11);
robotport.Write(new byte[] {141,0},0,2);
robotport.Close();
//

  • Double Click on Square, key in the following C# event handler code
//
SerialPort robotport = new SerialPort("COM11", 57600, Parity.None, 8, StopBits.One);
robotport.Open();
robotport.Write(new byte[] { 152, 17, 137, 1, 44, 128, 0, 156, 1, 144, 137, 1, 44, 0, 1, 157, 0, 90, 153 }, 0, 19);
robotport.Write(new byte[] { 153},0,1);
robotport.Close();
//
  • Save all and build the solution.
  • Run
  • Click on Sing/square and see how the i-robot responds!
Check out the videos and see how my i-robot responded!


DEMO


CODING/SCREENCAST


*If your laptop doesn't support Serial Port, Buy a USB to Serial converter!
*If you have any queries please add a comment, I shall reply to your queries asap.

12 comments:

nitin rao said...

very interesting, keep it up....

Sattvik said...

people really liked it at the UG Meet, including me. Keep up the good work...

Dhawal.Bhanushali said...

You rocked dude ... Only let me know where u got those magnets from :D ...

Qube said...

Thats simply amazing da. Thanks for this info. Really interested in exploring more on that.

Himanshu Sheth said...

Nice work.Which is the processor being used and what is the Clock Rate at which it works?

Also,just curious to know if it is Adapter Powered or USB powered?

Mail me if comments would be too much here :)

Nice to see young guys like you doing stuff like these !!!!

Keep it up.

-Himanshu Sheth

Himanshu Sheth said...

Ooops, There is external power supply :)

-Himanshu Sheth

Lakshman Srikanth said...

Hi himanshu,

Its just a Interface where you need not worry about low level hardware or mechanical movement! there are few micro controllers used for the IR sensors, motors/actuators.... I don't think any microprocessors are used!
But i can use a command module or a E-Box to program the i-robot, wherein that e-box/command module has a ARM processor. the module is connected to the Parallel Port of the i-robot i.e in the cargo bay!

Its not USB-powered!
Right now , in the demo , i have used 12 AA batteries,
Rechargeable battery is available specifically made for i-robot.

Please don't hesitate to reply :D , if you have more queries.... :-)

Thanks a lot :-)

Lakshman Srikanth said...

I am thinking of using the beagleboard! i.e linux embedded to the i-robot! So that i can build a robotics open source operating system :P

titty said...

hey sriki,

this was really cool.. :).. i would come home to see ur robo sing :)

Lakshman Srikanth said...

@titty - Sure anytime :-) Which song do you want my robot to play?

lol

thanks

Gracelyne Fernando said...

Neattttt Demo !!!!!!!!

Rock on dude..!Further plans besides opensource proj?

prathamesh parab said...

i need to drive irobot avr series microcontroller atmega16.. On avr loader v1.0 beta.. Can u help