RedBear IoT pHAT, designed for the Raspberry Pi Zero (other RPi boards with 40-pin header will also work).
The RPi Zero is a nice board, it is small in size which is very good for developing IoT projects and prototypes. However, it lacks of wireless features such as WiFi and Bluetooth.
With the IoT pHAT, now, your RPi Zero will get more powerful than before. It adds WiFi and Bluetooth wireless technologies to the RPi Zero.
Front View
Back View
WiFi Router or Access Point (2.4 GHz enabled) and connected to the Internet
Raspberry Pi Zero or other models with 40 pin connector header
SD Card with NOOBS or Raspbian installed (tested on NOOBS 2.4.1 with 21-06-2017 version of Raspbian)
Additional Items for RPi Zero
Optional
The IoT pHAT will also work on other 40-pin RPi boards such as RPi Model A+ and RPi 2.
Check EEPROM firmware version
$ cat /proc/device-tree/hat/product
Follow this guide to update the EEPROM if your one is not the latest version.
After booting up, the Linux kernel will read the configuration from the onboard EEPROM, it will turn on the WiFi driver
Now you can use WiFi to connect to your wireless router or access point directly.
You will see the WiFi driver (wlan0) is up by typing the follow command using the command line,
$ ifconfig
if you are in the command line, you can add your WiFi credentials to this file, it will connect to the AP automatically.
Edit the file,
$ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
Add,
network={
ssid="Your AP"
psk="Your PIN"
key_mgmt=WPA-PSK
}
Reboot,
$ sudo reboot
After associating to your router/AP, your RPi will broadcast mDNS service, so you do not need to know the IP address and the default host name is raspberrypi.local
, you can use ssh
to control your RPi from your computer remotely, we only tested on macOS and Linux, for Windows, you need a ssh utility and mDNS tool (e.g. Apple Bonjour SDK).
$ ssh pi@raspberrypi.local
The default login password is, raspberry
.
Trouble-shooting
if you do not see the wlan0 device using ifconfig
, then use the following command, you should see there is a folder named iothat
. It should be something wrong if you do not see it.
$ ls /proc/device-tree/soc/
check if your board comes without the 40-pin connector soldered, make sure your soldering is correct and check the I2C ID EEPROM pins (see the pinout diagram for details).
Also, upon booting up the board, the Kernel will read from the EEPROM for all settings for the Bluetooth including the UART which maps UART0 to GPIO 14 and 15.
You will see the Bluetooth is ready to use by using the Bluetooth manager (the Bluetooth icon) near to the clock (upper-right corner) or using the command line,
$ hciconfig
or
$ systemctl status hciuart.service
You can use the command line tool bluetoothctl
or the Bluetooth manager to pair your Bluetooth accessories.
Example for using the command line, AA:BB:CC:DD:EE:FF here should be your Bluetooth keyboard MAC address. Make your keyboard into pairing mode first,
$ sudo bluetoothctl
[bluetooth]# agent KeyboardDisplay
[bluetooth]# default-agent
[bluetooth]# scan on
[bluetooth]# pair AA:BB:CC:DD:EE:FF
Enter the PIN code from the Bluetooth keyboard
[bluetooth]# connect AA:BB:CC:DD:EE:FF
[bluetooth]# trust AA:BB:CC:DD:EE:FF
[bluetooth]# quit
Note: It seems that the BlueZ does not support BLE keyboard and mouse.
Prerequisites:
START
button for 2 seconds to power ON/OFF).To pairing:
Set the gamepad to the correct mode by pressing and holding the START
button until you see a white LED light on. Release the button, it will enter to the power off state.
Turn on the gamepad by holding the START
button for 2 seconds.
Holding the SELECT
button for 3 seconds to clear any previous pairing, you will see the white LED flash once, release it.
Use the follow steps:
$ sudo bluetoothctl
[bluetooth]# scan on
[bluetooth]# pair AA:BB:CC:DD:EE:FF
[bluetooth]# connect AA:BB:CC:DD:EE:FF
[bluetooth]# trust AA:BB:CC:DD:EE:FF
[bluetooth]# quit
To test the gamepad
$ sudo apt-get install joystick
$ jstest /dev/input/js0
If you paired two gamepad, the 2nd one will be the /dev/input/js1
device.
The following diagram shows the pins of the RPi 40-pin connector occupied by the IoT pHAT board.
Note that, the TXD on the RPi (as shown in the diagram) will connect to the RXD of the IoT pHAT, the same case applied to the RXD, CTS and RTS pins.