================================================================================================================================================

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
         MOC7811
         Encoder Slotted Disc
        




Thanks & Regards,
ccd@dharmanitech.com

208 comments:

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

When it comes to the cannabis scene in DC, there's no denying the buzz around Weed DC. The city has seen a remarkable shift in attitudes towards marijuana, with initiatives like Initiative 71 legalizing the possession and cultivation of weed in limited quantities. Whether you're a seasoned enthusiast or simply curious, Weed DC offers a range of options for exploring this budding industry. The city has become a haven for those seeking a greener lifestyle, from dispensaries with top-notch strains to informative events and workshops. So, if you're in DC and looking to experience the world of cannabis, Weed DC is where it's at!

Anne Teak said...

The anticipated course and useful substance work on it to investigate and draw in with your posts. Walmart Pet Rx is a very popular pet store which competes against brands like Chewy, Petco and Rover. Save with the best Walmart Pet Rx Promo Code now to take advantage of these incredible savings on the products you need and want. Shop smart and save big with Super Savers Info!

Robin said...

I read good articles and comments here and leave comments with a lot of help. Thank you. Abogado Transito Frederick VA

careergearup said...

https://clatbrains.in/clat-coaching-in-hyderabad/
https://careergearup.com/sociology-optional-syllabus/
https://careergearup.com/sociology-optional-coaching-online/
https://clatbrains.in/clat-coaching-in-hyderabad/
https://careergearup.com/top-10-csat-coaching-institutes-in-hyderabad/
https://careergearup.com/sociology-optional-coaching-in-hyderabad/
https://careergearup.com/ias-coaching-in-hyderabad/

dellbhoomi training said...

thanks for valuable information nice article

dellbhoomi

gcpmasters training in hyderabad said...

When it comes to the cannabis scene in DC, there's no denying the buzz around Weed DC. The city has seen a remarkable shift in attitudes towards marijuana, with initiatives like Initiative 71 legalizing the possession and cultivation of weed in limited quantities. Whether you're a seasoned enthusiast or simply curious, Weed DC offers a range of options for exploring this budding industry. The city has become a haven for those seeking a greener lifestyle, from dispensaries with top-notch strains to informative events and workshops. So, if you're in DC and looking to experience the world of cannabis, Weed DC is where it's at


https://gcpmasters.in/ gcp masters Training in Hyderabada

Pankaj said...

Digital Marketing course in south Delhi recently introduced a unique certification course for business leaders. It is designed to help improve your knowledge of marketing and boost your confidence to achieve your goals. Whether you are a senior marketer or a rising star, this program is ideal for you. The program includes 12 classes and online modules, the program also features interactive Q&As along with support from a community of experts. It will provide all the information you need to make it.

azure admin training said...

nice blog post

thank you for sharing with us.


azure admin training in Hyderabad

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