need 8 serial interfaces for my project

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
leachimtrebron
Normal user
Posts: 24
Joined: 12 Mar 2018, 20:11

need 8 serial interfaces for my project

#1 Post by leachimtrebron » 24 Feb 2023, 17:24

I need your help,
Requirement for my project to read all meters in the house for integration into ioBroker
- read out 8 eBZ meters
- Transfer info via serial bridge
- 25 temperature sensors DS18B20 via MQTT
- 7 counters that read the water meters and transmit status changes via MQTT


Except for 5 software RS232 I have got everything running.

Now I am missing 5 software RS232 interfaces.
These should also be transmitted via the Serial Monitor.

Hardware RS232
Counter 1: 192.168.178.164:1501 GPIO16 9600 Baud 7 Bit/Even/Stop1
Counter 2: 192.168.178.164:1502 GPIO13 9600 Baud 7 Bit/Even/Stop1
Counter 3: 192.168.178.164:1503 GPIO3 9600 Baud 7 Bit/Even/Stop1

How can I implement the rest of the software RS232 here?

Or does anyone know another project or can give me some hints?
I found: https://github.com/plerup/espsoftwareserial
And https://github.com/AlphaLima/ESP32-Serial-Bridge
How can these be brought together?
Unfortunately I am not a programmer and have only done a bit of Powershell.

I would be very happy about a hint or support.

User avatar
Ath
Normal user
Posts: 3488
Joined: 10 Jun 2018, 12:06
Location: NL

Re: need 8 serial interfaces for my project

#2 Post by Ath » 24 Feb 2023, 19:28

ESPEasy does support the SC16IS752 I2C serial boards. These usually have 2 serial ports, and multiple can be added when using different I2C addresses.
Not sure how many can be handled on a single ESP, probably, because of the memory requirements, it would be best to use an ESP32, as that has much more RAM memory available. Also, on ESP32 there are 32 tasks available for configuration, instead of the default 12 for ESP8266.
/Ton (PayPal.me)

leachimtrebron
Normal user
Posts: 24
Joined: 12 Mar 2018, 20:11

Re: need 8 serial interfaces for my project

#3 Post by leachimtrebron » 26 Feb 2023, 10:24

Thanks for your info.

The extension is much more expensive than if I invest in an additional ESp32 and then marry it via a P2P network.
P2P network to marry it.

In terms of power, however, I would then need to use a different power supply.

It would be nicer if software RS232 could be implemented.

I found this on github:
https://github.com/StefanRu1/SoftwareSe ... PEasy-mega

someone has already tried something here. unfortunately i don't know how to get this into my espeasy and if this could solve my problem.

Is there an official implementation or has anyone tried this before?

User avatar
Ath
Normal user
Posts: 3488
Joined: 10 Jun 2018, 12:06
Location: NL

Re: need 8 serial interfaces for my project

#4 Post by Ath » 26 Feb 2023, 13:19

On ESP32, ESPEasy also allows to freely configure the gpio pins to use for serial input. Not sure how many you can have on a single ESP32 though, as receiving can be quite cpu-intensive, and the serial channels/ports are limited.
/Ton (PayPal.me)

TD-er
Core team member
Posts: 8739
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: need 8 serial interfaces for my project

#5 Post by TD-er » 26 Feb 2023, 21:50

ESP32 only has 3 hardware serial ports.
I don't think we have SW serial included in ESP32 builds, as at some point there wasn't any SW serial (or at least not stable/usable) for ESP32 and later I never added it.

But I guess we can add it to ESP32 builds.

Still I don't think you have enough free GPIO pins for 8 serial ports.
Also I don't know how well SW serial will work when several are active at the same time.
Is it just an occasional byte you need to receive? Or is it a continuous stream of data, like GPS or PMSx003?

leachimtrebron
Normal user
Posts: 24
Joined: 12 Mar 2018, 20:11

Re: need 8 serial interfaces for my project

#6 Post by leachimtrebron » 11 Mar 2023, 14:43

Thanks for the feedback
It is about the reading of 8 electricity meters. These send with 9600 baud 7 bit/Even/Stop1.
The data comes all second. as Ocean Biogeographic Information System (OBIS).
Could https://github.com/plerup/espsoftwareserial be implemented?

TD-er
Core team member
Posts: 8739
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: need 8 serial interfaces for my project

#7 Post by TD-er » 11 Mar 2023, 14:47

We have software serial included on ESP8266.
We can add it, but that's quite a lot of work and I honestly think it will not work with many instances of SW serial as it does cause an interrupt for each bit received. For 1 instance this can somewhat work, but for multiple instances this will be loaded with corrupted data.

kimot
Normal user
Posts: 190
Joined: 12 Oct 2017, 20:46

Re: need 8 serial interfaces for my project

#8 Post by kimot » 11 Mar 2023, 21:57

Most of energy meters uses MODBUS, so they are addressable and one rs232 on ESP is enough.
Connect ESP TX with all RX pins ezB meters and all ezB TX pins through diode to ESP RX pin.
Got inspiration from multiple PZEM004 on one serial port https://community-assets.home-assistant ... 07d078.png

Or if your ezB meters really are able only send messages every second, you can mulitiplex their RX pins with setting GPIO and after receiving message from first ezB, switch to RX pin second ezB, then third and so on.
You can collect data from all eight meters after cca 10 second.
But serious problem will be parse received data to something useful without special written plugin

User avatar
Ath
Normal user
Posts: 3488
Joined: 10 Jun 2018, 12:06
Location: NL

Re: need 8 serial interfaces for my project

#9 Post by Ath » 11 Mar 2023, 22:16

So, it seems adding multiple SC16IS752 I2C Serial ports is the simplest solution. These should cost around 3.5 to 4 euro/dollar each when bought via Aliexpress, so that may be cheaper than extra ESP32 boards. You will need to get the documentation for the SC16IS752 chip to find the I2C Address selection options, as that's quite specific for this this chip.
/Ton (PayPal.me)

TD-er
Core team member
Posts: 8739
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: need 8 serial interfaces for my project

#10 Post by TD-er » 11 Mar 2023, 22:52

The remark Kimot made is maybe even the best one here.

Do these energy sensors communicate via RS485?
And thus, do you need to use some MAX485 for them?

Can these sensors be set to a unique Modbus address?
If they can't then maybe we can also add some multiplexer idea as those MAX485 also use some pin for DE/RE so maybe we can also have some GPIO toggle these on separate MAX485 boards as those are dirt cheap.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 42 guests