iM880 Serial Communications
Note: This is for use with the WiMOD LR Base firmware (has been tested using v1.12)
This script allows the iM880 to be configured, receive confirmed messages, and send confirmed messages all over a serial port.
- The file
configuration.info
are the selected configuration parameters based on our use case. - Based on the iM880.
Usage
var iM880 = ; // call the constructor with a deviceID and deviceGroupSERIAL_PORT = '/dev/ttyUSB1'; // serial port to connect toDEVICE_ID = 0x04; // in range [0x0000, 0xFFFF)DEVICE_GROUP = 0x10; // in range [0x00, 0xFF)SF = 10; // spreading factor, optional argument, defaults to 10BANDWIDTH = 125000; // bandwidth, optional argument, defaults to 125000ERROR_CODING = 4/5; // error coding, optional argument, defaults to 4/5TX_PWR = 20; // transmit power in dBm, optional argument, defaults to 20device = DEVICE_ID DEVICE_GROUP SERIAL_PORT SF BANDWIDTH ERROR_CODING TX_PWR; // callback for when constructor done and device configureddevice; // callback for reception of a confirmed messagedevice; // callback for when a transmit message completed and statusdevice
rx-msg
Packet
Example Note: This message would be received by the other iM880 in the example
(DEVICE_ID=0x09
, DEVICE_GROUP=0x10
)
{
destGroupAddr : 16,
destDeviceAddr : 9,
srcGroupAddr : 16,
srcDeviceAddr : 4,
payload : [4, 67, 23, 12, 90, 100],
receivedTime : 2016-10-10T17:38:49.198Z
}
destGroupAddr
: Group address of destination device (iM880 receiving message).destDeviceAddr
: Device address of destination device (iM880 receiving message).srcGroupAddr
: Group address of source device (iM880 transmitting message).srcDeviceAddr
: Device address of source device (iM880 transmitting message).payload
: Message being sent.receivedTime
: Timestamp message was received at.
Running examples
- Notice the files
example/tx-example.js
andexample/rx-example.js
, they can be used to quickly test your LoRa system:
-
Run
node rx-example.js
to open an iM880 waiting to receive messages. -
Run
node tx-example.js
in another terminal to open an iM880 that will transmit messages. -
After running both your output should be:
- for
rx-example.js
:
Configuration status: successful! Received message!! { //your received message }
- for
tx-example.js
:
Configuration status: successful! Tx-status: successful!
- for