Dashboard values don't update

Arduino Model? (example: Arduino Uno)

ESP8266

Arduino Ethernet / WiFi Shield? (example: Ethernet Shield W5100)

ESP8266

Please describe the bug / issue. Attaching any relevant screenshots would be very helpful!

I have a DTH11 sensor hooked up to an ESP8266. Humidity is set up on the dashboard as V0 as a generic digital input and temp is set up as V1 as a generic digital input. Also tried the temp as a DS18B20 input but there was no difference on the updates. Live graphs and value widgets for digital input do not update values. They add initial initial data point but that’s it. Code is attached.
New Text Document.txt (3.0 KB)

Thanks Adam! Very helpful when you post good explanation and code reference.

We will be able to look into this and see where the issue seems to be.

-B

Adam,
Anything I can do to help?
I can post my code, @kreggly can fix it (thanks Craig!), and you can take it for a spin.
I’ll give your code a run on my hardware and see what happens.

Here is the code for DHT21 and BME280 that I have running on one of my Adafruit Huzzah ESP8266 BOB’s.

Let me know if you want to try some different hardware combinations.

Ian

ps
keep in mind the CayenneWiFi.h library is modified per your instructions
http://community.mydevices.com/t/esp8266/820/16?u=ian

// Example testing sketch for various DHT humidity/temperature sensors
// Written by ladyada, public domain

#include "DHT.h"
#define CAYENNE_DEBUG         // Cayenne Code Uncomment to show debug messages
#define DHTPIN 4              // what digital pin we're connected to
#define CAYENNE_PRINT Serial  // Cayenne Code Comment this out to disable prints and save space
// #include <CayenneEthernet.h>  // Cayenne Code Change this to use a different communication device. See Communications examples.
#include <CayenneWiFi.h>
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>

// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = "";
// Your network name and password.
char ssid[] = "";
char password[] = "";

// Uncomment whatever type you're using!
//#define DHTTYPE DHT11   // DHT 11
//#define DHTTYPE DHT22   // DHT 22  (AM2302), AM2321
#define DHTTYPE DHT21   // DHT 21 (AM2301)

#define BME_SCK 12
#define BME_MISO 13
#define BME_MOSI 14
#define BME_CS 15
#define SEALEVELPRESSURE_HPA (1013.25)

//Adafruit_BME280 bme; // I2C
//Adafruit_BME280 bme(BME_CS); // hardware SPI
Adafruit_BME280 bme(BME_CS, BME_MOSI, BME_MISO,  BME_SCK);

// Connect pin 1 (on the left) of the sensor to +5V
// NOTE: If using a board with 3.3V logic like an Arduino Due connect pin 1
// to 3.3V instead of 5V!
// Connect pin 2 of the sensor to whatever your DHTPIN is
// Connect pin 4 (on the right) of the sensor to GROUND
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor

// Initialize DHT sensor.
// Note that older versions of this library took an optional third parameter to
// tweak the timings for faster processors.  This parameter is no longer needed
// as the current DHT reading algorithm adjusts itself to work on faster procs.
DHT dht(DHTPIN, DHTTYPE);

void setup() {
  pinMode(4, INPUT);
  Serial.begin(9600);
  Serial.println("DHTxx test!");
  Serial.println(F("BME280 test"));
  Cayenne.begin(token, ssid, password);
  dht.begin();
  if (!bme.begin()) {
    Serial.println("Could not find a valid BME280 sensor, check wiring!");
    while (1);
  }
}

void loop() {
  Cayenne.run();
  
  // Wait a few seconds between measurements.
  //delay(5000);

  // Reading temperature or humidity takes about 250 milliseconds!
  // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
  float h = dht.readHumidity();
  // Read temperature as Celsius (the default)
  float t = dht.readTemperature();
  // Read temperature as Fahrenheit (isFahrenheit = true)
  float f = dht.readTemperature(true);

  // Check if any reads failed and exit early (to try again).
  if (isnan(h) || isnan(t) || isnan(f)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }

  // Compute heat index in Fahrenheit (the default)
  float hif = dht.computeHeatIndex(f, h);
  // Compute heat index in Celsius (isFahreheit = false)
  float hic = dht.computeHeatIndex(t, h, false);

  Serial.print("Humidity: ");
  Serial.print(h);
  Serial.print(" %\t");
  Serial.print("Temperature: ");
  Serial.print(t);
  Serial.print(" *C ");
  Serial.print(f);
  Serial.print(" *F\t");
  Serial.print("Heat index: ");
  Serial.print(hic);
  Serial.print(" *C ");
  Serial.print(hif);
  Serial.println(" *F");

  Serial.print("Temperature = ");
    Serial.print(bme.readTemperature());
    Serial.println(" *C");

    Serial.print("Pressure = ");

    Serial.print(bme.readPressure() / 100.0F);
    Serial.println(" hPa");

    Serial.print("Approx. Altitude = ");
    Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA));
    Serial.println(" m");

    Serial.print("Humidity = ");
    Serial.print(bme.readHumidity());
    Serial.println(" %");

    Serial.println();


}

// These functions are called when the Cayenne widget requests data for the Virtual Pin.
CAYENNE_OUT(V0)
{
  Cayenne.virtualWrite(V0, dht.readTemperature(true));
}

CAYENNE_OUT(V1)
{
  Cayenne.virtualWrite(V1, dht.readHumidity());
}

CAYENNE_OUT(V2)
{
  Cayenne.virtualWrite(V2, dht.readTemperature());
}

CAYENNE_OUT(V3)
{
  Cayenne.virtualWrite(V3, dht.readHumidity());
}

CAYENNE_OUT(V4)
{
  Cayenne.virtualWrite(V4, dht.readTemperature(true));
}

CAYENNE_OUT(V5)
{
  Cayenne.virtualWrite(V5, bme.readTemperature() *9/5+32);
}

CAYENNE_OUT(V6)
{
  Cayenne.virtualWrite(V6, bme.readHumidity());
}

CAYENNE_OUT(V7)
{
  Cayenne.virtualWrite(V7, bme.readPressure() / 100.0F);
}

CAYENNE_OUT(V8)
{
  Cayenne.virtualWrite(V8, bme.readAltitude(SEALEVELPRESSURE_HPA));
}

CAYENNE_OUT(V9)
{
  Cayenne.virtualWrite(V9, bme.readTemperature());
}

You don’t need to modify Cayenne WiFi. Just use the include code I’ve posted.

Ian, all your stuff is working now? My DHT sensors haven’t come yet - slow boat.

If your code is working, I’d ditch the stuff in the main loop so your not slowing things down. All that stuff an add up and get you timeout errors again.

Other than that, I’m pumped people can easily build user drivers now.

Craig

Craig,
Things are working very well now. I keep un-commenting the serial print statements because I’m still fiddling with stuff. Once I get past proof of concept I’ll rem all that crap out again.

Rem? How old is he?

Ian

I get it. I started out programming 6800s with a keypad and a 7 seg display.

Then I worked on enough RF devices, that I consider them all just radios whether it’s wifi, bluetooth, 2G/3G/4G, dsss, satelite, WCDMA, GPS, etc.

Ok. I feel old now.

Thanks alot, Ian.

The really bad news is that when I learned to use REM in code was the last time I had formal training in code. circa 1983 I think.

GPS is for wimps- LORAN, now there’s a way to navigate.

Oh wait, I have had a code class since the early eighties. Of course that was code of the Samuel Morse variety, there’s a tool that is getting very rusty in the ol’ tool box.

Ian

VE6JKR has never keyed a thing…

KBØHKY - learned it long enough to get the ticket
I can still do my name- di dit di dah dah dit
not much else.

73 my friend

Ian

we strait-up high-jacked this thread - sorry Adam @ats1080s

Adam can speak up, I remember him from the PICLIST some 20+ years ago.

He ain’t no spring chicken either.

Ha, must have been someone else. I’m only 27 so that would have made me 7 :baby_bottle:

My apologies. I was thinking about @picaxe :slight_smile: