Linux Debian 10 laptop through which I use Firefox (v78.4.0esr) to configure / communicate with HA
I have also set up SSH to get to HA through a terminal window on the laptop
Arduino Mega 2560 has firmata v2.5.8 library installed
I am trying to set up HA to work with my Arduino Mega - this is a brand new setup and a learning experience for me. Thanks for the patience. Here goes:
Here’s a simple view of the hardware:
name: DHT22_1
pin: A0
pin_mode: ANALOG
differential: 3
I find the following error Configuration / Logs
Logger: homeassistant.components.firmata.config_flow
Source: components/firmata/config_flow.py:41
Integration: Firmata (documentation, issues)
First occurred: 9:01:13 AM (1 occurrences)
Last logged: 9:01:13 AM
Error connecting to PyMata board serial-/dev/serial/by-id/usb-Arduino__www.arduino.cc__0042_559303435363510141F2-if00:
I can’t help with your specific question and while I don’t mean to discourage your experiment, you’re probably better off looking at an ESP8266 (eg, Wemos D1 Mini) and using ESPHome or Tasmota to get the DHT22 working. This way you can use a WiFi connection and learn things such as MQTT and if you want to use C++ well that’s available to you too.
Arduino is a great platform but has been largely usurped by more capable WiFi enabled boards as they do the basics and so much more.
Yeah, I have ordered two 8266s that have not arrived yet. My goal is to get the integration working both ways. I’ll still want touse the Arduino for the number of ports.
“The arduino sensor platform allows you to get numerical values from an analog input pin of an Arduino board. Usually the value is between 0 and 1024.”
If you want to read a DHT you’ll need to write some custom code to either output values to the serial port, or modify the firmata to fool the values to an analog pin value, or connect up an Ethernet and send the values via HTTP, MQTT, etc.
This, this is not remotely true.
Especially keeping in mind that most ESP8266 projects are using the Arduino framework.
I’m not sure, at this point, how any of your comments were intended to lend me greater understanding. Apologies. I still don’t know what further understanding of Arduino<->Home Assistant you’re aiming to convey.
I had accidentally posted the wrong link, as it leads to the current Firmata integration where I took the information to reply from.
However, the statement stands. You cannot use the Firmata integration to read from a DHT sensor.
DHT sensors are not PWN output sensors.
DHT sensors use a custom digital protocol. You can read about it in the link below however to summarize: The data line is held high. To start a read, the MCU pulls the line low for 18ms, then high for 40 us. After which, the DHT now pulls the line low for 80us, then high for another 80, the begins transmitting its data by alternately pulling the line low and high for specific time periods to represent 1s and zeros. 50us low then 26-28us high for 0, or 70us for 1. The MCU reads this pulse stream, evaluates it and pulls out the bits to construct a reading.
Incidentally this precise timing is why this sensor is such a pain on MCUs like the ESP8266 which have background functions running. You can’t necessarily guarantee timing without disabling interrupts, etc.
Point is, it’s not PWM. Firmata cannot read it.
You can read the sensor via the standard Arduino DHT libraries and send via serial, or Ethernet. Or you can modify the Firmata code to translate the readings of the sensor into false analog input values between 0 and 1023 which you can feed to Firmata in place of the direct analog pin reading.
I use a modified version of OpenMQTTGateway for this.
I have lots of door sensors, motion sensors, temp/humidity sensor and a light sensor wired to it. Connected to the network through ethernet cable. This is the mega I am using. Its been running for more than a year without any issue.
OG can directly talk to HA or through MQTT but the old version I am running did not have the HA integration, I am talking to HA trough MQTT.