element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum How to control two 9V DC motors using an IR remote control on the arduino uno?
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Suggested Answer
  • Replies 5 replies
  • Answers 1 answer
  • Subscribers 418 subscribers
  • Views 1486 views
  • Users 0 members are here
  • diy
  • code
  • electronics
  • electrical
  • arduino
Related

How to control two 9V DC motors using an IR remote control on the arduino uno?

e14 Contributor
e14 Contributor over 12 years ago

I have connected two 9V DC motors to my arduino and have attached an IR sensor on the breadboard as well. I have an IR remote control and want to power the motors via the remote but I have no clue what to write for the code. Can someone help me write the code and also can I get good references to a "dictionary" I guess you can call it for the arduino programming language. Thanks!

  • Sign in to reply
  • Cancel
  • Robert Peter Oakes
    0 Robert Peter Oakes over 12 years ago

    just google this

    "c programming kernighan and ritchie pdf" and you should find several references

     

    the two names there where the authors of C way back in the Bell Labs days, they basically invented it

     

    As the Arduino is not using C++ or even modern variants of C, this will be a good starting point for you
    as it wont get you doing things that are not available

     

    there is also this  Arduino - Learn the basics

     

    As for you motors, how have you connected them (You did not mention). The Arduino is not compatible with 9V devices and it also does not have the drive capability to dive motors (Maybe the smallest low voltage low power ones but that's still a bad idea) so I am concerned you may be setting your self up to damage you Arduino.

     

    This is a bad way, with the back EMF of the motor you can easily blow the controller as there is NO protection Simple 2-way motor control for the Arduino

     

    Many people claim the 328 can sink or source up to 40mA, this is from the ABSOLURE MAX specifications and therefor not recommended

     

    this is an excerpt from the data sheet

    Although each I/O port can sink more than the test conditions (20 mA at VCC = 5V, 10 mA at VCC = 3V) under steady state

     

    1] The sum of all IOL, for ports C0 - C5, ADC7, ADC6 should not exceed 100 mA.

     

    2] The sum of all IOL, for ports B0 - B5, D5 - D7, XTAL1, XTAL2 should not exceed 100 mA.

     

    3] The sum of all IOL, for ports D0 - D4, RESET should not exceed 100 mA.

     

    If IOL exceeds the test condition, VOL may exceed the related specification. Pins are not guaranteed to sink

    current greater than the listed test condition.
    (Which is 20mA)

    this is a better way to drive a motor (he voltage can vary as needed to the motor so in your case 9 V will work without any change to the circuit

     

    Typical toy DC motor circuit with Arduino this will drive a motor on and off but not reverse, you will need an H Bridge circuit for that, google "Arduino motor H Bridge" and you will find plenty to help

     

    Take a photo on you cell, camera or just sketch it out in your favorite drawing program if needed and post it here

     

    We can then help better

     

    Peter

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • kidiccurus
    0 kidiccurus over 12 years ago

    Personally, I find the reference section on the arduino website almost indispensable. Arduino - Reference

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • dougw
    0 dougw over 12 years ago

    There are lots of examples on the internet - Mr Google can help you....

    IRLib | CY's Tech Talk

    Ken Shirriff's blog: A Multi-Protocol Infrared Remote Library for the Arduino

    https://learn.adafruit.com/trinket-gemma-ir-remote-control/using-ir-codes

    https://www.inkling.com/read/arduino-cookbook-michael-margolis-2nd/chapter-10/recipe-10-2

     

    etc.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • e14 Contributor
    0 e14 Contributor over 12 years ago in reply to Robert Peter Oakes

    The motors are hooked up straight to the arduino ports via a breadboard. It's wires on motors connected to wires from arduino ports.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Robert Peter Oakes
    0 Robert Peter Oakes over 12 years ago in reply to e14 Contributor

    as I suspected. This is not a good idea as I said before, you will risk damaging the Arduino so get a driver for it, the circuit above or an ic like the LM2003 which is more than enough to drive a small to medium motor and is very easy to connect

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube