0

Retrieve MCP9808 temperature value with Huzzah ESP8266 ?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Retrieve MCP9808 temperature value with Huzzah ESP8266 ?

by Khoi on Mon Oct 05, 2015 10:23 am

Hi All,

I want to log the temperature of my vaccine fridge (I'm a French pharmacist) into a database stored on my NAS webserver.

1) I succeeded to read the temperature from MCP9808 with an Arduino UNO board.
2) I succeeded to read the temperature from MCP9808 with the Huzzah ESP8266 board with Lua scripts (in this case, I have the value without decimals).
3) Then I tried to do the same with Arduino IDE and it failed (error exception). I think the SDA / SCL pins are not the same than an Arduino UNO.

Is there an "easy" solution with Arduino IDE ?
Is it possible to define other SDA/SCL Gpio pins ?

I take a look at the SoftI2C library but don't understand how to use it.

Best regards,

Khôi.

Khoi
 
Posts: 3
Joined: Mon Oct 05, 2015 10:07 am

Re: Retrieve MCP9808 temperature value with Huzzah ESP8266 ?

by Khoi on Mon Oct 05, 2015 1:16 pm

Here is the code :

Code: Select all | TOGGLE FULL SIZE
#include <Wire.h>
#include "Adafruit_MCP9808.h"
Adafruit_MCP9808 tempsensor = Adafruit_MCP9808();

void setup() {
  Serial.begin(115200);
  Serial.println("Huzzah ESP8266 - MCP9808");
  if(!tempsensor.begin()) {
    Serial.println("Couldn't find MCP9808!");
    while(1);
  }
}

void loop() {
  float c = tempsensor.readTempC();
  Serial.print("Temp: "); Serial.print(c); Serial.print("*C\t");
  delay(250);
}


Serial monitor

Huzzah ESP8266 - MCP9808
Couldn't find MCP9808!

ctx: cont
sp: 3ffe9bb0 end: 3ffe9d80 offset: 01b0

>>>stack>>>
3ffe9d60: 00000000 00000000 3ffe9da4 40201cbf
3ffe9d70: 00000000 00000000 3ffe8d60 40100118
<<<stack<<<

ets Jan 8 2013,rst cause:2, boot mode:(1,7)

ets Jan 8 2013,rst cause:4, boot mode:(1,7)

wdt reset

Khoi
 
Posts: 3
Joined: Mon Oct 05, 2015 10:07 am

Re: Retrieve MCP9808 temperature value with Huzzah ESP8266 ?

by bbx10node on Mon Oct 05, 2015 8:53 pm

Try SCL connected to pin #5 and SDA connected to pin #4. If it does not work swap them around.

See the following for more details.

https://github.com/esp8266/Arduino/blob ... digital-io

bbx10node
 
Posts: 132
Joined: Sun Feb 22, 2015 4:14 pm

Re: Retrieve MCP9808 temperature value with Huzzah ESP8266 ?

by Khoi on Tue Oct 06, 2015 1:53 am

Try SCL connected to pin #5 and SDA connected to pin #4. If it does not work swap them around.


Thanks a lot!
It's working !

Khoi
 
Posts: 3
Joined: Mon Oct 05, 2015 10:07 am

Re: Retrieve MCP9808 temperature value with Huzzah ESP8266 ?

by morwic on Fri Dec 28, 2018 1:02 am

So what would the config look like to send data to adaio with a esp8266 ?
Thank You

morwic
 
Posts: 45
Joined: Thu Nov 28, 2013 8:37 pm
Location: Houston

Please be positive and constructive with your questions and comments.