Hi,
I tried using the Sensor Tutorial for the following configuration:
Notecarrier-AF/Adafruit-Huzzah32/CPP-Arduino-Wiring
I am having a problem getting the device to connect to the project in Notehub.
The Quickstart project example worked okay.
I then created a new project with new productUID.
I created the example sketch using Arduino IDE 1.8.13.
I am using an MS8607 temp/humidity/pressure sensor.
I see the hub.set request during setup and the note.add requests while in the loop, but I never see the device connect on the hub. I am seeing the 100 note capacity error - but I assume that’s because I can’t connect.
Can you help me debug this.
Thanks,
Ralph
Here is the output on the Serial Console:
09:34:39.617 → rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
09:34:39.617 → configsip: 0, SPIWP:0xee
09:34:39.617 → clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
09:34:39.617 → mode:DIO, clock div:1
09:34:39.617 → load:0x3fff0030,len:1100
09:34:39.617 → ho 0 tail 12 room 4
09:34:39.617 → load:0x40078000,len:12308
09:34:39.617 → load:0x40080400,len:3076
09:34:39.617 → entry 0x400805ec
09:34:42.268 → MS8607 Connected…
09:34:42.548 → {“req”:“hub.set”,“product”:“com.hotmail.ralphjy:ms8607”,“mode”:“continuous”,“body”:{“agent”:“note-arduino”,“compiler”:“gcc 8.4.0”,“req_interface”:“i2c”,“cpu_name”:“esp32”}}
09:34:42.748 → {}
09:34:42.828 → Temperature = 22.27 *C
09:34:42.828 → Humidity = 39.16 %
09:34:42.828 → {“req”:“note.add”,“file”:“sensors.qo”,“sync”:true,“body”:{“temp”:22.27000045776367,“humidity”:39.16220092773438}}
09:34:42.988 → {“err”:“error adding note: can’t exceed 100 notes per file (currently 100; see note.template)”}
09:34:58.023 → Temperature = 22.26 *C
09:34:58.023 → Humidity = 39.04 %
09:34:58.023 → {“req”:“note.add”,“file”:“sensors.qo”,“sync”:true,“body”:{“temp”:22.26000022888184,“humidity”:39.04013061523438}}
09:34:58.183 → {“err”:“error adding note: can’t exceed 100 notes per file (currently 100; see note.template)”}
And the sketch
#include <Notecard.h>
#include <Wire.h>
#include <Adafruit_MS8607.h>
#include <Adafruit_Sensor.h>
#define serialDebug Serial
#define productUID "com.hotmail.ralphjy:ms8607"
Notecard notecard;
Adafruit_MS8607 ms8607;
void setup() {
// put your setup code here, to run once:
delay(2500);
serialDebug.begin(115200);
Wire.begin();
notecard.begin();
notecard.setDebugOutputStream(serialDebug);
// Try to initialize!
if (!ms8607.begin()) {
serialDebug.println("Failed to find MS8607 chip");
while (1) { delay(10); }
}
serialDebug.println("MS8607 Connected...");
J *req = notecard.newRequest("hub.set");
JAddStringToObject(req, "product", productUID);
JAddStringToObject(req, "mode", "continuous");
notecard.sendRequest(req);
}
void loop() {
// put your main code here, to run repeatedly:
float tempC, tempF, humid, press;
sensors_event_t temp, pressure, humidity;
ms8607.getEvent(&pressure, &temp, &humidity);
tempC = temp.temperature;
tempF = tempC * 9 / 5 + 32;
humid = humidity.relative_humidity;
press = pressure.pressure;
serialDebug.print("Temperature = ");
serialDebug.print(tempC);
serialDebug.println(" *C");
serialDebug.print("Humidity = ");
serialDebug.print(humid);
serialDebug.println(" %");
J *req = notecard.newRequest("note.add");
if (req != NULL) {
JAddStringToObject(req, "file", "sensors.qo");
JAddBoolToObject(req, "sync", true);
J *body = JCreateObject();
if (body != NULL) {
JAddNumberToObject(body, "temp", tempC);
JAddNumberToObject(body, "humidity", humid);
JAddItemToObject(req, "body", body);
}
notecard.sendRequest(req);
}
delay(15000);
}