ThingSpeak

javadoc

Chart data into the cloud with the ThingSpeak service.  ThingSpeak is a site which allow posting, displaying of data.  This service allows an easy gateway to MRL data to be sent and displayed there.  Any data producing service (Arduino, OpenCV, Runtime, etc) can send messages to the ThingSpeak service and it will relay the data to a user defined channel.

The following Python script will start and Arduino and ThingSpeak service.  It will then subscribe the ThingSpeak service to listen to the Arduino's publishPin event, and relay the data to a users public channel. The data can be viewed here at the moment : https://www.thingspeak.com/channels/4050


#file : service/ThingSpeak.py edit raw
from time import sleep
from org.myrobotlab.service.data import Pin
from org.myrobotlab.service import Arduino
 
# variables dependent on your setup
boardType = "atmega328p"  # atmega168 | atmega328p | atmega2560 | atmega1280 | atmega32u4
comPort = "COM12"
readAnalogPin = 15
 
arduino = runtime.createAndStart("arduino","Arduino")
thing = runtime.createAndStart("thing","ThingSpeak")
 
arduino.setBoard(boardType) # atmega168 | mega2560 | etc
if not arduino.isConnected():
  arduino.connect(comPort)

 
thing.setWriteKey("AO4DMKQZY4RLWNNU")
thing.subscribe("publishPin", arduino.getName(), "update", Pin().getClass())
 
# update the gui with configuration changes
arduino.publishState()
 
# start the analog pin sample to display
# in the oscope

# decrease the sample rate so queues won't overrun
# arduino.setSampleRate(8000)
arduino.arduino.enablePin(readAnalogPin)

Analog data being traced on pin 15 (A1) - The data is relayed to ThingSpeak

Seems like there is a lot of potential here to do fun things.

References :

Examples:


#file : service/ThingSpeak.py edit raw
from time import sleep
from org.myrobotlab.service.data import Pin
from org.myrobotlab.service import Arduino
 
# variables dependent on your setup
boardType = "atmega328p"  # atmega168 | atmega328p | atmega2560 | atmega1280 | atmega32u4
comPort = "COM12"
readAnalogPin = 15
 
arduino = runtime.createAndStart("arduino","Arduino")
thing = runtime.createAndStart("thing","ThingSpeak")
 
arduino.setBoard(boardType) # atmega168 | mega2560 | etc
if not arduino.isConnected():
  arduino.connect(comPort)

 
thing.setWriteKey("AO4DMKQZY4RLWNNU")
thing.subscribe("publishPin", arduino.getName(), "update", Pin().getClass())
 
# update the gui with configuration changes
arduino.publishState()
 
# start the analog pin sample to display
# in the oscope

# decrease the sample rate so queues won't overrun
# arduino.setSampleRate(8000)
arduino.arduino.enablePin(readAnalogPin)