Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Jaume Miralles
Published © GPL3+

Get Data from the Cloud to Your Arduino

Get an input for your Arduino from the cloud without taking care of server side.

IntermediateProtip2 hours11,957
Get Data from the Cloud to Your Arduino

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
ESP8266 ESP-01
Espressif ESP8266 ESP-01
×1
Resistor 10k ohm
Resistor 10k ohm
×1
Resistor 1k ohm
Resistor 1k ohm
×1
Resistor 2.2 KOhm
×1

Software apps and online services

Circus Of Things (Online service)
Arduino IDE
Arduino IDE

Story

Read more

Schematics

Nano - ESP8266

Shows how the ESP8266 Wifi Module should be connected to the Arduino Nano, according to the code supplied

Code

ReadOneSignal.ino

Arduino
ReadOneSignal.ino

This example code that shows how to read a signal using the circusofthings.com API through its CircusWifiLib-2.0.0 library for Arduino.

This code will temperature value beiing posted at at Circus.

A software serial port is used, so the onboard serial port is used to monitor the process. You have 3 degrees for monitor: DEBUG_NO,DEBUG_YES and DEBUG_DEEP.

There are no 3rd part libraries to use, beside SoftwareSerial.

Created by Jaume Miralles Isern, November 13, 2018.
/*
  ReadOneSignal.ino
  
  This example code that shows how to read a signal using the circusofthings.com API through its CircusWifiLib-2.0.0 library for Arduino.
  
  This code will temperature value beiing posted at at Circus.
  
  A software serial port is used, so the onboard serial port is used to monitor the process. You have 3 degrees for monitor: DEBUG_NO,DEBUG_YES and DEBUG_DEEP.
  
  There are no 3rd part libraries to use, beside SoftwareSerial.
  
  Created by Jaume Miralles Isern, November 13, 2018.
*/


#include <CircusWifiLib.h>

// ------------------------------------------------
// These are the CircusWifiLib related declarations
// ------------------------------------------------

int TXPinForWifiModule = 2;               // IO port in your arduino you will use as TX for serial communication with the wifi module
int RXPinForWifiModule = 3;               // IO port in your arduino you will use as RX for serial communication with the wifi module
char ssid[] = "your_SSID_here";           // your wifi network SSID
char pass[] = "your_WIFI_password_here";  // your wifi network password
int wifiSerialBaudRate = 9600;            // Baud rate between your arduino and your wifi module. Did you check that your module actually uses this baud rate?
int debugSerialBaudRate = 9600;           // Baud rate between your arduino and your computer
char token[] = "your_token_here";         // Your API token for Circus
char temperatureSignalKey[] = "your_signal_key_here";     // The key of the signal you that exists at circusofthings.com

SoftwareSerial ss(RXPinForWifiModule,TXPinForWifiModule);
CircusWifiLib circus(Serial,&ss,ssid,pass,DEBUG_YES,KEEP_ALIVE);



void setup() {
  Serial.begin(debugSerialBaudRate);
  ss.begin(wifiSerialBaudRate);
  circus.begin();    
}

void loop() {
  delay(5000);
  double d = circus.read(temperatureSignalKey,token);
  Serial.print("Temperature value is: ");
  Serial.println(d);
}

Credits

Jaume Miralles

Jaume Miralles

5 projects • 43 followers

Comments