Showing posts with label Adafruit DC & Stepper Motor HAT for Raspberry Pi. Show all posts
Showing posts with label Adafruit DC & Stepper Motor HAT for Raspberry Pi. Show all posts

Wednesday, 21 February 2018

U3A robot - get the motors running

This is a record explaining the build on the robot RaspberryPi.

For now we're using the adafruit DC motor hat
  1. Fresh SD card image with Raspbian stretch lite
  2. Add wpa-supplicant file and ssh file to card
  3. Boot up pi and log in via ssh
  4. expand filesystem, change password, and change machne name (raspi-config)
  5. enable i2c (raspi-config)
  6. mkdir github, cd github
  7. sudo apt-get install git python3-dev python3-pip
  8. sudo apt-get install nfs-kernel-server  # if you want to remotely access files on this pi
  9. install the adafruit python library and setup
  10. make sure you are in the Adafruit examples library:
    cd ~/github/Adafruit-Motor-HAT-Python-Library/examples
Here's the motor HAT plugged into an Rpi Zero, the power is taken from the RPi's 5V supply (these are only little motors) and motors 3 & 4 are hooked up on my baby robot chassis. The example program DCTest.py now happily drives one of the motors.

Wednesday, 1 June 2016

getting more out of an Adafruit DC & Stepper Motor HAT

As described in an earlier post, this HAT is really only doing stepper motor control as an afterthought, so limited the step rate to just under 80 per second.

However after rummaging around in the code while developing a driver for my telescope mount, I noticed that the Adafruit code is pretty basic and makes no attempt at optimisation.

With some simple changes to the Adafruit code I have managed to improve the step rate to around 280 per second peak. This also means that there is less jitter in the pulse timing as well.