Clock & Timer Circuit DiagramsLCD-LED DisplayOscillators Circuit Diagrams

16 Ways to Switch your AC Power On Schematic Circuit Diagram

Connect this microcontroller controlled switch between an ordinary AC Power On/Off switch and the load, and you have 24 (say, sixteen) ways available for managing how and when the load actually gets powered. Your options are listed in the table! As soon after the AC outlet voltage (230 VAC or 115 VAC) is applied to the Live (L) and Neutral (N) input terminals (USA: G; Ground), the voltage across C2 will rise above 2.7 V and the ATtiny13 microcontroller (IC1) will start to execute the program held in its flash memory. The program controls the logical state of output pin PB4 in order to switch the power supply to the load on and off. In detail:

16 Ways to Switch your AC Power On Schematic Circuit Diagram

if PB4 is at ‘1’, the current through the LED inside optoisolator IC2 is interrupted causing the internal triac driver and triac Tr1 to be held Off; consequently no current flows through the load connected to the AC Power output terminals; if PB4 is at ‘0’, current flows through the LED inside IC2, the internal triac driver and Tr1 are switched On; consequently AC current flows through the load connected to the output terminals. The circuit, in particular, the ATtiny13 firmware, has full control of the power distribution to the load as long as the AC Power On/Off switch (not shown here) is on. For example, the program can switch on the load with a delay, keep the load switched on for a predetermined time period, switch the load on and off according to some pattern… you name it!

An example Bascom-AVR program called “EE_prog_switch.bas” is written to illustrate the possibilities. The program is a free download from [1]. ‘Bascom-AVR is supplied by MCS Electronics — a free Demo version limited to 4 KB source code size is available [2]. Initially, the program checks the state of configuration switches S1-S4 and calls the relevant pre-programmed routine from a set of 16 — see the table.

‘One-shot’ routines will execute only once; to repeat them you should switch the AC Power switch ahead of the circuit Off and On again. Routines with a repeating pattern (‘once every…’) will execute in a loop as long as the AC Power is on. If you want to select a different pattern, you should switch AC Power off and flip to another setting on S1-S4. The new setting will be recognized the next time your AC Power switch is switched to On.

The switch patterns shown in the table are just examples, and you are encouraged to define and implement other patterns that suit your applications. If there is only one On/Off pattern that the switch should follow, you can omit switches S1-S4 and thus make the circuit even simpler. It should be noted that the design does not accommodate for precise timing. The overall accuracy primarily depends on the accuracy of the ATtiny’s internal RC oscillator (<10%; <3% if calibrated), while the Wait routines in BascomAVR are accurate to within 1%.

Depending on your local power grid, dimension the following components:

115 VAC/60 Hz AC: C1 = 0.68µF;

R1 = 750 Ω; R2,R3 = 470 kΩ

230 VAC/50 Hz

AC: C1 = 0.33µF;

R1 = 1.5kΩ; R2,R3 = 1 MΩ

C1 should be an X2 class capacitor with a minimum specified operating voltage of 250 VAC; for example, WIMA MKP-X2, WIMA MP3-X2, Epcos MKP X2 or similar, rated for 250, 275 or 305 VAC voltages. As these capacitors are normally available with ±20% tolerance, the value is calculated to ensure 10 mA of current even in a worst-case, i.e. when the capacitance is significantly out of tolerance. As a matter of fact, the total AC current flow through C1 exceeds 20 mA, but half the current is ‘lost’ because of the half-wave rectification. Most of the current flow through the LED inside IC2: some 5-6 mA when switched on (if necessary, adjust the value of R4 to keep this current within range). The ATtiny13 runs on its internally calibrated 9.6 MHz oscillator, but the clock frequency is lowered to 600 kHz to keep power consumption under 1 mA. The rest of the current flows through zener diode D1 which acts as a shunt regulator and provides a reasonably stabilized voltage for the circuit. You can expect about 4.4 V across C2 when IC2 is switched off, which will drop to some 3.4 V when IC2 is switched on. The actual values depend primarily on D1.

Resistor R1 limits the inrush current during power-on, but sadly also causes some unwanted losses during operation. You may use a 1-watt nonflammable resistor in place of R1, but a better solution would be to use an NTC resistor. Unfortunately, we were unable to find an appropriate NTC for limiting the inrush current to 200 mA. Therefore, two series connected Epcos NTC thermistors may be considered with a resistance of 680 Ω (at 25°C). These thermistors are intended for temperature measurement and compensation but work well as inrush current limiter, too. For 115 VAC, it is safe to use just one 680 Ω NTC thermistor. The BT136 triac is rated for 4 ARMS on state current. Consider replacing it with a stronger device if the load current can be expected to exceed 3 A. Components R7-C4 form a snubber network and may not be necessary depending on the particular triac and load used. A 1-second delay is provided at the beginning of the example program. Therefore, the expression “as soon as the power is switched on” from the table should be read as “1 second after the power is switched on”. This was found necessary as the voltage across C2 rises slowly at power-up and there is not enough power to switch on IC2 and Tr1 until the voltage across C2 reaches more than 3.5 V. A 1-second delay will allow the voltage across C2 to reach at least 4 V before the program actually starts to run, which will ensure that IC2 and Tr1 can be reliably switched on at the very beginning of the program.

The ATtiny13’s fuse bits should be set during programming to enable the Onchip Brown-out detection (BOD) circuit to monitor the VCC level with a trigger level fixed to 2.7 V and to configure the micro to run on the calibrated internal RC oscillator at 9.6 MHz clock frequency. It is the programmer’s (i.e. you’re!) responsibility to set a divide-by-16 prescale factor at the beginning of the program to lower the clock frequency to 600 kHz. If you are not into programming microcontrollers, order your ATtiny13 ready programmed from Elektor (# 100443-41) [1].

Caution. The circuit is at Live AC potential and potentially hazardous to touch. Never work on the circuit while it is connected to the AC power outlet. The circuit must be enclosed in an approved enclosure preventing any part of it from being touched. When in doubt, ask for the assistance of a qualified electrical engineer.

Internet Links
www.elektor.com/100443
www.mcselec.com

Tags

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button
Close
Close
Read previous post:
LC Oscillator with Pot Tuning Schematic Circuit Diagram

An LC oscillator is usually adjusted using a variable capacitor. However, for frequencies below around 100 kHz, this calls for...

Close