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 – 212 of 212
eshwar said...

nice article

thanks for sharing with us

Azure Admin Training In Hyderabad

Halloween Costume said...

Magnificent piece of content. I just found your weblog and in progression money to affirm that I get really adored account your weblog posts. Halloween Costume

Saudi Arabia Switches to E-Visas said...

I learned so much from your post! Your ability to simplify complex concepts is commendable. Looking forward to more educational content.

digital john said...

Nice article

digital marketing course in hyderabad
digital marketing trainier

shane said...

Design with Microcontrollers" likely refers to a technical field or educational focus centered around the use of microcontrollers in electronic design and development. It involves creating and implementing various electronic systems and projects using microcontroller technology. abogado de testamentos y sucesionesThis field explores the integration of microcontrollers for automation, control, and embedded systems across various applications and industries motorcycle accident in virginia beach .

Unknown said...

Thank you for consistently providing new and innovative perspectives that help us grow." Your site is an inspiration, and your work improves our lives.wanikani promo code

Saudi visa on arrival fees said...

I'm consistently enthralled by your blog! You masterfully intertwine profound insights with eloquent storytelling, providing readers with a thoughtfully designed expedition through a realm of knowledge. Your talent for simplifying intricate ideas is genuinely commendable. Gratitude for sharing this enlightening piece that profoundly resonates with your audience.

glen said...

Amazing, Your blogs are really good and information. It is very great and useful to all. 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 motorcycle accident i 95 virginia. I got a lots of useful information in your blogs. Keeps sharing more useful blogs...

vcube said...

Nice article keep posting
Java Training institute in Hyderabad

Lilly Anna said...

Your IR Remote Controlled Car project showcasing PWM motor control using ATmega8 is both impressive and insightful! phil mickelson net worth The integration of ATmega8 for precise PWM control adds a layer of sophistication to the traditional remote-controlled car concept.

Mason said...

Great article on IR remote-controlled cars and PWM motor control! Your explanation of how PWM enhances motor control is really helpful for beginners like me. Can't wait to try these techniques on my next RC project.

bankruptcy chapter 7 attorney near me

Anshita Panchal said...

Enroll in our South Delhi-based Best Artificial Intelligence Course In South Delhi course and delve into extensive modules facilitated by industry experts. Acquire expertise in the crucial skills required for success in the AI field.

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