Raspberry Pi computers are powerful and inexpensive, but require additional hardware to connect to robot sensors and actuators. In Pi parlance, an auxiliary circuit board that 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. '''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 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. * http://www.nxp.com/products/power-management/lighting-driver-and-controller-ics/i2c-led-display-control/16-channel-12-bit-pwm-fm-plus-ic-bus-led-controller:PCA9685 * 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''' * Black 5-pin EXP expansion 1. +5v 2. SDA (level shifted to 5v) 3. SCL (level shifted to 5v) 4. +3v3 5. GND * Red 6-pin motor controller - designed to mate with the L298N dual DC motor controller 1. PWM1 2. DIO24 (GPIO24 level shifted to 5v) 3. DIO22 (GPIO22 level shifted to 5v) 4. DIO18 (GPIO18 level shifted to 5v) 5. DIO17 (GPIO17 level shifted to 5v) 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 DIO17, black to DIO18 * Motor 2: white (signal) to PWM1, red (+5v) to DIO24, black to DIO22 * Drive DIO17 and DIO24 high to provide +5v reference * Drive DIO18 and DIO22 low to provide ground return/reference * White 4-pin 9DOF 1. +3v3 2. GND 3. SCL (3v3 levels) 4. SDA (3v3 levels) * Blue 4-pin Ultrasonic 1. +5v 2. Trigger/DIO23 (GPIO23 level shifted to 5v) 3. Echo/DIO27 (GPIO27 level shifted to 5v) 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. DIO5 (GPIO25 level shifted to 5v) 2. GND 3. +5v * Blue 3-pin Right-wheel encoder 1. DIO12 (GIO12 level shifted to 5v) 2. GND 3. +5v * Yellow 3-pin (2x) digital I/O 1,2 1. DIO6/GPIO6 for DIO1 connector, DIO13/GPIO13 for DIO2 connector 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