Looking for some advice on how to put some smart dimmable lighting in my RV - my only caveat is I want physical switch control (da wife) as well as with regular automation.
Was looking at a dimmer switch like this which uses PWM:
Could I power the switch then feed the lighting output into a D1 Mini and then have the D1 control the light fixture. I did something similar with my gas fireplace which has a normal light switch to turn it on and off and it worked really well. I was able to capture the switch toggle on one of the inputs and then used a relay wired to the gas terminal to turn the fireplace on or off. The PWM stuff is outside my league though.
The problem with using that is how dovyou plan to report the state back to HA? I use mosfet breakout boards and a rotary encoder. You can find nice looking rotary encoder similar to that dimmer. A lot of then also have a switch built in so you can turn either direction plus actually push the switch to toggle on/off. Doing it that way it’s pretty straight forward physically controlling the light while still tracking the brightness level in HA and controlling it from there too.
It’s a mosfet module. It’s how you control higher voltages/current than an esp can do alone. It takes a 3.3v pwm signal and steps it up to 12v pwmor whatever you need. You can dim led’s, control the speed of a motor, or just use it to switch on/off 12/24v loads. It’s a transistor/mosfet… They’re the most common component in any circuit you can build
There’s no shortage of information on the Internet on how to dim leds. I assume you havnt tried Google and educating yourself. You can’t search for “esp8266 dim led” ? You have to make an effort bud, this is a DIY hobby.
Have another drink bro. You don’t have to be a prick. Your solution doesn’t (at least to me) address handling a physical device for light level control. Of course you have that sorted…
You’re in an esphome forum… The device is the esp, the rotary encoder or potentiometer and the mosfet. When you put the 3 together you can control a wide range of devices including led’s. What you are confused about is you think it’s my job to be your private tutor and hold your hand, it’s not. I pointed you in the direction you needed and told you the components you need. All you had to do is do some basic searches with Google or here and put it together or just copy one of the many projects that do this and are widely available online. All you have to do is use a search box. If you can’t do that, you better just stick to some premade Tuya crap.
Hopefully, I cleared the air on this one.
You need following materials
Esp32/ESP8266 node-mcu or any other esp32/esp8266
Power mosfet.
12V power supply which you already have in RV
connection is simple.
12V connected to the VIN + and VIN - side.
light connected on the OUT + and OUT -side.
Connect GND from esp32/8266 to gnd pin on the power mosfet, and TRIG/PWM will be connected to any GPIO pin on the esp32/8266. in my case it is GPIO19.
Thanks for all the responses. I’m not an electronics guy but my guess is a rotary encoder is just a variable resistor. For the device I want to use, it is already outputting a pwm signal. Can an Esp read this signal and calibrate it to a brightness level?
I don’t like the look of a rotary encoder in my application.
Why would you guess what it is when you could just look it up? No, it’s not a variable resistor. They look similar but they’re completely different things. You’re making this way harder than it should be. If you already have a controller than use that. Trying to use a pre-made controller and then add onto it what is essentially another controller doesn’t make any sense, it’s like a dog chasing its tail. If your not into electronics and for some reason can’t Google anything, then you need to buy a controller that will do what you need and integrate into HA because what your trying to do is going to be a nightmare and this actually very simple and a beginner project
I mocked up the circuit for you. Instead of that red wire going to an led you would use the pwm terminal on the mosfet board or you can use an led w/220ohm resistor to test it.
here is the code for it. The rotary encoders usually have a push switch built in so you can push it to toggle on/off then spin it for changing the brightness. I didn’t add it in the circuit but its just one more wire to a gpio and the other pin from the encoder goes to ground.
Justin,
Did you look at the dimmer I want to use? Its tap to toggle on/off and press hold to dim. I don’t want to use a rotary switch, I am trying to get a bit more modern behaviour and not look like an electronics experiment.
I think you’re in the wrong place. I clearly said, “I mocked this circuit up”. Was it not obvious that it’s not a finished product and it was to show you how to make the circuit? I told you that switch wont work and someone else did too. It’s not going to change by asking over and over. I think you might be in the wrong place. You can find those cheap Chinese Tuya dimmers and such that aren’t an “electronics experiment” but they are idiot proof and you basically just plug therm in.