Close
0%
0%

AC Safety timer

Turns your soldering iron off after a half hour

Similar projects worth following
My Hakko soldering iron has a feature I've come to value - if you leave it turned on for a half hour, it will shut down. This is particularly valuable for a soldering iron - they don't make any noise in operation, and one left on is both dangerous and it's not so great on the tip.

I bought a Hakko desoldering gun and it doesn't have this feature. So far, I haven't been careless with it, but mistakes can happen, and it'd be nice if the iron had my back like my regular one does.

This project aims to build a box with an AC plug and socket and a single button. Push the button, and the power turns on. Push it again and it turns off. Leave it on for a half hour and it will turn itself off.

There are a lot of ways this could be done, but I decided to leverage the work I have done in other projects, so the design is an opto-isolated triac AC power switch controlled by an ATTiny9.

The ATTiny needs a 5 volt power supply, so that requires an isolated AC/DC power supply module - ironically the most expensive component of the entire build. The ATTiny9 is set up with one of its I/O lines connected to a button (other side of the button to ground), a second as the opto-isolator driving line, and a third driving a chassis mounted LED. There is a pilot light hooked up to the output to act as a power indicator. If you're still working after 25 minutes, the warning LED will begin to blink. If you push the button while the warning light is blinking, the timer will be reset without turning the power off. If you push the button while the warning light is not blinking, the power will go out. If you do nothing after 5 minutes of the warning light blinking (30 minutes from power-up), the light will go out.

The triac circuit is one half of the Toast-R-Reflow power switching board. It uses a MOC-3020 opto-isolated triac driver and a BTA-20 triac. The board in this case is routed for a design maximum of 600W. At that sort of power, the BTA-20 will only be expected to dissipate about 5 watts of heat, which should be easy to sink through a finned heat sink. There's a snubber on the output to protect against unintended operation with inductive loads, and there's a beefy parallel load resistor to prevent leakage through the triac from lighting the power light dimly when it's turned off.

As with all HV designs, care must be taken to insure the correct current capacity for the load-bearing traces and to pay heed to creepage and clearance distances. It's also a good idea to draw a solid divide between the HV and logic portions of the circuit, with only isolated components allowed to bridge the line.

For the chassis, there is a panel-mounted IEC C14 inlet, plus an NEMA 5-15 outlet. The hot and neutral lines of each will go to dedicated connectors on the board. The pilot light is wired separately to the outlet hot and neutral. The two grounds are tied together and to a lug on the chassis. The button and warning LEDs mount at some distance away from the AC connections and tie to the logic part of the board.

Adobe Portable Document Format - 19.70 kB - 06/23/2020 at 15:00

Preview
Download

sch - 203.98 kB - 06/23/2020 at 15:00

Download

brd - 63.31 kB - 06/23/2020 at 15:00

Download

  • Fixing programming

    Nick Sayer06/23/2020 at 14:51 0 comments

    In the last log, I talked about the problem of low impedance loads on the programming pins. It turns out that this really only applies to TPID because it's a bi-directional pin, and the chip has a collision detection mechanism. TPIC shouldn't have similar issues. So the simpler solution (as opposed to adding a MOSFET driver) for this is to just swap the optoisolator and button pins. As long as you don't push the button during programming, it won't interfere at all. Having TPIC shared with the optoisolator will cause the LED inside it to blink during programming, but that's not a big deal. To help with this even more, we can actually swap POWER and WARN as well, because WARN can be disconnected much more easily.

  • Tiny is as tiny does

    Nick Sayer06/09/2020 at 06:30 0 comments

    Well, the ATTiny9 variant works. I'm programming with the ATMelICE under Windows for now, but I have found a solution for using the usbtiny with an external adapter with avrdude.

    The really tough part is that the chip has 32 bytes of RAM. That was not a mistake. 32 bytes. That has to accommodate the call stack, all of the static variables... everything. The code didn't work at first, and I think the stack was just smashing the BSS.

    The fix was to rearchitect it to separately track seconds and milliseconds. That allows time values to be 16 bit values instead of 32 and still be able to both debounce the button (with milliseconds) and track long time intervals (in seconds).

    Additionally, all of the functions except for the timer ISR and main() have to be forced inline to reserve the stack for the ISR. This trades flash for RAM, effectively, but for this architecture, that's necessary.

    It's also a little irritating that the 150Ω impedance on the opto-isolator breaks programming, so you have to disconnect it for every code change. It's unclear whether this is the fault of the programmer or the chip. The fix is to add a MOSFET as an impedance "buffer" of a sort. But if that's really necessary then it drives up the part count by one. I really hope it's just changing to a different programmer that makes the difference.

    EDIT: Yes, it turns out that you can't directly drive an LED on TPID without disconnecting it for programming. So there needs to be a MOSFET driver as an impedance buffer unless you want to remove the series resistor every time.

  • Enter the ATTiny9

    Nick Sayer05/24/2020 at 00:39 0 comments

    I don't really have a reason to do this, but I've decided to try to rev this to use the ATTiny9. I patched the source code to use the chip select macros to pick between ATTiny4x and ATTiny9/10. The code winds up being 669 bytes long (won't fit in a Tiny4, alas) and since I don't need an ADC, the Tiny9 is nominated.

    Since the project only requires 3 pins, it's an ideal part. I can leave !RESET alone and therefore won't need to play any funky tricks to be able to use it as a GPIO pin except for programming.

    The only problem is that I have an AtmelICE programmer that can program with TPI... but avrdude doesn't support using it for TPI, unfortunately.

    So as soon as I can figure out how to either fix avrdude or get another programmer I'll get some boards made and try it out.

  • WARN light update

    Nick Sayer06/05/2018 at 17:24 0 comments

    One potential downside of the project as designed was there was no way for the power to remain on longer than a half hour. For a soldering iron, a momentary interruption isn't a big deal, but I could envision other equipment you'd want to remain continuously powered while it's attended.

    So the project now has a "warning" light in addition to the power light (which is just connected to the AC output power). The warning light is under software control only, and it turns on during the last 5 minutes of the half hour. If you push the button during the "warning" phase, then the timer is reset and the warning light turned out. As before, if the warning light is out and the button is pushed, the power is turned off.

    This does raise a slight ambiguity in the user interface. The power button is no longer a simple push-on/push-off paradigm. The only way to preserve this paradigm would be to add the concept of a "long push" versus "short push." You'd push and hold the button for a quarter second or so to just reset the timer. A short push would turn the power on and off. The problem with this is that you then have to be cognizant of how long you push the button, and I think for this application that's a worse user experience.

    Still, the behavior is simply defined by firmware. You can change the rules pretty easily.

    The board design has been updated as well to use a smaller power supply module (unfortunately, it's not a whole lot cheaper), and incorporates the bleed resistor on the triac output and much thicker traces for the high current path.

    I haven't built a new one, simply because the first one still works just fine. I will, however, retrofit it for the new "warn" light firmware and add a warning light.

  • Safety notes

    Nick Sayer02/13/2018 at 16:06 0 comments

    If you’re going to build one of these, for the love of God, don’t apply power to it unless the case is all buttoned up.

    This, in particular, means don’t program the controller with power applied. 

    Not only is it a pretty dumb idea to be messing with the board while 120V is hooked up, but in addition the programming lines are shared, and one of them drives the LED in the opto-isolator. If power was applied, it would flick the triac on and off, which would be bad for any load connected and for the snubber components probably.

    For the same reason, don’t push the button while programming, as that would mess things up.

    If programming doesn’t work, it’s possible that your programmer can’t overcome the impedance imposed by the LED. If this happens, just temporarily remove the 150Ω series resistor (or get a better programmer).

  • Fixed the pilot light

    Nick Sayer02/03/2018 at 22:05 0 comments

    As I reported last time, with no load, the pilot light stays on at about half brightness because of leakage from the triac. I was able to measure something like 60 volts with no load.

    Well, the way to fix that is to add a parallel load to lower the voltage.

    Today I grabbed some hefty resistors to try and figure out the highest resistance that would reliably turn the pilot off (after all, the lower the resistance, the more power is wasted when the circuit is turned on, and that power winds up being dissipated as heat). I had on hand 50kΩ, 91kΩ, 150kΩ and 300kΩ resistors from my work with the Hydra and OpenEVSE II designs - all of those rated for 1W and flameproof. The 91kΩ one worked and the 150kΩ didn't, so the 91kΩ one was selected. I just trimmed the leads a little shorter and jammed them into the output screw terminals on the board along with the output lead and pilot light wires.

    It's worth mentioning that once you've picked a load resistance, you need to calculate the power to insure you use a resistor beefy enough. P=E^2/R, of course, so in this case this will dissipate just under 160 mW (for AC, you can use the RMS voltage for such calculations, and the result will be RMS power, but that's what's significant for measuring resistor dissipation).

    It's probably not a great idea to put 3 wires into a single screw terminal, but there isn't going to be an unnatural amount of current flowing through this thing (not like an EVSE that switches 30 amps), so I have some confidence that it will be ok. Soldering it across the pilot lamp's terminals would have also been an option (perhaps a marginally better one).

    But I'm happy now that the pilot lamp turns all the way off with nothing plugged into the socket.

    P.s. The lesson EVERYONE should take away from this is that just because a non-mechanically switched circuit is ostensibly turned "off" that doesn't mean that there isn't a significant voltage available to give you a nasty surprise.

  • Final build report

    Nick Sayer02/02/2018 at 05:52 0 comments

    I completed the build and uploaded some pictures of the result. 

    It works just fine as it is. There are a couple of things I would do over again if I were to make another one of these. 

    Firstly, if I had made the board traces wider, I could have supported a current spec more like 8 amps than 2. I might have also stuck a fuse in somewhere if I were doing it for a wider audience. 

    I chose a box much larger than I could have just so I could insure that all the parts stayed sufficiently separated from each other (given that there’s AC line voltage involved). I specifically chose a metal box and grounded it to insure that if anything came loose it would create a ground fault and blow my local GFI (or a circuit breaker). I also chose a nice, big red button for it, but the downside of that was having to grind the hole large enough for it to fit. Grinding the IEC and NEMA outlet holes was a pain too. Of all the parts of a project like this, that’s my least favorite. 

    The last little quirk is that when there’s no load at all, the power light glows faintly. When you connect any sort of load this stops, but it indicates some level of leakage in the triac circuit. I probably need to revisit the biasing. But it is “off” enough to keep my desoldering iron cold, so I will call it a “win.”

    Lastly, I picked the power supply module I did out of pure laziness. It’s capable of 3W if output, though the 5 volt powered portion of the circuit undoubtedly draws less than 50 mA in practice. I could have bought a smaller one and maybe saved a couple of bucks, at the cost of designing a new EAGLE library entry for it. 

  • I18N

    Nick Sayer01/15/2018 at 03:40 0 comments

    For those following along outside of North America, it turns out that there’s nothing about the circuit that needs to change to switch 230VAC. The CUI power supply works on 90-240VAC 50/60 Hz, and the triac will work just as well at 230V as 120V.

    With a higher voltage, you can increase the design power to 400W without changing anything about the circuit or board (except, of course, the outlet).

View all 8 project logs

Enjoy this project?

Share

Discussions

Daniel wrote 05/10/2020 at 03:55 point

I was a bit worried when I saw you bolted the triac directly to the case. But when I look up the part, I saw it is an insulated one so all good ;)

Is there a particular reason, why you use a triac here instead of a relay?

  Are you sure? yes | no

Nick Sayer wrote 05/10/2020 at 04:26 point

You bring up a good point about insulation. It’s important if you have a conductive case to insure it has a solid connection to the earth conductor on the inlet and outlet sides. If the datasheet were wrong about the triac or if something broke inside it, you’d definitely want to insure that the ground will trip the breaker or blow the on-board fuse. I recently built a new one with a plastic case, so that’s no longer an issue. But the plastic isn’t a good heat conductor, so I’ve added a small heat sink to the triac instead.

As for triac vs relay, if you mean a traditional magnetic relay, they aren’t as reliable for the long term as solid state devices. I’ve built EVSEs and in those cases you want to use a relay or contactor because the dissipation in a solid state device would be excessive for that much current. But for this project, a triac is fine. If you’re referring to a solid-state relay, internally those are often triac based anyway, and doing the triac switching yourself is competitive cost-wise. That, and I sell a triac based switching board for toaster reflow oven conversion on Tindie, so I happened to have a bunch of BTA20s and MOC3020s on hand anyway. 

  Are you sure? yes | no

Daniel wrote 05/11/2020 at 05:43 point

I meant a magnetic relay because with this you wouldn't have to worry about heat dissipation. But the reliability is certainly an issue, especially in a safety device.

Thanks for your comprehensive explanation ;)

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates