Im really sorry im confused on this topic can someone help me find a relay for the following job please? I have a touch sensor connected to an arduino, when pressed I need the arduino to switch a relay which turns on 12v leds, I need the relay to stay switched on (leds stay on) till the switch is pressed again? Not sure if the arduino is even needed in any of this but I dont know enough about electronics. Could someone help me find a suitable relay for this please?
You could do what you are explaining, it would just be more complicated, and more expensive than a switch.
You would need an Arduino, a relay, a touch sensor, and some wires.
Here is the code you would need:
#define relay 3
#define touch A0
#define touchLimit 800 //out of 1023
int Touch;
boolean flag = false;
void setup() {
pinMode(relay, OUTPUT);
pinMode(touch, INPUT);
}
void loop() {
Touch = analogRead(touch);
if (Touch >= touchLimit){
flag = !flag;
while (Touch >= touchLimit);
delay(200); //debounce
}
if (flag == 1){
digitalWrite(relay, HIGH);
}
else if (flag == 0){
digitalWrite(relay, LOW);
}
}
Change the relay number at the top to the correct pin you have it attached to. Same with the touch sensor. You can also change the touchLimit definition.
In theory a logic level N-channel MOSFET + TTP223 + a linear regulator to power the TTP + a few caps should be all that is needed. From my experience the TTP get sometimes stuck in "touched state" and needs a power cycle to realize there is no touch.
Cant use a plain switch as its for an infinity mirror the switch is to go behind a piece of glass
Thank you for your help and input all its actually finding a suitable relay that I'm really stuck on, something that can be triggered by 3v and capable of turning on 12v, need it to stay turned on till its triggered again been a long long time since I even worked on relays so can't remember what to even look for had a look on ebay just searching for relays 3v and got stuck and confused lol
I have a 12v led driver for the leds I need to turn this on and off using a touch switch, which I think I can only connect 3v or 5v to, so I was going to use a 5v arduino connected to the switch, when switch is touched it turns on relay/other something... which switches on the 12v to the leds, I can't connect either the switch or the arduino directly to 12v
A SRD-12VDC-SL-C relay would work fine. It works with 5V but I'm not sure if it works with 3.3V. Why 3.3V? The Arduino outputs 5V on a digital pin except for the 3.3v pro mini.
Sorry PaulB I've probably wrote the original post all wrong, i haven't got a touch sensor yet, I just have a couple of led drivers lying around, im looking on suggestions on how to achieve the following
I just want some leds behind a piece of glass, have some sort of touch sensor/switch behind the glass that turns on the leds and press again to turn them off, I know technically not an arduino but I was going to use something like a esp32 or even a d1 mini as its cheap and cheerful I could use 5v leds and I have another psu available already for 5v, however I just don't know how to make a circuit to do all of that, hope that makes sense?
There is no reason it would not; the tricky matter is arranging the electrode on the back of the glass.
OK as noted, the touch sensor I cited - with the Aliexpress link - it the most straightforward way of doing this, using an Arduino or ESP is just making things unnecessarily difficult.
To determine the best way of connecting the touch sensor, we need to know about these LED drivers and what LEDs you wish to use with them. "Know about" means a Web link.
I've got a regulated 5v power supply which is already used for some ws2812 leds however it could also drive this if i used a 5v strip sorry I dont have links for that as I ordered it ages ago, its just one of those silver caged psu's
These are the 12v led drivers i have, their from another project i only need one i think the smaller 2.5a would should be sufficient for the amount of leds I need i measured exactly 2.24 meters
Thank u kgray9 I could kiss u thats amazing however should I be using a relay then cos read their bad and they blow up over time and its better to use a mosfet or something else etc (read all that after I started this journey, lol)