In Part Two of this blog series, I’ll focus on setting up our RPMA DevKit and getting the Arduino understood.

Back in Part One of my blog series, I set an Arduino Yún to take readings from a DHT11 temperature + humidity sensor and shared the Arduino sketch I threw together to make it all work. Just a heads up: I realize now that sending characters over a serial connection to represent these numerical values isn’t super efficient. Smart people would have known to send them over in bytes or something like that. For my simple project, ASCII characters are going to be just fine.

USB Host Cable

Set Up the Serial Cable

First thing’s first, I knew I would have to configure the RPMA DevKit board to receive/transmit serial transmissions and forward those on to Intellect. The files & scripts included in the Starter Pack downloadable make this a pretty easy process. First, I slipped the FTDI serial-to-usb cable we provide with the development kit onto the host serial interface on the DevKit board. It’s the row of five male pins next to the DC power jack on the board. Then the USB business end plugs into your PC or Mac. You’ll probably have to install the drivers — we’ve included them for Linux/Mac OS X/Windows in various flavors (32-bit/64-bit) but it can’t hurt to check FTDI’s website for a newer version. The drivers we provide work great on my Mac running the macOS Sierra public beta.

Another valuable bit of information you’ll need is the ID or com port for the USB cable’s serial connection. In Windows Device Manager, it’ll come up as something like “COM5” and on a Mac or other UNIX-based machine, you’ll need to run a console command to retrieve the port name. Using the console of your choice (I’m using Terminal.app), punch ls /dev/tty.* into the command line and hit return.

username$ ls /dev/tty.*
/dev/tty.Bluetooth-Incoming-Port
/dev/tty.Brain-WirelessiAP
/dev/tty.SuperBrain-WirelessiAP
/dev/tty.usbmodem141321
/dev/tty.usbserial-FTFMFMP8

view raw
get_serial_id
hosted with ❤ by GitHub

username$ ls /dev/tty.*
/dev/tty.Bluetooth-Incoming-Port
/dev/tty.Brain-WirelessiAP
/dev/tty.SuperBrain-WirelessiAP
/dev/tty.usbmodem141321
/dev/tty.usbserial-FTFMFMP8

view raw
get_serial_id
hosted with ❤ by GitHub

Basically, we told the console to list anything in the /dev directory whose name starts with tty. It generates a list of items that match that criteria. In my case, the FTDI cable shows up as /dev/tty.usbserial-FTFMFMP8. Your cable will come up with a similar, but not identical name. Copy and paste this somewhere handy. Replace /dev/tty.usbserial-FTFMFMP8 in all my examples below with your serial cable’s identifier.

Install Python & pyserial

The RPMA DevKit configuration scripts are all written in Python, a handy and nearly universal programming language. It’s super extensible (meaning you can supplement its capabilities with add-on modules and the like) and pretty much cross-platform compatible. By default, the Python installation included with your Mac or Linux-based PC (Windows users will have to use the Python 2.7.9 installer we’ve included in the starter pack) won’t be able to communicate over a serial connection. We fix that by installing a module called pyserial that enables serial communication. Pretty cool! Installers are included in the starter pack, or you can grab the latest version here.

Windows adds one more complexity here. You’ll need to add the Python directory  C:Python27 to the Windows “PATH” variable. Get the low-down on how to do that here.

First Exercise: Get Device Status

Okay, so now we have the serial cable plugged into our computer and development board. Python is installed along with pyserial. We know the serial port name or ID. Let’s run one of our included Python tools and have it execute a command. In your console, change directory to the python_tools folder under your model of rACM (mine is racm_1.4.6). On a Mac or in Linux, punch in ‘cd’ followed by the correct path. In my case that reads like “cd /Users/mgibbons/Desktop/rACM/racm_1.4.6/python_tools/”. Next, run the following command to get a status report on your RPMA DevKit board:

python host_app_ctrl.py -d /dev/tty.usbserial-FTFMFMP8 GET_DEVICE_STATUS

python host_app_ctrl.py -d /dev/tty.usbserial-FTFMFMP8 GET_DEVICE_STATUS

We’re basically telling our computer to use ‘python’ to execute the script ‘host_app_ctrl.py’ to connect to our serial device (in my case ‘/dev/tty.usbserial-FTFMFMP8’) and send the command ‘GET_DEVICE_STATUS’. For whatever reason, I sometimes have to send this command a couple of times before it actually works. What you’ll end up with is something like what you see below.
username$ python host_app_ctrl.py -d /dev/tty.usbserial-FTFMFMP8 GET_DEVICE_STATUS
Device ID = 00000001 (0x00000001)
Node ID = 0x0003451F
Node Type = UNODE
Comm System = COMM_SYS_2.X
Device state = DEPLOYED
Application Profile = UNSECURED_POWERED
POR Host UART State = TEST_OVERRIDE
Alarm Hysteresis = 300 (sec)
UART Timeout = 8 (sec)
UART Retry Alarm Thresh = DISABLED
LVD Alarm Config = DISABLED
Network Discovery Conn = ON
Provision Quick Start = ENABLED
RHT Protocol Support = DISABLED
Ext Switch Function = ALARM_TOGGLE
————————-
Read Block1 Rate:Offset = 1HR (2) : (GMT + 0:00)
Read Block2 Rate:Offset = NONE (15) : (GMT + 0:00)
Poll Block1 Rate:Offset = NONE (15) : (GMT + 0:00)
Poll Block2 Rate:Offset = NONE (15) : (GMT + 0:00)
Poll Block3 Rate:Offset = NONE (15) : (GMT + 0:00)
————————-
POR App Serial Function = OTA_BUFFERED
APP_INTF1 Mode = FUNC_MODE0 (LPT)
– OTA Data Reporting = OFF
– Read Block Mapping = NONE
– Poll Block Mapping = NONE
APP_INTF2 Mode = DIG_INPUT
– OTA Data Reporting = OFF
– Read Block Mapping = NONE
– Poll Block Mapping = NONE
APP_INTF3 Mode = DIG_INPUT
– OTA Data Reporting = OFF
– Read Block Mapping = NONE
– Poll Block Mapping = NONE
APP_INTF4 Mode = DIG_INPUT
– OTA Data Reporting = OFF
– Read Block Mapping = NONE
– Poll Block Mapping = NONE
APP_INTF5 Mode = DIG_INPUT
– OTA Data Reporting = OFF
– Read Block Mapping = NONE
– Poll Block Mapping = NONE
APP_INTF6(ANA_IN0) Mode = ADC1 (fixed)
– OTA Data Reporting = OFF
– Read Block Mapping = NONE
– Poll Block Mapping = NONE
APP_INTF7[A_UART] Mode = SERIAL_DATA (fixed)
– OTA Data Reporting = OFF
– Read Block Mapping = NONE
– Poll Block Mapping = NONE
APP_INTF8[VREAD2] Mode = VBATT (fixed)
– OTA Data Reporting = OFF
– Read Block Mapping = NONE
– Poll Block Mapping = NONE
————————-
APP_INTF1 DIG_INPUT Configuration
– Edge Interrupt = INT_OFF
– Alarm Type = DISABLED
– Internal Pull Enable = DISABLED
– Pull Up/Down = INTERNAL_PULLDOWN
APP_INTF2 DIG_INPUT Configuration
– Edge Interrupt = INT_OFF
– Alarm Type = DISABLED
– Internal Pull Enable = DISABLED
– Pull Up/Down = INTERNAL_PULLDOWN
APP_INTF3 DIG_INPUT Configuration
– Edge Interrupt = INT_OFF
– Alarm Type = DISABLED
– Internal Pull Enable = DISABLED
– Pull Up/Down = INTERNAL_PULLDOWN
APP_INTF4 DIG_INPUT Configuration
– Edge Interrupt = INT_OFF
– Alarm Type = DISABLED
– Internal Pull Enable = DISABLED
– Pull Up/Down = INTERNAL_PULLDOWN
APP_INTF5 DIG_INPUT Configuration
– Edge Interrupt = INT_OFF
– Alarm Type = DISABLED
– Internal Pull Enable = DISABLED
– Pull Up/Down = INTERNAL_PULLDOWN
————————-
APP_INTF1 DIG_OUTPUT Configuration
– Open Drain Enable = DISABLED
– Drive Strength = LOW
– Output Level = LOW
APP_INTF2 DIG_OUTPUT Configuration
– Open Drain Enable = DISABLED
– Drive Strength = LOW
– Output Level = LOW
APP_INTF3 DIG_OUTPUT Configuration
– Open Drain Enable = DISABLED
– Drive Strength = LOW
– Output Level = LOW
APP_INTF4 DIG_OUTPUT Configuration
– Open Drain Enable = DISABLED
– Drive Strength = LOW
– Output Level = LOW
APP_INTF5 DIG_OUTPUT Configuration
– Open Drain Enable = DISABLED
– Drive Strength = LOW
– Output Level = LOW
————————-
ADC1 Block Configuration
– Cal Slope = 0.045776 (mV/count)
– Cal Offset = 0 (mV)
– Sampling Params = 10 subsamples across a 167msec window
– Alarm Type = DISABLED
– Upper Thresh (Hi) = 3300 (mV)
– Upper Thresh (Lo) = 3300 (mV)
– Lower Thresh (Hi) = 0 (mV)
– Lower Thresh (Lo) = 0 (mV)
ADC2 Block Configuration
– Cal Slope = 0.045776 (mV/count)
– Cal Offset = 0 (mV)
– Sampling Params = 10 subsamples across a 167msec window
– Alarm Type = DISABLED
– Upper Thresh (Hi) = 3300 (mV)
– Upper Thresh (Lo) = 3300 (mV)
– Lower Thresh (Hi) = 0 (mV)
– Lower Thresh (Lo) = 0 (mV)
VBATT Block Configuration
– Cal Slope = 0.091553 (mV/count)
– Cal Offset = 0 (mV)
– VBATT Thresh Mgmt = DISABLED
– VBATT Thresh (Hi) = 3000 (mV)
– VBATT Thresh (Lo) = 2100 (mV)
– VBATT Recharge Poll = NONE
————————-
OTA State = JOINED
Alarm Bit Mask = 0x0000
Current Sensor Data = 0
————————-

username$ python host_app_ctrl.py -d /dev/tty.usbserial-FTFMFMP8 GET_DEVICE_STATUS
Device ID = 00000001 (0x00000001)
Node ID = 0x0003451F
Node Type = UNODE
Comm System = COMM_SYS_2.X
Device state = DEPLOYED
Application Profile = UNSECURED_POWERED
POR Host UART State = TEST_OVERRIDE
Alarm Hysteresis = 300 (sec)
UART Timeout = 8 (sec)
UART Retry Alarm Thresh = DISABLED
LVD Alarm Config = DISABLED
Network Discovery Conn = ON
Provision Quick Start = ENABLED
RHT Protocol Support = DISABLED
Ext Switch Function = ALARM_TOGGLE
————————-
Read Block1 Rate:Offset = 1HR (2) : (GMT + 0:00)
Read Block2 Rate:Offset = NONE (15) : (GMT + 0:00)
Poll Block1 Rate:Offset = NONE (15) : (GMT + 0:00)
Poll Block2 Rate:Offset = NONE (15) : (GMT + 0:00)
Poll Block3 Rate:Offset = NONE (15) : (GMT + 0:00)
————————-
POR App Serial Function = OTA_BUFFERED
APP_INTF1 Mode = FUNC_MODE0 (LPT)
– OTA Data Reporting = OFF
– Read Block Mapping = NONE
– Poll Block Mapping = NONE
APP_INTF2 Mode = DIG_INPUT
– OTA Data Reporting = OFF
– Read Block Mapping = NONE
– Poll Block Mapping = NONE
APP_INTF3 Mode = DIG_INPUT
– OTA Data Reporting = OFF
– Read Block Mapping = NONE
– Poll Block Mapping = NONE
APP_INTF4 Mode = DIG_INPUT
– OTA Data Reporting = OFF
– Read Block Mapping = NONE
– Poll Block Mapping = NONE
APP_INTF5 Mode = DIG_INPUT
– OTA Data Reporting = OFF
– Read Block Mapping = NONE
– Poll Block Mapping = NONE
APP_INTF6(ANA_IN0) Mode = ADC1 (fixed)
– OTA Data Reporting = OFF
– Read Block Mapping = NONE
– Poll Block Mapping = NONE
APP_INTF7[A_UART] Mode = SERIAL_DATA (fixed)
– OTA Data Reporting = OFF
– Read Block Mapping = NONE
– Poll Block Mapping = NONE
APP_INTF8[VREAD2] Mode = VBATT (fixed)
– OTA Data Reporting = OFF
– Read Block Mapping = NONE
– Poll Block Mapping = NONE
————————-
APP_INTF1 DIG_INPUT Configuration
– Edge Interrupt = INT_OFF
– Alarm Type = DISABLED
– Internal Pull Enable = DISABLED
– Pull Up/Down = INTERNAL_PULLDOWN
APP_INTF2 DIG_INPUT Configuration
– Edge Interrupt = INT_OFF
– Alarm Type = DISABLED
– Internal Pull Enable = DISABLED
– Pull Up/Down = INTERNAL_PULLDOWN
APP_INTF3 DIG_INPUT Configuration
– Edge Interrupt = INT_OFF
– Alarm Type = DISABLED
– Internal Pull Enable = DISABLED
– Pull Up/Down = INTERNAL_PULLDOWN
APP_INTF4 DIG_INPUT Configuration
– Edge Interrupt = INT_OFF
– Alarm Type = DISABLED
– Internal Pull Enable = DISABLED
– Pull Up/Down = INTERNAL_PULLDOWN
APP_INTF5 DIG_INPUT Configuration
– Edge Interrupt = INT_OFF
– Alarm Type = DISABLED
– Internal Pull Enable = DISABLED
– Pull Up/Down = INTERNAL_PULLDOWN
————————-
APP_INTF1 DIG_OUTPUT Configuration
– Open Drain Enable = DISABLED
– Drive Strength = LOW
– Output Level = LOW
APP_INTF2 DIG_OUTPUT Configuration
– Open Drain Enable = DISABLED
– Drive Strength = LOW
– Output Level = LOW
APP_INTF3 DIG_OUTPUT Configuration
– Open Drain Enable = DISABLED
– Drive Strength = LOW
– Output Level = LOW
APP_INTF4 DIG_OUTPUT Configuration
– Open Drain Enable = DISABLED
– Drive Strength = LOW
– Output Level = LOW
APP_INTF5 DIG_OUTPUT Configuration
– Open Drain Enable = DISABLED
– Drive Strength = LOW
– Output Level = LOW
————————-
ADC1 Block Configuration
– Cal Slope = 0.045776 (mV/count)
– Cal Offset = 0 (mV)
– Sampling Params = 10 subsamples across a 167msec window
– Alarm Type = DISABLED
– Upper Thresh (Hi) = 3300 (mV)
– Upper Thresh (Lo) = 3300 (mV)
– Lower Thresh (Hi) = 0 (mV)
– Lower Thresh (Lo) = 0 (mV)
ADC2 Block Configuration
– Cal Slope = 0.045776 (mV/count)
– Cal Offset = 0 (mV)
– Sampling Params = 10 subsamples across a 167msec window
– Alarm Type = DISABLED
– Upper Thresh (Hi) = 3300 (mV)
– Upper Thresh (Lo) = 3300 (mV)
– Lower Thresh (Hi) = 0 (mV)
– Lower Thresh (Lo) = 0 (mV)
VBATT Block Configuration
– Cal Slope = 0.091553 (mV/count)
– Cal Offset = 0 (mV)
– VBATT Thresh Mgmt = DISABLED
– VBATT Thresh (Hi) = 3000 (mV)
– VBATT Thresh (Lo) = 2100 (mV)
– VBATT Recharge Poll = NONE
————————-
OTA State = JOINED
Alarm Bit Mask = 0x0000
Current Sensor Data = 0
————————-

It’s displaying the configuration of every pin on the RPMA DevKit board and some important identifiers like node ID (each RPMA module has a unique identifier straight from the factory).

Configure the RPMA DevKit

Now that we’re all set up, we’re going to configure our DevKit to accept serial communications over its application interface (those two rows of fourteen parallel pins) and pass the messages on to Intellect, our cloud-based platform. There’s an easy way to do this, and a hard way. I’m all about easy ways, and for my purposes the easy way is the right way.

While still in the appropriate python_tools directory, enter the following command:

python host_app_ctrl.py -d /dev/tty.usbserial-FTFMFMP8 SET_FIELD_CONFIG /Users/mgibbons/Desktop/rACM/rACM_Config_Files/host_app_field_cfg_serialPort.txt

python host_app_ctrl.py -d /dev/tty.usbserial-FTFMFMP8 SET_FIELD_CONFIG /Users/mgibbons/Desktop/rACM/rACM_Config_Files/host_app_field_cfg_serialPort.txt

The tail end of that command is going to change depending on your own computer and where you have the starter pack files located. We’re telling the python script ‘host_app_ctrl.py’ to grab that ‘host_app_field_cfg_serialPort.txt’ file and use it to configure the RPMA DevKit board. Your exact file path will differ from mine.

Wire Them Up

Now that the RPMA DevKit is configured for serial, we can actually hook up the Arduino. I’ve been told that you should unplug everything from power for this step, or whenever you plug/unplug anything to an Arduino or other board. Sometimes I’m lazy or forget, but luckily I haven’t caused any fires yet.

You’ll need to connect just three wires between the Arduino and rACM to get this going. One wire from Arduino RX (pin 10 in my case) to rACM TX (Pin 9. Top row. Third from left.). Another wires goes from Arduino TX (pin 11 on my Yún) to rACM RX (Pin 7. Tow row. Fourth from left.). The final wire functions as a ground and goes from Arduino ground pin to pin 1 on the rACM board (Upper-right-most pin). Basically with the RX/TX wires you’re flipping the connection: Arduino’s transmit (TX) goes to rACM receive (RX) and vice versa.

RPMA DevKit Arduino
Power everything back up. Provided smoke hasn’t started pouring out of places it shouldn’t, the Arduino board is now transmitting temperature and humidity values over its serial connection to the RPMA DevKit board every five minutes. The DevKit will in turn wirelessly pass those values on to Intellect.

In Part Three of my short idiot’s guide, I get into how I used our included Python scripts to grab the latest data from Intellect, parse into something palatable, and pass that data to the AT&T M2X platform.