Lucky Resistor
Menu
  • Home
  • Learn
    • Learn C++
    • Product Photography for Electronics
      • Required Equipment and Software
    • Soldering for Show
  • Projects
  • Libraries
  • Applications
  • Shop
  • About
    • About Me
    • Contact
    • Stay Informed
  •  
Menu

Always-On Project

Posted on 2020-06-052020-06-05 by Lucky Resistor

I just finished a new project, which is called Always-On. This project is a simple bidirectional bridge between the mains-voltage installation and an Adafruit Feather board as a controller.

The idea is to have a device integrated into the electric installation. It works as a smart light switch, monitors power lines or works as a timer for a device.

In this post, I describe a minimal version of the project I used as a prototype, which has one power sensor and one solid-state relay. It may be a good starting point if you plan to create a similar device.

In contrast to other projects, I will do only a superficial overview in this post. It is no project to be copied as shown. This post is meant as inspiration providing a working base to start.

Working with mains-voltage (line power) can be very dangerous. Only create a device as shown if you are familiar with this topic. Also, read this good article from Hackaday for safety precautions.

Overview

Let’s have a look at the different sections and components of the device.

Mains-Voltage Side

The left side of the board is connected to mains power and the right side is the low power side with the controller. There is a large air gap between the two sides as extra protection.

There are three fuses (A) and two over-voltage protections (B) as an extra safety measure. A power module (C) IRM-03-5 from Mean Well converts mains-voltage to the required 5V DC for the controller part. The traces on the top and bottom side are covered with insulating silicone.

On the upper side is the solid-state relay (D) IXYS CPC1966YX6, which can switch a load up to 3A. On the lower side is the optocoupler (Lite-On LTV-8141) for sensing line power. I use two 100kΩ 3/4W resistors to reduce the voltage for the optocoupler to the required value.

Controller Side

The right side of the board is built around a socket for any Adafruit Feather board. The shown minimal version has 5V as main power supply, the Adafruit Feather provides the 3.3V power from this source.

I use an Adafruit Feather M0 Adalogger (A) in this example, any other Feather will work too. You can add boards with WiFi, Bluetooth or LoRa and use Feather Wings on top.

On the lower side is a small debounce circuit (B) for the optocoupler signal and on the upper side, two LEDs (C) for displaying the current state of the power sensing circuit and solid-state relay.

There is a footprint for a DS3132M RTC chip (E) and a super capacitor (D) as backup power. The footprint (F) is for an optional FRAM chip to store settings or logs.

Extension / Sensor Connector

The connector on the very right side of the board is for connecting sensors and extensions. It provides 5V and 3.3V power, connection to three microcontroller pins and a separate I2C bus.

Circuit Schema

The following schema is for the shown version of the device.

Specific part numbers are only noted if they are important and the result of calculations, otherwise, common components for resistors, capacitors and LEDs will do.

Testing

I designed the device to do tests without connection to mains-voltage. The mains-voltage part is disconnected and the controller side is powered using the USB connector on the Feather board.

Now just the controller side is powered and you can use the test button to simulate the power sensing via optocoupler and monitor the state of the solid-state relay using the LEDs.

This is a very safe way to develop a firmware for the controller, without all the risks of mains electricity connected.

For deployed devices, you simply remove the Feather board and work on the firmware with the test board, not connected to mains-voltage. After finalising the new firmware version, you put the feather back into the device.

Housing

Housing is very important. I designed the board to fit into an IP65 sealed case using two cable glands on both sides. There has to be enough space in the housing for free air circulation.

If you are unsure about the heat dissipation, just add a temperature sensor to your device and use it to monitor the temperature rise in some extreme situations. E.g. use a hairdryer to simulate a hot summer day. 😁

Conclusion

A controller as shown provides a permanent solution for home automation. With your custom firmware, you control lighting or other devices in complex ways, without WiFi, Bluetooth and smartphone required (aka. IoT).

If you have any questions, missed any information, or simply want to provide feedback, feel free to comment below. 😄

More Posts

Build a Sustainable Refillable Active Coal Filter

Build a Sustainable Refillable Active Coal Filter

If you ever used air filters to keep smells, fumes and dust at a low level in your workshop, you for sure came in contact with these expensive throwaway active coal filters. While throwing-away the ...
Read More
Rail Grid Alternatives and More Interesting Updates

Rail Grid Alternatives and More Interesting Updates

I published another large update to the storage boxes project in the last two weeks. All buyers who subscribed to update emails already got a summary of the changes. If you read the email, you ...
Read More
Stronger 3D Printed Parts with Vertical Perimeter Linking

Stronger 3D Printed Parts with Vertical Perimeter Linking

One issue with fused filament fabrication is the weakness introduced into the parts at the layer boundaries. I had this simple idea of how especially straight sections of 3D prints could be improved on regular ...
Read More
The Hinges and its Secrets for Perfect PETG Print

The Hinges and its Secrets for Perfect PETG Print

A while ago, I published the models for three different strengths of print-in-place hinges. If these are printed with PETG or ASA, they are incredibly strong and durable. This post explains why these objects print ...
Read More
Candlelight Emulation – Complexity with Layering

Candlelight Emulation – Complexity with Layering

In this blog post I explain the microcontroller firmware that emulates candlelight in more detail. You can apply the explained techniques in similar situations to get organic effects on CPU and RAM-limited platforms. I will ...
Read More
Update to the Storage Boxes System

Update to the Storage Boxes System

Last week I sent all subscribers a small update to my storage boxes system. There are new split boxes for the tall boxes (LR2052-300C-S) and a new extensive PDF catalogue with a great overview, but ...
Read More

4 thoughts on “Always-On Project”

  1. Pingback: Designing a power control device with Feather @LuckyResistor « Adafruit Industries – Makers, hackers, artists, designers and engineers!
  2. Jerry says:
    2021-01-18 at 19:39

    Cool, I was looking for a device that uses 5vdc solar and battery as normal power and when battery reaches low level it would switch to mains power as a backup

    Reply
  3. ilium007 says:
    2021-08-09 at 02:42

    What is the air gap clearance distance? What tools are available to calculate this?

    Reply
    1. Lucky Resistor says:
      2021-08-09 at 14:01

      I did choose a large gap distance of 4mm, but the width of the gap is not that important. In most devices, you only find an air gap of 1-2mm. Because air is so much better at insulating than the PCB, even a small gap has a great effect. As soon you add such a gap, the distance between the high-voltage and low-voltage areas, on the PCB is increased, because the shortest path has to curve around the gap. It makes an unwanted connection between these parts more unlikely.

      There are many online calculators, where you can calculate the PCB trace spacing for certain voltages, like this one: https://www.smps.us/pcbtracespacing.html. The shown calculator gives you the minimum distance according to the standard IPC-9592 (Requirements for Power Conversion Devices for the Computer and Telecommunications Industries). This is a good value for the distances on the high-voltage side and also a good starting point to get minimum distances for overvoltage situations. This is called “creepage“, which is the reason why one likes to add an air gap.

      If you e.g. use a value of 250V (AC) you will get a value of 1.8mm distance between traces on the PCB. For an overvoltage situation, with e.g. 3000V you need at least ~15mm distance. This is the distance measured between the nearest high-voltage and low-voltage contacts connected by the PCB material.

      These distances are small, compared with the insulation effect of air, which is approximate 1(worst)-3(avg)kV/mm (depends on the geometry of the electrodes and humidity). Therefore an air gap of 2mm between two electrodes already insulates 2kV. The shortest air path in my device is the legs below the optocoupler which are 8mm apart. It would need more than 8kV(worst case) to create a spark between these legs.

      For my project, the nearest tracepoints are ~8mm apart, below the optocoupler. If they were just separated on the PCB, an overvoltage situation >~1.5kV, could allow a path to the low-voltage section. By adding the air gap, the path has to go around this gap, which increases the length to 17mm – into a safer zone (>=3.2kV).

      I used 3000V for my calculations because this is the maximum insulation voltage for the parts I used (except the optocoupler which can handle 5000Vrms). So even if my air gap would increase the distances to be safe for 10kV – the used components would probably fail and pass some of the voltage to the low-voltage part.

      For this reason, I also added additional overvoltage protection components (varistors), at the high-voltage inputs. If there are any peak voltages above 300V, the varistor will create a short and hopefully prevent the worst case.

      Lightning strikes can easily create voltages over 10kV by induced transients into the mains installation. The outcome of such events is unpredictable. E.g. the voltage spike could come through a sensor cable of the low-voltage side.

      For this reason, the physical insulation of all cables is very important for all devices like this. There should be no point in the whole setup, where a human gets into contact with any part. You should e.g. never use an exposed capacitive touch panel as input on the low-voltage side, because of the worst-case scenario.

      I hope this answered your question. 😄

      Reply

Leave a Reply Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Stay Updated

Join me on Mastodon!

Top Posts & Pages

  • How and Why to use Namespaces
  • Storage Boxes System for 3D Print
  • Use Enum with More Class!
  • Circle Pattern Generator
  • Real Time Counter and Integer Overflow
  • Circle Pattern Generator
  • Logic Gates Puzzles
  • C++ Templates for Embedded Code
  • C++ Templates for Embedded Code (Part 2)
  • Logic Gates Puzzle 101

Latest Posts

  • The Importance of Wall Profiles in 3D Printing2023-02-12
  • The Hinges and its Secrets for Perfect PETG Print2023-02-07
  • Better Bridging with Slicer Guides2023-02-04
  • Stronger 3D Printed Parts with Vertical Perimeter Linking2023-02-02
  • Logic Gates Puzzle 1012023-02-02
  • Candlelight Emulation – Complexity with Layering2023-02-01
  • Three Ways to Integrate LED Light Into the Modular Lantern2023-01-29
  • The 3D Printed Modular Lantern2023-01-17

Categories

  • 3D Printing
  • Build
  • Common
  • Fail
  • Fun
  • Learn
  • Projects
  • Puzzle
  • Recommendations
  • Request for Comments
  • Review
  • Software
Copyright (c)2022 by Lucky Resistor. All rights reserved.
 

Loading Comments...