The SparkFun Auto pHAT for Raspberry Pi is an all in one robotics package that focuses on quickly adding robot functionality and support to your Raspberry Pi or other single-board computer. The Auto pHAT can drive two small DC motors with or without encoders and up to four servo motors in a straightforward manner via an I2C connection. The servo control is based on the SparkFun servo pHAT and thanks to its I2C capabilities, this PWM add-on saves the Raspberry Pi's GPIO pins, allowing you to use them for other purposes. We have also provided a Qwiic connector for easy interfacing with the I2C bus using the Qwiic system. Whether you use the Auto pHAT with a Raspberry Pi, NVIDIA, Jetson Nano, Google Coral, or other SBC, it makes for a unique robotics addition for and board with a 2x20 GPIO.
The DC motor control comes from the same 4245 PSOC and 2-channel motor ports system used on the SparkFun Qwiic Motor Driver. This provides 1.2A steady state drive per channel (1.5A peak) and 127 levels of DC drive strength. The SparkFun Auto pHAT also supports up to two motor encoders thanks to the onboard ATTINY84A to provide more precise movement to your creation!
Additionally, the Auto pHAT has an on-board ICM-20948 9DOF IMU for all your motion sensing needs. This enables your robot to access the 3-Axis Gyroscope with four selectable ranges, 3-Axis Accelerometer, again with four selectable ranges, and 3-axis magnetometer with an FSR of ±4900µT.
Power to the SparkFun Auto pHAT can be supplied through USB-C connector or external power. This will power either the motors only, or power the motors as well as the Raspberry Pi that is connected to the HAT. We've even added power protection circuits to the design, to avoid damage to power sources.
This skill concerns mechanical and robotics knowledge. You may need to know how mechanical parts interact, how motors work, or how to use motor drivers and controllers.
Skill Level: Rookie - You will be required to know some basics about motors, basic motor drivers and how simple robotic motion can be accomplished.
See all skill levels
Whether it's for assembling a kit, hacking an enclosure, or creating your own parts; the DIY skill is all about knowing how to use tools and the techniques associated with them.
Skill Level: Noob - Basic assembly is required. You may need to provide your own basic tools like a screwdriver, hammer or scissors. Power tools or custom parts are not required. Instructions will be included and easy to follow. Sewing may be required, but only with included patterns.
See all skill levels
If a board needs code or communicates somehow, you're going to need to know how to program or interface with it. The programming skill is all about communication and code.
Skill Level: Competent - The toolchain for programming is a bit more complex and will examples may not be explicitly provided for you. You will be required to have a fundamental knowledge of programming and be required to provide your own code. You may need to modify existing libraries or code to work with your specific hardware. Sensor and hardware interfaces will be SPI or I2C.
See all skill levels
If it requires power, you need to know how much, what all the pins do, and how to hook it up. You may need to reference datasheets, schematics, and know the ins and outs of electronics.
Skill Level: Rookie - You may be required to know a bit more about the component, such as orientation, or how to hook it up, in addition to power requirements. You will need to understand polarized components.
See all skill levels
We welcome your comments and suggestions below. However, if you are looking for solutions to technical questions please see our Technical Assistance page.
Based on 1 ratings:
Hi,
i like this board because I can power the motors and the rpi from the same cell phone power block.
I haven't tried the servo subsystem yet. I have to figure out how to mount a RCWL-1601 (3.3 v HC-SR04) ) on a servo.
I haven't tried the IMU yet.
Improvements:
The ethernet connector on the rpi 3b v1.2 blocks the qwiic connector a bit.
More documentation !!!
Build one for the ESP-32 Wrover.
Is the PSOC able to talk to the encoder counter ATTINY as well? Ultimately everything on the board can support closing the loop with the encoders, but it's not clear if the PSOC is able to support master communication to the ATTINY and slave communication to the pi - is this possible the way the hardware is configured? It's so close to being perfect!
Did you ever manage to get this done? I want to use this for PID control - rotate a specific number of encoder counts, with given speed and acceleration.
Thanks, Dan.
Hi there, it sounds like you are looking for technical assistance. Please use the link in the banner above, to get started with posting a topic in our forums. Our technical support team will do their best to assist you.
That being said, yes it is possible, as they are connected to the same I2C bus. However, you would need to re-program the PSOC using the SWD pins. Unfortunately, those instructions are beyond the scope of our support team. (I would recommend checking out the schematic and our Serial Controlled Motor Driver for information on the PSOC firmware.)
Is it possible to have code source of the ATiny ? (if I ask kindfully...)
Hi SebCestBien, Absolutely! Sorry we didn't get this posted sooner. We have the firmware available as a separate github repository. I just clicked "make it public", so you should be able to view or clone it here:
https://github.com/sparkfun/Qwiic_Dual_Encoder_Reader
Cheers! -Pete
I'll ask the engineer if he can add it to the product repository on GitHub.
Will this board be stackable, allowing for more motors and servos?
Yes, the I2C addresses just need to be modified for the motor driver and servo controller ICs, with the jumpers on the bottom.
Hey Santa and #965, Thanks for chiming in here! You are correct. But I also wanted to mention there are 2 more devices on the I2C bus: (1) the 9DoF IMU and (2) the Encoder Reader ATTiny84. (this means there are 4 total devices on the bus that you must consider while stacking). All of these have dedicated hardware address jumpers on the bottom side of the board, so this would enable stacking two of the HATs.
Hey #965, how many HATs were you thinking of stacking? For what application?
It's a great little board, but getting power to all those things is a challenge. Is there any chance the users could interest SparkFun in creating a power board for this system? For example, it would be great to have a board that would...
Take as Input some unregulated power supply, like a 2-3S LiPo battery
Provide three power outputs:
5V 3A to power Auto phat board and back-power the Raspberry Pi
5V 8A to power the Servo ports
Pass-through battery voltage to supply the Motors
Then this power board would just solder to the available power inputs, and the challenge would be solved.
Has anyone figured out how to use the imu on the auto-phat to get a compass bearing (0-360) in Python ? I have been using various formulas but nothing is making any sense. Do I need to calibrate the magnetometer on the imu ? According to the specs, there is some sort of self-test.
I have been using deg = math.atan2(rawy,rawx) * 180/math.pi to get my degrees but it only seems to give a range between about 97 for north and 67 for south. 97 is not on magnetic north. 67 does seem to be a low point close to the opposite side of 97.
Help !!!
I tried getting the compass heading off the imu using this code:
Hmmm. Everytime I ctrl-c out of the python motor test code the raspberry pi locks up and finally shuts down with a 'client_loop: send disconnect: Broken pipe' I am running via ssh. rpi 3b+ code: ========= import time import sys import math import qwiic_scmd
myMotor = qwiic_scmd.QwiicScmd()
def runExample(): print("Motor Test.") R_MTR = 0 L_MTR = 1 FWD = 0 BWD = 1
if name == 'main': try: runExample() except (KeyboardInterrupt, SystemExit) as exErr: print("Ending example.") myMotor.disable() sys.exit(0)
Hi there, is it possible to stack more servos? Maybe stacking this servo controller "Zio 16 Servo Controller" https://www.sparkfun.com/products/16773 ?
Hi there, it sounds like you are looking for technical assistance. Please use the link in the banner above, to get started with posting a topic in our forums. Our technical support team will do their best to assist you.
That being said... yes, you can add more PCA9685 chips (i.e. servo controllers) to the I2C bus. You just need to modify the jumpers so that each controller has their own I2C address (i.e. similar idea to giving people their own phone number or home address). Then you would need to modify the code so that you are controlling each chip separately.
The board has pins for powering the motors externally, but the hookup guide says that the DRV8835 H-bridge is hard wired to 5V. Do I need to disconnect the 5V hard wiring somehow before using the external power pins?
I am using a pair of L-shaped TT motors and encoders and at only 3 Ohms of resistance I find that the motor needs to draw 1.7A to start from stall when powered with 5V. If I can power the H-bridge with only 3.3V then the current draw should remain below the 1.5A max and 1.2A steady state limit.