I used a simple test code to test the Wemos with the DHT and the MQ9.
An Arduino Uno is used to power the MQ9 at 1.5V with a voltage divider on the 5V pin. Another voltage divider cuts the MQ9's output voltage into 2/3 its original to avoid damaging the ADC of the Wemos.
Circuit:
Code:
#include "DHTesp.h"
DHTesp dht;
void setup()
{
Serial.begin(115200);
Serial.println();
dht.setup(12, DHTesp::DHT11); // Connect DHT sensor to GPIO 17
}
void loop()
{
delay(500);
float humidity = dht.getHumidity();
float temperature = dht.getTemperature();
Serial.print(humidity, 1);
Serial.print("\t\t");
Serial.print(temperature, 1);
Serial.print("\t\t");
Serial.println(analogRead(A0));
}
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.