Mains Gate: Programmable Relay & Energy Monitor [120709-I]
HELP! I'd appreciate any assistance with this project particularly from someone with power experience.Proposal
HELP! I'd appreciate any assistance with this project particularly from someone with power experience.
Proposal
Rather than some US political scandal, this is an idea for "mashing up" five of the circuits from the July & August 2012 double issue to produce a really flexible "mains gatekeeper" circuit combining a multitude of control, measurement, protection and logging functions at minimal cost.
The sources are:
- "A Zero Current Switch" by Matthias Haselberger.
- "MOSFET Circuit Breaker" by Georges Treels.
- "Equipment 'ON' Counter for 68 Years Max" by Vladimir Mitrovic.
- "16 Ways to Switch your AC Power On" also by Vladimir.
- "Soft AC Line Start" by Jurgen Kruger.
The new circuit starts with the mains switching element used in (1), an IGBT or high voltage MOSFET in the DC arm of a diode bridge. However Matthias's discrete control circuit is replaced by a microcontroller. Georges' idea (2), measuring current by using the voltage drop across the on resistance of the MOSFET, is adapted by using an ADC channel in the microcontroller. The Microchip PIC range has some controllers with in-built op amps which would minimise the BOM and cost of this circuit. Voltage will be measured on another ADC channel using a simple potential divider. We are now in a position to duplicate and improve all the functionality of these first two source circuits using firmware in the microcontroller. For example, we can measure power factor and apply any compensation automatically, so eliminating the need for the manual link and capacitor in Matthias's circuit. We can easily implement the ideal AC switch: zero volt switch on, zero current switch-off.
Next I will pinch two ideas from Vladimir (3). A separate programming circuit enables settings to be written to EEPROM in the microcontroller as well as logged values to be read. I would probably use a simple BOB style USB connection and a PC UI for this function. Following Vladimir again, we can use the mains voltage measurement already described as a timebase for logging the on time.
It is now trivial to embrace and extend Vladimir's other circuit (4). By using the mains timebase, we can improve the timing accuracy over the internal RC oscillator used in the original. We can eliminate the hardware programming switches and the corresponding microcontroller GPIO pins using the external EEPROM programmer. This will enable us to offer a much wider range of programming options including ones which respond to an external optically isolated input to provide a true solid state relay. I would also add an output which could be used to gang a number of the circuits for power saver arrangements (e.g. turn your peripherals off when the power drawn by your PC drops, indicating it has gone into standby).
By adding an optional power resistor switched by a second MOSFET or IGBT in parallel to the first, we can have a soft-start as implemented by Jurgen (5), with the extra benefit of programmability.
Finally we can push the firmware into completely new territory without needing any further hardware. We can measure and log mains voltage, power draw, power factor and accumulated electricity consumption. We can implement protection trips on any of these parameters. We could even implement timer functionality by building a firmware real-time clock on the mains timebase. A light level switch or thermostat would also be easy to add as an option using a few extra components.
Design Process
Model 1 illustrates the mechanical design of the above circuit. It is designed to fit in the bottom part of the DIN rail enclosure mounted on the mains in and out screw terminals as shown. The main components will be on the underside with the available envelope shown as a white box. The IR input and output will be mounted at centre on top of the board with a shield between to prevent optical crosstalk.
Model 2 shows how an interface circuit is mounted in the top part of the enclosure with matching optical transducers on the bottom of the unit. Again the available envelope for component mounting is shown as a white box. A number of interchangeable interface circuits may be designed. The simplest would be a connection from one of the pairs of screw terminals to the IR transmitter for a relay input. More complex would be a USB or Elektorbus serial interface with programming and reading capabilities.
Model 3 shows a concept for ganging several mains gates together. The interface circuit is split into two “bookends”. One bookend has an IR transmitter optically coupled to the input of the first mains gate, which has its IR transmitter bent through ninety degrees to fire sideways. Intermediate mains gates have both receiver and transmitter bent over to couple with the adjacent unit. The other bookend has an IR receiver coupled with the transmitter of the last mains gate which has its receiver bent over to couple with its neighbour. The firmware will allow messages to be routed from receiver to transmitter so that they get passed on ‘bucket brigade’ style and seen by all units.
Update 28-Nov 2012
Schematic 2 shows several improvements in the light of bench testing. I found that MOSFETS rated for mains voltages and currents (I am testing using a STP14NK50Z) need a higher gate voltage than the PIC microcontroller can switch, so I added a MAX4427 dual buffer. I was uncomfortable with the inefficiency of the control-side power supply concept of Schematic 1 and experimented with the capacitor-based solution shown in this schematic. Sadly, while the power supply and the switching cell both work well in isolation, connect them together and the sour smell of burning plastic ensues! Anyone have any clever ideas about this? Will I just have to bow to convention and use an isolating transformer?
Update 01-Sept 2013
I am reluctantly retiring this as a dead end because we have been unable to come up with a control power scheme which meets the original vision of an economical self-contained unit. Without this, a more conventional multi-channel design will be better. If anyone wishes to revive this under their own name, or reuse some of the ideas in their own design (which after all is exactly what I was attempting to do), please do so with my blessing!
Discussion (9 comments)