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
#########################################
# ThingSpeak.py
# more info @: http://myrobotlab.org/service/ThingSpeak
#########################################

# virtual=1
comPort = "COM12"
# start optional virtual arduino service, used for internal test
if ('virtual' in globals() and virtual):
    virtualArduino = Runtime.start("virtualArduino", "VirtualArduino")
    virtualArduino.connect(comPort)
# end used for internal test 

readAnalogPin = 15
 
arduino = runtime.start("arduino","Arduino")
thing = runtime.start("thing","ThingSpeak")
 
arduino.setBoardMega() # setBoardUne | setBoardNano
arduino.connect(comPort)
sleep(1)
# update the gui with configuration changes
arduino.broadcastState()
 
thing.setWriteKey("AO4DMKQZY4RLWNNU")

# start the analog pin sample to display
# in the oscope

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

def publishPin(pins):
  for pin in range(0, len(pins)):
    thing.update(pins[pin].value)

arduino.addListener("publishPinArray",python.getName(),"publishPin")

arduino.enablePin(readAnalogPin,1)

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
#########################################
# ThingSpeak.py
# more info @: http://myrobotlab.org/service/ThingSpeak
#########################################

# virtual=1
comPort = "COM12"
# start optional virtual arduino service, used for internal test
if ('virtual' in globals() and virtual):
    virtualArduino = Runtime.start("virtualArduino", "VirtualArduino")
    virtualArduino.connect(comPort)
# end used for internal test 

readAnalogPin = 15
 
arduino = runtime.start("arduino","Arduino")
thing = runtime.start("thing","ThingSpeak")
 
arduino.setBoardMega() # setBoardUne | setBoardNano
arduino.connect(comPort)
sleep(1)
# update the gui with configuration changes
arduino.broadcastState()
 
thing.setWriteKey("AO4DMKQZY4RLWNNU")

# start the analog pin sample to display
# in the oscope

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

def publishPin(pins):
  for pin in range(0, len(pins)):
    thing.update(pins[pin].value)

arduino.addListener("publishPinArray",python.getName(),"publishPin")

arduino.enablePin(readAnalogPin,1)