2 channel in wall dimmer
Hi here is my 2 channel dimmer project that I am working on. The project will fit a 70 mm in wall round box. There are still some things to consider in the design, but i expect that i will be making an order within the next 2 weeks for this prototypes.
If there is interest i can share more about the project
Really nice - does this use 240v to power everything?
How do you convert it to 5v? Please share
Is it a atmega328?
fleinze last edited by
Could you share schematics?
How many Watt/Ampere are you trying to dim? Is residual heat from the transistore/thyristors? an issue?
Here is the schematic of the conversion from 240 V to 5 V. It could work for 110 V as well but that needs to be simulated.
Be aware that by this type of design with the transformer less design considerations needs to be taken when connecting computers and other stuff. So my recommendation would be to program everything without 240 V attached.
I have used the 328P
The picture below shows the AC to DC conversion. This design can handle ~30mA on the 5V side.
The AC is on the left hand side. the 0.33 uF capacitor in series on the 240 sets the maximum current, which should be around 10 mA on the AC side (Theoretically 25mA, simulated 10mA).
Be aware that not all values in the design below is correct to get the MAX 17552 to work.
Ther Triac in the design is T405-600B which should be able to handle 4A current if i read the spec right. I have not tested it yet so i dont know how much power dissipation there will be
It would be nice if you could explain how you think about safety with high voltage.
We have had several good discussions you maybe seen, but whats your thoughts?
What i mean is that care needs to be taken when using this type of design when it comes to handling. The main thing is if the 0.33uF capacitor breaks then there could be 240 V on the low voltage side, so as long as you handle the equipment with respect to this then i believe it will be safe. That's why i will only use the inbuilt wall switch together with this as that one is rated for the 240 volts.
Also there can be a grounding issue as this design is floating. This is why i will not connect my programmer to this with 240 Volts connected, most likely nothing will happen, but better be safe than sorry, don't want to damage my computer.
The only thing i think i will add in the design is a thermal fuse to be on the safe side. I have one of these ACS712 that I can read the current, but then everything is up to the programming to make sure you don't have any over current in the system that causes heat.
I have also added 0.75 mm isolation distance between traces on the board as well as having thick enough lines for the 4A that I have designed for.
I have now made a new layout on this where i have added a Thermal cut off resistor as well. This made me rearrange some things on the board. At the moment I am still investigating the best triac to use and if it will be "quiet" enough on the line if i use the snubberless version of the triac.
Here is the current schematic of the design.
Interesting! Im following this since im also trying to figure out a good in-wall sollution.
First attempt to see how a box could look like
Diameter 56 mm 50 mmside to side
Very nice @Denke!
stephenmhall last edited by
I like it, what sort of switch would be on the wall?
This project is in-wall only. You can control it any way you like - from smartphone, PC, remotes or physical switches.
I like the project very much.
How are you sure that this hardware circuit is suitable and safe to give stable output ? I am asking that because I studied electronics but still see that a lot of knowledge are missing to implement such circuit. so, how did you learn this ? This is not a normal full wave rectifier It looks professional
goranrad last edited by
Very nice Denke,
I suspect this unit is going to be mounted in wall behind the existing switch and wonder if existing switch can be used to control the dimming. The switch have to have spring return naturally.
jemish last edited by
can we control Celling fan using this dimmer.
@Denke Can you share your files for this design?
It would be awesome and this looks great!
I will try to answer your questions.
Q: what sort of switch would be on the wall?
For this design i would recommend that you use 230 V rated switch to control the dimmer. The output is still only 0V that you switch on and off. But the design is made in such a way that if you get short circuit on the capacitor in series in to the rectifier there can be 230 V on the input pins ( very unlikely because of other things will burn) but it can happen.
Q: How are you sure that this hardware circuit …….
Doing a little benchmark and understand how dimmers and switches from NEXA or similar are working. Actually I ripped them apart and found out that they were using transformer less designs. From that I Googled this and read up on the topic as well as discussed this with colleges of mine. I then changed some parts as the transformerless design would in simulation not give more than 10mA so I added the MAX 17552 circuit in between and set the input voltage to 24 V with the zener diode and by that I will be able to draw about 30 mA (starting current of the circuit that I tested is around 24 mA).
Q: I suspect this unit is going to be mounted in wall behind……..
Yes of course but just use it as the switch, what I mean is that don’t use at ordinary switch were 230 V is applied. The circuit is designed to just feel a logic zero on one of the inputs. ( just make sure that you read my first reply above for safety reasons)
Q: can we control Celling fan using this dimmer.
Should not be a problem as I have used Triacs that are made for inductive load (not tested though). But the fan should not consume more than 4A. I also have not tested from a heat perspective how much power I can have running in the system. It might be less than the 2 channels times 4A.
I have not descided yet if this is something i will sell or not so before i take that descision i will not share the actual design files but I will be happy to answer questions around the design and the considerations i have taken.
I might post a question later on if someone wants to join on first ordering for the prototypes/functional version, as this is the first step, primaraly to equip my house with these gadgets. In such a case i will offer those dimmers for a very low cost
So, what is the problem of sharing design as open hardware and at the same time sell your boards assembled?
@hek Its more that i at this moment have not gone through the pros and cons of open hardware. And this is something i will read up on. So Im not saying that i will not share, but i need my time to go through it.
Thanks for answering.
I have a question regarding dimmer circuit. I read that these circuits needs EMI filter. Is this something else rather than adding a snubber circuit ?
This issue I found in this link : http://hackaday.com/2015/04/19/switch-mains-power-with-an-esp8266/
the TRIAC will dump out a ton of EMI (that’s why most commercial dimmers have to have a choke in series with the load to be able to get FCC certification).
Hi This circuit is not tested yet and can as you describe put out some or as stated a lot of EMI (Electro Magnetic Interference). I have not yet taken this in to account when designing this but have had it in the back of my head for something to look in to.
The snubber circuit is more to protect agains "current rush" when you switch of an inductive load. This is actually something you use on the 5 volt side of relays to protect the transistor from breaking down. Andyou should also use on the output side of a relay for example if the cable you are runnigng is long or you want to switch of an inductive load
@Denke clear enough. Thanks
Hello @Denke , any updates about your progress ?
This will make your box less
@Ivan-Z Thanks I will look in to this design and what it means to the design
@ahmedadelhosni Going slowly at the moment had to do a respin on my thermostat project as i have made some small errors. Some of the design is the same so i will verify some things on the other design. Also waiting for chinese new years to end
ahmedadelhosni last edited by ahmedadelhosni
@Denke Yeah the holiday takes a long period there
Actually yesterday I read a lot about AC-DC converters and really learned new things, but I may need your help in clarifying some points please. I watched this video which guided me to this type of circuit design. Modlet Smart-Outlet Teardown and Review - (IT'S A POS)
Be aware that by this type of design with the transformer less design considerations needs to be taken when connecting computers and other stuff.
1- What I learned yesterday is that a "transformless" design is not safe ( don't know to what level of safety though ), but I read that there is no isolation between Main inputs and low voltage.
- Is this normal ? Would that affect the Atmega and other components ?
- How to avoid this ?
2- The above video mentioned that the Modlet outlet uses LNK304DN Datasheetwith outputs 12V. The below picture is from the datasheet and that reference was even used in the Modlet outlet as mentioned in the video.
- There are different designs in the datasheet but I can't diffrentiate between them and what is the best to use, but in all cases, this design still lacks the safety procedures, correct ? Like there is no MOV, Fuse .. ? It is just the circuit to produce a 12V 120mA which shall be stable and not noisy. Correct ?
The AC is on the left hand side. the 0.33 uF capacitor in series on the 240 sets the maximum current, which should be around 10 mA on the AC side
I then changed some parts as the transformerless design would in simulation not give more than 10mA so I added the MAX 17552 circuit in between and set the input voltage to 24 V with the zener diode and by that I will be able to draw about 30 mA (starting current of the circuit that I tested is around 24 mA).
Can you explain what the 0.33 uF does to set the maximun current ?
- What is the maximum current and how was it calculated ?
- How can I increase the output current to 100mA 5v/3.3v ?
- Actually the schematic is not clear at all when I download the pictuers. Maybe resolution
Thanks a lot for your support.
@Denke Very nice project! Hope to see a working protype soon. Any thoughts about making a relay switch based on this design. Will there be space and power for a 10A relay?
@m26872 I guess there will be space for 1 or 2 relays. But it will be crowded, but nothing is impossible
tante ju last edited by
- Is this normal ? Would that affect the Atmega and other components ?
- How to avoid this ?
This is a matter of reference. When you have a power source with no contact to any othe rreference you are safe to touche one contact of that power source. If you make contact to the other one, you would be a resistor to the power source and act as esistor, having current runningthrough your body with all the negative impacts, including chance of death.
As explained, that is a matter of the reference. When you use a transformator, where secondary is not connected to anything else, you could safely make contact. In case you use any transfromless design, everything is somehow connected to mains. You are connected to grounds, so touching anything would be dangerous. As long as you do not touch anything, you are safe.
In fact a lot of electronics is tranformless with enough and safe insulation around it, so that no contact to grounds is possible. It is not only affecting persnal health, but could also be a source of fire if there could leak any current to grounds or mains from that circuitry. That's the reaosn for the insulation.
In fact this applies to transformators as well, as the primay side has contact to grounds.
So, it does not affect any Atmel or so, it just raises the level of security precautions you have to take care of for this type of circuitry.
Thanks for great clarification.
So does this only happens when the device is pluged in the wall ? In other words, there are a bunch of capacitors and passive components in the low side which has rederence to main inputs ( that's what i understood ) so touching is damgerous while plugged. But if i unplugged the device, will it still contain charges which can kill me ?
Suppose this is a wall plug and I have both terminals of the plug free to be touch ofcourse. So will the charges disappate through the terminals and then to my body ?
@ahmedadelhosni : I agree too. yes mostly inwall. and yes there still can be some capa charged.
for the difference in the schematic. Generally you can use the standard schematic in datasheet for simple things even if you have to add few components. But for things like transformerless, which is more tricky for instance, it is not sufficient. you have to add components around. I don't remember right as I have already looked at this (and have a bunch of lnk306 and tny in stock), there are more complete schematics in appnotes or in the datasheet. But footprint increase to have something more secure or more optimized (the reason why I choosed hilink finally, but in some case transformerless makes sense and insulating is mandatory!). There are online tools at powerintegrations, to calculate what is possible to do regarding value of component.
Thanks Tante-ju and Scalz for helping out with the answer. This is why i stated that you need to treat the equipment as hot, becouse that you don't have control of the reference to ground. But as long as it stays "inwall" and you are using 230 V rated switches on the low voltage switch then the insulations shall be ok and safe. But as soon as you open up and work with it you need to treat is as hot.
Thank you all. I still want to know whether there will be charges also when I unplug it or not ?
I am giving the example of a wall plug because it can be plugged and unplungged several times and the terminals can be touched.
@ahmedadelhosni That all has to do if you have some sort of bleeder. or something that uses the charge. So in my design on the secondary side (+5V) there is always something that consumes the current. On the primary side you can see that there is bleeder resistors in paralell with the capacitor. So it should be safe from that aspect
@Denke yeah great. I understood now.
I am thinking of using LNK304 to produce 120mA max. Still trying to investigate how to layout the pcb design correctly from a safety prespective.
Thanks for support
Boards are now ordered. Lets hope they will work fine. I have some doubts about EMI coming from the boards when dimming. So now it will be measure and correct if needed
Finally new boards have arrived..
Assembly will start soon:)
@Denke Nice I am really excited to see your results.
Regarding the resistor which is in parallel to act as a bleeder. What value do you think the most suitable ? 100K ? 1M ? and howa much watt ?
Hi I have used 1M as bleeder in 0603 size. This resistor should be able to handle around 0.1W.
If i have calculated right the power in the bleeder resistor should be around 0.05W
Any pictures of the assembled board ?
@ahmedadelhosni Have not started the assembly of these boards yet. Im currently doing assembly of my other project Wirsbo/Uponor thermostat replacement. And those boards seems to be fully functional.
I will post a picture as soon as I get it assembled
If I am not mistaken, isn't this the bleeding resistor in parallel with the cap ?
Why is there a reverse diode ? Won't this block the current from passing from the + terminal of the capacitor to the resistor then to gnd ?
It's a zener diode which will pass current once voltage is above 24v and then the resistor protects it from complete shorting to ground.
First components added after a visit to the lab at work and some soldering under the microscope
Hi just wanted to get an update on this project.
I have assembled 2 pcb (not all components) to start debug the processor platform and surroundings. Unfortunatly i got a bit stuck as i have problems loading the boot loader. I have tried to use the process suggested on arduino.cc using an nano as ISP. I get alot of strange behaviours and are not able to upload.
Any tips and tricks is well received if you have any.
Othervise i will rest this project for a couple of weeks to be able to finnish my other thermostat project as well start a new, as the pool season is around the corner. And i really would love to be able to corntol pupm, lghts read temperatures and other stuff.
But if i find some good tricks i will pursue the goal to finnish this in wall dimmer before summer.
Oitzu last edited by
I get alot of strange behaviours and are not able to upload.
You not yet have added the nrf24, or? With the nrf24 module added the upload via isp will not work.
Can you describe any more behaviour? Log output, led flashing...
@Oitzu - why should not burning a bootloader to the atmega work without the nrf24 attached?
Oitzu last edited by
@sundberg84 in most of my cases it failed due to spi interferences.
@Oitzu Ahh, sorry I missunderstood you - the other way around. I read it like you had to have the nrf attached to make it work