Raspberry Pi Example

A Raspberry Pi or similar Single Board Computer (SBC) can also be used, as long it has a serial port for talking to the RockBLOCK. If you want to use the CircuitPython library, you'll also want to use a SBC that has Blinka support.

You can use any Raspberry Pi. However, since the remote location will likely not have WiFi and power will probably be a premium, the Pi Zero is a good option.

Raspberry Pi Zero - Version 1.3

PRODUCT ID: 2885
At first glance, the Pi Zero isn't much.  It just looks like a slimmed down version of the Raspberry Pi we know and love.  But when we started to think of the...
$5.00
IN STOCK

RockBLOCK 9603 Accessory Cable

PRODUCT ID: 4529
The RockBLOCK 9603 Accessory Cable is terminated with a simple 10-pin Molex-style connector at one end and male jumper wires at the other.This accessory cable...
$4.95
IN STOCK

Wiring

Here's the wiring diagram. If you use the accessory cable, you should be able to match the colors. But it's also best to verify actual pin location on the RockBLOCK.

  • 5V to VIN
  • GND to GND
  • TX to TXD*
  • RX to RXD*

* Yep, TX to TX and RX to RX. The RockBLOCK uses backwards nomenclature for its TX/RX pins.

Enable Serial

Follow these steps to enable serial on the Pi's GPIO header. The general process is to enable the serial hardware AND remove the default login shell that would otherwise use it.

You can do all this via raspi-config.

Download: file
sudo raspi-config
  • Select 5 Interfacing Options
  • Select P6 Serial
  • Answer NO to "Would you like a login shell to be accessible over serial?"
  • Answer YES to "Would you like the serial port hardware to be enabled?"
  • Select OK
  • Exit and reboot

Install CircuitPython Library

See here for information on how to install Blinka to allow using CircuitPython libraries with Python on the Raspberry Pi:

and make sure you have passed the Blinka Test.

Then, install the RockBLOCK library with:

Download: file
pip3 install adafruit-circuitpython-rockblock

Run Simpletest Check

As a quick test to make sure you are connected and talking to the RockBLOCK, use the simpletest example from the library. Here's the code.

# pylint: disable=wrong-import-position
# CircuitPython / Blinka
import board

uart = board.UART()
uart.baudrate = 19200

# via USB cable
# import serial
# uart = serial.Serial("/dev/ttyUSB0", 19200)

from adafruit_rockblock import RockBlock

rb = RockBlock(uart)

print(rb.model)

We need to make some changes first.

Comment out these lines:

Download: file
uart = board.UART()
uart.baudrate = 19200

so they look like this:

Download: file
# uart = board.UART()
# uart.baudrate = 19200

and add these new lines:

Download: file
import serial
uart = serial.Serial("/dev/serial0", 19200)

and now your UART is talking on the Pi's GPIO header.

Try running the example:

and you should see the model information text printed out as shown above.

Additional Examples

The only change that should be needed for running other examples is to make the changes for configuring the UART. Once you've done that and passed that UART to the CircuitPython RockBLOCK library, the rest should just work.

Check out the other examples in the library repo.

This guide was first published on Apr 08, 2020. It was last updated on Apr 08, 2020.
This page (Raspberry Pi Example) was last updated on Jul 03, 2020.