Arduino Wifi Temperature Logger

22,489

83

49

Published

Introduction: Arduino Wifi Temperature Logger

This is a simple demo using the ESP8266 and Cactus Micro (a arduino compatible board) to update a remote server (https://data.sparkfun.com/) using a digital temperature sensor.

Step 1: Materials

The Cactus Micro is an arduino compatible dev board, it integrated a WIFI chip ESP8266.

Step 2: Connecting the Wires Together

  • Connect esp8266 module is easy. Just plug in to the pins.
  • DS18B20 - DQ(2) -> Cactus pin 14, DQ(2) -> 4.7KR -> VCC(3.3V)

Step 3: Arduino Setup and Sketch

The sketch code: https://github.com/AprilBrother/cactus-micro/blob/...

For Cactus Micro Rev2, the default firmware for esp8266 is espduino. Please use this sketch instead. https://github.com/AprilBrother/cactus-micro-r2/tree/master/libraries/CactusMicro/examples/temperatureLogger

Step 4: SparkFun Setup

We create a data stream at SparkFun, follow this link to do this. https://data.sparkfun.com/streams/make

Once you've created your stream, keep the window open so you have easy access to your public and private keys handy - you'll need those to replace the KEY in the Arduino sketch.

Now you are ready to start sending data.

Share

    Recommendations

    • Water Contest

      Water Contest
    • Creative Misuse Contest

      Creative Misuse Contest
    • Clocks Contest

      Clocks Contest

    49 Discussions

    hi,

    could you update the code for cactus micro rev2 please?

    trying, but i can not.

    question: how long data keeps on sparkfun? (the free one)

    2 replies

    Hi, We've updated the sketch for Cactus Micro Rev2 today. It should work with default esp8266 espduino firmware.

    https://github.com/AprilBrother/cactus-micro-r2/tree/master/libraries/CactusMicro/examples/temperatureLogger

    Can you make it reading temperature from several sensors? Should it be like example below or there is better way? Thanks.

    tempSenNum++;

    if (tempSenNum > 3){

    tempSenNum = 1;

    }

    switch (tempSenNum) {

    case 1:

    DeviceAddress thermometer = { xxxxxxxxxxxxxxxxxxxxx }; //sensor #1

    break;

    case 2:

    DeviceAddress thermometer = { xxxxxxxxxxxxxxxxxxxxx }; //sensor #2

    break;

    case 3:

    DeviceAddress thermometer = { xxxxxxxxxxxxxxxxxxxxx }; //sensor #3

    break;

    }

    My order from Tindie arrived... ready to build... but link for code not there...

    https://github.com/AprilBrother/cactus-micro/blob/master/examples/arduino/temperatureLogger/temperatureLogger.ino

    1 reply

    Hi,

    I have just updated the link for the sketch.

    Please note: the code is only work on rev1. You must change the code to hardware serial port Serial1.

    Hi there,

    I'm interested in using this Cactus micro in my project for sending data to a website.

    Do the flash memory,ram and ROM stack when I use it with Arduino Uno? Or any different in term of speed?

    Thank you

    1 reply

    You should compare it with Arduino Leonardo or Arduino Micro. The micro controller is ATMega32U4.

    I made some change with your code. Not tested. I replace some "Serial" with the SoftwareSerial port "debug". Please diff the code.

    https://gist.github.com/volca/da178cd000abb91d649f

    10 replies

    i copied your code above and using IDE 1.0.6 now - still no online upload, also the temperature is really high all the time, very strange.

    .

    still never AT+CWMODE=1 or AT+CWJAP lines shown on the serial monitor;

    temperature1021

    light256

    water53

    AT+CIPSTART="TCP","184.106.153.149",80

    AT+CIPCLOSE

    temperature1022

    light252

    water33

    AT+CIPSTART="TCP","184.106.153.149",80

    AT+CIPCLOSE

    .

    i still think it is the code, rgb led works with the right colors and sensors are picking up data as well. just no online connection

    For test WIFI connection, please make it simple. Run the sketch below.

    https://gist.github.com/volca/69c559cfb50e5580668c

    Module Test: OK

    AT+CWJAP="8d59bb","244221619"

    ....................Can not connect to the WiFi.

    Module Test: OK

    AT+CWJAP="8d59bb","244221619"

    ....................Can not connect to the WiFi.

    Module Test: OK

    AT+CWJAP="8d59bb","244221619"

    ....................Can not connect to the WiFi.

    Module Test: OK

    AT+CWJAP="8d59bb","244221619"

    ....

    keeps repeating this. isn't it supposed to first set the mode, AT+CWMODE=1 ? this line doesn't showup on the software serial monitor..

    I edited the line 31:

    Original:

    delay(500);//delay after mode change

    Edited:

    delay(3000);//delay after mode change

    Give it enough time. It will connect the WIFI easy. I just tested the sketch and it worked.

    actually i think i solved the problem.

    on the serial monitor the code never prints - debug.println("AT+CWMODE=1");

    this maybe why,

    -

    Module Test: OK

    AT+CWJAP="8xxxb","2xxxx9"

    .....OK, Connected to WiFi.

    temperature1019

    light481

    water0

    SEND: AT+CIPSTART="TCP","184.106.153.149",80

    GET /update?key=9TYUWTFXTYC9RKT8&field1=1019&field2=481&field3=0

    Change the line

    debug.println("AT+CWMODE=1");

    to

    sendDebug("AT+CWMODE=1");

    You will see it on the serial monitor. It's not the problem.

    how about this,

    on my sketch; https://drive.google.com/file/d/0B8bvYGugxvFFYjJoN...

    at the very end line, i have;

    cmd = "AT+CIPMUX=0";

    sendDebug( cmd );

    if( Serial.find( "Error") )

    {

    debug.print( "RECEIVED: Error" );

    return false;

    }

    you didn't include above part in your final sketch here; https://gist.github.com/volca/da178cd000abb91d649

    i remember reading that this line is very important for successful upload. i tried including it myself but didn't still no success, i'm not sure where exactly it has to go however, maybe you can include it

    .

    also, looking at other esp8266 posts here, i notice that after AT+CIPSTART the monitor prints AT+CIPSEND=(a random number?)

    when I used esp8266 rev-01 on my previous project this is what the serial monitor looked like - picture 1

    picture 2 is how it looks like with your final sketch right now.. thingspeak channel still doesn't receive any data.

    picture1.jpgpicture2.jpg