Revisiting The RedBearLab IoT pHAT

Howdy, folks. Hope everyone has been okay and has had a good week. Its Friday again!

So my first proper post of 2017 is about the IoT pHAT from RedBearLab, which (if you can recall) I was supposed to review. Due to issues with the HAT firmware that was not possible for quite some time. In the early hours of January 12th, a firmware update was made available which purportedly fixed the issues. On testing it myself, I found this to be the case. So let’s talk about how to get up and running with it. Typically, you’d want to start at this page, but there’s alot of information in there, some of which (thus far) doesn’t seem necessary anymore, so I’m going to try to keep it as linear as I can.

First off, you’ll need an IoT pHAT – not surprisingly. I backed their crowdfunding campaign, but you can now buy one on the RedBearLab store if you don’t already have one. You can get one of two versions – one with headers presoldered and one without headers presoldered. I chose the former version. Note that it only works with Pi boards that have 40-pin headers, so this won’t work with model A and B Pis, but will work with models A+, B+/2/3 and Zero. The steps described in this page were done with the 2016-11-25-raspbian-jessie release, in the desktop environment.

The IoT pHAT comes with some firmware onboard, and this firmware is what had been causing problems. As the firmware update was recently made available, there’s a pretty good chance that your pHAT comes with older firmware (<= v0.3) rather than the current stable version (v0.4). To check the firmware version, run the command cat /proc/device-tree/hat/product. If the result is anything other than “IoT pHAT w/eep_v0.4” then an update is necessary.

To perform the update, you can follow the steps as described here. At this point, ensure that the pHAT is not plugged into the Pi. You can connect your Ethernet cable or WiFi adapter at this point because you’ll need an internet/network connection.

  • Edit config.txt to enable the other I2C bus. Remember to save changes.
  • Download the relevant files (you can do this on the Pi itself or on a PC then transfer the files to the Pi). The files are a .eep file, and a .sh file (the flash script)
  • Now, you can remove/disconnect your network connections, then power the Pi down. Removing the network connections isn’t strictly necessary, but the shutdown is.
  • Plug the pHAT to the Pi and power the Pi up
  • Make the flash script executable with chmod +x
  • Run the flash script with root privileges (this will take 2-3 minutes to complete)
  • Reboot.
  • You should also remove the line in config.txt which enables the other I2C bus to avoid issues when using a Pi camera

Once this is done, checking the /proc/device-tree/hat/product file should show that the firmware is now v0.4.

From this point, the pHAT works exactly like a regular USB WiFi adapter. Note also that the update is only ever done once, and the pHAT is fully plug and play after that. Using the desktop network applet, I was able to associate with my router’s network, surf the net and generally just do stuff. It seemed very slightly slower than a USB adapter, but maybe that was just me. Bluetooth also worked flawlessly, although I wasn’t able to do anything other than just pair with my cellphone. I think I’ll test out Audio streaming in a later post to see how well it works, but I don’t anticipate any issues.

So in summary, the IoT pHAT is a cheap and fairly painless way to add WiFi and Bluetooth 4 to your Raspberry Pi A+/B+/2/3/Zero. With the v0.4 firmware update the price point is certainly compelling. I’ll hopefully do Audio streaming and possibly a stress test in later posts, so stay tuned!

For my next post, I’ll discuss some mystery hardware I found on Electrodragon and put it to the test.

*walks out of saloon, gun smoking*


Popular posts from this blog

Enabling SPI1 on the Raspberry Pi B+/Zero/2/3

Bitbanging SPI on the Raspberry Pi (via spi-gpio)

Getting Started with Logic Analyzers and Pulseview