Author Topic: looking for design ideas for 50kHz tone demodulator  (Read 1844 times)

0 Members and 1 Guest are viewing this topic.

Offline JeanFTopic starter

  • Regular Contributor
  • *
  • Posts: 143
  • Country: fr
looking for design ideas for 50kHz tone demodulator
« on: October 04, 2019, 06:54:39 pm »
Hello,

what kind of circuit would you use to decode an asynchronous bit stream, at 9600 baud, which is on-off modulated on a 50kHz carrier? With negative logic, i.e. carrier on = 0 and carrier off = 1.
The two output wires are isolated from everything else, I suspect they are using an output transformer. The pulses are about 12V peak to peak. I connected some resistors of different values and found that the output impedance must be about 150ohms.
I’d like the input of the decoder/detector to be galvanically isolated as well, in order to avoid frying my board if someone disconnects the cable at the remote end and connects 230V right across it or whatever, but this can be discussed.

I’m looking for inspiration and/or ideas, not just to make the circuit work (it already does) but to learn along the way. You’ll find what I came up with at the end of the post :)

Thank you ! :)






A bit more context, for those interested:

The utility installed a smart meter at home, which comes with a “tele-information for clients” output port (they call it “TIC”). The previous generation of electronic meters already had that feature. But now with the new meter, the data format was changed. They added timestamps to the data, there are more data fields, and the baud rate is now 9600 instead of 1200.

There are many posts on French forums talking about “TIC”, with Arduino / Raspberry Pi interfacing examples, but almost all of them were posted before the protocol upgrade.

Most of the times people are using variations of this design:
https://hallard.me/blog/wp-content/uploads/2015/07/montage-de-base.jpg

With the two diodes the positive and negative going pulses are transmitted. I think the trick is the slow reaction time of the optocoupler, which, when you hold your tongue at the right angle, stretches and filter the pulses just enough to be decoded by your casual Arduino or FTDI board. But you have to adjust the series resistor to stay just at the edge of saturation, which is not very practical.

Well, it may kind of work at 1200 baud, but at 9600 baud it became very unreliable. One of the USB to serial boards that I have received data but with many errors, the other USB adapter did not decode anything at all.

That’s why I wanted to make a more reliable decoder. I breadboarded the circuit attached to this post and it seems to work OK, but I would like to hear your comments, suggestions or ideas for other designs.

One of the other designs, using a fast optocoupler to trigger a monostable multivibrator: http://bernard.lefrancois.free.fr/schema2.htm

I also looked at the LM567C, but the datasheet says “Fastest ON-OFF Cycling Rate : f0/20” so I think it would not be appropriate for 9600bps, as the carrier is at 50kHz.

Thank you for your ideas and comments :)
« Last Edit: October 04, 2019, 07:14:14 pm by JeanF »
 

Online coppice

  • Super Contributor
  • ***
  • Posts: 10034
  • Country: gb
Re: looking for design ideas for 50kHz tone demodulator
« Reply #1 on: October 04, 2019, 09:00:24 pm »
I just timed the pulses with a timer on an MCU.
 

Offline hamster_nz

  • Super Contributor
  • ***
  • Posts: 2812
  • Country: nz
Re: looking for design ideas for 50kHz tone demodulator
« Reply #2 on: October 04, 2019, 09:42:30 pm »
Have you thought about rectifier, low pass, then opto?

That would get rid of the 50kHz (or 100kHz when rectified) before the opto....
« Last Edit: October 04, 2019, 09:48:24 pm by hamster_nz »
Gaze not into the abyss, lest you become recognized as an abyss domain expert, and they expect you keep gazing into the damn thing.
 

Offline moffy

  • Super Contributor
  • ***
  • Posts: 2216
  • Country: au
Re: looking for design ideas for 50kHz tone demodulator
« Reply #3 on: October 05, 2019, 06:59:51 am »
Use a 220pF capacitor for C1 instead of the 10nF. Change R2 to 4.7k. See if that works. The 100 ohms in series with the optocoupler is too small and should be changed to something like 1k.
« Last Edit: October 05, 2019, 07:43:42 am by moffy »
 

Offline JeanFTopic starter

  • Regular Contributor
  • *
  • Posts: 143
  • Country: fr
Re: looking for design ideas for 50kHz tone demodulator
« Reply #4 on: October 05, 2019, 10:52:51 am »
Thank you all for your replies.

coppice,
yes but I can't directly connect the output port of the source device to a MCU input, it's AC and the levels are too high

hamster_nz,
I'll give that a try next week when I get back home. Would this be an improvement? Is it better practice in general to filter the signal as early as possible? I was afraid that by doing so the output impedance of the filter, seen by the input of the opto, would be too high and there would be not enough current in the opto's LED (5-15mA as per datasheet). I could add a buffer but that increases the number of components upstream of the isolation barrier, and it would need an isolated supply.

moffy,
sorry I don'te quite get what you mean here. Changing C1 to 220p without changing R3 would shift the cutoff frequency of the RC filter to about 723kHz which is too high, and changing R2 to 4k7 would just increase the output impedance of the opto. Could you please elaborate?
About the 100R resistor, it seemed low for me as well, but as per the source impedance measurement I made, I thought 1k would have been too high. I probed across the resistor and I measured about 7.5mA peak which seemed OK. I will try with a pot and measure what's the maximum value before the receiver stops decoding, though.

I hope nobody is too offended that a beginner like me posted here in "projects" instead of in "beginners". As I was looking for design ideas, I thought is was OKish. In fact I have posted another thread in the beginners section, regarding the choice of values for R and C in the filter. (beware if you read both threads, I had the component designators mixed up)

Thank you again!
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 20357
  • Country: gb
  • 0999
Re: looking for design ideas for 50kHz tone demodulator
« Reply #5 on: October 05, 2019, 01:02:01 pm »
Thank you all for your replies.

coppice,
yes but I can't directly connect the output port of the source device to a MCU input, it's AC and the levels are too high.
Then how about using a potential divider to attenuate the signal? I suppose it won't be isolated.

Is there any DC component to the signal? If not i.e. it's 50% duty cycle, then how about using a pulse transformer?
 

Offline moffy

  • Super Contributor
  • ***
  • Posts: 2216
  • Country: au
Re: looking for design ideas for 50kHz tone demodulator
« Reply #6 on: October 05, 2019, 11:46:07 pm »
If you are getting 7.5ma peak, that sounds OK but (6V - 2.5)/100 = 35ma (the -2.5 is for the diode and LED voltage drop). With regard to the values I did an LTSpice simulation and replacing R2 with a short circuit, and making R3 4.7k and C1 220pF gives the best response. You want the output to be low when the pulses are coming and to quickly go high when they stop. When a pulse comes the opto discharges the cap C1 fully. For the period between pulses R3 charges C1, but it hopefully stays below the threshold of the 74HC14. So you have continuous low when pulses are present. When the pulses stop R3 charges C1 and it transistions from 0 to 1 in a reasonable time for 9600 baud. For my simulation I used a 4N27 optocoupler which might have a lower saturation voltage, I haven't checked.
 

Offline JeanFTopic starter

  • Regular Contributor
  • *
  • Posts: 143
  • Country: fr
Re: looking for design ideas for 50kHz tone demodulator
« Reply #7 on: October 06, 2019, 12:26:15 pm »
I'll double check my measurements tomorrow for the LED series resistor.

Oh I see now, I think there was a bit of confusion between R2 and R3. I'll try to increase the value of the pullup (R2) and replace the series resistor with a short (R3) and see what it does to the output. I wonder if there is a risk of frying the output transistor of the 6N137 when it tries to discharge the cap without a series resistor, what do you think?

Zero999, Yes I'd prefer if the input is isolated. I have absolutely no experience with pulse transformers, I don't know where to start but I'll read up on them. A quick look on wikipedia says that they are used with fast risetime square pulses, and that they must transmit one pulse at a time, so that means I would have to filter and "square up" my trains of ~10 half-sine pulses before going to a transformer, isn't it? In which areas are they better or worse than optocouplers?

Thank you again everyone.
 

Offline vk6zgo

  • Super Contributor
  • ***
  • Posts: 7855
  • Country: au
Re: looking for design ideas for 50kHz tone demodulator
« Reply #8 on: October 06, 2019, 01:38:41 pm »
If the signal consists of a 50Khz sinewave carrier, with the data in the form of on/off carrier switching,
you can probably use a transformer made up using a ferrite ring.
This will provide extra isolation.

As you seem to have plenty of signal strength, some loss through the transformer  will probably be tolerable.
You can then unbalance the secondary signal & feed it into a phase locked loop of some kind.
The correction signal to the VCO will now follow your modulation.

Specialised tone decoder ICs are made, & would be better,  but they may not operate as high as 50kHz.
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15797
  • Country: fr
Re: looking for design ideas for 50kHz tone demodulator
« Reply #9 on: October 06, 2019, 02:28:54 pm »
One possible way of dealing with that is to implement some kind of data slicer. There may of course be other approaches for your particular needs, but this one has the benefit of being pretty versatile, and can scale well with carrier frequency and data throughput (as long as the passive components and the comparator are selected appropriately), and would also work for AM signals (modulation < 100%).

Here is the basic circuit:


To isolate this, the simplest would be here to isolate the data output. At such a low bit rate, any solution, even a cheap optocoupler, will work.
« Last Edit: October 06, 2019, 02:31:16 pm by SiliconWizard »
 

Offline moffy

  • Super Contributor
  • ***
  • Posts: 2216
  • Country: au
Re: looking for design ideas for 50kHz tone demodulator
« Reply #10 on: October 06, 2019, 11:51:15 pm »
The opto output wil have no problem discharging the cap. It is very common.
 

Offline JeanFTopic starter

  • Regular Contributor
  • *
  • Posts: 143
  • Country: fr
Re: looking for design ideas for 50kHz tone demodulator
« Reply #11 on: October 08, 2019, 10:07:23 am »
vk6zgo, SiliconWizard, thank you for your ideas. I won't have time to try them right now but I'll no doubt keep them for future experiments and learning. I wasn't aware that a PLL could be used as a decoder, good thing to know! And I may look into slicing data before the opto as you suggest, which would allow to buffer it as well. In my existing circuit I'm drawing a few mA from the data line to light the LED of the opto, which seems to be fine for a one-off but that won't scale well if I want more decoders on the same bus.
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 20357
  • Country: gb
  • 0999
Re: looking for design ideas for 50kHz tone demodulator
« Reply #12 on: October 08, 2019, 07:58:24 pm »
Zero999, Yes I'd prefer if the input is isolated. I have absolutely no experience with pulse transformers, I don't know where to start but I'll read up on them. A quick look on wikipedia says that they are used with fast risetime square pulses, and that they must transmit one pulse at a time, so that means I would have to filter and "square up" my trains of ~10 half-sine pulses before going to a transformer, isn't it? In which areas are they better or worse than optocouplers?
A pulse transformer will be able to pass a sine wave with no problem. It's the lowest frequency of interest, which is more of a limiting factor with a transformer, than the high frequency content.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf