DONOFF – WiFi enabled light dimmer (Part 4)

[ 684 views ]

Part-4 – Building a DONOFF device

I will, in four parts, explain how you can build and use this DONOFF ecosystem.

In the previous parts I introduced the DONOFF ecosystem.
In this part I will show you how to build a DONOFF device.

Warning: Any circuit that deals with MAINS VOLTAGES is inherently dangerous, and you should NEVER handle mains voltages unless you know exactly what you are doing. The DONOFF circuit is purely theoretical and offers no isolation or any safety features, and therefore, without modification, it does not constitute a safe circuit, or having practical applications outside serving as a proof-of-concept.

DONOFF dimmer PCB
If you still reading this I have one more warning: Whatever you do, do not build this circuit on a broad board!
You can build it on an experiment-board (use a board with pads on both sides) with proper soldering. But the best way by far is to use a dedicated PCB.


The PCB is designed using KiCad 5.0 and is produced by PCBWay. The standard copper layer used by PCBWay is 1 oz/ft2 and according to the Online Trace Width Calculator the track width for the High Power (HP) traces should be about 2mm.


 
Bill Of Material (BOM)
You need the following parts:

# Part Description Price €
1 DONOFF PCB © by Willem Aandewiel 6,00
1 IRF 730 Q1 – Power-MOSFET N-Ch TO-220AB 400V 5,5 A 0,75
1 B420C1500 (Round) D1 – Bridge rectifier 1,5A 420VAC 0,25
1 1N4007 D2 – Diode 1000 V 1 A 0,05
1 1N 5352BG ONS D3 – Zener diode 017AA 15 V 5 W 0,25
1 4N 35 U1 – Optocoupler 0,30
1 2 Watt Metal 150K R4 – Metallic film resistor 2W, 5% 150K-ohm 0,15
2 Metal 220 ohm R3,R6 – Metallic film resistor 1/2W 220 ohm 0,20
1 Metal 6k8 ohm R7 – Metallic film resistor 1/4W 6800 ohm 0,10
2 Metal 10K-ohm R2,R5 – Metallic film resistor 1/4W 10K-ohm 0,20
1 VDR-0,6 460 RV1 – Varistor Rm 7,5mm 0,6W 460VAC = JVR14N751K 0,30
1 RUBY 100PX47MT78 C2 – Elco Radial 47 uF RM 3,5  105*C 2000H 20% 0,30
1 MMK 220N 400 C1 – Film Capacitor 220nF 400V 100*C 0,30
2 LAKL 1,5 2 5.08 J1,J3 – Phoenix Screw terminal 2-poles RM 5,08mm 90* 1,25
1 LAKL  2 2.54 J2 – Phoenix Screw terminal 2-poles RM 2,54mm 90* 0,60 
1 K TR 1,0A Fuse 5x20mm Slow Blow 1,000A 0,55
1 PL 112000 F1 – Fuse holder 5x20mm max 6,3A/250V 0,30
1 AC to 3.3v DC  PS1 – Hi-Link HLK-5M03 or Mean Well IRM-01 7,40
1 ESP-01 U2 – ESP8266 module ESP-01 black edition (1MB) 5,90

Total cost of all parts (excl. proper casing) less than € 26,-

Putting it all together

Building a DONOFF device involves a view steps that should be followed in sequence.
Before you begin, make sure you have all the right parts!

Step 1

The High-Power traces on the PCB are only 1.5mm wide. To comply with the rated current of ~1 ampere I have left-out the solder-mask on these traces to make it possible to raise the maximum current by covering them with solder. It is absolutely mandatory that you do that!

 

Step 2

Solder the lowest parts on the PCB first. These are R1, R2, R5, D1 and U1.

Make sure you place D1 and U1 in the right way, the D1 “+” pin point opposite the markings on the PCB. U1 has a tiny mark (dot) near pin 1 or a small groove. Align pin 1 towards the 1 on the silkscreen.
The resistors have no polarity so it does not matter how you place them.

 

Step 3

Place R4 but make sure you elevate him a bit above the PCB as this is a component that dissipates a lot of heat and the more air surrounds it, the better it can get rid of this heat.
The temperature of R4 rises about 15°C above the ambient (surrounding) temperature!

 

Step 4

Now place the diode D2 and the resistors R3, R6 and R7 vertically.

Try to place them in a way where there is the least chance the wires from the resistors can make contact with other parts on the PCB.
The polarity of D2 is important! The white stripe on D2 connect to to the square pad on the PCB.
It’s always a good idea to isolate them with some heat-shrink tube.

 

Step 5

Solder D3 vertically on the PCB. The polarity is important!

The white stripe on D3 connect to to the square pad on the PCB. And again, some heat-shrink on the exposed wires makes it a little safer!

 

Step 6

Next place F1 (fuse holder), RV1 (varistor) and C2. Make sure you align the white stripe () on C2 with the white arc on the PCB!


 

Step 7

Solder Q1. The metal plate of Q1 points to C2. To lower the profile of the DONOFF dimmer you can bend Q1 a little towards C2. And again, some heat-shrink over Q1 reduces the chance for a short circuit and lower the chance you get electrocuted.

 

Step 8

Solder the 2×4 header for the ESP-01 and the three screw terminals for Mains-In, LED-Out and Ext.Switch.

 

Step 9

Finally solder C1 and PS1 on the PCB.

Your done!

The DONOFF dimmer hardware is ready for the ESP-01 to be placed on the 2×4 header.

As I stated before, this project is very dangerous due to the high voltages involved and the many exposed parts that carry these high voltages. It is best to place the DONOFF dimmer in a suitable casing before you connect it to mains.

Rapping it all up

I used a mains extension cord and cut it in 1/3 and 2/3. The power plug is connected to the MAINS IN terminal, the power out is connected to the LED OUT terminal.

 

 

 

 

 

Adding a foot switch

The external switch is isolated from mains and connected to the low-voltage (3v3) part of DONOFF so you don’t really need to use a mains-power cord to connect the switch. As, in this case, it is a foot operated switch I choose to make it rigged.

This entry was posted in Arduino, DONOFF, ESP8266, Hardware, SONOFF, WiFi and tagged , , , , , , , , , . Bookmark the permalink.

5 Responses to DONOFF – WiFi enabled light dimmer (Part 4)

  1. K.G. Dik says:

    Willem , ik ben iedere keer weer onder indruk van de mogelijkheden van de huidige electronica, maar dat wist je al!
    Ik ben benieuwd wat je dit jaar allemaal weer fabriekt!
    Kees

  2. Erik Meinders says:

    Willem,

    This is exactly what SONOFF misses; the ability to dimm your lights. Even LED lights, which of course is today’s standard. I can’t wait to see what else you come up with in 2019!?

    Keep up the good work,

    Erik

  3. Rob says:

    mooi project willem. Nu nog een versie ontwerpen die zoals de zwave en shelly systemen achter een schakelaar in een wcd past.

    • Willem Aandewiel says:

      @Rob,

      I’m not familiar with zwave and shelly but I wonder if they have PWM dimmers that small …. But of course that is the ultimate goal.

  4. You can place your comments after Part 1

Comments are closed.