wiki:PiBotHat

Raspberry Pi computers are powerful and inexpensive, but require additional hardware to connect to robot sensors and actuators. In Pi parlance, additional hardware that sits on top of the Pi and plugs onto the Pi 40-pin expansion connector is called a 'hat'. The PiBot Hat is designed to make it easy to connect motors, sensors, and other peripherals to a Raspberry Pi.

PiBot Hat

OVERVIEW This PiBot hat allows any Raspberry Pi or compatible to serve as a robot controller. The footprint is identical to the Pi Zero and mounting holes are included to allow mounting to a Pi Zero with M2.5 standoffs. The hat includes:

  • A switch-mode power supply that will accept +6v to +24v battery input and generate the +5v required by the Pi. Overcurrent protection is provided (but it is not protected against reverse polarity...maybe next spin...please be careful and observe the polarity markings on the battery connector!)
  • Active level shifters adapt the +3v3 input/output levels required by the Pi to the +5v input/output levels required by many sensor and controller modules.
  • A multi-channel PWM generator that will allow the Pi to control up to 5 motors (DC motor controllers or servo motors)

Like the roboRIO, connectors are provided that allow many devices to be connected with a single cable that provides both power and signal connections. Two level-shifter ICs and two transistors shift voltages between the 3v3 used by the Pi and the 5v required by most of the modules. Connectors are provided for:

  • 2x DC motor controller (nominally the L298N dual motor controller but can use any)
  • 9 degrees of freedom (9DOF) sensor: accelerometer, gyroscope, magnetometer
  • Ultrasonic rangefinder
  • 3x servo motors
  • 2x wheel encoders (or can be used for general-purpose I/O)
  • 2x digital I/O

PWM Because the Pi has very limited PWM capability, the PWM outputs are generated by an NXP PCA9685. There are two PWM outputs for the DC drive motors and 3 PWM outputs to control servo motors. Servo1 is expected to control a small servo motor that pans the ultrasonic sensor and camera. Servo 2 and 3 are available to control other motors.

  • All address pins are grounded (0) so address is 1000000x or 0x80 and 0x81; it also will respond to 0xE0 (All call address) and 0x06 (software reset). Note that the low bit is for r/*w (1=read, 0=write). For more details see the device datasheet.

Connector Pin-outs
Note: pin numbering is very confusing on the Pi and with Wiring Pi. See: cheat-sheet and cheat-sheet2

  • Black 5-pin EXP expansion
    1. +5v
    2. SDA (level shifted to 5v) Pi header pin 3 (SDA1) Wiring Pi pin 8, BCM 2
    3. SCL (level shifted to 5v) Pi header pin 5 (SCL1) Wiring Pi pin 9, BCM 3
    4. +3v3
    5. GND
  • Red 6-pin motor controller - designed to mate with the L298N dual DC motor controller
    1. PWM1
    2. GPIO.5 (level shifted to 5v) Pi header pin 18 Wiring Pi pin 5, BCM 24
    3. GPIO.3 (level shifted to 5v) Pi header pin 15 Wiring Pi pin 3, BCM 22
    4. GPIO.1 (level shifted to 5v) Pi header pin 12 Wiring Pi pin 1, BCM 18
    5. GPIO.0 (level shifted to 5v) Pi header pin 11 Wiring Pi pin 0, BCM 17
    6. PWM0
  • Note that the motor control interface can also drive 2x high-current motor controllers such as Talon SR or Spark using standard PWM cables. Connect the PWM cables with the white wires on the outside pins (1,6) and configure as follows:
    • Motor 1: white (signal) to PWM0, red (+5v) to GPIO.0, black to GPIO.1
    • Motor 2: white (signal) to PWM1, red (+5v) to GPIO.5, black to GPIO.3
    • Drive GPIO.0 and GPIO.5 high to provide +5v reference
    • Drive GPIO.1 and GPIO.3 low to provide ground return/reference
  • White 4-pin 9DOF
    1. +3v3
    2. GND
    3. SCL (3v3 levels) Pi header pin 5 (SCL1) Wiring Pi pin 9, BCM 3
    4. SDA (3v3 levels) Pi header pin 3 (SDA1) Wiring Pi pin 8, BCM 2
  • Blue 4-pin Ultrasonic
    1. +5v
    2. Trigger: GPIO.4 (level shifted to 5v) Pi header pin 16 Wiring Pi pin 4, BCM 23
    3. Echo: GPIO.2 (level shifted to 5v) Pi header pin 13 Wiring Pi pin 2, BCM 27
    4. GND
  • Red 3-pin Servo motor 1
    1. PWM2
    2. +5v or +6v (see servo power jumper)
    3. GND
  • Black 3-pin (2x) servo motors 2,3
    1. PWM3 for servo 2, PWM4 for servo 3
    2. +5v or +6v (see servo power jumper)
    3. GND
  • White 3-pin Left-wheel encoder
    1. GPIO.21 level shifted to 5v (wPi pin 21) Pi header pin 29 Wiring Pi pin 21, BCM 5
    2. GND
    3. +5v
  • Blue 3-pin Right-wheel encoder
    1. GPIO.26 level shifted to 5v (wPi pin 26) Pi header pin 32 Wiring Pi pin 26, BCM 12
    2. GND
    3. +5v
  • Yellow 3-pin (2x) digital I/O 1,2
    1. GPIO.22 for DIO1 connector (Pi header pin 31) Wiring Pi pin 22, BCM 6
      GPIO.23 for DIO2 connector (Pi header pin 33) Wiring Pi pin 23, BCM 13
    2. +5v
    3. GND
  • Black 2-pin: battery/power
    1. +6-24vdc
    2. GND
  • Black 3-pin Servo Power
    • Jumper pins 1-2 for the PiBot Hat to supply 5v to the servo motors
    • For higher power servo motors, remove jumper and connect external +6v power to pin 2 and ground return to pin 3.
    1. +5v supplied by PiBotHat
    2. Vout to Servo motors
    3. GND
Last modified 5 years ago Last modified on Sep 16, 2016, 11:15:52 PM

Attachments (1)

Download all attachments as: .zip