Light Dimmer ideas

That module has a BT139-600E Triac on it with an optocoupler for control. Just based on what I can see in the photos it seems like a very common setup. I’ve done almost the same thing in some projects, for example I did a controller a few years ago with two output channels, each with a Triac controlled by a MOC3042S Triac-driving optocoupler with built-in zero-crossing detection. I’m pretty sure it would be functionally almost the same thing as this module.

The big problem with all these things, as you point out, is certification!

If ITEAD can do a version of Sonoff with dimming, and they get it certified, I think it would be a killer product. I’d buy about 30 of them and rip out all my relays.

1 Like

I’m remodeling my 1909 craftsman Home in the USA (Oregon). I’ve been planning my “Suprhouse” for more than 20 years. All new wiring, plumbing, built-in AV, the works. My lighting has been the hardest thing to design. Do I go with traditional light switches or do I go with LV controlled lighting. After your last epiphany and simplification of your lighting controller scheme, I finally settled on LV lighting. I need to control my lighting at each entrance to a room and also remotely using a touch panel.

Getting past the inspections is one of my main concerns. I would like to dim all of my main room lights but the lack of a certified dimmer solution (that’s reasonably priced) holds me back. I think that I will install all of the lighting like you did Jon, then after the inspections are concluded I can add dimming between the relay and the homerun light panel. I left plenty of room in my lighting panel for dimmer circuits. Additionally, I can add occupancy sensors to any light in the same manor.

I ran across a good article on designing a zero crossing dimmer controller that might be of interest.
http://esp8266-projects.org/category/ac-dimmer/
This is open source/hardware and one of his designs has an onboard processor (Atmega I think) to control the z detection making it very tuneable and able to work with 220v or 110v. As I understand it, you can’t use a zero crossing Triac like the BT139-600E with an LED dimmer because of a problem I’m still wrapping my mind around. At least that’s what I’ve read in several different articles about LED dimmers. The PWM zero crossing needs to lag the actual mains zero crossing to eliminate flickering, or some such thing. One of the designs also adds a DAC for controlling the PWM for a very precise and smooth dim. The DAC also has nonvolatile ram to remember the current setting. Definitely a handy feature. I really like having a cheap processor on board because once you get the board tuned, it is easy to clone the processor for more add-on boards. This should also eliminate flickering and random lighting anomalies that evidently plague similar boards. Also for ESP8266 enthusiasts, he has a dimmer board controlled by that. For those less electronically inclined, he does sell finished boards for $15-$25 depending on type, although the $15US shipping is a pain.

I personally would like to make my own boards, mainly because I need about 20 of them and I need to get the cost down to about no more than $10 each. At least I can have the bare boards made up and then populate them as I can afford too. I might also design a multiple board with maybe 4 circuits per board. I’ll post more information as I progress. Right now I’m just trying to finish wiring the house lighting so I can get on to drywalling.

1 Like

@MisterFixit1952 could you use a manual dimmer button setup with smart bulbs and buttons/potentiometer on the switch to control the dim level?

Basically the same setup that @jon has except, two buttons are used to dim (or you could use one that goes up and down the longer you hold it). Button is being polled by controller, then anytime the button is pressed, increase/decrease an MQTT value which is then synced to the smart bulb using an integration in openHAB or Home Assistant. Then if the button is switched on/off, the brightness is set at the last known value from the MQTT service.

Only tricky part I can think of, is syncing up the MQTT dimmer value if you change the lights via the proprietary app (Philips Hue for example). Maybe every 60 seconds or so, the lights are polled individually and the MQTT dimmer value is updated to match? Alternatively, just don’t use the proprietary app and stick to your custom setup :grin:

Again, I think you could run all of that off of a 2-3 button board (which jon has in the shop for $7/ea https://www.superhouse.tv/product/light-switch-rj45-breakout-3-button/).

Hi just joined this community and am also thinking about the ability for LED light dimming using SonOff and PWM.
In my case it is for an existing lamp that has 10x 10W halogen G4 bulbs which I want to replace with 1,5W LED G4, 12V.
For the dimming I want to make use of a SonOff Basic, and use GPIO14 for PWM signal to a MOSFET board that is connected to a 12V power supply. The relay on the SonOff to switch the 12V power supply on/off.
I want to put these 3 components in a plastic enclosure that will replace the current power supply and dimmer for the halogen bulbs.

If possible, I want to connect a rotary encoder to GPIO4 and GPIO5 (requires some soldering) to be able to manually set the dimlevel.

And by using Tasmota based firmware it is also possible to control the lamp remotely.

Not sure if this is a feasible approach but it is nice to start understanding the SonOff before installing it at other places in the house :slight_smile:

Hi Ocram72 - the sonof basic does give dry contacts for you to switch 12v - in other words it only can pass the mains voltage through the relay. I believe the sonoff 4c gives terminals for common / NO / NC of the relay. If you were already planning for three individual circuits then this may be the way to go anyways.

1 Like

Thanks for your comment. The thing is, I do not want to use special programmable bulbs. One is their expensive and two they generally have a noticeable lag, also they tend to have a shorter life than a standard LED bulb. The main thing is I want to keep the Dimming circuits standardized for the entire house. Also, a programmable bulb can cost about $15 each and I would like to build the dimming circuit for about $10 each. Every time I would have to replace a $15 bulb instead of a $5 bulb, the cost of dimming goes up instead being fixed at the $10/per level.

Another thing to consider is standardization. If there is a problem with the lights, it’s easier to troubleshoot if every light circuit is the same. Also programming the system is easier. Whie programming the lighting system it will be an easy thing to include dimming into all of the light’s programming but just comment out the dimming portion until it’s implemented. Or possibly implement the dimming in the MQTT (or node red) portion of the interface.

I haven’t decided how to implement control of the dimming yet. I could use 2 buttons for each light, using one color to designate the on/off button and one to control the dimming function by holding down the button, causing the level to increase or decrease. Another way to control the dimming would be to use only one button for the on/off with dimming control being implemented through a touch screen web interface.

I plan on having at least one 7 or 10 inch inexpensive tablet, wall mounted, in each main room, probably above the central lighting switches. Since a cheap tablet can be purchased for as little as $50US (or less) and the tablet only has to connect to the house web server. In my case, the server room is centrally located in an attic room in the center of the house, a short distance above all of the main floor rooms, Additionally, I have a second WiFi in the basement hallway closet along with all of the basement lighting controls and AV equipment for that floor.

This post is getting a bit long and I have a lot more to say about my house and my smart home project so I am going to move my conversation over to my own topic to continue cronicalling my project.

MisterFixIt1952

Hi @aspork42,
The relay of the SonOff basic is intended to switch mains voltage in my “project” - the 12V power supply has mains input and 12V output. So the SonOff relay switches the mains input of the 12V power supply. The output of the 12V power supply is connected via MOSFETs to the lamp, and the MOSFETs are controlled via PWM from SonOff Basic GPIO14.
Am I overlooking something?

hi i new to this stuff but i would like to do smart home as well and i like your review and sonoff products but lack of dimmers its issues.I live in uk and i found similar product to sonoff but i would like to ask your opinion and they do dimmer as well and few cool stuff as well if you would like to check and give you opinion it will be great
http://glstouch.co.uk/epages/950018119.sf/en_GB/?ObjectPath=/Shops/950018119/Categories/VIDEO
http://glstouch.co.uk/epages/950018119.sf/en_GB/?ObjectPath=/Shops/950018119/Categories/Category1/RF_Remote_Panels

Ahh - so you are just switching mains voltage which is downstream plugged into a wall-wart 12vdc adapter. No problems with that.

Those look nice, ridersh. They do require Line and Neutral which in the us only became the norm relatively recently. My house was built in the late 60’s and does not have Neutral available. They also cost 25 GPB each which would add up very quickly…

@jon we might have a topic for a future episode :slight_smile: light Dimmer comparison for “what is currently available

1 Like

Yes, there’s some very interesting information in this thread!

Dimming is a huge topic that I’d love to cover in future.

1 Like

I managed to have the “demo” setup ready!
Used Tasmota for the SonOff basic, Mosquitto, Domoticz and Node-Red on Raspberry Pi 3.
Everything works, NodeRed is indeed great. Did not fully utilize Domoticz (yet), one step at a time.
The PWM of the Tasmota firmware sometimes flickers a bit, probably when the firmware is busy with “other” tasks like posting the Tele-data once every 5 mins…
Tried to solve this by disabling all unwanted modules (webserver, infrared, I2C…). Slight improvement but not 100% happy.
I have read somewhere else to make use of a dedicated PWM device with I2C connection to the SonOff, hopefully I don’t need to go that road. Need to dive a little bit deeper into the Tasmota firmware to see if improvements can be made to how the PWM is implemented.

With regard to the “manual” control of the light intensity with a Rotary encoder, I think I want to make use of the GPIO2 and GPIO3 instead of soldering a wire to GPIO4 and GPIO5… too small to solder directly onto the ESP8266 chip for me!

Could you post a video?

I have considered a down and dirty method for dimming using the rheostat and a servo. So good or no good?

Ocram72, in case you missed it in my above post, check out this web site.
http://esp8266-projects.org/category/ac-dimmer/
Look around because the gentleman who did the post has several on the site including one using a esp8266 and since his work is opensource and open hardware, you can find his program on github. Also he goes into why you get flicker and has some good info on the subject
Also he evidently uses Domoticz because he has several articles on dimming with Domoticz and the Raspberry pi. He also sells fairly reasonable finished hardware and bare boards if you prefer. to make your own. A couple of his boards use an onboard atmega cpu for the brains of the zero crossing.and dimming.

Aspork42
By rheostat I gather you mean a slide or knob dimmer. You have to be sure to use a dimmer rated for LEDs if you plan on using them…Before you give up and try the servo route, read the link above. He will give you some very good info about digital dimming, do’s and don’ts etc.
The problem with using servos is by the time you add at least an arduino tiny along with a servo driver or for wireless, a esp8266 or lua board, you quickly get to the point where you have spent almost as much as a lutron or such and that’s not taking into account the programming, debugging, etc. Could turn into a PIA very quickly. Especially if you need a bunch of them. Hang in there. Jon,myself or one of the other talented individuals on this blog will come up with a good, reasonably priced option for dimming. When I get my relay panel finished next month, I plan on devoting some extra time to the problem.

2 Likes

DMX with constant voltage PWM output for led lighting control/dimming? Your thoughts? I will be starting a new build in 8-12 months and have just started on the home automation journey. I like the idea of all lighting controlled and powered from a central hub/s.

Hi,

@aspork42
I can try to create a video, not experienced on that area :slight_smile:
I also have the “manual” control using GPIO1 & GPIO3 in place using a Rotary encoder. That part will be wall mounted, and can control the dimmer remotely. I am aware of the dependency on WiFi, not ideal but for now the only option.
I used Node-Red only, no integration with domoticz yet. One step at a time, Domoticz is running on the Pi but I could program all I wanted using NodeRed.

@MisterFixit1952
I checked out the website you mentioned, but that is for AC dimming - probably usefull for other lights in the house. The LED lights in the lamp I wanted to dim using PWM has 12V input. I did not want to PWM the input of a power supply, so AC PWM dimmer not an option for this setup.
Probably there are better solutions already available, but this is also a hobby for me - it’s nice if you create something yourself :smiley:

In general, it works as intended at the moment. Needs finetuning offcourse. I must admit that the brightness of the 1,5W G4 LEDs is quite impressive, and at 1% dimming level there is still quite some light emitting. Checked with a scope, and the blockwave is OK - so probably the LEDs are a bit “slow”. If I turn PWM frequency to a higher value, the lowest PWM value becomes more bright. So I use 200Hz at the moment.

Ocram72 - if you have a smartphone, just take a video with that. Then log into this website and you should be able to upload directly to the forum with the “Upload” button.

image

It’s great if you are using 12V leds for lighting. Dimming 12v DC is a breeze. There are a bunch of inexpensive Chinese modules and gizmos that you can buy that make it easy to control low voltage LED lighting and power supplies including WiFi interfaces, wireless and such. Banggood.com has bunches of different products, cheap.

Unfortunately, I need to wire my house using 110v AC so I am stuck doing things the hard way. I am doing some LED strip lighting in a couple of my rooms. I plan on hiding the strips behind the crown moulding in those rooms. The crown moulding will be dropped a couple of inches down from the ceiling and the strips will be attached to the back side of the moulding aiming up at the corner of the ceiling giving me a reflected glow in the room. Nice for mood lighting. I have RGB strips so I can change the colors to fit the mood.

Also on my front porch stairs, I wired for RGB strips under the lip of the brick treads. I have two columns on each side of the stairs and I put proximity sensors in them to turn on the lighting as you approach the stairs. I will be able to change the lighting to reflect the season or holliday, like orange for Halloween and red and green for Christmas. I can’t wait to get my lighting panel finished so I can try them out. As soon as the weather dries out a bit I will be able to install the strips and hook them up to the wiring, which was embedded into the mortar of the steps when I laid the bricks. The wire goes into the crawl space behind the stairs, under my living room. That’s where the power supply for the lighting is. I have cat5 wire running to the attic lighting panel to control the 12V lighting circuit and RGB controls in addition to the proximity sensors. I will be able to arm the lighting, using my master daylight sensor and control the color scheme through the house control panel. Same with the room mood lighting. The room lighting power supplies and RGB controller are in the attic near the lights.

MisterFixIt1952

That sounds awesome - you should post a new thread for that with some pictures of what you have so far.