Hi This is my first query re my first project which is to use a DHT22 sensor to check the temperature. I am aiming to use it to switch on 12v at a given temp with a relay. No problem recording the temp or working the relay but if I use them together I get nan readings on the temp. As soon as I disconnect the relay the temp readings re-appear.
Ive tried various output pins with no success. Can someone give me some guidance please?
@r_hood, nan error is 'not a number' error. It sounds like something might be interfering with the I2C buss you have set up. Without visual or hands on, that's my best guess.
Try ignoring the sensor data and manually control the relay in the code. Try to isolate/separate the two and see if you can locate the problem.
Edit: Try to work with both separately and it might highlight the problem.
Thanks Centari and Yurkshire Lad
I think I’ve got things sorted now. Not sure what I did re the ‘nan’ problem but it’s working now - possibly a bad connection?
Re the relay itself I found a fault with it. It’s an optorelay module and was indicating by the LEDs on the input side that it was responding to input from the ESP32 but I found it needed a good thump to make the output switch over ! I’ll perhaps set it up on the blink program to see if that will loosen it up.
Thanks for your time, much appreciated