AUTOMATIC VOLTAGE STABILIZER USING MSP430

Photo of author

By Jackson Taylor

Home » Hardware » AUTOMATIC VOLTAGE STABILIZER USING MSP430

As an Amazon Associate we earn from qualifying purchases.

Mains voltage is rarely steady. It can sag when the load on the grid is high and rise when the load is light. Refrigerators, televisions and computers can be damaged or behave badly when the supply drifts too far from its rated value. An automatic voltage stabilizer watches the input voltage and corrects it, so the connected appliance sees a safer value.

This article explains how an automatic voltage stabilizer built around a Texas Instruments MSP430 microcontroller works. It covers the block diagram, the main components, the firmware logic and the safety points you should respect. The video above shows the project in action.

What an automatic voltage stabilizer does

A stabilizer sits between the wall socket and your appliance. It measures the incoming AC voltage and decides whether it is too low, too high or acceptable. If the voltage is off, it changes the output so the load gets a value closer to the nominal one. If the input is far outside a safe range, it disconnects the load completely.

Hardware Hack

Stop Buying New Batteries for Your Tech

Electronics are expensive, but their power sources don't have to be. Discover the simple engineering trick to recondition dead batteries and bring your gadgets back to 100% capacity.

Watch the Free Video

A microcontroller-based design replaces the analog comparator circuits found in older stabilizers with a program. This makes the thresholds easy to change, lets you add delays and protections in software, and allows a display or indicator LEDs without much extra hardware.

Why use an MSP430

The MSP430 is a low-power 16-bit microcontroller family. Most parts include a built-in ADC, several timers and enough I/O pins to drive a few relays and a display. That is all this project needs. Its low power draw is also helpful, since the controller stays on all the time.

If you are new to the family, our guide to MSP430 assembly language covers digital I/O basics. The same pins you use there can drive the relay stages in this project.

How the circuit works

The design can be split into four blocks.

  1. Sensing: a small step-down transformer, a rectifier and a resistor divider turn the mains voltage into a small DC level that stays within the ADC input range of the MSP430.
  2. Measurement: the microcontroller samples that level with its ADC, averages several readings to reduce noise, and converts the result into an estimated mains voltage using a calibration factor.
  3. Decision: the firmware compares the voltage with a set of thresholds and chooses which relay should be on.
  4. Correction: relays connect the load to different taps of an autotransformer. Each tap gives a different boost or buck ratio, so the output moves back toward the nominal level.
See also
MSP430 - Digital Output

Tap switching with relays

The autotransformer has several taps. When the input is low, the relay selects a tap that boosts the voltage. When the input is high, a different relay selects a tap that reduces it. When the input is normal, the load connects straight through. Only one relay should be active at a time, and the firmware should make sure of that.

The MSP430 pins cannot drive relay coils directly. Each relay needs a driver such as a transistor or a Darlington array, plus a flyback diode across the coil to absorb the voltage spike when the coil turns off.

Main components

  • MSP430 board, for example a LaunchPad with a G2-series chip
  • Autotransformer or transformer with multiple taps, rated for the load you want to protect
  • Small step-down transformer, bridge rectifier, filter capacitor and resistor divider for sensing
  • Relays with contacts rated above the maximum load current
  • Transistors or a driver IC, and flyback diodes
  • Indicator LEDs or an LCD to show voltage and status
  • Fuse, enclosure and a regulated low-voltage supply for the controller

Firmware logic

The program is simple but a few details make the difference between a toy and a usable stabilizer.

Thresholds and hysteresis

Define a few voltage bands: cut-off low, boost, normal, buck and cut-off high. Add hysteresis, which means the voltage must move a little past a threshold before the relay changes back. Without it, a voltage hovering near a limit makes the relay click on and off repeatedly, which wears the contacts.

Turn-on delay

After power returns, or after a cut-off, wait for a short delay before reconnecting the load. This protects compressor-based appliances such as refrigerators, which should not be restarted immediately after a power interruption.

Safe relay switching

When changing from one tap to another, release the first relay before pulling in the second. A short gap avoids shorting two transformer taps through the relay contacts. Some designs also switch at a point where the load current is low, but even a simple dead time helps.

Sustainable Tech

Keep Toxic E-Waste Out of Landfills

Don't throw away your failing laptop, phone, or car batteries. Learn how to recondition them at home in just a few hours. It's better for the planet—and your wallet.

Learn How It Works
See also
SOLID STATE TRANSFORMER USING ARDUINO (230V AC TO 110V AC)

Calibration

Compare the displayed value with a reliable multimeter and adjust the scaling constant in the code. Resistor tolerances and transformer ratios vary, so calibrating once is better than relying on calculated values.

Building and testing

  1. Build and test the sensing stage first, and check the DC level with a meter at different input voltages.
  2. Program the MSP430 to read the ADC and show the result on an LCD or send it to a serial terminal.
  3. Calibrate the reading against a multimeter.
  4. Add the relay drivers and test them with a low-voltage supply and a lamp before connecting anything to the transformer.
  5. Test the full system with a variable AC source if you have one, such as a variac, then with a small load, then with the real load.

If you want to see another mains-related project with this controller, take a look at MSP430 and TRIAC switching. For DC power conversion work, our high voltage buck converter project is another useful read.

You can find the original project page through the More link.

Safety notes

  • Mains voltage can kill. Only build this if you are comfortable working with it, and never touch the circuit while it is plugged in.
  • Keep the low-voltage control board separated from mains wiring, and insulate every mains connection.
  • Use a fuse or breaker on the input, and choose relays and wire sizes rated well above the expected load current.
  • Mount everything in a closed enclosure and ground the metal parts.
  • Test with a low-power lamp first, not an expensive appliance.

Limitations

A relay-based stabilizer corrects voltage in steps, not smoothly, so the output will still move a little within each band. The relays also take a short time to switch. It does not filter spikes or noise, and it does not replace a surge protector. Check that your autotransformer and relays are rated for the appliance you plan to connect.

FAQ

Why use a microcontroller instead of an analog circuit?

A microcontroller lets you change thresholds, delays and protections by editing code instead of replacing components. It also makes it easy to add a display or logging.

See also
Voltage Gain Enhancement for Step-Up Converter Constructed by KY and Buck-Boost Converters

Can the MSP430 measure mains voltage directly?

No. The ADC accepts only a few volts. You must scale the mains down using a transformer and divider, which also gives isolation from the mains.

Why do relays click repeatedly when the voltage is near a limit?

This happens when there is no hysteresis. Add a small margin in the code so the relay only switches back after the voltage has moved clearly into the next band.

Can I use this to protect a refrigerator?

Yes, if the transformer and relays are rated for its current, and the firmware includes a turn-on delay after a cut-off. The delay protects the compressor from restarting too quickly.

Revive Your Dead Electronics

Got a drawer full of dead gadgets or a failing car battery? Instead of paying a premium for replacements, use this simple trick to easily recondition them right from home.

See How It Works