Serial Web Services API

The Serial Web Services API allows data sent into the Serial Smart Board (SB-5) and the ioBridge IO-204 web gateway to be routed to web services from Twitter, Google, Yahoo, etc. This API also supports the ioBridge IO-204-PRO (discontinued) and the Gamma PRO and IO-201 Wi-Fi web gateways using their native serial port.

Anything that can send simple serial strings, can use the Serial Web Services API to send email, request stock quotes, and get the current temperature and time – opening up the world wide web to microcontrollers and embedded serial devices. The ioBridge web gateways act as a conduit to the Internet and web services for microcontrollers connected via serial.

Setup

Connect a serial device to the transmitter, receiver, and ground of the Serial Smart Board connected to the IO-204 web gateway. Match baud rate and signal type (true or inverted) on both your serial device and the serial smart board. Serial settings are configured on the Module tab.

Usage Limits

Transactions

Using this API allows for so many transactions in a 24 hour period. Abuse will cause the disruption of messages temporally. The limit is 1440 transaction is a 24 hour period, which equates to one transaction per minute.

Long Messages

The serial smart board has a buffer of 200B. When the buffer is full, the RTS pin goes high. The buffer clears a moment later and you can send more data. You can send long commands thru the board if you put a second of pacing between 200B chunks of the message. The API looks for the opening brackets and closing brackets before the service acts on the command. However, if you transmit more than 200B to the board without pacing, only 200B will be transmitted to the server which breaks the command.

Web Service Commands

The format for commands are as follows:

[[[command|parameters]]]

Sending serial strings wrapped in brackets will cause the command to be routed to web services. The commands are delimited by pipes (“|”).

email

Use the email service to allow your microcontroller to send email, text messages, Twitter / Facebook updates, and UberNote notes

[[[email|address|subject|body]]]

Reply: Sent

Text Messaging

You can also receive notifications to an event as a text message by entering your cell phone’s email address. Your cell phone number can be converted to an email address based on your service provider.

  • AT&T: yournumber@txt.att.net
  • Verizon: yournumber@vtext.com
  • T-Mobile: yournumber@tmomail.net
  • Sprint PCS – yournumber@messaging.sprintpcs.com
  • Virgin Mobile – yournumber@vmobl.com
  • US Cellular – yournumber@email.uscc.net
  • Nextel – yournumber@messaging.nextel.com
  • Boost – yournumber@myboostmobile.com
  • Alltel – yournumber@message.alltel.com

Note: ioBridge is not responsible for charges incurred by text messaging. Your standard text messaging rates apply with your mobile carrier.

UberNote

UberNote is free note taking service that is a replacement for Google Notes. UberNote allows email access to post new notes. Once you setup and account, an email that is linked to your account is created and listed under your settings page. If your action sends a message to the UberMail address, it will be automatically posted to your account. UberNote also supports tagging and public RSS feeds of notes.

UberNote

tweet

Use this command to send Twitter Status Updates / Tweets using the ThingTweet app by ThingSpeak

[[[tweet|ThingTweet_API_Key|status]]]

ThingTweet_API_Key: 16 character API Key for the Twitter account to update

status: Up to 140 character status update / tweet to be sent

Reply: Updated

datetime

[[[datetime]]]

Reply: yyyy-mm-dd hh:nn:ss (GMT/UTC)

By default, the “datetime” command returns the date time with no time offset, otherwise known as UTC time. If you need to return a specific date time for a time zone, you can pass a Time Zone ID as an extra parameter.

For example:

[[[datetime|America/New_York]]]

List of supported time zones

date

[[[date]]]

Reply: yyyy-mm-dd

By default, the “date” command returns the date with no time offset, otherwise known as UTC time. If you need to return a specific date for a time zone, you can pass a Time Zone ID as an extra parameter.

For example:

[[[date|America/New_York]]]

List of supported time zones

time

[[[time]]]

Reply: hh:nn:ss (GMT/UTC)

By default, the “time” command returns the time with no time offset, otherwise known as UTC time. If you need to return a specific time for a time zone, you can pass a Time Zone ID as an extra parameter.

For example:

[[[time|America/New_York]]]

List of supported time zones

stock

[[[stock|symbol]]]

Reply: (last trade stock price)

weather

ioBridge is using the licensed API from Weather Underground to generate the responses to weather commands.

[[[weather|location|options]]]

Location: any postal code or full city name

Options (optional):

  • temp_f
  • temp_c
  • humidity
  • pressure_mb
  • pressure_in

Default Option: temp_f

Reply: (weather info)

calc

[[[calc|expression]]]

Expressions are based off of Google Calculator syntax. You can convert units and perform mathematical operations.

Reply: (result of expression)

get

Use the “get command” to GET a URL of your choice.

[[[get|url]]]

Reply: (response up to the first 70-80 characters)

thinghttp

Use this command to send and parse ThingHTTP requests using SSL, Basic Auth, Query Strings, HTTP (GET, POST, PUT and DELETE), Custom HTTP Headers, and custom encoding types using the ThingHTTP app by ThingSpeak

[[[thinghttp|ThingHTTP_API_Key|parameters]]]

ThingHTTP_API_Key: 16 character API Key for the ThingHTTP request

parameters (optional): Query string parameters for ThingHTTP request replacements

Reply: (response up to the first 70-80 characters)

Applications

Use ThingHTTP to connect to almost any external web service such as Twilio, Prowl, and Foursquare. ThingHTTP allows for a simple serial device to use complex web services by sending serial strings to ioBridge and ThingSpeak.

data_log

[[[data_log|key|timestamp|data]]]

key: 18 alpha numeric characters – The key is created at ioBridge.com by adding a Data Log from an External Source to your account. This key will tie the serial data being pushed to the database.

timestamp: yyyy-mm-dd hh:nn:00 – If the timestamp field is blank, the API will use the current GMT/UTC system time.

data: Serial string up to 50 characters

Reply: Inserted

Arduino Example

Request

Serial.print("[[[stock|GOOG]]]");

Reply Handler

char charIn = 0;
byte i = 0;
char stringIn[32] = "";

while(Serial.available()) {
    charIn = Serial.read();
    stringIn[i] = charIn;
    i += 1;
}

int stockPrice = atoi(stringIn);

Basic Stamp (BS2) Example

Humidity

The following command replies back with the current humidity percentage in Gainesville, FL.

SEROUT 8,84,["[[[weather|Gainesville, FL|humidity]]]"]

Sends serial data out of pin 8 of a BS2 at a baud rate of 9600 with an inverted signal

Basic Stamp Email

The following command emails the current temperature measured by a serial temperature sensor.

SEROUT 8,16468,["[[[email|support@iobridge.com|My Temperature|My temperature in my room is ",SDEC tempF,".]]]"]

Sends serial data out of pin 8 of a BS2 at a buad rate of 9600 with a true signal – SDEC tempF is from a serial sensor hooked up to the BS2

Projects

  • Internet-enabled Message Center – Project from ioBridge user that uses the Arduino and the Serial Web Services API to get stock quotes, get weather, and send email.

Resources