Motorshield

From SB-Components Wiki

Raspberry Pi Motor Driver HAT

Motor Shield for Raspberry Pi is created to assist you in building your Raspberry Pi-based Robot. This board has the ability to control both the DC and stepper motors. You may use your IR and Ultrasonic sensors to provide information to your robot about its surroundings. Line Following, Object Following, Wall Following, and Maze-Solver Robots are all simple to create.

Features

  • Motor Shield is powered by Dual H-Bridge IC L293D: For controlling up to 4 DC motors or 2 stepper motors.
  • Motor Input Supply Range: 6V – 24V
  • Single Motor Output Current: 600mA or 1A peak current per channel.
  • Programmable onboard LED arrow indicator for motor direction.
  • 2 IR sensor Connectors with 3.3V level output protection.
  • 1 Ultrasonic Sensor Connector with 3.3V level output protection.
  • Male Header and screw terminal for Motor Supply.
  • On-board GPIO stacking header

Specifications

  • Motor control : upto 4 DC or 2 Stepper Motor
  • Indicator : LED arrow Indicator.
  • Sensor Connector : 2 IR sensor, 1 Ultrasonic sensor connector.
  • Python Library : Yes.
  • GUI : Python-based GUI.

Pinout

MotorShield RPi BOARD Numbering
VCC 5V
GND GND
M1 EN 11
M1 IN1 13
M1 IN2 15
M2 EN 22
M2 IN1 18
M2 IN2 16
M3 EN 19
M3 IN1 21
M3 IN2 23
M4 EN 32
M4 IN1 24
M4 IN2 26
Forward Arrow 37
Backward Arrow 33
Left Arrow 36
Right Arrow 35
Ultrasonic TRIG 29
Ultrasonic ECHO 31
IR1 and IR2 7, 12

Installation

  • Stack Motor Shield on Raspberry Pi 40 Pin GPIO header as shown below.
  • Open Terminal and download the code by writing:
git clone https://github.com/sbcshop/MotorShield.git
  • Your code will be downloaded to '/home/pi' directory. Use 'ls' command to check the list of directories.
  • Go to directory 'MotorShield' and open 'Test_Motor.py'.
  • Run (Press F5) file 'Test_Motor.py'. This is the example code to run all the motors in 'Forward' and 'Backward' direction.
  • For interfacing Stepper Motor use example code 'Stepper_Test.py'.

GUI of Motor Shield for Raspberry Pi

 GUI Features: 
  • GUI for Controlling Motors using Motor Shield
  • Control 4 DC motors with Direction controlling
  • User can also control Speed of each Motor

GUI Guide

  • You can run GUI by running below command in terminal or by running "GUI_Motor_Shield.py" file on any python supported ide.
python3 GUI_Motor_Shield.py
  • Set the direction (i.e. Forward or Backward) and speed of Motor. Adjust the Speed in percentage i.e. 10 – 100%.
  • Click the START button to start the Motor.
  • You can ON/OFF the direction LED also as per the direction of Motor or Robot.
  • You can set all 4 motors at different speed and direction.

Resources

Github

Datasheet