Timer Switch

Switches off the soldering iron* when the timer counts down

* or anything that uses 5A or less of mains power

The user interface on my soldering iron is a model of simplicity, it's a physical on/off button on the front which is super but you can forget to switch it off. There is a power LED but it's easily missed.

Soldering Iron

After getting back from holiday and noticing that I'd left the soldering iron switched on the whole time I looked around for something to turn it off with a timer.

There are lots of mains timer switches available, but nothing which quite works for my use case.

Some are just for turning the power on and off at certain times during the day

Timer 1

Some don't allow you to set the timer with enough resolution

Timer 2

Some have horrible little displays with overly complicated user interfaces

Timer 3

This one comes close but doesn't show the timer

Timer 4

The most common problems with the existing solutions were:

  • Tiny lcd displays not easily visible at a glance
  • Overly complicated interfaces which did more than I wanted without doing exactly what I wanted
  • Non-wall mountable form factors (mostly they're 'through-plug' style)
  • Crazy prices (the closest match was this for 40 quid) but again, overly complicated UI

So I came up with some requirements:

Requirements
ElectricalMains powered
Handle 1.2KW power (5A @ 240V)
Replaceable fuse
Compliant with safety regulations
PhysicalWall mounted 'breaker' style
80 x 80 x 40mm form factor
InterfaceAs simple as possible, one click on/off
On-time can be increased/decreased on the fly
Large timer display (visible from across the room)
Beep to warn of impending shut off
Configurable default on-time
Power status LED indicator

Overview

It's a very simple gadget using the crappiest STM32 MCU available, a push-button rotary encoder, a relay, and a MAX7219 to drive the display. Electronics are powered by a generic HLK-PM01 5V PCB mounted PSU. Separation/creepage distances between the 'hot' mains side and the rest of the board are maintained.

The schematic is very simple and fits on a single sheet.

schematic

BOM

This was all done before the great component shortage so little thought was given to availability, but as of September 2021 all components are currently available somewhere, although pricing is a bit silly in some places. Note this BOM is just for prototyping, a real BOM has many more columns than this. Note that everything except the MCU, the MAX7219, the PSU and the relay can be substituted with any old generic part you can find.

DesignatorQuantityValueFootprintCommentDescription
BZ11-PIEZO_BUZZERBUZZERPiezo buzzer
C1, C3, C43100nFCAPC1608X07L100nFCeramic capacitor
C21100uFCAPAE9585X105L100uFElectrolytic cap
C5, C721uFCAPC1608X07L1uFCeramic capacitor
C914.7uFCAPC3216X07L4.7uFCeramic capacitor
C10, C1123.3nFCAPC1608X07L3.3nFCeramic capacitor
D1120mALEDLED5mm through hole
D2120V 500mASODFL250X100-2LDSF05S30USchottky Diode
F11-5x20 FUSE520_102701Fuse speed F
R11620RESC1608X05L620Resistor 1%
R3128kRESC1608X05L28kResistor 1%
R512KRESC1608X05L2KResistor 1%
R6, R7210kRESC1608X05L10kResistor 1%
R8, R92120RESC1608X05L120Resistor 1%
INPUT, OUTPUT2-TERMINAL_BLOCKTERMINALx3 terminal block
Q11-SOT95P230X110-3LSSM3K36MFVn-channel mosfet
PSU15V 600mAHLK-PM01HLK-PM015V PSU 0.6A
RELAY11240VAC/5AG5RL-1A-E-HRG5RL-1A-E-HRRelay 5V
ENC1-PEC12R-4XXXF-SXXXX_1ENCODERRotary encoder
LDO113.5v 150mATSOP95P280X110-6LNCV8560SN350T1G3.5V 150mA LDO
SEG1-5641AH5641AH4x7 Segment display
U21-SOIC127P600X175-14L74HC1254 way level shifter
U11-TSOP65P630X120-20LSTM32F030F4P6Microcontroller
U31-SOIC127P1030X265-24LMAX7219LED Driver

PCB

For such a simple board, 2 layers is fine and in fact the 2nd side of the board has only a ground plane, earth surround and some duplicated higher current traces on it. Note that the 'top' of the PCB faces the wall and the display and rotary encoder are on the 'bottom'. 2nd revision of PCBs from JLCPCB was bodge free after bringup.

Top
pcb_bottom
Bottom
pcb_top

Note the PCB can carry up to 10A (and the relay can do 16A) but using a 5A fuse leaves a good margin. Gerbers are here, the zip file can be uploaded directly to JLCPCB order page to get bare boards.

Glamour shots

render_top
render_bottom

Firmware

The firmware is also quite straightforward, the relay is controlled with a GPIO via a mosfet, the MAX7219 is a simple SPI device and reading the rotary encoder is just a handful of lines of code. To save the settings through a power cycle I used some STM32 flash code from another project.

Enclosure

I used Autodesk Fusion 360 (when it was still free) to design the enclosure which consists of three parts: the back, the front and the fuse holder. It looks like this

enclosure_screenshot

There's also a small slab of 3mm red perspex in front of the digits to make them more visible. Any old plasterboard screws are used for wall mounting, they attach through the base and then four other screws attach the front to the back. The fuse holder uses some tiny machine screws which go into some threaded inserts on the front. Sadly Autodesk are holding the files hostage since they changed the licensing model for Fusion 360 so step/stl files can't be extracted without paying them for a license.

Conclusion

It works, I use it all the time, I haven't changed it since I mounted it on the wall and don't expect to need to. Making rather than buying something like this means I get exactly what I want and have some fun along the way so this goes in the success pile. And here it is in action (it's green because I was trying to use up a roll of filament)

photo

Instructions

  • Push the knob to toggle power on and off
  • Twist the knob to increase or decrease remaining on-time
  • Hold the knob down to enter menu mode
  • Menu items:
ItemDescription
setset the default on-time. This is what the timer will be set to when the power is switched on
brtset display brightness
beepset when the warning beeps start
flshset when the display starts to flash
doneexit menu
  • To replace the fuse
    • unscrew the two front-mounted screws
    • pull off the fuse holder
    • take out the old fuse
    • put the new fuse in
    • insert the fuse holder
    • screw in the two front-mounted screws