Triggering a tactile switch

I have a very simple circuit board that utilizes a tactile switch to toggle the thing on and off. I'd like to use the Arduino to bypass that switch so I can provide control over the timing using a sketch. Is this even possible?

Is this even possible?

The Arduino could rotate a servo to press the switch, so, yes, it is possible.

You can't just connect the two wires going to the switch to the Arduino and have it complete the circuit without knowing just how much voltage and current are involved.

There are other ways as well. You could easily hook up a relay to the same connections the tactile switch is connected to. And drive that relay with your Arduino. You might be able to use a MOSFET or transistor, if you know more about the circuit.

The transistor thing kinda makes sense. An output pin of the arduino could be high for like 15ms…just long enough to close the circuit going through the tactile switch. Does that sound right?

Does that sound right?

Yes, IF the appropriate transistor is selected. You have not described the voltage and current through the switch. A transistor to control 5V DC and 0.2 milliamps will not control 430V AC and 500 Amps.

It may be that the Arduino pin could be used directly. Or not. It really depends on the circuit. If you post the circuit we might be able to tell. Or at least describe the circuit. Is one end of the tactile switch connected to ground?

If you unfamiliar with Arduino and you have a set time you want to use when hitting the button. You maybe able to use a simple 555 timer circuit as well. Unless you want to have fun with the mcu of course. A 555 is very simple to use for button high timing.

Here goes...

The circuit that I would be controlling with the arduino is pretty basic but I don't have a schematic for it since I bought it as is...I cant find the schematic for it. the function is pretty basic though. Supply 5V, hit the tactile button switch thing and the circuit (piezo nebulizer) turns on and stays on until you hit the button again.

My intention is to activate the tactile button remotely (Bluetooth app - Thunkable). In the code below, the "LAMP" section is a push and hold toggle. The Bluetooth circuit is only "ON" as long as im holding the button on the app. As soon as I take my finger off of it, the Bluetooth circuit shuts off. I'd like to toggle the piezo circuit with this portion (lamp=11). In the breadboard set up, it just turned on/off and LED. Can I replace the LED with wires going to the tactile switch? Is that possible?

//---------ELECTRONOOBS----------//
//--------BT app control---------//


int lamp=11;
int vent=12;
int light=8;
int pc=7;

int Received=0;
int light_state =0;
int vent_state = 0;
int pc_state = 0;


void setup(){
  
  Serial.begin(9600);
  pinMode(lamp,OUTPUT);
  pinMode(vent,OUTPUT);
  pinMode(light,OUTPUT);
  pinMode(pc,OUTPUT);
  
}

void loop(){
 
 if(Serial.available()>0)
 { 
    Received = Serial.read();
    
 }
////////////////LIGHT/////////////////////
if (light_state == 0 && Received == '1')
  {
    digitalWrite(light,HIGH);
    light_state=1;
    Received=0;  
  }
if (light_state ==1 && Received == '1')
  {
    digitalWrite(light,LOW);
    light_state=0;
    Received=0;
  }
///////////////////////////////////////////



////////////////VENT/////////////////////
if (vent_state == 0 && Received == 'a')
  {
    digitalWrite(vent,HIGH);
    vent_state=1;
    Received=0;  
  }
if (vent_state ==1 && Received == 'a')
  {
    digitalWrite(vent,LOW);
    vent_state=0;
    Received=0;
  }
///////////////////////////////////////////




////////////////PC/////////////////////
if (pc_state == 0 && Received == '2')
  {
    digitalWrite(pc,HIGH);
    pc_state=1;
    Received=0;  
  }
if (pc_state ==1 && Received == '2')
  {
    digitalWrite(pc,LOW);
    pc_state=0;
    Received=0;
  }
///////////////////////////////////////////




  
////////////////LAMP/////////////////////
 if (Received =='8'){
   digitalWrite(lamp,HIGH);   
  }  
 if (Received == '9'){
 digitalWrite(lamp,LOW);
 }
 ///////////////////////////////////////////

 
 
}

Thanks again for your help!

Probably not directly. You could try it and see. The worst that could happen is fry the Arduino. It's hard to tell without some sort of idea what the tactile switch is connecting and what sorts of voltages are involved.

One thing that I'm pretty sure you could do quite easily is to get one of those little relay boards and connect that up. Go to EBay and search for "1 channel Arduino relay board module". They're inexpensive, easy to hook up, easy to control, and will almost certainly work for what you want to do. Just hook up the NO output terminals to the same places your tactile switch is connected to. Then connect the input signal to the same pin your "lamp" is connected to in your sketch. You might have to invert the output signals. Other than that, it's a snap.

I got two of these relay boards from mouser

https://www.mouser.com/search/ProductDetail.aspx?r=619-27115

they are intended for 120V but could it work?

Perfect. The Mouser site specifications are woefully insufficient, but Parallax has a neat little guide pdf that has more pertinent information.

You can't drive the relay directly from the Arduino I/O pins -- it takes too much current. The spec sheet says about 85 mA. However, the board has a driver transistor on it, with a resistor and back EMF limiting diode as well. Exactly what you need.

Let us know how it turns out.