I’m trying to set up normal white LED strip under the kitchen cabinets with a touch sensor, but can’t seem to get it to work. So I’m asking the great minds of this community for some help.
I have it wired like this: 12V power supply: positive terminal goes to positive LED terminal, positive stepdown regulator IN and drain pin on mosfet,
negative terminal connects to every gnd terminal: stepdown IN and OUT, led strip, GND on esp32, gate pin on mosfet with 10k ohm resistor and source pin on mosfet,
then from stepdown regulator positive terminal goes to vin pin on esp32.
Esp32 pwm gpio32 is connected to gate pin on mosfet via 10k ohm resistor and gpio33 to my metal touch ‘‘pad’’ which is just a metal circle
i would like to use that metal circle for: a quick touch: turn on the lights second quick touch: turn off the lights holding it: gradually increasing the brightness or dimming
As for the touch sensor, I’m just using a thin metal plate…
I need to point out I used chatgpt to help me with the code, I only now see that it doesn’t know what it talks about, I’ll got to documentation, but I would appreciate any help I can get.
A written description of the circuit is gibberish to an Engineer. Engineers speak in schematic. Your connections drawing is not a schematic, but it’s close enough that I could draw a schematic from it.
A glance at the schematic shows immediately why it won’t work:
All the mosfet is controlling is the current through the source resistor.
The LED strip is across the power supply and never turns off, let alone dim.
First, you have to move the LED strip connections:
Second, you are asking a binary GPIO pin to detect a low-voltage analog signal. This won’t work. A touch switch works by detecting the electromagnetic radiation that is all around you. If you have ever touched the input of an audio amplifier and heard hum, this is what the touch switch is detecting (and you are an antenna).
So, you have to give the GPIO pin something to detect. This MIGHT work, but I don’t know how sensitive a binary input is to a resistive touch. (Note the plate is split and your finger acts as a resistor.
Better yet, if you make GPIO33 an analog input pin, then there is no need to to split the touch plate. You can just detect the change in voltage when you touch the plate.
Thank you, I’ve tried the second schematics and it now works but the LED’s are only getting 7,20V and not 12V that’s needed…
I’ve tried with another 12V power supply, still the same…
I’m lost.
Thank you and sorry for the gibberish schetch, I’m not an engineer
Because you are using the wrong MOSFET. The IRF530N is a high power MOSFET and needs more than the logic level voltage on the gate, Vgs of 20V, so you aren’t fully turning the MOSFET on. It’s probably getting warm as well. The gate resistor is there to prevent the MOSFET from going into oscillation- anything from 1K to 20K will work.