Friday, January 9, 2009

IR Remote Controlled Car (PWM motor control using ATmega8)

Hi Friends,
in my last post of Simple DC motor Control, I've discussed controlling a small DC motor using the PWM method with MOSFET H-bridge. The circuit was build with microcontroller ATmega8.
Here, I'm extending the same circuit to control the DC motor with IR remote control. The motor is fitted on a toy car wheels with gears, as shown in the figure above.

Following is the schematic (Click on the image to enlarge it):

The circuit uses two PWM channels of ATmega8 for controlling the speed and direction (reverse, forward) of the car, based on the command received from the IR remote. Here, a Sony TV remote was used. The IR codes were received by using TSOP1738 IR detector from Vishay. (Thanks a lot to Michael Spiceland from tinkerish.com, for helping me out with the code for IR signal decoding!).

Following buttons on the remote are used for control:
'1' : Start motor
Volume+ : Increase speed
Volume-: Reduce speed
Channel+: Forward direction
Channel-: Reverse Direction
'0': Stop motor

Check out the video (the LED blinks whenevr a key on the remote is pressed. The remote is not visible in the video as I was holding the camera and remote both!!)

The coding is done with ICCAVR compiler. It can be easily adapted to other compilers with minor changes. Complete code is given here:

View Code on Google Docs
Download source code files (zip)

Updated Design (done sometime in 2010, added here in 2018):
       As brought out by many in comments, above design is not power efficient, as it uses n-type MOSFETS in upper and lower, both the sides of the H-bridge. So here is the modified design of a Three-wheeled dual DC motor robot (with speed, direction and turning controls), using  the popular L293D motor driver IC, which is very easy to control and size and power efficient, providing two full-bridge circuits in one IC, each having 1A capacity to drive a DC motor.


       Following is the circuit schematic:


     This one is ATmega32 based, IR remote controlled (using TSOP1738 IR detector) with two optical detectors (MOC7811) provision to detect the robot speed. Two detectors can be used to implement a control algorithm, like PID, if required (here only one detector is used, just to display the speed). A slotted wheel is used, mounted on the motor shaft, to work with the optical detector. The wheel slots pass through the detector, generating pulses while robot is moving. The pulses are counted for speed detection.
    It has a 16x2 LCD with 4-bit interface to display the speed and current status of the robot (based on the IR input received). It has a reset button and two user buttons. There is also hardware provision for RS232 driver on-board, for adding any further functionality, like adding user configuration in EEPROM via serial port, without changing the code.
    The design runs on a 9-12V DC supply. A commonly available 9V higher density battery can be used while running the robot. When powered NO, the circuit waits in ready state (with Green LED ON) till the button1 is pressed, after which it starts accepting the IR remote commands, and acts as per the commands (with Red LED ON). Following pictures show some of the functional states.


Here are the IR remote commands used for  robot control:

    Remote Button (IR code) -   Robo Action
    ----------------------------------------    ---------------
  • START/STOP         (21)         Start/Stop
  • VOLUME+            (18)         Increase Speed
  • VOLUME-              (19)         Decrease Speed
  • UP                        (116)        Go Forward  (and stop any turn already in progress)
  • Down                    (117)        Go Backward  (and stop any turn already in progress)
  • LEFT                     (52)         Turn Left  (pressing again makes turn sharper and sharper) 
  • RIGHT                   (51)         Turn Right  (pressing again makes turn sharper and sharper)
  • CENTER               (101)         Pivot Turn  (both motor wheels in opp. directions)

Following are the optical encoder slotted disc, optical encoder and the IR Remote receiver:


        Download source-code files (zip)

         Datasheets & further info:
         TSOP1738 datasheet
         Encoder Slotted Disc

Thanks & Regards,


«Oldest   ‹Older   201 – 233 of 233
Anonymous said...

With Powerful Categories with bestschoolnews.com
Remember to check out for

Student Guide

N-Power News

Recruitment Update

Study Abroad

Visa Application

Scholarship Update


Sweden Visa Lottery

Past Questions

School of Nursing Check out for News Update.

According to bestschoolnews.com you can apply for
Sweden Visa Lottery
Cost of Flight Ticket from Nigeria to Canada
Visa Lottery Form
Canadian Visa Lottery Application Form
JAMB Result
N-Power Shortlisted
N-Power Recruitment for this year.

With bestschoolnews.com check requirement to Study Abroad.

Study in Sweden
Study in Russia
Study in Colombia
Study in Estonia
Study in Peru
Study in Ecuador
Study in UK
Study in Netherlands
Study in Guyana
Study in Paraguay
Study in Zimbabwe
Study in chile
Study in Philippines
Study in Britain
Study in Canada

How to apply for Canadian Student Visa for international student here online.

Get Past Question here

PM Kisan Yojana Scheme said...

This particular scheme was started by the Prime Minister of India to provide financial aid to every farmer who was and is in desperate need of this support.
Visit: PM Kisan Yojana Scheme.

sk said...

impossible to find well-informed people in this particular topic,but you sound like you know what you’re talking about! Skydive Fyrosity Las Vegas
Columbia Interchange Omni Heat
skydiving jobs

Data Science Training in Bhilai - 360DigiTMG said...

Terrific post thoroughly enjoyed reading the blog and more over found to be the tremendous one. In fact, educating the participants with it's amazing content. Hope you share the similar content consecutively.

data science course in varanasi

trainingcourses said...

Wow! Such an amazing and helpful post this is. I really really love it. It's so good and so awesome. I am just amazed. I hope that you continue to do your work like this in the future also.
business analytics course

trainingcourses said...

Really nice and interesting post. I was looking for this kind of information and enjoyed reading this one. Keep posting. Thanks for sharing.
data scientist course in malaysia

trainingcourses said...

Thanks for the informative and helpful post, obviously in your blog everything is good..
data science course

Priya Rathod said...

I wanted to say I really liked this article. I also agree with your sentiment that instruction is a hot topic because of the fact nothing can replace thorough and ongoing training, and there's no better way to do that right now than through the internet! The article you've written makes me eager for more articles from you, so please keep up the great work.
AWS Training in Hyderabad
AWS Course in Hyderabad

Priya Rathod said...

Great blog. Interesting topic and I enjoyed reading through it. Thanks for taking the time to publish!
Data Science Training in Hyderabad
Data Science Course in Hyderabad

360DigiTMGAurangabad said...

This post is very simple to read and appreciate without leaving any details out. Great work!
data scientist training in aurangabad

cloud computing course in bangalore said...

Extremely overall quite fascinating post. I was searching for this sort of data and delighted in perusing this one. Continue posting. A debt of gratitude is in order for sharing. data scientist course in delhi

training institute said...

Awesome blog. I enjoyed reading your articles. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work!
data scientist training in malaysia

opbestcom8 said...

Always i used to read smaller articles or reviews that also clear their motive, and that is also happening with this paragraph which I am reading here. 풀싸롱

data science said...

Great to become visiting your weblog once more, it has been a very long time for me. Pleasantly this article i've been sat tight fosuch a long time. I will require this post to add up to my task in the school, and it has identical subject along with your review. Much appreciated, great offer. data science course in nagpur

roulettesitetop said...

I like this website very much, Its a rattling nice position to read and get information. Again, awesome web log! 룰렛

sportstototopcom said...

I have read your article, it is very informative and helpful for me.I admire the valuable information you offer in your articles. Thanks for posting it . 토토

About Us said...

Amazing information i really enjoyed reading this wonderful info i have also bookmarked this blog more interesting post like this

leather jackets direct said...

Your post was amazing. I love it to recommend Leather Store to the users. Where they can crawl Exciting Products Super Star Jackets Platform is providing 100% Geniune Leather Products All products are available in Feasible Prices The best seller Leather Jackets Direct is offering amazing Leather Jackets to its customers. You can Click Here to get exciting Leather Products Offers

Anonymous said...

Toluene diisocyanate or TDI is an organic compound, which is manufactured on a large scale. It is generally obtained through the nitration of toluene. brooks adrenaline gts 21

Anonymous said...

The person who created this post it was a great human .. Thank you for sharing this amazing one post. sneakers

Anonymous said...

The NPK in NPK fertilisers stands for nitrogen, phosphorus, and potassium. These are the three essential nutrients that are crucial for an effective fertilizer. cardigan dress

vivikhapnoi said...

The article was up to the point and described the information very effectively.
vé máy bay từ singapore về sài gòn

Chuyến bay thương mại từ Nhật về Việt Nam

vé máy bay từ toronto về việt nam

vé máy bay từ san francisco về việt nam

vé máy bay từ los angeles về việt nam

chuyến bay thương mại từ canada về việt nam

Mallela said...

Thanks for posting the best information and the blog is very good.data science course in Lucknow

training institute said...

I wanted to leave a little comment to support you and wish you a good continuation. Wishing you the best of luck for all your blogging efforts.
data scientist certification malaysia

vivikhapnoi said...

It's really amazing to have many lists of will help to make thanks a lot for sharing
các chuyến bay từ nga về việt nam

đặt vé máy bay từ canada về việt nam

chuyến bay từ frankfurt đến hà nội

mua vé máy bay giá rẻ tu itali ve Viet Nam

Săn vé máy bay 0 đồng tu Ha Lan ve Viet Nam

Vé máy bay Vietnam Airline tu New Zealand ve Viet Nam

Kundan Kishore said...

Kundan Kishore has a created a phenomenal course on Stock Market. It’s called A Complete Course on the Indian Share Market. This is a course curated for investors, traders, career seekers and students of India.
Visit: Kundan Kishore

vivikhapnoi said...

It's really amazing to have many lists of will help to make thanks a lot for sharing
giá vé máy bay từ mỹ về việt nam tháng 12

giá vé máy bay từ đức về việt nam

chuyến bay cuối cùng từ anh về việt nam

bao giờ có chuyến bay từ úc về việt nam

đặt vé máy bay giá rẻ tu Dai Loan ve Viet Nam

khi nào có chuyến bay từ canada về việt nam

sk said...

Thanks for the share. But if you guys want Top Digital Branding Agency In Delhi then contact us. candela laser machine

Outsourcing Training institute In Dhaka said...

A very instructive post. Thanks for sharing this. It was very beneficial for me.

Web Development Company In Bangladesh said...

Thanks for sharing this article . This article is very helpful for me.

Alexander Debrah said...

We've gained valuable experience working for various agencies on very demanding security assignments.security services in London With this experience, taking care of your kids won't be a problem. This is because our officers are accustomed to working under tough conditions taking care of high-profile individuals and their families.

eddielydon said...

Thanks for posting this info. I just want to let you know that I just check out your site Dirk Gently Leather Jacket

Muhmmad Hassan said...

I like the valuable info you provide in your articles.
I’ll bookmark your blog and check again here regularly.
I am quite certain I will learn a lot of new stuff right here!
Good luck for the next! Attacks on journalists

«Oldest ‹Older   201 – 233 of 233   Newer› Newest»