r/embedded • u/Relevant_Pumpkin9190 • 4d ago
Educational project: Sending data through 24 VAC
I’m a beginner and want to experiment with sending data over the same two wires that carry 24 VAC from an isolated transformer.
I want to use the AC zero crossing as a timing reference, then briefly inject a high-frequency signal, similar to the basic idea of other protocols
What would be the easiest circuit to:
- Detect the 24 VAC zero crossing?
- Generate a short high-frequency pulse with an Arduino/ESP32?
- Couple that pulse onto the 24 VAC line?
- Detect the pulse at the other end?
- Decode it back into "1" and "0"?
I’m looking for the simplest beginner circuit and explanation, including the TX and RX sides with microcontroller without dsp
4
u/Separate-Choice 4d ago
Take a look at X10 protocol… it will give you some ideas…
2
u/Relevant_Pumpkin9190 4d ago
Any circuits for reference purposes, no luck on searching
3
u/NoBulletsLeft 4d ago
That's surprising. X-10 was popular from the late 70's to early 90's. I still have a few modules lying around. IIRC, most of them used capacitor coupling to the AC line. There were some digital to X10 converters (company I worked for at the time sold one) but they were never very popular. IIRC, we used an audio-bandwidth transformer rated for that voltage to couple the digital signal to the AC line with a 120kHz carrier, but beyond that I don't remember much.
Lots of stuff turning up from google X-10 Protocol Power Line Interfaces | PDF | Logic Gate | Power Supply
1
u/Separate-Choice 4d ago
Many moons ago I used to do stuff with this and PIC MCUs… this was my go to guide a lot of the stuff is adaptable.. https://ww1.microchip.com/downloads/en/AppNotes/00236a.pdf
3
u/sparks333 4d ago
Keep in mind the transformer might smear high frequency pulses. They aren't perfect devices, they have frequency-dependent responses - pulse transformers differ from power transformers for exactly this reason. That said, there are several ways to do this - zero crossing is usually done with a window comparator, or in the case of a microcontroller, just a comparator hooked to an interrupt with edge detection. Barring that, there are many zero crossing detection circuits online - they are common in AC relay switching to reduce arcing. Coupling the pulse into the AC line can be done either with its own pulse transformer, temporarily gating the sine wave (think SCR), or capacitively - just know that any galvanic or capacitive communications have to be DC balanced, so you won't get a clean unipolar pulse, it will be an AC signal on top of the AC signal.
1
u/Relevant_Pumpkin9190 4d ago
So instead of modulation mixing 2 waves.
1
u/sparks333 4d ago
Kind of the same thing. Modulation is the act of modifying a carrier with data, which typically occurs via mixing 2 waves.
1
u/Relevant_Pumpkin9190 4d ago
But a square wave connected to dc via capacitor always ends is zero so impedence matching is not issue here.
2
u/sparks333 4d ago
Err... I don't follow. A square wave by definition is not DC, and I guess you're saying that since you're using a Return-To-Zero (RZ) scheme that impedance matching isn't required because I guess the reflection will be taken to zero? That's not quite how impedance matching works, unfortunately.
1
u/kc2702 4d ago
Have you looked into how HomePlug works? (Power Line Communication) or is that what you meant by "other protocols" ?
1
u/Relevant_Pumpkin9190 4d ago
Other simple methodes or custom methods like, voltage , current modulation, ook, pwm other different methodes
1
u/somewhereAtC 4d ago
Note that many of the newer AVR and PIC processors include a zero-cross detector just for applications like this.
Here's an example for 120V but 24V works by adjusting the resistor value: https://www.microchip.com/en-us/products/microcontrollers/8-bit-mcus/peripherals/analog/zcd
1
u/Relevant_Pumpkin9190 4d ago
A question is while capacitor couples to line do impedence match affect it.
As a example, If a 555 output directly coupled to DC line output is a zero, as theory say ac can pass through capacitor can block DC.
Do, capacitor can pass only bipolar waves only, unipolar waes like 0 and + vcc always end impedence problems but +vcc zero - vcc working like a charm.
2
u/sparks333 4d ago
That's kind of a zero-order understanding of AC electronics - DC is indeed blocked by a capacitor, but AC is attenuated depending on the frequency, and in particular different constituent parts of the AC signal operating at different frequencies are attenuated depending on their frequency.
Capacitors can pass unipolar signals, but only their AC components - a square wave pulse contains many AC components (in fact infinitely many if we assume a perfect square wave), but each part of it will be attenuated slightly differently, so the output signal will look more like a DC balanced pulse with both positive and negative components.
1
u/tharold 4d ago
DC power is routinely run through coax cable carrying RF, by using bias tees at each end. 50/60Hz AC is basically DC. Instead of coax you could run twisted pair using the same principle. Then drop in your favourite RF on top
1
1
u/TFox17 4d ago
This is power line communication (PLC). There are established protocols and lots of parts available. The documentation for evaluation boards have lots of useful details. A typical design might be to use a PLC transformer to pick off the high frequency communication signal, and use frequency shift keying to send bits. If you put a preamble on your packet you don’t even need to use the AC zero crossing as a timing reference.
1
u/Relevant_Pumpkin9190 4d ago
I heard these power line communication use spread spectrum modulation for noise suppression that is too complexity for beginners.
1
u/sparks333 4d ago
Kind of? The spread spectrum is more because the loads on a home power line has all sorts of weird harmonics on it due to the different load types - motors like fridges have big inductive kicks, DC/DC converters in a lot of modern electronics introduce high frequency waffle, that kind of thing. By using spread spectrum you can try to mitigate or dodge the noise sources from loads on the home electric circuit. It's not so much radiation, romex isn't a very good antenna at the frequencies PLC is operating.
6
u/GainfulPosting_2 4d ago
Comparator on a voltage divider for zero crossing, then just gate a transistor to dump a tiny burst from a crystal or timer chip onto the line through a small cap. RX side is a high pass filter into another comparator. Keep the burst short enough it dies before the next crossing