Feature Request - PME
Moderators: grovkillen, Stuntteam, TD-er
-
- Normal user
- Posts: 45
- Joined: 07 Dec 2020, 15:33
Feature Request - PME
Hi, not sure where I should start this topic. Here or github.
I've being looking for ways to extend my IOs and found that PME is by far the best solution. However, there are some flaws.
I need almost 48 IOs distributed in 4 different boards. The I2C is a perfect solution since I can wire those boards using I2C bus. Even better, I can use an isolation I2C device. No short propagation or ESD.
I can also get the freedom to set PWM and make analog reads if needed in the future.
Here are a list of restrictions marked by priority:
1_[High] PME doesn't allow me to adjust the I2C address. It is fixed in 0x7f. I can only use one PME.
2_[High] PME add only one device. For a 48 IOs, would be better to add only 4 devices, in which 12 digital ports are enabled by device. Otherwise, I'm stuck in 12 devices.
3_[Low] Request are performed by ESPEasy only. Task must be triggered by time.
4_[Medium] Can't use other better suitable boards, such as bluepill / blackpill. Commands could be adjusted by string? PA1 instead of a Int number?
Before I start trying to change the code, I've decided to post here first to get some guidance and help. Even better, to understand if this is the better solution. For instance, in the past I've used TaskValueSet and UART to communicate an Arduino and ESPEasy. The problem now is that I want to use 4 arduinos. Before someone asks, why I will not use 4 ESP boards. I need to use ethernet cable and I just can't simply add four cables or a switch in the place. It is too complicated. I'm not planing to make a gateway with one board. Looking for wired solutions.
I've being looking for ways to extend my IOs and found that PME is by far the best solution. However, there are some flaws.
I need almost 48 IOs distributed in 4 different boards. The I2C is a perfect solution since I can wire those boards using I2C bus. Even better, I can use an isolation I2C device. No short propagation or ESD.
I can also get the freedom to set PWM and make analog reads if needed in the future.
Here are a list of restrictions marked by priority:
1_[High] PME doesn't allow me to adjust the I2C address. It is fixed in 0x7f. I can only use one PME.
2_[High] PME add only one device. For a 48 IOs, would be better to add only 4 devices, in which 12 digital ports are enabled by device. Otherwise, I'm stuck in 12 devices.
3_[Low] Request are performed by ESPEasy only. Task must be triggered by time.
4_[Medium] Can't use other better suitable boards, such as bluepill / blackpill. Commands could be adjusted by string? PA1 instead of a Int number?
Before I start trying to change the code, I've decided to post here first to get some guidance and help. Even better, to understand if this is the better solution. For instance, in the past I've used TaskValueSet and UART to communicate an Arduino and ESPEasy. The problem now is that I want to use 4 arduinos. Before someone asks, why I will not use 4 ESP boards. I need to use ethernet cable and I just can't simply add four cables or a switch in the place. It is too complicated. I'm not planing to make a gateway with one board. Looking for wired solutions.
Re: Feature Request - PME
As you haven't included links or clues to what your PME stands for, I'm assuming you are talking about the ProMini Extender?
.
.
.
When using Ethernet:
Your ESP will be of the ESP32 type, as that's the only ESP32 that's currently capable of having an Ethernet interface (none of the other ESP32-derivates support that). Seeing the number of ports/connections you want to use, it is strongly advised to use an ESP32 based board anyway, because of better CPU performance and much more available memory, also attributing to better performance and stability, so using one with an ethernet port included sounds like a logical choice. The higher number of GPIO pins (though quite a few are occupied by the Ethernet interface) might also be helpful.
Using I2C serial boards based on the SC16IS752 chip, that offer 2 serial ports per board, and multiple can be connected of different I2C addresses. Again because of performance, it is strongly advised to use an ESP32/ESP32-S2/ESP32-S3 board. Cost shouldn't be an issue, when composing a setup like yours.
ESPEasy has full support for the most popular I2C Multiplexers TCA954x, that provide up to 8 separate I2C bus channels, so consider that issue solvedthalesmaoa wrote: ↑20 May 2023, 01:01 1_[High] PME doesn't allow me to adjust the I2C address. It is fixed in 0x7f. I can only use one PME.

For each PME connected to your I2C multiplexer, you will need a separate task (with a unique name), and after that you can control the I/O pins using the <taskname>.extXXX,... commands to address the PME connected to that task (documentation is lacking, unfortunately). No need to configure each pin separately. Again, issue solvedthalesmaoa wrote: ↑20 May 2023, 01:01 2_[High] PME add only one device. For a 48 IOs, would be better to add only 4 devices, in which 12 digital ports are enabled by device. Otherwise, I'm stuck in 12 devices.

Assuming the ESP has access to a time-source, either using NTP or a supported I2C connected External Time Source (DS1307, DS3231, PFC8523 or PFC8563), you can write rules with rather accurate clock-time support. Also solvedthalesmaoa wrote: ↑20 May 2023, 01:01 3_[Low] Request are performed by ESPEasy only. Task must be triggered by time.

Not sure what that means?thalesmaoa wrote: ↑20 May 2023, 01:01 4_[Medium] Can't use other better suitable boards, such as bluepill / blackpill. Commands could be adjusted by string? PA1 instead of a Int number?
Is that Ethernet cable providing an Ethernet connection, or just multiple serial connections to the Arduinos?thalesmaoa wrote: ↑20 May 2023, 01:01 Before I start trying to change the code, I've decided to post here first to get some guidance and help. Even better, to understand if this is the better solution. For instance, in the past I've used TaskValueSet and UART to communicate an Arduino and ESPEasy. The problem now is that I want to use 4 arduinos. Before someone asks, why I will not use 4 ESP boards. I need to use ethernet cable and I just can't simply add four cables or a switch in the place. It is too complicated. I'm not planing to make a gateway with one board. Looking for wired solutions.
When using Ethernet:
Your ESP will be of the ESP32 type, as that's the only ESP32 that's currently capable of having an Ethernet interface (none of the other ESP32-derivates support that). Seeing the number of ports/connections you want to use, it is strongly advised to use an ESP32 based board anyway, because of better CPU performance and much more available memory, also attributing to better performance and stability, so using one with an ethernet port included sounds like a logical choice. The higher number of GPIO pins (though quite a few are occupied by the Ethernet interface) might also be helpful.
Using I2C serial boards based on the SC16IS752 chip, that offer 2 serial ports per board, and multiple can be connected of different I2C addresses. Again because of performance, it is strongly advised to use an ESP32/ESP32-S2/ESP32-S3 board. Cost shouldn't be an issue, when composing a setup like yours.
/Ton (PayPal.me)
-
- Normal user
- Posts: 45
- Joined: 07 Dec 2020, 15:33
Re: Feature Request - PME


I have tons of other questions, but let me try to ask them one by one. Probably, the best solution will arise.
From the back to the start, you have a great point regarding the ESP32.
If I get it right, you are suggesting to use SC16IS752 to make an I2C connection with the "main board" and the UART to connect two other "client boards". Is that correct?
In my application, the distance is 70m long (that is why only one ethernet cable) and I need to connects the boards in series (this is why the PME I2C).
Regarding <taskname>.extXXX, I will check if digital pin read work in the log. I need digital pin read most. How can I helo with docs? I will make some tests, read the source and post it.
What about CAN? Is there any movement towards it? I see it as the best solution. It worth to develop a plugin for it?
Re: Feature Request - PME
Such long cables can only be dealt with using ethernet.
You could maybe use some RS485 transceivers to overcome the long distance, but those can only be used in half-duplex mode.
Not all devices may work fine with that. Modbus devices can operate in half-duplex, but there's still the problems with noise, isolation, termination, etc.
You can't use I2C over such long distances. Max. for I2C is roughly a few tens of cm.
You could maybe use some RS485 transceivers to overcome the long distance, but those can only be used in half-duplex mode.
Not all devices may work fine with that. Modbus devices can operate in half-duplex, but there's still the problems with noise, isolation, termination, etc.
You can't use I2C over such long distances. Max. for I2C is roughly a few tens of cm.
Re: Feature Request - PME
If you need a lot of on/off inputs you could have a look at P129 Input - Shift registers (74HC165), that can handle up to 128 inputs per task. It won't handle analog input though. And for controlling on/off output pins you could use P126 - Output - Shift registers (74HC595), that can theoretically handle 255 * 8 output pins.thalesmaoa wrote: ↑20 May 2023, 15:20 Regarding <taskname>.extXXX, I will check if digital pin read work in the log. I need digital pin read most.
These chips don't support PWM or analog.
I'll pick up the documentation in a couple of days, NP. (sometimes I need some distraction/distance from the project I'm working onthalesmaoa wrote: ↑20 May 2023, 15:20 How can I helo with docs? I will make some tests, read the source and post it.

/Ton (PayPal.me)
-
- Normal user
- Posts: 45
- Joined: 07 Dec 2020, 15:33
Re: Feature Request - PME
Are those the best references for plugin creation?
https://letscontrolit.com/wiki/index.ph ... Guidelines
https://letscontrolit.com/wiki/index.ph ... evelopment
https://letscontrolit.com/wiki/index.ph ... Guidelines
https://letscontrolit.com/wiki/index.ph ... evelopment
Re: Feature Request - PME
The wiki is outdated, please use the read the docs.
https://espeasy.readthedocs.io/en/latest/
https://espeasy.readthedocs.io/en/latest/
-
- Normal user
- Posts: 45
- Joined: 07 Dec 2020, 15:33
Re: Feature Request - PME
Just realized that I need to create a controller.
Any tip where to start?
Any tip where to start?
Re: Feature Request - PME
Look at the source of some controller 
Basically a controller gets its data from the sendData function, which is being called from running the PLUGIN_READ function.
Some controllers, like MQTT controllers, can also receive data from the publish command.
But it is by far easier to implement a non-MQTT controller as the MQTT controllers are handled a bit different from the others.
You also need to look at the queue elements, or pick a generic one, for example one that holds the pre-formatted task value strings.
Just look in the code where USES_C00x is being used (for plugin nr x
)

Basically a controller gets its data from the sendData function, which is being called from running the PLUGIN_READ function.
Some controllers, like MQTT controllers, can also receive data from the publish command.
But it is by far easier to implement a non-MQTT controller as the MQTT controllers are handled a bit different from the others.
You also need to look at the queue elements, or pick a generic one, for example one that holds the pre-formatted task value strings.
Just look in the code where USES_C00x is being used (for plugin nr x

Who is online
Users browsing this forum: Ahrefs [Bot] and 15 guests