wanabo wrote: ↑10 Sep 2023, 09:46
Thanks for the advice.
As everything works without any external powersupply, do you think it's not safe ?
Even though Ton already suggested a much more likely cause of what was truly happening, I still want to reply to your question about powering stuff.
You have to realize that whenever you connect two separately powered devices together, there might be a difference to what each considers "ground" level voltage.
And even if both are powered from the same power supply, there will be losses in the cables due to the current flowing through these cables.
When you have thin cables for power (and ground), the voltage drop may become significant when you have a larger current flowing through these cables.
This may cause a voltage difference between grounds on both ends and thus the signal level of your data may appear lower (or higher) on the other end.
I made a quick drawing to illustrate:
- Ground Voltage Difference.png (79.62 KiB) Viewed 3019 times
The resistors illustrate the internal resistance of the (thin) wires.
100 Ohm isn't close to the true resistance, but just for illustrative purposes.
Let's assume the lamps L1 ... L4 each have an internal resistance of 300 Ohm.
The part with L1 consumes 1/3rd of the energy consumed by the part with L2 ... L4.
So L1 symbolizes the ESP board, L2 ... L4 symbolizes the LED display as this one probably will consume more than the ESP when all LEDs are on.
The current through R1, L1, R2 = 5V / (100 + 300 + 100) = 10 mA.
Thus the voltage over each of these parts is:
1V over R1 and also over R2.
3V over L1. (Volt meter P3)
Now the other part...
Rv of L2...L4 = 100 Ohm, since all three have the same resistance and are in parallel.
The current through R3 and R4 = 5V / (100 + 100 + 100) = 16.7 mA
Thus the voltage drop over R3 and R4 each is 1.67V
As you can see the voltage between GND (on the power supply) and GND1 = 1V
Voltage between GND and GND2 = 1.67V
Voltage between GND1 and GND2 = -0.67V (measured by volt meter P1)
N.B. GND2 will have a higher voltage than GND1, that's why I marked the voltage as being negative.
Thus the GND of each part differs because of different currents being drawn by each part.
When the ESP sends a signal on a GPIO pin, its level will be compared to GND of the ESP (thus GND1)
Let's assume this signal is a pulse of 3V.
For the device receiving this signal, it appears to be 2.33V as it is comparing it to GND2. (Volt meter P2)
This is probably too low.
TL;DR:
Make sure to have thick(er) wires for power lines and GND and also make sure to have a properly connected GND between the parts.
Also it is better to have a direct power connection between connected parts instead of each powered via a separate set of power cables. Like 'daisy-chaining' the devices.
If you use separate power lines, you can create a "ground loop" which will cause all kinds of other issues.