Light Dimmer ideas


#1

I found this through a web search via a Home Assistant forum. Light dimmer that is made to operate with a microcontroller of some sort. It brings the zero crossing out to logic level and receives a control signal for the mosfet gate.
Very cool; but obviously no regulatory certifications (sonoff anyone?)

https://m.ebay.co.uk/itm/AC-LED-Light-Dimmer-Module-Controller-Board-ARDUINO-RASPBERRY-Smart-Home/111764492631?_mwBanner=1

I think if someone was to use it paired with esp8266 or actually with sonoff it would work well. My concern is that the light may flicker or turn fully on/off during a network connect. Possibly could use a helper ic and some non-blocking code to make it work.

Anyone else have good ideas?


#2

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.


#3

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.


#4

@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/).


#5

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:


#6

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.


#7

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


#8

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?


#9

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


#10

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


#11

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…


#12

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


#13

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

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


#14

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!


#15

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?