View previous topic :: View next topic |
Author |
Message |
Rohit de Sa
Joined: 09 Nov 2007 Posts: 282 Location: India
|
Powerline data acquisition and communication |
Posted: Sat Dec 26, 2009 1:05 am |
|
|
Hi all:
I'm working on a project that uses the powerline for simple measurement and control. I will have a master connected to, and powered by my laptop through USB - probably an 18F2550 for this. The '2550 will be connected to the mains 230v/50Hz here in India. The master will only be used for communication with the slave module.
The slave unit will be based on a 16F876A. It will be housed in a small switch board with 3 power sockets. I would like to measure line voltage and line current for the switch board as a whole (not individually, as this increases complexity). I would like to be able to control 3 relays. The relays will turn on or off the sockets. Maximum current for the switch board as a whole will not exceed 5amps @ 230v.
I'd like suggestions on these, please:
- How should I power the slave? Maximum current required by the slave is 200mA @ 5v. This is when all 3 relays and status LEDs are on. Transformerless supply? Or is the current requirement too much? Would a regular transformer supply be better? That way I'd get some isolation, _and_ I can use the transformer for a few other things (read below).
- For AC mains measurement (at the slave) if a normal transformer supply is used, I could use the secondary voltage with a peak dector. I think I would need an opamp-based 'super diode' peak detector, right?
- For current measurement I will be using a current transformer. I have ferrite toroids from an old UPS. Is it feasible to make my own current transformer. Note that I have never used a current transformer before - I know basic theory, but I've never practically implemented this. The current transformer will give me an AC voltage. Would I need to use a similar 'super diode' peak detector here as well?
- Communication: the slave and the master are both in the same room, on the same breaker. So no problem about phase coupling, etc, etc. In India we have 3 pin sockets - live, neutral, and ground. Max data rate 2400bps.
- I had read in a couple of places about sending 120kHz modulated signals to transfer data. I'm not too keen on sticking my PIC to the live line for comms, even through a coupling capacitor. Would using the ground and neutral wire be OK? Ideally, neutral and ground should both be at 0v, but I've measured neutral at 4v AC. This is probably due to phase imbalances. Anyway, 4v is better than 230v! If I use ground and neutral, can I do away with the 120kHz modulation, and instead use coupling capacitors with manchester encoded serial?
- Would transformer coupling be better? Can I use the slave's power transformer for this? This would necessarily mean sending data down neutral and live, requiring modulation. I'd also need to use a transformer on my master.
Sorry about the barrage of questions; I hope I've included all the necessary details.
Rohit |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Sat Dec 26, 2009 7:12 am |
|
|
For communication people have tried lots of ways and some work fairly well. I would search for "X10" to see how that standard works, though its data rate is quite slow. At least read up on the thoery behind it. All the fast methods are proprietary, though I know some people use DSL chipsets. 2400BPS is going to be tough.
The problem with using ground & neutral is that those may be connected together at the fusebox or transformer. If this short is between your master and slave you will get no signal. Also line and neutral are often swapped accidentally so your circuit should be able to tolerate line voltage anyway.
For measurement you could use a peak detector, but it must follow a good low pass filter or you will just be measuring line noise. It would be better to use a RMS converter chip, or calculate RMS in software from many A/D readings. Analog Devices makes some good RMS chips.
For current coupling, not every ferrite core will work well. You want the highest inductance you can get. It is also good to use the "zero flux" technique. This requires two windings with many turns and the one turn for the power line. One big winding detects flux and drives an op amp. The op amp drives the other big winding to keep the core flux at zero. The op amp current x number of turns = power line current x number of turns. With 1000 turns it takes 1 mA of op amp current per Amp of line current. Adjust the turns to suit your op amp and load. Put a resistor in series with the 1000 turns to get a signal for your A/D. Since the core flux is always near zero you can use a cheaper core. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
|
Rohit de Sa
Joined: 09 Nov 2007 Posts: 282 Location: India
|
|
Posted: Sat Dec 26, 2009 9:59 pm |
|
|
Thanks Doug and Ben.
SherpaDoug wrote: | I would search for "X10" to see how that standard works | I've already had a look at this. Like you observed, its slow; infact too slow to do any sort of measurement. I don't want to restrict data transfer to zero crossings. 2400bps was the throughput aim, but I'll settle for 1200 (if its possible!)
SherpaDoug wrote: | The problem with using ground & neutral is that those may be connected together at the fusebox or transformer. If this short is between your master and slave you will get no signal. Also line and neutral are often swapped accidentally so your circuit should be able to tolerate line voltage anyway. | In India we have a separate ground and neutral......but I'll make doubly sure that they aren't shorted. Since this is a one-off home project, I'll know which line is live and which is neutral. Still, 230v tolerance is a big plus for safety.
SherpaDoug wrote: | It is also good to use the "zero flux" technique | Thanks! Didn't know about this....will google around.
Ben: I've seen the TDA5051 before. It seems ideal for my purpose. I can't seem to find it in [spam] (India). I wouldn't want to ship from the US coz that'll cost a bomb. The TDA uses ASK @ 600 or 1200 baud. So I'll try rolling my own 'modem'; if that fails, then I guess I'll _have_ to try out the TDA.
Ditto with the transformer....shipping from the US in *not* my first option. I want to keep costs down as far as possible. The problem in India is that you get a lot of stuff *without* proper part numbers or datasheets. So finding the right part is tricky. But if you're willing to put in the effort you can get things really cheap
Rohit |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Mon Dec 28, 2009 6:20 pm |
|
|
I wonder if the PIC24's IrDA might be coerced into doing the ASK over powerline.
You'd have to figure out the zero crossing part... but it makes me wonder.
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
Powerline data acquisition and communication |
Posted: Tue Dec 29, 2009 6:36 am |
|
|
You haven't indicated the accuracy, sample rates, etc. that you're looking for.
However here are some thoughts. They should help you decide where to start with your design.
Voltage transformers.
You'll need to be careful in designing yours to avoid saturation with mains voltages. Ferrite saturates at a lower flux level than steel (iron), therefore at low frequencies you will neeed more turns with ferrite. If you want to impress your data signal onto the mains then a voltage transformer is a safe option. The transformer can be designed to provide the required voltage isolation. Using your power transformer to double as a signal transformer will depend on its bandwidth and your choice of signal carrier frequency.
Current transformers.
These do represent a simple means of converting alternating current into a voltage signal. There are however some limitations. There is only a certain frequency band over which they are effective. A current transformer usually consists of a single turn primary with an N turn secondary and a burden resistor (r).
From the point of view of the primary the transformer looks like a parallel LCR circuit. The L is the Al of the transformer core (i.e. the inductance of one turn). The R is the reflected value of the burden resistor (i.e. r/N^2). The C is the reflected value of the winding capacitance. In its operating region most of the current flows through the resistor. At low frequencies the current flows through the L and at high frequencies the C. From what you have said your problem is going to be to get the reflected resistance low enough.
Super diodes.
If you bias your voltage and current signals at half the PIC's Vref, you can measure these directly with your PIC. You do not then need super diodes, OPamps, RMS converters etc.
Transformerless supplies.
On the 230V 50Hz supply in the UK we get up to ~70mA supply with a 1uF capacitor. You can scale this for other voltages, frequencies and currents. When the system is off-load all the available current has to be dumped (usually into a Zener diode). The diode gets hot, and needs to be more than adequately rated. Everything connected to such a supply is at mains voltage. Be warned if you are not used to working on live circuits they can be lethal. As a switch mode power supply designer I am always very wary of using transformerless supplies. There are also start-up issues and you need to consider what will happen when the current limiting capacitor goes short-circuit. Also think about what happens when you disconnect the system from the mains (the capacitor may be charged to peak mains voltage!).
Mike |
|
|
Rohit de Sa
Joined: 09 Nov 2007 Posts: 282 Location: India
|
|
Posted: Tue Dec 29, 2009 7:27 am |
|
|
Ben wrote: | I wonder if the PIC24's IrDA might be coerced into doing the ASK over powerline. | Haha, I like the idea very much. I don't have a PIC24 with me right now, but I _do_ have a serial to IrDA chip. Let me dig around a bit. I was even toying with the idea of using a TSOP1738 with an IRLed. Use the PIC's PWM to modulate a 38kHz signal onto the mains at the TX end. Filter out mains at the RX; feed the signal to an IRLed pointed at the TSOP; and hopefully - "Eureka"!
Mike - thanks for the detailed reply.
Mike wrote: | You haven't indicated the accuracy, sample rates, etc. that you're looking for. | The reason I haven't included these is because I don't really know what limits will be suitable. This is the first project in which I am attempting to interface to mains, so I'm going to use it like a 'proficiency-building' exercise. I'm not looking for anything super accurate - just something that gives me a basic indication of whats going on. I guess I'd like to be able to measure a 1V drop on the mains, and have a 0.1A current resolution. With the 10bit ADC on an '876A I don't think that's asking too much (or is it?). With all the noise sources I'll be software-scaling my resolution to 8bits anyway.
Mike wrote: | If you bias your voltage and current signals at half the PIC's Vref, you can measure these directly with your PIC. You do not then need super diodes, OPamps, RMS converters etc. | I guess I could probably bias at 0.5Vcc for the current transformer. But since the transformer gives me AC, I'd still need to take multiple samples *and* calculate RMS current in software. Also, I had wanted to use my power transformer for (1)power, (2)voltage measurement, and (3)data transmission. I won't be able to use a "0.5Vcc" method if I want to achieve all of this with one transformer.
Mike wrote: | Transformerless supplies. | Scary! I'm leaning further and further away from them for this project.
Rohit |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
Powerline data acquisition and communication |
Posted: Tue Dec 29, 2009 9:19 am |
|
|
Rohit wrote
Quote: | Also, I had wanted to use my power transformer for (1)power, (2)voltage measurement, and (3)data transmission. I won't be able to use a "0.5Vcc" method if I want to achieve all of this with one transformer.
|
You can use the "0.5Vcc" method if your power transformer has a centre tapped secondary. Either end of the secondary is a copy of the mains input voltage and is referenced to 0V.
Your remaining problem then is to couple the data signal. It may help if you consider the mains network to behave as a ~100R transmission line.
Mike |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Tue Dec 29, 2009 11:51 am |
|
|
Rohit de Sa wrote: | Ben wrote: | I wonder if the PIC24's IrDA might be coerced into doing the ASK over powerline. | Haha, I like the idea very much. I don't have a PIC24 with me right now, but I _do_ have a serial to IrDA chip. Let me dig around a bit. I was even toying with the idea of using a TSOP1738 with an IRLed. Use the PIC's PWM to modulate a 38kHz signal onto the mains at the TX end. Filter out mains at the RX; feed the signal to an IRLed pointed at the TSOP; and hopefully - "Eureka"!
|
And I don't think you're even stuck with the 38KHz. I think the PIC24 supports up to 1Mb/s -- so you could up the datarate nicely and maybe "borrow" some of the other interface components from the TDA5051 schematic to get it on the line. :D
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
Powerline data acquisition and communication |
Posted: Wed Dec 30, 2009 12:41 pm |
|
|
You still haven't told us what exactly you are trying to measure or response times etc.
Are you wanting to measure simply voltage, current or power. Do bear in mind that power is not the same as RMS_current * RMS_voltage. Note, most ordinary AC meters measure mean amplitude, then apply a correction to convert to RMS.
You seem worried about computing RMS values with a PIC. Something like 20 samples per cycle will give reasonably accurate RMS value estimates. High end oscilloscopes (like Lecroy) make very good measurements by taking just one sample then advancing the sample point on successive cycles. You can simulate the effect of different sampling regimes on a spread-sheet, its much easier than doing it in 'C' on a PIC. That way you can get an idea of the sort of performance to expect before you start.
You mentioned high data rates more than once. If most of the computation is done locally, you don't need to send much data down what is a potentially noisy link. Are you wanting a bi-directional comms link?
Mike |
|
|
Rohit de Sa
Joined: 09 Nov 2007 Posts: 282 Location: India
|
|
Posted: Thu Dec 31, 2009 6:35 am |
|
|
Thanks for the inputs, Mike.
I will be measuring voltage and current. Voltage resolution of about 1-2V, current resolution of 50-100mA. Since my loads are only resistive (no fans/motors) I am assuming a power factor of almost 1. So current and voltage are in phase. Therefore, power will simply be Irms * Vrms, or (Ipeak * Vpeak) / 2. I will be sending data over powerlines at a maximum rate of once per half second. The payload will be 6 bytes: 1 header + 4 data + 1 CRC. That's 60 bits in total, assuming UART based transmission. I'm still trying to figure out how exactly to send this across - pseudo-IrDA, TSOP, blah, blah. *If* it was UART only, then even 150bps would work, but I'm looking to 'upgrade' the link later, so the higher the data rate, the better. The link will be bidirectional half-duplex. It'll start with 'one master-one slave', and then progress to a 'one master-multi slave' setup.
Mike wrote: | Something like 20 samples per cycle will give reasonably accurate RMS value estimates. High end oscilloscopes (like Lecroy) make very good measurements by taking just one sample then advancing the sample point on successive cycles. | Something like 'Equivalent Time Sampling' on certain DSOs? I don't think I'll be needing this - the PIC will have enough free processing time to take at least 100 samples per second. So I suppose I could calculate RMS like that. No messing around with peak detection and super diodes
Rohit |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Thu Dec 31, 2009 8:34 am |
|
|
Rohit wrote
Quote: | Something like 'Equivalent Time Sampling' on certain DSOs? I don't think I'll be needing this - the PIC will have enough free processing time to take at least 100 samples per second. So I suppose I could calculate RMS like that. No messing around with peak detection and super diodes |
I assume you meant cycle. 100 samples per second is only 2 per cycle.
Mike |
|
|
Rohit de Sa
Joined: 09 Nov 2007 Posts: 282 Location: India
|
|
|
tesla80
Joined: 23 May 2007 Posts: 81
|
|
Posted: Wed Jun 30, 2010 4:47 pm |
|
|
I've ordered TDA5051AT, I'm gonna try to make a transceiver over power line. Is there a someone who will help me on the schematic? It seems so dangerous and I don't have so many chips, actually I don't want to lose any chip
I've looked over the datasheet but there is no a complete schematic and I did not understand how to make the power part, isolated or non-isolated? if it's not isolated the transceiver pins have to be isolated or I read something like that.
I'll be glad If I get any help. Lets do something together ;) |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Wed Jun 30, 2010 4:50 pm |
|
|
Is this for work or fun?
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
|