This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# --------------------------------------------------------------------------------------------------- | |
# Temp/Humidity (ARDUINO Serial) | |
# This bit calls the new parser and also parses the serial payload into segments for M2X. It grabs the serial | |
# string from an arduino and parses it into chunks delineated by the '_' character. Then it formats/sanitizes | |
# the separate strings into numeric characters for M2X ingest. | |
# Each segment can be called by using text[0] (first segment) text[1] (second segment) and so on. | |
# NOTE: You can set the M2X stream data type to numeric with this parser. | |
# --------------------------------------------------------------------------------------------------- | |
elif dev_info['parser'] == 'serial_m2x': # Referencing the appropriate parser over in /parsers.py | |
print '\nBegin parsing ULSDU at %s with: serial_m2x, sdu_id %s \nnodeId %s rx_timestamp %s payload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#------------------------------------------------------------------------------ | |
# Temp/Humidity Arduino | |
# APP_INTF7 Application UART A_UART_RX J207 pin 7 | |
# Sample of a serial-based Arduino-to-rACM setup. Add additional sensor inputs | |
# under 'expectedSensors'. Since we're sending all sensor data to rACM as a single | |
# serial string all sensorIds are '6' and sensorType is '0xFFF'. sensorName should | |
# correspond with your M2X stream names. | |
#------------------------------------------------------------------------------ | |
def parser_serial_m2x(raw_hex): | |
expectedSensors = [{'sensorId': 6, 'sensorType':0xFFF, 'sensorName':'humidity',\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
devices = [ | |
{'desc':'Arduino-rACM', // whatever you feel like | |
'nodeId':'0x3451f', // add your Node ID here | |
'parser':'serial_m2x', // let's reference the parser we'll create | |
'm2x_device_id': 'z547acf8d450fc94863a5b7b498b6135', // grab from M2X | |
'm2x_primary_key':'n0b9b4d39c1bb86e733f37b62c666128', // same | |
'alarm_email_enabled':0, | |
'alarm_email_list':[]}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python host_app_ctrl.py -d /dev/tty.usbserial-FTFMFMP8 GET_DEVICE_STATUS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
username$ ls /dev/tty.* | |
/dev/tty.Bluetooth-Incoming-Port | |
/dev/tty.Brain-WirelessiAP | |
/dev/tty.SuperBrain-WirelessiAP | |
/dev/tty.usbmodem141321 | |
/dev/tty.usbserial-FTFMFMP8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include // My Yun's serial ports were all used up (one for USB, the other for the bridge) | |
#include // So we can talk to the DHT11 | |
// Let's learn how to read temp/humidity | |
SoftwareSerial port2(10, 11); // Define which digital pins we'll use for serial and give them a name | |
// Imperial Measurement FTW | |
double Fahrenheit(double celsius) | |
{ |