Tuesday, August 4, 2020

Robot Wheels -testing 2 DC motors

Robot cars or tanks have 2 motors one for each side. The most basic test is are the wheels connected correctly to motors.

Parts

Ardiuno ,L9110S H Bridge
breadboard, Jumper wires, 9V battery

Wiring

Wired so via signals from the Arduino both polarities, positive and negative, can be used.

From L9110S to Ardiuno (use male to female jumper cables)
(see photo)
  • B1B to Ardiuno pin 9 (red)
  • B1A to Ardiuno pin 3 (blue)
  • GND to Ardiuno GND pin (black)
  • VCC signal to Ardiuno GND pin (red)
  • A1B to Ardiuno pin 11 (gray)
  • A1A to Ardiuno pin 10 (white)

Basic Tests

  • Does each wheel move forward and backwards?
  • Can both wheels move at the same time?
    • change + and - for wheel going in wrong direction
  • Do both wheels move in the same direction?
  • Can the speed be varied?
  • Can change from forward to backwards?
  • Can wheels move at different speeds?

Code

Download code from github traisen/Ardiuno: here
  • Click on Code to download.
  • Unzip
  • Copy both folders into your Ardiuno folder where your other sketch code is 
    • optional, but recommended so listed under Sketchbook in your Ardiuno IDE
  • Open folder and click on file to open
Code Design Overview

variable set-up
  • pin definitions using variable that match the pin names for L9110S and on Arduino
  • pins 3,9,10,11 were chosen because PWM pins which can write analog signals.
setup()
  • define output pins
loop()
  • performs motor tests
local functions:
  • void move_motorA(int d) 
  • void move_motorB(int d) 

TestFor2DCmotorsUsingDigits tests:
  1.   Motor A fwd, bck, off   wait 5 sec.s
  2.   Motor B fwd, bck, off   wait 5 sec.s
  3.   Both Motors fwd, bck, off   wait 5 sec.s
TestFor2DCmotorsUsingAnalog tests:
  • Motor A fwd fast, fwd slow, bck fast, bck slow, off  
  • Motor B fwd fast, fwd slow, bck fast, bck slow, off   
  • Both Motors fwd-fast, bck-fast,   Tests forward, wait (10 secs)
  • Motor A slow motor B fast; wait, 
  • Motor A fast motor B slow; wait, 
  • Both motors: fwd-slow, bck-slow,off, wait

No comments:

Post a Comment

Arduino and pump

Motor Driver witn 9110 or 9110S  https://www.laskakit.cz/user/related_files/l9110_2_channel_motor_driver.pdf https://docs.sunfounder.com/pro...