Canary Theory of Operation

From ELC Wiki
Jump to: navigation, search

The main point of the load indicator device is to notify users when their MHP system is nearing full load therefore allowing them to decide whether or not it is safe to allow them to switch on more appliances.

The most basic approach for this on synchronous systems is to use a frequency detection circuit to monitor the system frequency. Once the system is reaching overload conditions, the system frequency will begin to drop. This information can then be used to notify users.

There are other methods that could be used to achieve the same functionality but with a greater level of accuracy. Typically a system like this would need to monitor the amount of power diverted to the ballast load in the powerhouse and then communicate how much power is available to the household units. The method of communication could be over the power-lines or via some sort of wireless communication using something simple like FM radio transmission or a more complex RF communication system.

Canary Chic

Canary Chic is the most basic form of load indication device and consists simply of a frequency detection circuit, and an audio visual alarm. The following sections will provide detailed information on the circuit operation. Full circuit schematics can be downloaded from the Design Files page as the information below will reference specific sections of these schematics.

Power Supply

The power supply of the system simply takes the AC mains voltage and converts it to 3.3V DC. This is achieved by a switched-mode power supply module which also provides electrical isolation between the micro-controller and the mains. Although electrical isolation is not essential, it is preferred, partly because it makes the system slightly safer but also because it means the micro-controller can be referenced to ground voltage which is required for programming.

The circuit board is designed to fit a specific power supply (MeanWell IRM-05-3.3) but could be modified to fit any other AC/DC convertor that takes mains input voltage and gives an output of 3.3V and is able to supply approximately 200mA. You could also use a simple transformer, bridge rectifier and voltage regulator if it's difficult for you to find a suitable switched-mode supply.

The specified power supply is good because it operates on a wide input voltage, allowing the system to power-up even from about 80VAC and is also compatible with 50/60Hz systems.

Zero Crossing Detector

Zero-Crossing detector circuit

This is arguably the most important part of the basic load indicator. This is a standard circuit for detecting zero-crossing point on an AC waveform which will occur twice per cycle.

The main device used to achieve this is an opto-coupler. Opto-couplers are integracted circuits that consist of an LED and a phototransistor contained within one device i.e. you can't actually see the LED. When the LED is energised, it emits photons that switch on the phototransistor and allow current to flow. You can get many different types of opto-coupler but the one we've chosen is known as an "inverse parallel diode opto-coupler". This sounds like a scary name but in reality, it just means that there are 2 LEDs instead of 1 and they are connected in opposite directions to each other. The benefit of this is that the device can be operated in either polarity, which is great for AC signals, however in this situation we just use the reverse diode to ensure that the voltage across the opto-coupler never exceeds more than one LED forward voltage. Without it we could exceed the reverse breakdown voltage of the LED.

On the mains voltage side of the opto-coupler, there are several series resistors, all of which are 15K. As with all LEDs, the one inside the opto-coupler has a forward voltage, and a maximum forward current that must not be exceeded. The series resistors are there to limit the current through the LED to safe levels, but as the voltage on the mains side is so high, there are several of them to spread out the power dissipation. Even a few milliamps at 230 volts is considerable power to dissipate, especially in small surface mount components.

We have also included a diode in series with the resistors and the opto-coupler LED. This half-wave rectifies the mains AC and means that the detector will only be triggered once per complete cycle.

On the micro-controller side of the zero crossing detector, we have the open collector output of the phototransistor. This is "pulled" high to the DC power rail (3.3V) by a 4.7K resistor. This ensures that when the opto-coupler is not active, the output of the zero-crossing circuit is "high". When the opto-coupler is activated, the transistor switches on, and the bottom of the 4.7K resistor is "pulled" low. The following 1.2K resistor and 180nF capacitor form a "low pass" filter with a little help from the 4.7K resistor, to try and reduce the effect of noise on the AC lines that might activate the detector. The output signal from this circuit (PULSEIN) is connected directly to the micro-controller on its timer input capture pin.

The micro-controller can be configured to automatically count time between digital events on this pin, such as a change from logic low to logic high or vice-versa. The time is calculated relative to the "clock speed" of the micro-controller, which in our case is 16MHz.

Audio Indicator Circuit

Audio indicator circuit

The audio indicator circuit is designed to operated with a small coil based speaker although in reality it could easily be modified to work with a piezo electric element instead by switching the diode with a resistor.

It should be noted that in this schematic VCC_EX is 3.3V DC and ACN_EX is connected to the micro-controller ground, 0V.

The circuit uses a small MOSFET device quickly switch on and off the speaker coil causing it to vibrate. The frequency with which you switch the coil on and off will determine the pitch of the sound from the speaker. As the specified device is intended as a simple indicator speaker it works best at a certain frequency however other frequencies can be used too.

As the speaker and MOSFET are mounted on the circular PCB, there is a disconnection in the circuit diagram between PULSEOUTTR and PULSEOUT_EX but for explanation purposes this can be ignored.

First of all, the micro-controller holds PULSEOUT low which ensures the gate of the MOSFET is fully discharged. This means the MOSFET is switched off and now current flows through the speaker coil. The top of the MOSFET should be sitting at approximately 3.3V at this time.

When the micro-controller brings PULSEOUT high, current flows through the gate resistor (R19) into the gate of the MOSFET which charges up like a capacitor. The resistor R19, limits the maximum current that can flow to protect the pin of the micro-controller and the gate of the MOSFET. Once the gate voltage exceeds its threshold voltage, the MOSFET switches on and current can flow through the speaker coil.

When the micro-controller brings PULSEOUT low again, current flows out of the MOSFET gate, through the gate resistor and the voltage on the gate begins to drop switching off the MOSFET again.

All of this happens very quickly and because speaker coils have some considerable inductance, the act of stopping the current flow through the speaker coil when the MOSFET switches off causes a relatively large "back EMF" to appear across the coil. For this reason, there is a diode in parallel (known as a freewheel diode) which will "clamp" the back EMF to one diode forward voltage (approximately 0.7-1.2V). This is safe for the MOSFET and prevents exceeding its breakdown voltage.

The PULSEOUT signal comes from another pin on the micro-controller which is connected to an internal timer peripheral. This timer is capable of automatically driving the connected external pin to different logic levels at predefined intervals. For our purposes, we configure it to switch on and off at about 2KHz which is the optimum frequency for the specified sounder.

Complex alarm sounds can be achieved by dynamically changing the switching frequency of PULSEOUT.

Visual Indicator Circuit

Visual indicator circuit

The visual indicator circuit is actually the same circuit duplicated 3 times to drive 3 sets of 4 LEDs. It also looks very similar to the audio indicator circuit because it is.

One of these circuits consists of the 4 LEDs connected in parallel, a single series resistor and a MOSFET to switch them on and off. As the LEDs are not an inductive load like the speaker is, there is no need for the freewheel diode. The series resistor is simply used to limit the current through the LEDs. Each LED will have a forward voltage (which is actually different depending on the colour), but is usually around 2.5V. The current through the LEDs can be calculated by subtracting the LED forward voltage from the supply voltage e.g. if the supply voltage is 3.3V and if Vf is 2.5V, the voltage across the series resistor is 0.8V. The current through a 15 Ohm resistor at 0.8V is (I=V/R) approximately 53mA. This current should be divided between the 4 LEDs to approximatly 13mA each.

It's a good idea to check the series resistor is capable of handling the power dissipation which will vary based on the forward voltage of the LEDs you choose.

The rest of the circuit operates in the same way as the audio indicator circuit. except without the use of the timer peripheral on the micro-controller. The gate of the MOSFET is simply controlled by a pin driven to the desired logic level to switch it on or off.