logo elektroda
logo elektroda
X
logo elektroda

[Solved] How to transfer PJON data over a 230V AC network using the ESP8266?

mjab 1647 15
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 21042541
    mjab

    Level 10  
    Hello
    I need to find a simple and cheap way to transmit data in a Smart Home over a 230V AC network infrastructure. We are talking about a modern electrical network with a residual current fuse.
    The data itself is to be transmitted using ESP8266 chips on a 160MHz clock (3.3V logic) via the PJON SoftwareBitBang protocol over a 230V AC network.
    Data about PJON technology : https://github.com/gioblu/PJON/blob/master/src/strategies/SoftwareBitBang/README.md
    Example video of how it works : https://www.youtube.com/watch?v=Y-CRYJ8_Kf0
    Can I count on help in building prototypes of such a device? :) .
    Company Account:
    Jabłoński KOMPUTERY
    Ogrodowa 3a, Rypin, 87-500 | Tel.: 507XXXXXX (Show) | Company Website: https://www.k.j.pl
  • ADVERTISEMENT
  • #2 21042605
    speedy9
    Helpful for users
    mjab wrote:
    SoftwareBitBang

    It is a valid alternative to 1-Wire
    This has so little to do with the 230V network.

    Isn't it easier to use PLC adapters (as you already have to have transmission over the power network) with WiFi and connect these ESPs over WiFi, since they have a built-in radio anyway?
  • ADVERTISEMENT
  • #3 21042648
    mjab

    Level 10  
    yyyy.... yes ....

    I knew that the topic of ESPnow, WiFi etc. would be thrown up .... It's just that it doesn't work when there are several hundred such devices in doors, lamps, motion detectors, kettles or cupboards. It just gets interfered with. I already have painted and plastered walls I don't want to forge them and put in a twisted pair. Wien 15 years ago this had to be done, but who then thought of building such a house by themselves.

    So we have to get the data transmission through 230v AC wires, the question is how to do it?

    Added after 2 [minutes]:

    I would also add that given the really large number of these modules, it would be nice if it was a simple and cheap solution. There could be a build diagram, and there could be a module.
    Company Account:
    Jabłoński KOMPUTERY
    Ogrodowa 3a, Rypin, 87-500 | Tel.: 507XXXXXX (Show) | Company Website: https://www.k.j.pl
  • ADVERTISEMENT
  • #5 21043490
    speedy9
    Helpful for users
    mjab wrote:
    I already have painted and plastered walls I don't want to forge them and put in a twisted pair.
    Then how do you imagine at least powering all this? And you have to pull wires to the 230V soet too, because you don't have sockets everywhere.
    Maybe you'd better look at Zigbee, for example. Then the sensors can be battery powered. You put up a few hubs and it works.
    mjab wrote:
    when there are a few hundred of these devices in doors, lamps, motion sensors, kettles or cabinets.
    How much are you planning for this? Have you considered how you will even "embrace" at least the visualisation of so many points, some smart rules etc.? A bit of an exaggeration in my opinion.
  • #6 21043836
    Anonymous
    Level 1  
  • #7 21045564
    mjab

    Level 10  
    speedy9 wrote:
    How do you imagine at least powering all this? And for the 230V soet you also have to pull wires, because you don't have sockets everywhere.


    The point is that these devices are already there and working. They just constantly interfere with each other on WiFi or ESPnow. There are 230v cables and power supplies, etc ... :)

    Does anyone have any ideas for data transfer from ESP8266 via 230v AC? I specifically need such technology.

    Added after 19 [minutes]:

    We are talking about a flat in a block of flats that is fully IoT. All the cupboards or doors open and close by themselves. The internal blinds are automatic, and the washing machine, dryer or even the electric kettle have an ESP8266 implanted and which can control the basic functions of these devices. There are more than 250 ESP8266s and ESP32s in total.

    The system is interfering with itself, lending PJON where I could throw cables under the strips solves the issue, but not everything can be 'wired'. However, the power is already connected and distributed throughout the flat.

    Generally in each room I built a gateway from Ethernet to PJON, and this gateway sends commands to the corresponding PJON IDs and queries them for states, and these are sent to Domoticz. It also works like this for the heating, which measures the temperatures on each radiator and, using individual solenoid valves on the radiators, controls them independently. So in addition to the BME280 measuring the temperature, pressure and humidity in each room, it also measures the outlet of the radiator in question. When this one is over 40'C it shuts it down until it cools down to about 30'C. In this way I reduced the heating costs by 95% without changing the temperature in the rooms.

    The cabinets open on servo motors (such for RC models with metal cogs).

    The room blinds are driven by 28BYJ-48 stepper motors, and I printed the mounts for the blinds on a 3D printer.

    The doors in the rooms have no handles, they open on electric door closers. I bought them at Allegro Local from a guy who remanufactures lifts in Spain for 300 PLN each. I threw an ESP8266 into them and these short-circuit the door opening contact as required. In front of the door there are VL53L0X v2 sensors which laser measure the distance of the person from the door.

    Generally everything is automatic. What I am missing is the transmission of this data over the 230v AC network.

    Added after 6 [minutes]:

    It would be nice to have one PJON gateway that transmits PJON signals over the 230v AC network and has Ethernet with which it sends data between Domoticz and the device data on the PJON bus.

    Added after 1 [minute]:

    Why PJON? - Because this technology simply comes for free at the price of the ESP8266. You don't need anything for it except 2 resistors.

    Added after 21 [minutes]:

    For those curious about this project ...

    Interior blinds : https://www.youtube.com/watch?v=pV5CoWIfM_I
    Lighting over desk : https://www.youtube.com/watch?v=mJAOOTe7edc
    Flower watering on balcony : https://www.youtube.com/watch?v=3-G23Gi2aiU&t=4s
    Infrared gates : https://www.youtube.com/watch?v=eC1U964yHzI
    Sliding wardrobe in hallway : https://www.youtube.com/watch?v=R03IILBuZrg&t=26s
    Heat module construction : https://www.youtube.com/watch?v=tpB2OZ8GU1Q

    Of course these are just single examples....
    Company Account:
    Jabłoński KOMPUTERY
    Ogrodowa 3a, Rypin, 87-500 | Tel.: 507XXXXXX (Show) | Company Website: https://www.k.j.pl
  • #8 21045773
    speedy9
    Helpful for users
    mjab wrote:
    The point is that these devices are already there and working. They just constantly interfere on WiFi or ESPnow.
    What do you mean by "interfere"? To the "eye" the problem is the very large number of WiFi devices and the lack of hardware that can handle such a number. Popular routers can usually handle a few dozen clients. To handle that many clients you should have a proper WiFi infrastructure, with a few APs and then it should work.
    It seems to me that there is too much interference in the power grid to make using it for some custom solution make sense.
  • ADVERTISEMENT
  • #9 21048024
    vodiczka
    Level 43  
    mjab wrote:
    We are talking about a flat in a block of flats that is fully IoT. All the cupboards or doors open and close by themselves...
    And the owners/users of such devices atrophy their muscles from physical inactivity or go to the gym to stop the process.
  • #10 21049563
    Anonymous
    Level 1  
  • #11 21050975
    mjab

    Level 10  
    ledo99 wrote:
    By the way, if I knew it was a flat in a block of flats, I would suggest an optical system - infrared communication - easiest in small rooms.


    I have tested this solution ... unfortunately there are problems on a sunny day.
    Company Account:
    Jabłoński KOMPUTERY
    Ogrodowa 3a, Rypin, 87-500 | Tel.: 507XXXXXX (Show) | Company Website: https://www.k.j.pl
  • #13 21051940
    Anonymous
    Level 1  
  • #14 21053368
    mjab

    Level 10  
    I have not measured the EM field ... and I guess I'm afraid to measure them.

    And can we get back to the topic of data transmission over 230v AC? :) .
    Company Account:
    Jabłoński KOMPUTERY
    Ogrodowa 3a, Rypin, 87-500 | Tel.: 507XXXXXX (Show) | Company Website: https://www.k.j.pl
  • Helpful post
    #15 21055345
    speedy9
    Helpful for users
    tos18 wrote:

    After all, you have the material on data transmission over the power grid provided here.

    This still has an example of a modem for transmission over the power grid: https://www.nxp.com/docs/en/data-sheet/TDA5051A.pdf
    Look at page 17 to start with (as you rather want isolation from the grid and consider whether such a solution is even right for your application.

    If you want to read briefly about the challenges regarding data transmission over the power grid (implementation challenges), this article briefly describes it regarding BPL technology, but applies to power grid transmission in general: https://en.wikipedia.org/wiki/Broadband_over_power_lines

    What you want to do will be neither cheap nor easy.

    Beyond that, I read one more thing about PJDL:


    How to transfer PJON data over a 230V AC network using the ESP8266?


    https://github.com/gioblu/PJON/wiki/Mitigate-interference

    So if the interface itself is susceptible to interference from close AC cables, and you would like to run the entire transmission over AC, I don't see it. In my opinion it is completely unsuitable for this purpose.

Topic summary

✨ The discussion revolves around the challenge of transmitting data over a 230V AC network using ESP8266 chips with the PJON SoftwareBitBang protocol. The user seeks a cost-effective solution for a smart home setup with numerous IoT devices, where traditional WiFi methods are hindered by interference. Suggestions include using PLC modems like TDA5051A or ST7540 for power line communication, while concerns about the feasibility of such solutions in a densely populated electrical environment are raised. The conversation also touches on alternative technologies like Zigbee and infrared communication, but the user emphasizes the need for a solution that utilizes existing 230V infrastructure. The complexity and potential costs of implementing data transmission over power lines are acknowledged, along with the need for isolation from the grid.

FAQ

TL;DR: With 250+ ESP nodes, avoid PJON directly on 230 V; “...comes for free at the price of the ESP8266.” Use a narrowband PLC modem (e.g., TDA5051A/ST7540) with isolation, then bridge PJON frames via UART/SPI. [Elektroda, mjab, post #21045564]

Why it matters: For ESP8266/ESP32 home‑automation builders hitting Wi‑Fi limits, this shows how to move PJON‑style traffic safely over mains.

Quick Facts

  • PJON SoftwareBitBang (PJDL) is sensitive to AC interference; keep the bus away from mains and use twisted pair. [Mitigate interference]
  • Narrowband PLC in EU runs in CENELEC bands (3–148.5 kHz) with low data rates for robustness on noisy lines. [Power-line communication]
  • TDA5051A integrates an FSK PLC modem and shows transformer‑coupled, isolated mains interfaces in the reference circuit. [TDA5051A Data sheet]
  • ST7540 is an FSK power‑line transceiver with MCU host interface (UART/SPI) and coupling network guidance. [ST7540 Datasheet]
  • Power‑line links face noise, impedance changes, and appliance filters; plan for non‑trivial design time and testing. [Power-line communication]

Can I run PJON SoftwareBitBang directly over a 230 V AC line?

No. PJON’s PJDL/SoftwareBitBang targets low‑voltage wiring and is vulnerable to AC‑induced noise. Its own guidance says to route it away from AC cables and use twisted pair. For mains, you need a proper PLC transceiver and isolated coupling, not GPIO on the line. [Mitigate interference]

So how do I actually send ESP8266 data over the power line?

Insert a narrowband PLC transceiver between the ESP8266 and the mains. A device like the ST7540 handles FSK modulation, receive filtering, and line driving. The ESP talks to it via UART or SPI. Use the datasheet’s coupling network and isolation guidance. Then carry your application frames over the modem’s link. [ST7540 Datasheet]

Is PJON over mains a good idea?

Treat PJON as your application layer, not as the mains physical layer. As one engineer put it, “This has so little to do with the 230V network.” Use a PLC modem to handle the harsh line. Keep PJON framing above it if you wish. [Elektroda, speedy9, post #21042605]

What data rate can I expect from narrowband PLC at home?

Expect low throughput optimized for reliability. Narrowband PLC in CENELEC bands (3–148.5 kHz) typically offers only a few kilobits per second. That is enough for sensor states, commands, and acknowledgements. It is not for video or high‑rate telemetry. Lower bandwidth improves immunity to household noise sources. [Power-line communication]

Will RCDs, SMPS supplies, or surge strips break PLC communication?

They can. RCDs, switching supplies, LED drivers, and surge‑protected power strips add attenuation and noise. EMI filters may notch your carrier and cause sudden link loss. Long branch circuits and high impedance variations also degrade SNR. Place nodes near clean circuits, and choose carrier bands carefully. [Power-line communication]

How do I prototype an ESP8266-to-PLC gateway?

  1. Pick a PLC modem (e.g., TDA5051A) and study the reference coupling circuit with isolation.
  2. Build the transformer‑coupled front end exactly as shown, including protection and filtering.
  3. Connect the ESP8266 to the modem, send a short test frame, and verify reception on a second node. [TDA5051A Data sheet]

Can I keep PJON at the app layer and tunnel it over PLC?

Yes. Keep PJON framing in your firmware and map its packets to the modem’s link. You already use Ethernet↔PJON gateways; replace the wired segment with PLC. Maintain addressing and IDs, and encapsulate payloads over the PLC hop. This approach preserves your existing Domoticz integration. [Elektroda, mjab, post #21045564]

Why not just add more Wi‑Fi access points instead?

Consumer routers often handle only a few dozen clients well. Hundreds of ESPs overload association, airtime, and retries. You need enterprise‑grade APs, proper channel planning, and more Ethernet backhaul. PLC avoids 2.4 GHz congestion and co‑channel contention in dense buildings. [Elektroda, speedy9, post #21045773]

Is Zigbee a better alternative here?

In heavy 2.4 GHz environments, Zigbee can suffer retries and stalls. Strong Wi‑Fi can mask low‑power mesh signals. Battery devices work, but reliability drops as C/N degrades. Sub‑GHz radios mitigate this, but they still require careful planning. PLC sidesteps the 2.4 GHz band entirely. [Elektroda, Anonymous, post #21043836]

Do infrared links work for smart‑home room control?

They can, but direct sunlight and bright ambient light cause dropouts. The OP reported sunny‑day problems after testing. You can add IR filters and improve receiver dynamics, but coverage remains line‑of‑sight. PLC provides room‑independent coverage via existing wiring. [Elektroda, mjab, post #21050975]

Are there ready-made PLC modules or dev kits to start with?

Yes. Builders commonly start with TDA5051A‑based or ST7540‑based modules. These integrate the analog front end and simplify coupling. Using a known‑good module reduces bring‑up time and mains safety risks. It also lets you focus on protocol bridging first. [Elektroda, Anonymous, post #21043434]

What isolation and coupling should I use to stay safe?

Follow the modem’s reference design. Use transformer coupling for galvanic isolation, surge protection components, and EMI filtering. Respect clearance and creepage distances on the PCB. Do not omit line protection parts. Validate with an isolation tester before deployment. Safety starts with the datasheet’s exact schematic. [TDA5051A Data sheet]

How do I troubleshoot PLC reliability on live wiring?

Start with a clean outlet and short cable. Remove surge strips and SMPS loads from the segment. Try alternate CENELEC bands and adjust carrier frequency. Add filtering where noise is strongest. Log SNR and error counts while toggling candidate noise sources. [Power-line communication]

Will my PLC traffic leak outside my flat to neighbors?

It can travel until a distribution transformer or strong filters attenuate it. Shared phases and common risers may couple signals between apartments. Use band‑pass coupling, notching, and install line filters for containment. Encrypt or authenticate payloads for privacy. [Power-line communication]

Does the ESP8266 160 MHz CPU clock matter to the PLC link?

Not much. The PLC transceiver handles modulation and timing. The ESP only feeds frames via its host interface. That decouples core clock jitter from line signaling. Focus on stable UART/SPI timing and buffer management. [ST7540 Datasheet]
ADVERTISEMENT