DISPLAY PROBLEMS ON THE ADAFRUIT IO SCREEN

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Darrenn05SG
 
Posts: 1
Joined: Mon Dec 06, 2021 2:01 pm

DISPLAY PROBLEMS ON THE ADAFRUIT IO SCREEN

Post by Darrenn05SG »

Hi, i've been experimenting problems lately with the communication between the Adafruit Feather HUZZAH ESP8266 with the wifi module incorporated. None of the data i showing on the screen, but when i go to "feeds", i can see that the IO platform is receiving readings from the sensors you use (hydrometer, photocell, raindrop sensor). I attach the code that i made, perhaps there's a problem with it.

Also, my IO platform is receiving NAN reading form a sensor that is connected as well, a DTH22. Why is that?

Code: Select all

#include "config.h"
#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <DHT_U.h>

#define HUMTEMP 2
#define SENSLUZ 5
#define SENSLLUV 12
#define SENSHUMSUELO 14
#define VALV0 0


// button state
bool current = false;
bool current1 = false;
bool current2 = false;

// create DHT22 instance
DHT_Unified dht(HUMTEMP, DHT22);

// set up the feeds
AdafruitIO_Feed *temperature = io.feed("temperature");
AdafruitIO_Feed *humidity = io.feed("humidity");
AdafruitIO_Feed *light= io.feed("light");
AdafruitIO_Feed *soil = io.feed("soil");
AdafruitIO_Feed *rain = io.feed("rain");
AdafruitIO_Feed *valve1 = io.feed("valve1");

void setup() {
  
  pinMode(SENSLUZ, INPUT); //Fotoresistencia
  pinMode(SENSLLUV, INPUT); //Sensor de lluvia
  pinMode(SENSHUMSUELO, INPUT); //Sensor humedad suelo
  pinMode(HUMTEMP, INPUT); //Sensor humedad-temperatura 
  pinMode(VALV1, OUTPUT); //Salida valvula 1
  pinMode(VALV2, OUTPUT); //Salida valvula 2
  pinMode(VALV3, OUTPUT); //Salida valvula 3
  pinMode(VALV0, OUTPUT); //Salida valvula 4 
  
  Serial.begin(115200);
  
  while(! Serial);

  // initialize dht22
  dht.begin();

  // connect to io.adafruit.com
  Serial.print("Connecting to Adafruit IO");
  io.connect();

  valve1->onMessage(handleMessage);

  // wait for a connection
  while(io.status() < AIO_CONNECTED) {
    Serial.print(".");
    delay(500);
  }

  // we are connected
  Serial.println();
  Serial.println(io.statusText());
  valve1->get();
}

void handleMessage(AdafruitIO_Data *data){

  Serial.print("Received <- ");

  if(data->toPinLevel() == HIGH)
    Serial.println("HIGH");
  else
    Serial.println("LOW");
  
  digitalWrite(VALV1, data->toPinLevel());
}

void loop() {

  // io.run(); is required for all sketches.
  // it should always be present at the top of your loop
  // function. it keeps the client connected to
  // io.adafruit.com, and processes any incoming data.
  io.run();

  sensors_event_t event;
  dht.temperature().getEvent(&event);

  float celsius = event.temperature;
 
  Serial.println();
  Serial.print("Temperatura: ");
  Serial.print(celsius);
  Serial.println("°C");

  temperature->save(celsius);

  dht.humidity().getEvent(&event);

  Serial.print("Humedad Relativa: ");
  Serial.print(event.relative_humidity);
  Serial.println("%");

  // save humidity to Adafruit IO
  humidity->save(event.relative_humidity);

  if(digitalRead(SENSLUZ) == LOW){
    current = true;
    Serial.println("Estado del clima: Soleado");
  }else{
    current = false;
    Serial.println("Estado del clima: Nublado / Es de Noche");
  }

  light->save(current);

  if(digitalRead(SENSLLUV) == LOW){
    current1 = true;
    Serial.println("Estado del clima: Está Lluviendo");
  }else{
    current1 = false;
    Serial.println("Estado del clima: No ha Llovido");
  }

  rain->save(current1);

  if(digitalRead(SENSHUMSUELO) == LOW){
    current2 = true;
    Serial.println("Estado del suelo: El suelo está empapado");
  }else{
    current2 = false;
    Serial.println("Estado del suelo: El suelo está seco");
  }

  soil->save(current2);
  
  delay(15000);
}

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: DISPLAY PROBLEMS ON THE ADAFRUIT IO SCREEN

Post by mikeysklar »

When you open the serial console on your machine and set the baudrate to 115200 you do not see anything? Even if you reset the controller?

There are some suggestions in this thread about getting around the NaN issue with the ESP8266 and the Adafruit DHT-sensor-library. Make sure things are 3v3, use D3 for the DHT22 out, sleep the controller for 45 seconds every hour, etc.


https://github.com/adafruit/DHT-sensor- ... /issues/94

Locked
Please be positive and constructive with your questions and comments.

Return to “Feather - Adafruit's lightweight platform”