Seriot

Seriot – The serial bridge to the Internet of Things

Seriot is a Windows application that provides a link between serial hardware and the Internet of Things. The main functions of Seriot are to listen to the serial port for sensor data records from a sending device i.e. Arduino, Netduino, PIC etc… and log the data to a file and optionally send them to the Internet. Currently Seriot supports sending records to ThingSpeak with more options planned for the future.

Features

  • Can work with any serial device capable of sending Seriot data format
  • Logs data to CSV files on the local PC
    • Creates new file for each calendar month
  • Can upload data to the Internet of Things
    • ThingSpeak support
  • Has multiple operating modes depending on desired use
    • Foreground, Background, Scheduled Task

Data Format

In order for Seriot to read data from the serial port the sending device must send the data in the following format. Each row/line must be separated with some type of line feed/break (configurable) and each row should optimally be sent from the device in one shot.The simple data format requires data rows be sent between record separators to mark one record set. The data rows can be in any order with any number of rows.

Record Separators:

  • “###BOD” – Beginning of data
  • “###EOD” – Beginning of data

Data row format:

  • “ID,Value” Where ID is your assigned ID for the sensor and Value is the sensor data point
  • Examples:
    • “TempSensor1,85.50” – Sensor with the ID “TempSensor1” is reporting a data point of “85.5”
    • “A34B3H,5783.50” – Sensor with the ID “A34B3H” is reporting a data point of “5783.50”

Sample Serial stream with 3 records :

###BOD
28a4e7af20069,71.92
28aceaf2002d,71.70
28addbaf2005a,71.92
281ddeaf2008f,58.31
###EOD
###BOD
28a4e7af20069,72.05
28aceaf2002d,71.70
28addbaf2005a,71.92
281ddeaf2008f,59.10
###EOD
###BOD
28a4e7af20069,72.15
28aceaf2002d,71.70
28addbaf2005a,71.81
281ddeaf2008f,59.10
###EOD

Operating Modes

Seriot can operate in 3 different modes depending on how you want to use it. The modes are configuration settings in the seriot.exe.config file.

  • Interactive Mode
    • Select this mode by setting InteractiveMode to TRUE in the config file.
    • When running in this mode Seriot will start up like a normal Windows application and will wait for the user to click Start to begin listening to the serial port. Once Start is clicked Seriot will continue to run and process records until stop is pressed.
    • Note: You cannot run Seriot in this mode in the background since it requires user interaction
    • Chose this mode for initial testing or for running on a PC that logs a user on automatically.
  • Non-Interactive Mode
    • Select this mode by setting InteractiveMode to FALSE and SingleRecordsetMode to FALSE in the config file.
    • When running in this mode Seriot will immediately begin listening for records on the serial port and will continue to process records until the application is closed.
    • Chose this mode for running Seriot as a background task at startup.
  • Single Record Set Mode
    • Select this mode by setting InteractiveMode to FALSE and SingleRecordsetMode to TRUE in the config file.
    • When running in this mode Seriot will immediately begin listening for records on the serial port. Once one record set has been processed the application will exit.
    • Chose this mode for running Seriot as a background Scheduled task on an interval i.e. every 30 minutes.
      • When scheduling a task set Seriot to run as SYSTEM to ensure it can access the correct resources.
      • You can also create an account for it to run in the background, which is more secure.

Log files

Seriot will automatically create a Logs folder within the directory it is run from. Two types of logs will be generated on the fly when needed.

  • Data log files
    • One file generated per calendar month
    • CSV file format
    • Contains logs of all data received as well as results of posting to the Internet
  • Error log file
    • Single file named ERROR.log
    • CSV file format
    • Contains application errors i.e. Failed to open serial port, Network errors etc…

Sample data log file showing 2 sensors being read over three 5 minute periods:

DateTime,SensorID,SensorValue,PostTo,PostResult,ReturnCode
2011-04-17 03:07:56.625,28aceaf2002d,70.25,ThingSpeak,OK,23925
2011-04-17 03:07:57.350,281ddeaf2008f,55.95,ThingSpeak,OK,21408
2011-04-17 03:12:47.965,28aceaf2002d,70.12,ThingSpeak,OK,23926
2011-04-17 03:12:48.675,281ddeaf2008f,55.95,ThingSpeak,OK,21409
2011-04-17 03:18:08.744,28aceaf2002d,70.01,ThingSpeak,OK,23927
2011-04-17 03:18:09.128,281ddeaf2008f,55.95,ThingSpeak,OK,21410

ThingSpeak Support

With ThingSpeak support enabled in the config file Seriot will read from a user defined sensor map while processing records and if it matches a sensor ID to a ThingSpeak channel/field in the map it will then post the data to ThingSpeak. You can define up to 99 sensors in the map and each sensor can independently map to a ThingSpeak channel/field.

  • Sensor Map
    • Defined in the config file
    • When configuring the map think about which ThingSpeak field you would like the sensor to map to then build the map.
    • Example #1 – I want my Wind Sensor (ID=”WindSensor1″) to go to field #2 in my ThingSpeak wind channel (Write API Key = “ABC1234567890YYY”)
      • Map Value =  “ABC1234567890YYY,field2,WindSensor1”
    • Example #2 – I want my Wind Sensor (ID=”AtticTemp”) to go to field #1 in my ThingSpeak temp channel ( Write API Key = “ABC1234567890XXX”)
      • Map Value =  “ABC1234567890XXX,field1,AtticTemp”

Configuration File

All settings for Seriot are contained within the Seriot.exe.config file. After editing the configuration file restart Seriot for the changes to take effect.

Sample Seriot.exe.config file:

<?xml version="1.0"?>
<configuration>

 <appSettings>

 <!--Run the application in Interactive mode for testing/manual operation"-->
 <!-- "TRUE" enables interactive mode -->
 <!-- "FALSE" disables interactive mode -->
 <!--Note: This must be set to FALSE to run as a scheduled task etc...-->
 <add key="InteractiveMode" value="TRUE" />

 <!--Enable Single Recordset mode. When enabled the application will start, listen for one set of records then shut down-->
 <!--Used for when running app from a scheduled task. ie. Windows Task runs app every 30 minutes-->
 <!-- "TRUE" Single Recordset mode -->
 <!-- "FALSE" Single Recordset mode -->
 <!--Note: Ignored if Interactive mode is TRUE-->
 <add key="SingleRecordsetMode" value="TRUE" />

 <!--Serial port to listen on-->
 <!--Example: "COM1" -->
 <add key="SerialPort" value="COM5" />

 <!--Serial port Baud Rate-->
 <!--Example: "57600" -->
 <add key="BaudRate" value="57600" />

 <!--Serial port new line seperator-->
 <!--Example: "\r\n" (Carriage return & New line) for Arduino -->
 <add key="NewLine" value="\r\n" />

 <!--ThingSpeak Items"-->
 <!--Enable posting to ThingSpeak - "TRUE" or "FALSE"-->
 <add key="ThingSpeakEnabled" value="TRUE" />    

 <!--URI for the ThingSpeak update API ie."http://api.thingspeak.com/update"-->
 <add key="ThingSpeakURI" value="http://api.thingspeak.com/update" />

 <!-- ThingSpeak (TS) Sensor Map -->
 <!-- Key="tsSensor-X" Where X is numbered from 1 to 99 in order -->
 <!-- value = "TS Channel Write API key,TS Field,Your Sensor ID sent to the serial port -->
 <!-- Example Map for 3 sensors -->
 <!--  <add key="tsSensor-1" value="ABC1234567890XXX,field1,MyTempSensorID" /> -->
 <!--  <add key="tsSensor-2" value="ABC1234567890YYY,field1,MyWindSensorID" /> -->
 <!--  <add key="tsSensor-3" value="ABC1234567890YYY,field2,MyOtherSensorID" /> -->
 <!-- Update/add your keys below -->
 <add key="tsSensor-1" value="ABC1234567890XXX,field1,MyTempSensorID" />

 </appSettings>

 <startup>
 <supportedRuntime version="v2.0.50727"/>
 </startup>
</configuration>

Download

To install Seriot just unpack the .zip file to your directory of choice. Double click Seriot.exe to start the application.

Note: Ensure InteractiveMode = TRUE  when running for the first time to test/troubleshoot your settings.

Questions

Post you questions/comments below.

4 comments

1 ping

Skip to comment form

  1. Gavin Groce

    can you add thingspeak twitter support?

    1. willnue

      Shouldn’t be a problem to add support for ThingTweet, but the bigger question is what would you want to tweet?

      • The value of every single channel/field/sensor update?
      • One tweet per record set updated? If so what would the message be?
      • Tweet at startup/shutdown of Seriot?
      • ???

      Let me know,
      willnue

  2. eric

    The app throws an unhandled exception when I run it. Not sure if there’s something wrong with my config or not, but I’ve double checked everything and it’s persistent. Here’s the error:

    ************** Exception Text **************
    System.IndexOutOfRangeException: Index was outside the bounds of the array.
    at Seriot.Form1.ParseDataset(Object sender, EventArgs e)
    at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
    at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
    at System.Threading.ExecutionContext.runTryCode(Object userData)
    at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
    at System.Windows.Forms.Control.InvokeMarshaledCallbacks()

    1. willnue

      Can you post a copy of your config file?

  1. Seriot: Serial Bridge for the Internet of Things « ThingSpeak Community

    […] them to ThingSpeak without having to have a dedicated network connection at each sensor. Visit NueWire to download the Windows application and learn more about this […]

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>


*