Monday, May 09, 2011

Building a computer controlled wireless robot

For a long time, I have been trying to find the cheapest and easiest way to control electronic devices wirelessly using a computer. It can open up a lot of possibilities. For example, you could build a radio controlled relay board, and control it from your computer. You could even control the board with a "small" computer such as an Arduino (or any microcontroller for that matter). If your Arduino has an Ethernet shield, you could use it as a Web server and control your relay board from anywhere in the world (as long as you have access to the Internet of course). There are many things that you could do without creating a mess with wires. I am mainly interested in this because I need a computer controlled wireless robot. A little background -

I have been working on a project at the Mobile Robotics Lab of IISc (Indian Institute of Science), Bangalore, in which I have to design a vision based obstacle avoidance algorithm for robots. What does that mean? Well, I basically have to design a robot that uses nothing but a small camera to identify obstacles in its path. Since image processing and computer vision stuff is usually quite CPU intensive, it is difficult to implement this code on a small robot. Small microcontrollers can't handle that stuff. So, the solution I came up with involves a wireless camera that transmits video to a nearby "big" computer. This big computer runs all the dirty computer vision codes, identifies the obstacles, and then somehow tells the robot how to avoid them. This is where wireless communication comes in.

To create a wireless link, you could rip the guts of a cheap RC car and use its transmitter and receiver to control your robot. That's one technique. I did something similar a few years ago . This time, I wanted to do things a little more elegantly, without destroying an RC car. I found this really inexpensive RF transmitter/receiver pair at a local electronics shop in Bangalore:





They cost only 200 INR (about 4 USD)...both transmitter and receiver. What a steal!

You can also find these online at Sparkfun:

Transmitter - http://www.sparkfun.com/products/8945
Receiver - http://www.sparkfun.com/products/8948


They cost a little more on Sparkfun, but they're still inexpensive. The ones on Sparkfun operate at 315 Mhz, but the ones I have, operate at 434 Mhz (like this one). I don't think that would make any difference in how you connect them.

To use these cheap RF modules, you could either connect them directly to your microcontroller/computer, or connect them with the help of parallel - serial encoder/decoder ICs.

I used the HT12E (parallel to serial encoder) and the HT12D (serial to parallel decoder) ICs. The HT12E is a 12 bit parallel to serial encoder. Of those 12 bits, 8 bits are the address code, and the remaining 4 bits are data. To send a signal, the address bits on the transmitter and receiver should be the same. It's like a password. You can use a single RF transmitter to control different RF receivers (at the same frequency) by configuring the address bits appropriately. All receivers would have to be set to different addresses. With 8 bits, you can create a total of 256 combinations.


Here's what the serial data coming out of the encoder looks like, in an oscilloscope:



If you look closely, you'll notice that there are 13 peaks (instead of 12). I'm not sure what the first bit is for. (Probably a parity bit?) The 8 bits coming after the first bit make the address, and the last four make the data being sent. You connect your microcontroller's (or computer's) parallel output to the 4 input channels on the encoder. With 4 bits, you can create 16 unique commands. That is enough for my purpose.

For more on how to use these ICs with the Tx/Rx, check out this excellent article - http://www.botskool.com/tutorials/electronics/general-electronics/building-rf-remote-control

Here's a flowchart of my system:



I've connected an Arduino to my computer which acts as an interface between the encoder and my computer. Here's the Arduino that I'm using:




It's a ModernDevice BBB Arduino Clone that I received from my friend Tom Boyd. I've been hooked to it ever since I got it! You should definitely get an Arduino if you don't already have one. It's the perfect tool for the programmer who enjoys playing with electronics. And it's also very easy and fun to use!

Tom has some excellent tutorials on electronics and programming on his website that keeps inspiring me! Check out some of his awesome Arduino projects - http://sheepdogguide
cools.com/arduino/ahttoc.htm.

The robot I am using is a Microbric Viper robot that I received from Microbric a few years ago. The Microbric Viper comes with an IR module which can be used to communicate with a computer wirelessly. Although I've used it in the past, it's kind of difficult to set up because infrared communication requires line-of-sight. Moreover, the range is quite limited.



I'm not going to get into the details of connecting the encoders/decoders with the RF modules because it is already covered in detail in the article I mentioned earlier. I am however, going to share some difficulties I have faced in using these RF modules.

When I was testing the receiver on a breadboard, I was powering it with an AC to DC adapter. The voltage was fine, but the decoder did not work at all. Why? When I was debugging the circuit with an oscilloscope, I realized that the signal at the encoder side was fine, with 13 distinct peaks. However, when I checked the data at the receiver side, I realized that there was some sort of noise, and the peaks were not distinct. The address bits were too close together and sometimes even merging together. Since the address bits on the decoder side did not match with this noisy data, it rejected it. I figured that this noise could be caused by radio interference noise from the AC to DC adapter. So, I removed it and powered each of them (Tx and Rx) with two AA batteries.

The other thing I noticed is that if you connect the third pin of the RF receiver (which is either marked as "Data" or "CE") to the data-IN pin of the decoder , the circuit won't work. Leave it unconnected.

I'm using a 1/4 wave monopole antenna (6.8 inches) with the RF modules. It's just a single core wire. The range I get is amazing. I think I get about 100-120 ft (through walls), and 1000+ ft outside (line-of-sight)! More than enough for my purpose. When I test it outside, it just keeps working no matter how far I go. So, I don't really know its limit yet!

The Arduino communicates with my computer through a USB to Serial cable. If I want to make the robot move forward, I would send the character '1' to the Arduino. It would recognize this as a command and forward it to the transmitter. I can send four commands to the Arduino - '1', '2', '3' and '4'. On receiving these characters, it sets the appropriate data bits on the encoder and transmits the signal.

Arduino code:


On Windows, I use a C# application to send these commands to the Arduino. On Linux, I just use the terminal. My Arduino shows up as /dev/ttyUSB0. To send the command '1', I write...

echo -n "1" > /dev/ttyUSB0

This makes the robot move forward. For a more interactive session, you can use the screen command:

screen /dev/ttyUSB0 9600

More on this here - http://www.arduino.cc/playground/Interfacing/LinuxTTY

And finally, the thing you were probably waiting for...a video! -



I hope you enjoyed this post. My next step would be to put a wireless camera on this robot and test my obstacle avoidance algorithm. Wish me luck.

I hope the information I've shared helps you build your own radio controlled electronic devices and robots!

So what did you think? I'd love to hear your feedback in the section below.

Ashish

Share/Bookmark

93 comments:

Anonymous said...

this is some really good stuff. i look forward to your posts and they never fail to impress. thanks for sharing

Anil said...

Good job done Ashish, all the best for your future projects.

Anil Mishra

Will Price said...
This comment has been removed by the author.
Will Price said...

Nice post, those transmitters/recievers look interesting, I'll have to pick some up someday!

swantron said...

Nice project. I put together a little proof of concept last week...I was driving a 4x20 LCD screen utilizing my Arduino and Linux box. Our solutions are very similar...I was doing an "echo -n [message] > /dev/ttyUSB0" to push text...pretty slick.

Take a look if you would like
http://swantron.com/command-line-lcd-arduino-interface/
Cheers

Anonymous said...

Nice!
Lucky that you are in bangalore, we have no shops like this in delhi.

Would it be possible for you to ship the Rx/Tx modules to delhi?

My email is sarangthestig(@) gmail.com

Thanks@

Anonymous said...

Nice!
Lucky that you are in bangalore, we have no shops like this in delhi.

Would it be possible for you to ship the Rx/Tx modules to delhi?

My email is sarangthestig(@) gmail.com

Thanks@

Ashish Derhgawen said...

@Swantron: Cool project! Our solutions are similar. You gotta love Linux!

@Anonymous: Yes, there are shops in Delhi. Go to Lajpat Rai market (near Red Fort)

Aficionado said...

hi ashish...
could you please post the pcb layouts of RF transmitter and reciever! thanx

reddy said...

This is really awesome and helpful to many others.Thanks for making this available to everyone.Waiting for your future projects.

Ashish Derhgawen said...

@Aficionado: The transmitter/receiver PCB was available as a kit, and I don't have its layout.

You can create your own layout based on the circuit on this page - http://www.botskool.com/tutorials/electronics/general-electronics/building-rf-remote-control

Unknown said...
This comment has been removed by the author.
Unknown said...
This comment has been removed by the author.
Deepak Karki said...

you're projects are just amazing and innovative. sure would like to learn some stuff from you. even i stay in bangalore.....where do you stay(may be we can meet up some time). and where in bangalore do you get all these stuff?(S.P. road i presume)
Are you a school student or an engg. student?

Poker Party said...

Great work Ashish. Best wishes.

Party Casino Bonus said...

Keep doing good work dude.

free casino comps said...

Thank you. was looking for this. will check it now by applying it.

franklin said...

Hi man!

Congrats for this work, it's really good!

But I have one question: I tried once do this (serial wireless communication) using a Atmel microcontroller and its serial comunication module (without encoder/decoder) and it didn't work!

Theoretically, it should work, huh?

Do you know the difference between a UART and these encoders?

Did you try do that?

Thanks a lot!

Ashish Derhgawen said...

@franklin: Sorry for taking so long to respond! I had not checked this post for a long time. Anyhow, you said:

"I tried once do this (serial wireless communication) using a Atmel microcontroller and its serial comunication module (without encoder/decoder) and it didn't work!"

I think it should have worked. You don't have to use an encoder/decoder. The encoder is basically just translating the parallel input data to serial (for the transmitter).

Did you check the activity on the receiver side with an oscilloscope?

Anonymous said...

First of all, great post! I had not realised the first 8 bits were the address and the final 4 were data bits. Makes perfect sense now. I noticed that there were 13 peaks while reading the encoders output on an oscilloscope too. My thought is that perhaps the first peak is a wake up call for the receiver.

Thanks for the tutorial.

Nahdoa

Elamaran said...

Hi Ashish,
its a nice project. By the way your blog posts are great.
I would like to buy the Tx/Rx module and those encode/decoder circuits for one of my projects.Can you tell me where did you buy those in Bangalore? SP road i guess.
If so is there any specific model name you used to buy them?
Thanks for your reply in advance.

cartier said...

So have succeeded in it?

Utkarsh said...

hi ashish!!i'm a big fan of your projects.thanks for posting so many projects and making them so easy!

Ashish Derhgawen said...

@cartier: Yes! The obstacle avoidance robot is working nicely...I'll write a blog post on that soon. Too much work right now. :P

Ashish Derhgawen said...

@elamaraon: Check Om Electronics on SP road.

Brundaban said...

i want to know how to use wireless camera in a mobile robot controlled by computer i read ur article it was awesome plz help me and if u have any program regarding above topic.
if u have that program plz share it in ur blog or just mail me
my email id is rmmechrocks07@gmail.com
i'll be highly obliged

Ashish Gangal said...

I have been looking for a wireless camera but the ones I have found online are quite expensive.
Could you suggest some place I could get one?

Anonymous said...

hey anyway i can get contact with you? please email me at stormrobot@live.com.

Thanks

Elamaran said...

Thanks for the info Ashish.

Ryan Gibson said...

Hey Ashish,

Great work here. Do you have an email I can grab you on I have a few questions to ask you about your builds.

Thanks

Ryan

ABG said...

Gud work. i'm also doing a similar work as my last year project . It is wireless PC controlled robotic arm. your blog is quite intresting continue your work :)

Kiran said...

hi ASHISH!
Do you know what is the output voltage of the receiver?

thanks

mobile phone bingo said...

Wow, it is really fantastic. I have used it. It is looking so cute. Love your blog.Best wishes for you future blogging career. Thanks

roulette games said...

I am amazed to see such an amazing post. Keep up the good work.

slot machines said...

Nice information, many thanks to the author. It is incomprehensible to me now, but in general,
The usefulness and significance is overwhelming.
Thanks again and good luck!

mobile poker said...

Nice post love your blog.This blog is awesome full of use full information that i was in dire need of. Thanks for this post. Keep it up.

mobile casino said...

Hello,

Very nice post. I like your blogging techniques and have bookmarked this blog as found it very informative. Keep it up.

black jack games said...

Nice information, many thanks to the author. It is incomprehensible to me now, but in general,
The usefulness and significance is overwhelming.
Thanks again and good luck!

Poker Sign Up Bonus said...

I am feeling very fresh and comfortable after reading you article. Nice work and keep doing well.

Party Casino Bonus said...

Very informative and impressive article. unique information.

free casino comps said...

Hello,

Very nice post, I like your blogging techniques and have bookmarked this blog as found it very informative. Keep it up.

Cartier Love said...

I view something genuinely special in this internet site. cartier love necklace

siddharth said...

hi
ur bot seems gr8.....
is it completly autonomous?
i mean if it sees an obstacle does it change its path on its own?

cheap Hermes bags said...

Useful content and awesome design you got here! I want to thank you for sharing your solutions and taking the time into the stuff you publish! Sublime work!e

surykant said...

very cool dude!!!!!!!

Everest Poker Sign Up Bonus said...

Thanks for the awesome post. Keep on going; I will keep on eye on it.

Casino Tropez Review said...

I am amazed to see such an amazing post. Keep up the good work.

online poker community said...

Hello,

Very nice post, I like your blogging techniques and have bookmarked this blog as found it very informative. Keep it up.

iphone black jack said...

This is one of my favorite i like this very much this is one of my favorite keep it up........ well done...

canada said...

is there a way to send more than 4 commands?

Stacey said...
This comment has been removed by the author.
facebook like said...

Nice post love your blog.This blog is awesome full of use full information that i was in dire need of. Thanks for this post. Keep it up.

Mobile Casino said...

Very nice post. I like your blogging techniques and have bookmarked this blog as found it very informative. Keep it up.

android poker said...

Thank you for such a wonderful post.
I enjoyed every bit of it.

iphone blackjack said...

Hello,

Very nice post, I like your blogging techniques and have bookmarked this blog as found it very informative. Keep it up.

iphone bingo said...

Nice post.and it is Amazing post as well . :)

iphone slots said...

Thanks for the awesome post. Keep on going; I will keep on eye on it.

iphone roulette said...

It’s a Good blog and congrats on having good Information, Keep it up! Thanks for sharing your knowledge with us!

party poker bonus code said...

Hi,

Nice post! Your content is very valuable to me and just make it as my reference. Keep blogging with new post! Unique and useful to follower.

Online slots said...

If it would have been split into manageable sections covering each technology rather than cramming it all into one, it would have been much better + easier to understand.

Anonymous said...

can u please explain the coding

"PORTD = B00000100;"
wat it means

Casino games said...

It’s a Good blog and congrats on having good Information, Keep it up! Thanks for sharing your knowledge with us!

Casino games said...

Really nice blog, very informative. Thanks dude for wonderful posting. Keep it up in the future as well.

party poker bonus code 2012 said...

Hi,

That is fabulous that a wireless robot is now available.. and i thing more i would say that congrats on making this and congrats that it is working nicely....

party poker bonus code 2012 said...

Great Technology.

ipad poker said...

Very useful and informative content has been shared, I must say that your writing skills are very attractive. Moreover sharing information and acknowledging others is really very good job, keep it up.

android black jack said...

Wow, it is really fantastic. I have used it. It is looking so cute. Love your blog.Best wishes for you future blogging career. Thanks

eph said...

the concept i need for the school project communicating using pc

AlbertTeh said...

Good evening there, I am from Malaysia.

I would like to ask about the range for the car to move.

Is it possible to move around a house with just using transmitter and receiver?

Your reply is appreciated.

Ashish Derhgawen said...

@AlbertTehP: It depends on how big your house is. The range I got was about 150 ft line of sight. It worked in my house without any problem.

rahulrk said...

will it work even if i use normal wires like the ones which i use to connect stuff on my breadboard as the antennas?? i've connected everything correctly as per my knowledge but doesnt seem to work.. pls help..

rahulrk said...

and will it work fine if i dont use any switches in the Tx? Just ground it for 0 and connect it to Vcc for +5 volts? This is what i am doing for all the pins D0 to D3 and the TE pin..

bharghav teja said...

hi ashish i have a doubt that whether a wireless robot uses more power or wired one?????

Anonymous said...

good project

iPad Application Development said...

This website is providing the lot of topics are visible in this blog that to valuable info in this blog.

Anonymous said...

may I know the specification of this project? If I am going to use zigbee will it work? what is the connection of the arduino to pc? could you please send the schematic diagram of this project to may account?thank you..jrexsal@yahoo.com

Snake said...

Hey I'm looking forward to build this for our Electronic Project in College.. But I have a BIG Question... Where Can I buy this Vehicle Part with 2 Wheels, Motors and the Circuit ???

Rama Bala said...

Can we use the same wireless process for laptops as it has an embedded keypad and also does it's parallel port can be connected with an encoder IC
and also how the commands of the keyboard travels to the parallel port..?

Lavanya Herle said...

awesome work !!!!!!
can u plz explain the baseboard connections of rf tx&rx.....t link tt u have posted is not responding :(
plz do tis at t earliest.....

Hassan Nashid said...

Hi Ashish, I would like to ask if you can design a video circuit for me. Please contact me for more details. Thanks & have a good day.

Abhiram Vit said...

one doubt please.....u have mentioned that u have used viper robot kit in this project....we have to use Viper Robot Kit only or we can use any remote control car circuit.

kichha huchha said...

hello Ashish..the info provided are very useful..could you please provide some info about electronic shop frm wer u bout RF transmitter/receiver and also does this RF transmitter/receiver come with encoder and decoder..Pls do reply..

Shashwat said...

Sir, I want to make an internet controlled robo via a laptop..... I've connected my robo to a laptop bt dont know how to connect the lapi to the the internet and share the data packets..... Please help me out......//
My Email Id-shashwat.krish.sriv@gmail.com

medo moon said...

Sir, I want to make an internet controlled robo via a laptop..... I've connected my robo to a laptop bt dont know how to connect the lapi to the the internet and share the data packets..... Please help me out.


my emil xx11oo@windowslive.com

Product Reviews said...

Hi, Nice post thanks for sharing. Would you please consider adding a shout out to my website on your next post? I will return the favor. Please email me back. Thanks!

Randy
randydavis387@gmail.com

sanjay chhelavda said...

Project provides very good information about interfacing adruino to computer.go on and on. all the best

Rahul Dias said...

Hey Ashish.
I'm a 11th standard student interested in designing a similar robot.
Please can you give me a list of all the components you've used?
I'm guessing you bought them from SP Road :P
here's my email id:
rahuldias69@gmail.com
really need your help! :)

Calin Dragos said...

this is one of my preferred tutorial from where I learn how to use the Ethernet shield. I add this tutorial to an article http://www.intorobotics.com/getting-started-with-arduino-ethernet-shield-tutorials-and-resources/ aiming to help beginners to understand how a robot can be controlled through internet

Poker said...

Looks like this super articles is not only one on this website. I spending more time if you will be posting soon.
-----------------------------------
Online Poker bonus gratis
Poker
Table bingo is simply stunning, the designers share 90 ball, 80 ball and 75 ball rooms into sections, making it easy to select the game. Making a donation is easy with a wide variety of payment options including PayPal, if you have a problem just contact support that is second to none - Will Hill is a great brand with a good reputation in the UK.
Games William Hill Bingo has recently free poker strengthened its offer of bingo 80 ball bingo, this option is in texas holdem poker addition to the many 75 ball and 90 ball bingo. There are many decent jackpots offered in bingo. Full house in 38 balls or less wins you Rocket cash of L 2500 while packing a full house in 33 or less will award the progressive jackpot Mountain Money. Money Mountain jackpot starts at L 10,000 and has grown considerably over L 50,000 before they got in the past. This is William Hill say, so you should expect the mini-games galore. Bingo slots and bingo cards can be played between the beginning of games and a very impressive jackpots. Clover Rollover jackpot slot machine, in particular, has reached more than L 100,000 prize on several occasions.
Sin Deposito Texas Holdem
Ohne einzahlung online poker
In addition, regular charges with cash prizes of up to L 100 run regularly on the site online poker and win this all you have to do is continue playing. A total of 200 prizes are awarded each month, including 100 pounds of pot, L 50, two second prizes, 20 prizes of L 10, L 80 and 5 awards two L 107 prizes. For every L 1 that you spend you will receive one entry in the draw so the more you play, the greater the chance of winning one of these monthly gifts.
Williamhillbingo offers a wide selection of free bingo, BOGOF bingo and guaranteed jackpot games. Run the L 8,000 Bingo Linx day, 1000 pounds worth of free bingo games and many other one-off game for the whole month.
William Hill Bingo - Our verdict free money for poker. Minimalist design and style is quite a relief online poker, easy to use and everything is in the right place. Plus, this is the site for real fans of online games, with so many side games, instant win and slots to choose from. Selection, brightness, sound bingo games and high-quality design. In total, William Hill Bingo is a good bet! Other big names in the bingo. William Hill is one of the biggest players in the online bingo world, who are in direct competition with Virgin Bingo and Foxy Bingo, which will bring something different to the table.
Free poker sponsorship
Free Poker Bankrolls
free online poker bankroll, no deposit poker and texas holdem poker no limit free.

Poker Bonus said...

I googling since few hours and this post is one of the best available. Need to say - Keep good posting every day dear admin.
--------------------------
Online Poker sans depot
Online Poker bonus
How much do you play? You're a pro, mediocre, new to poker? Select Bonus adapted to your level.
Choose Subscribe to Play Poker
League football returns after the online poker bonus free holidays, and you have an opportunity to combine the jam poker betting bookmakers. Giving a prize of € 100 to spend on sports, Football League Freeroll perfectly corresponds with the start of the tournament.
Blow up the house of cards flaming coin, and even € 100 can be yours. Using the works to launch a chip, a new bonus game gives you an extra dimension to the knowledge of the game at the tables blaze.
The middle of summer, so it takes stinging rake race worth € 30,000. to raise the temperature even more. Divided into two rankings, guarantees fast and furious action.
Online poker sin deposito
Bonus ohne einzahlung
How about a 100 000 euro? Huge cash is up for grabs with many freerolls that we have prepared for you to increase your bankroll.
Troia is a thing of the past, very successful free poker money indeed. Now it's time for the future, and that the French Cannes. You can see it already on the horizon. For the first time we host in the city's famous film festival is why the promotion that you might like. Why not take part in?
Free poker money
Poker senza deposito

Free Poker said...

Your posts are awesome, many visitors think the same i see. Anyway, i will be back here, cuz spending time here is pure pleasure.
----------------------

No deposit online poker
Free Cash for Online Poker
In poker texas holdem limit (eg, limit 2/4), the lower limit is used in the first two rounds, and higher in the two pozostaƂych.Top 10 Most Famous / Popular / Favorite poker winners money in the world
Erik Sieldel / Daniel Negreanu / Phil Ivey / Jamie Gold / free poker bonus / Michael Mizrachi AKA "The Grinder" / Peter Eastgate / Joe Hachem AKA "Hash" / Scott Nguyen / Phil Hellmuth Jr. (North America) - NAPT / (European) - EPT (Latin America) - LAPT / (Australia New Zealand) - ANZPT (United Kingdom Ireland) - UKIPT / (PokerStars Caribbean Adventure) - PCA / (Asia Pacific) - APPT English William Hill Poker. William Hill Poker is one of the oldest and largest bookmakers in the UK, now part of the booming iPoker network, traffic and promotions at William Hill, first-rate, and as much as $ 16 million in guaranteed prize money each month on the network.
Free Holdem Learn
Instant poker sponsorship
Given its UK origins, William Hill Poker is a popular poker room for British players (and European players in general) as the busiest traffic time around European peak hours.
Due to the significant sport and a tendency to crowd moving to the poker room for a few hands, Will Hill tables are usually filled with wild and loose players. Play in general is considered to be fairly loose with tons of simple games, especially at the micro stakes. The software is decent and the lobby got a well-deserved makeover in 2009, which gives a cleaner look and easier to find what tournaments. Multi-currency deposit and is also available, as is a wide variety of games and sit-and-go.
The games offered are Texas Hold'em, Omaha, Omaha Hi-Lo, no deposit poker, Seven-Card Stud, Seven-Card Stud Hi-Lo and Five-Card Stud. William Hill Poker also spreads high-stakes blackjack, casino games and sports betting. Real money player statistics as of December 2011 show 10,000 ring-game players at peak hours and 55,000 tournament players at peak hours. English William Hill Casino - The name you know and trust. Experience the quality you've come to expect. William Hill Casino combines over 7 decades of gaming knowledge with a reputation for fair play. Use the time-honored commitment to quality online casino games and innovation - play online at William Hill Casino.
No deposit poker bonus
Free Poker Money

susarla said...

how ur controlling dc geared motar with out using L293D?

Kevin Collins said...

Hi. I really enjoyed my brief visit on your site and I’ll be sure to be back for more.
Can you please consider placing my website on your link list?

Please email me back.

Thanks!
Kevin
kevincollins1012 gmail.com