Adafruit Motor HAT v1

Last Updated on 30th September 2023 by Suffocation

The motor board is perfectly suited for small robot projects that use 2 to 4 drive motors.

Additionally, it offers connections for two servos. The analogue ports are looped through.

Facts

Here are the key data points at a glance:

  • 2 Servo connections
  • 2 engine mounts
  • 1 shift register
  • Reset switch
  • 1 External voltage connection
  • 1 Power LED
  • Jumper – to interrupt the board voltage
DescriptionWorth
Logic Voltage [V]5
Motor output voltage [V]4,5 -25
Max current output per motor / peak [mA]600
Peak currents of up to [mA]1200
Servo voltage [V]5
Jumper separation supply voltage and board voltage1
Supply voltage for motor [V]4,5 -25
Key data

Addendum 30.09.2023Recent PCBs seem to function up to 36V output voltage

Wiring

Motor bridges

Using the motor driver boards, 4 DC motors or 2 stepper motors (with 4 wires) can be operated. The L293D motor driver boards can supply motors up to a current of 600mA (briefly up to 1.2A). If a higher current is required, additional L293D ICs can be soldered piggyback onto the existing ones and operated in parallel.

The shift register allows you to control the direction of the motors with just 3 Arduino pins.

(Perhaps include a post about the disc register...).

Among other things, there is a library from Adafruit for controlling the motors. This can be downloaded via Git or the Arduino GUI (see below).

https://github.com/adafruit/Adafruit-Motor-Shield-library/zipball/master

The motor bridges occupy the following pins on the Arduino:

  • Pin 11 Motor 1 – Speed
  • Pin 3  Motor 2 – Speed
  • Pin 5  Motor 3 – Speed
  • Pin  6  Motor 4 – Speed
  • Pin 4, 7, 8, 12 Directional setting for all motors via 74HC595 register.

Servo connectors

The board has two slots for standard servos. Each slot has three pins, one each for power, ground, and the control input.

The control inputs occupy the following pins on the Arduino:

  • Pin 9 – Servo 1
  • Pin 10 – Servo 2

External power supply

A voltage of 4.5V to 25V can be applied to the screw terminals. Please pay attention to the polarity, otherwise it will smoke...

Views

Operation

  • Two-axis plotter
  • 2 or 4 wheel robot
  • Pan/Tilt Tripod

Programming

Libraries

I've looked at the library via GitHub downloaded and installed it manually. It's a bit easier via the Arduino GUI.

Open Library Manager

Search for „motor“ and install the latest version of the „Adafruit Motor Shield Library“. Beware, there is an „Adafruit Motor Shield V2“ which unfortunately cannot be used for the V1 board. (Motor board V2).

Code

Control servos

Basically, the servos are controlled quite normally via the Arduino library. The important thing for the motor board is only that the servos are connected to ports 9 and 10 here.

My cheap servos judder a bit at the endpoints, these could be excluded by adjusting the min and max constants.

The step size can be determined by the factor, and the waiting time between individual steps can be determined by wait.

ServoTest.ino

Controlling the engine

For a first test, I used the existing example program.

Simply select, copy, and then engine 1 runs.

To test all four engines, which seems useful for checking the directions of rotation (polarity), I have adjusted the file as follows.

MotorTest2.ino

The output should then look like this.

Control stepper motor

Basics of the stepper motor exist here.

For the initial tests, there's a sample program.

Miscellaneous

Compatibility

The Shield can be used with the following boards.

Arduino Uno

Arduino Leonardo

Uno + WiFi

Conditionally compatible, an external power source is required to operate more than one servo.

Arduino Mega + WiFi

Conclusion

The circuit board can control 4 motors and two servos, which should be sufficient for most RC or robot projects. Unfortunately, at full utilisation, it already occupies 10 I/Os for this. Anyone needing more I/Os could with the Version 2 of the circuit board be better off, but it is currently quite expensive.

Related Posts

Sources

https://playground.arduino.cc/Main/AdafruitMotorShield

https://learn.adafruit.com/adafruit-motor-shield/library-install

https://learn.adafruit.com/adafruit-motor-shield

https://learn.adafruit.com/adafruit-motor-shield/faq

Leave a Reply

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