Introduction:

Hua's Raspberry Pi Project Shield is an I/O expansion board to Raspberry Pi 1a+, 1b+, 2 , 3 , Zero and Zero W single board computers. It is designed to have features for projects connecting multiple sensors and servos easily. The features include providing 18 connectors for RC servos, for four i2c slave connectors, re-routed SPI connector and RX/TX UART pins. Extra 5V and 3.3V output power pins will further ease the case of supplying power to other external electronics. Originally RPI can only directly connects to 1 single i2c slave. With this project shield, people can directly connect 4 slaves. In many applications, it takes more i2c sensors or actuators.

Integrating a 40W (5V, 8A) power regulator allows it to drive high load electronics. The regulator takes input of 3.7V lithium batteries and then stepping up to output 5V and 3.3V to connected electronics. With two XH2.54 battery connectors it can embrace very large capacity power in separated battery packs.  The second battery connector can be used to chain up 2nd boards which makes single battery pack to power up multiple boards.  A switch controls the input power on/off. The external on/off switch connector gives convenience to application.

The built-in charging circuit can charge the batteries without disconnecting battery for recharging scenario. Charging port is standard micro USB socket which people  can do charging with any 5V USB power source.  Without battery connecting, this port is also the power source to power up Raspberry Pi. In addition, external pins for connecting different power socket type are also provided.   

With such many good features and characteristics, this project shield is a comprehensive solution for different projects from robotics to IOT applications using Raspberry Pi.

 

Board Layout

 

PWM and Servo Control:

PWM (Pulse Width Modulation) is technique used to control LED dimming, DC motor speed and RC servo movement. Raspberry Pi native hardware support to PWM is very limited.  Widely and commonly approach  is to use GPIO to generate PWM signal. This approach is known as soft PWM.  Supporting connection of  large number of servos is the main feature of this project shield. There are 18 connectors for servos.  Each signal pin is routed to GPIO pins on Raspberry Pi 40-pin header for soft PWM. Couple of soft PWM solutions existing in Raspberry Pi.  Below are most effective implementation.

 

Connector Description:

 

 Above figure describes the connector function. Servo connector signal pin and GPIO mapping is as below

 

Servo Connector GPIO Number 40-pin Header Pin Number
P4 4 7
P5 5 29
P6 6 31 
P7 7 26 
P12 12 32
P13 13 33 
P16 16 36
P17 17 11
P18 18 12 
P19 19 35 
P20 20 38 
P21 21 40 
P22 22 15 
p23 23 16 
P24 24 18 
P25 25 22 
p26 26 37 
P27 27 13 

 

A Robotic Project:

Raspberry Pi powered 3D printed 8 DOF quadruped robots were implemented using this project shield. The big one is built with 8 of MG996R high torque servos.  With the high power regulator 8 high torque servos work very well.  The small one is built with 9g torque low price servos. Servos are driven using soft PWM kernel module. Both are embedded video camera for streaming the vision. A neat web interface is for people to control it via WiFi connection. 

People are welcome to build one for themselves. To build one, you will need following items in additional to the project shield.

  1. Raspberry Pi 1A+, 1B+, 2, 3
  2. Nano size  WiFi USB dongle for 1A,1B+, 2.  
    1. e.g Ralink RT5370 USB Wireless Adapter
  3. Raspberry Camera V1.3,  optional if no vision video streaming
  4. Downloads 3D printed STL model files:
    1. small robot  
    2. large robot
  5. System SD card image:
    1. downloads it here.
    2. it is a Raspbian Linux version based on OctoPi project.
    3. see below Installation of System Image for how to write image to SD card
  6. 3.7V 18650 battery pack - two 18650 batteries in parallel

Prior to build or assemble the robot, you need to 3D-print the models and preparing the SD card for Raspberry Pi.

 

 

 

3D Printing the Models:

Those implementations in demo were printed in PLA.  The models were sliced using Cura.  Here are the suggested parameters for slicing the robot models to print. You may adjust to fit the 3D printer you're using. 

  • layer height: 0.2mm
  • shell thickness: 1mm
  • bottom/top thickness: 1.2mm
  • fill density: 10%
  • support: needed
  • adhesion type: none

 

Preparing the SD card:

Installation of System Image 

You will need to use an image writing tool to write the image onto your micro SD card.

Etcher is a graphical SD card writing tool that works on Mac OS, Linux and Windows, and is the easiest option for most users. Etcher also supports writing images directly from the zip file, without any unzipping required. To write your image with Etcher:

  • Download Etcher image writer
  • Connect an SD card reader with the SD card inside.
  • Open Etcher and select the image file you wish to write to the SD card.
  • Select the SD card you wish to write image to.
  • Review your selections and click 'Flash!' to begin writing data to the SD card.

Testing Image And Wi-Fi Setup

After you installed the system image to the SD card, next step is to setup the Wi-Fi connection. You must have your Wi-Fi access point ready. Robot system SD image is a Raspbian Linux version based on OctoPi project. 

  • Re-insert the SD card to your computer, configure your WiFi connection by editing octopi-wpa-supplicant.txt  to change the "Your Wifi SSID" and "your wifi password" to those of your Wi-Fi AP given.
  • Connect the Raspberry Pi to the HDMI monitor and keyboard
  • Connect the USB Wi-Fi dongle to RPi USB port if not RPI3
  • Insert the SD card to Rapberry Pi, then power on it to boot. While booting, the green LED will be flashing. You also can see the booting messages on the monitor. This may take a little while as it involves operation of Wi-Fi connection.
  • While see the login prompt, you can login with
    • default username is “pi”, default password is “raspberry”.
    • you may change the password using the "passwd" command.
    • IP address will be shown if Wi-Fi setup is correct.
  • Without the monitor, to find the IP address given to the Raspberry Pi you can 

 If you have IP address assigned, you have successfully done this step. Your SD card is ready.

 

Robot Assembly:

You must have 3D printed models and the SD card ready. Assembling video can be found here.

 

How To Play:

If you are success to have WiFi setup, you can access the Web control interface with the URL http://minikame-pi.local:8080/ or http://<the ip address>:8080/.