RoboHAT – Robotics Controller for Raspberry Pi

Links for Various Resources for the 4tronix RoboHAT

rh09

 

See the bottom of this page for software library and downloads.

 Useful Links

Know your RoboHAT

rh12a

Clockwise from top left:

  • 2-way screw terminal for DC Motor 1 (left motor if using the Python library)
  • EEPROM containing the HAT information for the device tree
  • DRV8833 motor driver chip
  • 2-way screw terminal for DC Motor 2 (right motor)
  • 4-pin male connector for the Ultrasonic distance sensor (HC-SR04)
  • 6-pin female connector for the I2C breakout. This is the standard header used on all 4tronix controller boards
  • 4 x 3-way (GVS) inputs. These accept 3-5V input signals and are converted to the 3.3V logic required for the Raspberry Pi GPIO pins. They are labelled with both pin numbers and Broadcom GPIO numbers
  • Blue Power indicator LED
  • Jumper to select power input method for the motor driver. In most cases this should be to the left so that a single set of batteries can be used to power the Raspberry Pi and the motors. If you want a separate power supply for the motors, then move this jumper to the right and connect the separate motor power to the 2-pin screw terminal
  • 2-pin screw terminal for optional separate motor power
  • DC Jack for the main power input. This is the input from your (typically) 7.2V battery pack and is used to create the 5V for the Raspberry Pi and to drive the motors directly (if motor power jumper is to the left)
  • 6 x 3-way (GVS) outputs. These provide a 5V driven output from the Raspberry Pi GPIO pins. They are labelled with both pin numbers and Broadcom GPIO numbers

 

Pin Assignments

RoboHAT signals are mapped directly to individual GPIO pins as follows:

Description

In/Out

J5 Pin Number

Broadcom Number

1 Motor1 A

Out

36

16

2 Motor1 B

Out

35

19

3 Motor2 A

Out

33

13

4 Motor2 B

Out

32

12

5 Ultrasonic

In/Out

38

20

6 Input 0

In

7

4

7 Input 1

In

11

17

8 Input 2

In

29

5

9 Input 3

In

13

27

10 Input 4

In

15

22

11 Input 5

In

16

23

12 Output 0

Out

18

24

13 Output 1

Out

22

25

14 Output 2

Out

12

18

15 Output 3

Out

31

6

 

Python Software

To download the library and example programs from the internet, you can use the following commands from your Raspberry Pi in the home folder. (open LXTerminal from desktop):

  • wget http://4tronix.co.uk/robohat.sh -O robohat.sh
  • bash robohat.sh

 

Files included

  • robohat.py This is the python library module, see the first few lines of the library for listing of all the exposed functions for controlling motors, LEDs and reading sensors
  • motorTest.py – cycles through various motor directions
  • motorTest2.py – use the arrow keys on your keyboard to control the direction and speed of the motors
  • motorTestRaw.py – cycles through various motors, but doesn’t use the library
  • irTest.py – check the state of the IR line and obstacle sensors sensors (assumes you have the sensors connected as shown in the Initio build instructions)
  • sonarTest.py – prints the distance using the UltraSonic sensor
  • servo.py – a very simple servo test using the RPI.GPIO PWM commands
  • servoTest.py – a more sophisticated test that uses ServoBlaster (servod) to create the timing pulses