I’m trying to setup an SM300D2 Air Quality sensor on an ESP-01 and having some issues. I’ve got the ESP flashed with a basic config to get things running. All the Entities show up in HA with no problems. The problem is actually reading from the sensor. Seem to be having the same issues reported here. From that thread it seems the issue was fixed and then maybe broken and now I’m not sure.
One question on the sensor itself. Once powered up there’s a blue LED that blinks at about a 1Hz rate. Is that normal or does it maybe indicate a problem with the sensor? I have it powered from a DC-DC Buck convertor and the voltage is a steady 5.0x.
Log errors show:
[13:43:49][W][sm300d2:026]: Invalid preamble for SM300D2 response!
[13:44:50][E][uart:015]: Reading from UART timed out at byte 0!
[13:44:50][W][sm300d2:020]: Reading data from SM300D2 failed!
[13:45:50][E][uart:015]: Reading from UART timed out at byte 0!
[13:45:50][W][sm300d2:020]: Reading data from SM300D2 failed!
[13:46:50][E][uart:015]: Reading from UART timed out at byte 0!
[13:46:50][W][sm300d2:020]: Reading data from SM300D2 failed!
[13:47:50][W][sm300d2:026]: Invalid preamble for SM300D2 response!
[13:48:50][E][uart:015]: Reading from UART timed out at byte 0!
[13:48:50][W][sm300d2:020]: Reading data from SM300D2 failed!
Hello @EdDickens,
I’m having the same issue, even with an ESP32 with hardware UART bus.
I didn’t find a solution for now, but I saw that we could debug the data received on the UART. I will try to decode it myself to see if the SM300D2 sends readable data (data decoding method in the description here https://fr.aliexpress.com/item/1005003325805481.html)
For information, on SM300D2 sellers’ websites like aliexpress, it said that the SM300D2 sends the data every second, so I don’t think the LED blink is an issue, as it should blink at every report.
I hope the community can help us with this problem.
I will keep you posted on the debug result with the data received.
Using a USB to Serial device, I’m not reading anything from the sensor on either RS232 or RS485.
The ‘Rx’ indicator on the USB to Serial device does blink in sync with the sensors LED flashing so it seems something is there. But Read operations just timeout with no data received.
I’ve’ tried several different combinations of Baud Rate, Data Bits, Stop Bits and Parity but nothing seems to work.
The right serial settings are:
Baud rate: 9600bps
Data bits: 8 bits
Stop bit: 1 bit
Check digit: None
On my side, I’m receiving data from the device, but they don’t correspond to the data format explained in the SM300D2 documentation (https://img.elecbee.com/ic/download/docx/20200511045813SM300D2.docx).
The payload isn’t starting by “3C 02” so it failed at byte 0…
I’m receiving a payload of 19 bytes. I tried to compute the checksum using the last byte with the same method used in the documentation, but I’m not able to have a valid checksum, and even if I am, I will not be able to match the payload values with the corresponding measures (CO2, PM2.5 etc).
The device is maybe broken :(.
Did you try to enable the debug feature on the UART bus to check if you received data on it?
If the USB to serial device’s led blinks, I think you missed something on the computer side to read the data.
I saw your issue on esphome’s github repo, I will follow it too.
The Github article just restates what the spec document on the product web page says so absolutely no help. I replied back with more details trying to explain the issue. Waiting for a response.
So I’ve been digging into the code and it looks like we just need to reapproach how the code is parsed.
There are now 19 fields with the 17 being broken into two.
the first two data placements are for HW ver and Addressing.
So we have to take into account that they are changing as well over time.
I’ve got a fork I’m working on to possibly fix this for good.
Following this thread. I’m considering an SM300D2 for my home later this year and want to ensure there’s a clear path to success before pulling the trigger
I you can post a copy of the output of your data stream. I can tell you if it will work with the code fork I’ve created… I don’ t think they’ve changed it that much since v2.