This is demonstrating an Arduino Pro Micro (Leonardo) controlling 2 TT motors which are two wire DC and a 9 volt battery. The code drives them forward and backward at different speeds. We will use Arduino and the Pro Micro (which has several PWM pins) to drive our Mecanum wheeled robot car as we enlarge it to 12 volts.
A dollar and a dime: https://www.aliexpress.com/item/1761850243.html?src=google&albslr=202579861&src=google&albch=shopping&acnt=494-037-6276&isdl=y&slnk=&plac=&mtctp=&albbt=Google_7_shopping&aff_platform=google&aff_short_key=UneMJZVf&&albagn=888888&albcp=2069223045&albag=83200626464&trgt=743612850714&crea=en1761850243&netw=u&device=c&gclid=Cj0KCQjwn_LrBRD4ARIsAFEQFKvkiNHC43d71m7xF4XStgPsWMvWKNbluACkJ_sX0uTfhYJVDGs2z30aAjWIEALw_wcB&gclsrc=aw.ds
For this to work you have to use 2 PWM pins. On the Pro Micro, those are the digital pin numbers that are circled in white: here I use #9 and #10 for my PWM data pins. The other two wires for each motor are whatever you choose as long as it matches in the coding sketch. You also must have a “common ground” ; that is, the 9 volt battery ground wire goes into the same L298N port as the Pro Micro ground wire. I tried less than 5 volts and this did NOT work.

, https://i.ytimg.com/vi/g_73KHoB7u8/hqdefault.jpg

source

1 Comment

  1. I just ordered DC motor which accepts voltage between 3-6 volt . Can you use with 9 volt battery?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.