I am using an esp8266 read data from my power meter via SML. I wanted to add my second and third meter (one uses D0, the other uses SML) using software serial on the esp, but I am just recieving garbarge data. My setup is a small esp8266 devboard (d1 layout) and a BPW40 with a 1k pullup connected to GPIO4. Below is my yml and logs.
Can someone help me with this? Thanks in advance.
My yml:
Yes, get another esp device and use HW serial. Software Serial is a great idea, but often leaves much to be desired when trying to actually use it.
I had a water heater that used 9-bit serial. With esp chips this requires SW serial (and a custom version at that). I was able to make it work mostly, but it was never reliable. I needed 19200 baud but even 9600 is fast for software serial.
Luckily, my water heater died and I got a different one that uses 8-bit serial and works much better.
If you only needed 1200 baud or less it might be worth it.
I’m pretty sure you can’t reliably use hardware serial and Software Serial at the same time on the ESP8266. The ESP8266’s hardware UART relies heavily on interrupts, and those interrupt latencies make Software Serial timing inaccurate or completely unusable.
Switch to ESP32, which has three full hardware UARTs and no Wi‑Fi‑interrupt timing issues.
It works for low-speed communications, 9600 or less. For example, I use it to communicate with the DFPlayer Mini and it leaves my UART I/O free for flashing and debugging. If you try to use both at the same time, the software serial will likely be garbled.
It does work, but it depends on your expectations.
Always use a HW serial port if you can. If you can’t be REALLY sure you can’t, because you will likely spend a lot of time getting SW serial to work well enough.
The esp chips don’t don’t support 9-bit serial, so I was forced to use SW serial. I got it mostly working before I no longer needed it.
If you want great learning go down the path of getting software serial to work. At least a few people have been successful. Having gone down the path I can say it is not an easy path. It will challenge you.
What personally prevents me to waste time with this kind of approach is that even if you manage to make it work, it can break any moment in future. Add some components or update esphome and you have exciting times again. I do like challenges but only new ones.