Bypass 4 pin push button

Hello all,

I am trying to create a cigar humidifier using arduino UNO, a DHT22 humidity and temperature module and an ultrasonic atomizer (with its board) that connects to the Arduino via a MOS module.

I have set up the modules and all is good except one thing. Due to the fact that I couldn’t find any ultrasonic atomizer with board designed for Arduino in my country, I bought an USB desk humidifier and disassembled it. Unfortunately the humidifier has a push button for on/off on its board (as you can see in the picture).

The question is how can I bypass the button so when I set the MOS to 1 the humidifier starts directly without the extra/necessary step of pushing the button.

Thank you in advance for help,
Sorin

Does it work, when the button is pushed all the time (Even before plugging in the USBhcable)?

If so, just soldering a piece of wire across the push button pins should work

Hello Couka. No it does not. If you push it once it turn is on; push it again and it turns it off, and so on.

Then you need to provide more information, at least good-quality, sharp pics of both sides of the PCB of the humidifier

Attached front and back, better resolution

I’m probably not the best Person to answer your question but as the thread is going stale, here’s my thoughts about how I would Approach the Problem.

First off, decide if you want to maintain the ability to push the button and turn the device on/off manually or not. If you want to maintain that ability, you Need to be able to simulate pressing the button through the Arduino. Though the Switch has four Pins, it is probably only one Switch and two Pins are shorted to each other (for example, both top Pins are shorted or both left Pins). To find out, just measure which two Pins are always shorted and your circuit should provide an Arduino controlled short between the other Pins.

If you don’t care about the Manual mode and want everything solely under the control of the Arduino, I think you should just find out what voltage is on the gate when the device is on vs. off. Assuming the gate measures near 5 Volts when on, your circuit should provide control between the 5V and the gate to turn the device on.

JaBa:
Though the Switch has four Pins, it is probably only one Switch and two Pins are shorted to each other (for example, both top Pins are shorted or both left Pins).

It does look like one of these:

square buttons.jpg

Willpatel_Kendmirez's information is correct and accurate for this type of pushbutton.

With this type of pushbutton, if you don't have the information or are still having problems identifying the correct connection, then by choosing diagonally opposite pins you will get the correct operation.

Thank you all for the info.

@Jaba - the two options I would be fine with are:

  1. when the circuit board of the humidifier is powered i want the water atomizer to start without the need of the button to be pushed.
  2. control the behavior of the push button via arduino.

Either way I do not want to manually start the circuit board; that would defeat the purpose of what I want to build. So either bypassing the button or controlling it via arduino.

I have measured the voltage between the pins when the water atomizer is off and this is what I have (if I number the pins according to the picture attached):

1-2 = 4.91
1-4 = 4.93
1-3 = 0
2-3 = 4.93
2-4 = 0
3-4 = 4.93

a-c = 0

Another aspect of the pushbutton that I saw is that long press does not activate the water atomizer, just a short press does the trick.

Also, when the button is pressed I get 2.26V between a-c and of course 0 if pressed again.

@JohnLincoln I tried connecting a wire between 2 and 3 and nothing happens. If I touch 2 and 3 or 1 and 4 for a fraction of a second it simulates the pushing of the button and opens the circuit.

Thank you


So the red+black wires connected next to the switch are the 5V power supply, and the other 2 wires to go the atomiser module?

If so, you should measure the voltages around the switch relative to the black/psu-ground. Otherwise you could be measuring meaningless floating voltages against each other.

I suspect that you can simply connect an Arduino pin directly to one of the switch contacts to control it. If course, the Arduino and the board must share a common ground. To simulate pressing the button, the Arduino sketch can change the pin to OUTPUT & LOW for a couple hundred milliseconds, then back to INPUT.

Hello PaulRB,

So I connected the circuit board directly to Arduino and connected pin 4 of the switch to Digital pin 7 of Arduino. When I read the pin it is shows value 1. When pressed it shows 0.

I have tried different versions of code to simulate the click but I was unsuccessful. Is there anywhere an example code for what I need?

thank you

Is one side of the switch always connected to Ground (the black powet wire)? Or is one side connected to 5V? If you do not have one or the other then this is going to be more difficult.

If you have Gnd or 5V, the other side of the switch is the one that the Arduino must control. That will be pretty easy. digitalWrite() is all you need. The Arduino should be powered from the same power source.

As of now I kinda’ made it work with a small issue. I am using the same power and GND for the arduino and humidifier board, and I get that following issue:
If the humidity is less than 70 the atomizer should run. But with the current code it runs only for 5 seconds, then it stops for 5 seconds, then runs again for 5 seconds and so on. How can I make it to do the switch only once?

void setup() {
 // configure pins
 pinMode(sensDATA, INPUT_PULLUP);
 pinMode(inPin, INPUT);
 Serial.begin(9600);
 dht.begin();
 delay(1000);
 hum = dht.readHumidity();
 temp = dht.readTemperature();
}

void loop()
{
  //Read data and store it to variables hum and temp
 hum = dht.readHumidity();
 temp = dht.readTemperature();
 //Print temp and humidity values to serial monitor
 Serial.print("Humidity: ");
 Serial.print(hum);
 Serial.print(" %, Temp: ");
 Serial.print(temp);
 Serial.println(" Celsius");
 
 val = digitalRead(inPin);

 if (hum<70) {
   pinMode(inPin, OUTPUT);  // Pull the signal low to activate the power button
   delay(500);  // Wait half a second
   pinMode(inPin, INPUT);  // Release the power button.
 }
 
delay(5000);
}

What you describe is exactly what I would expect to happen, looking at your code.

The question is, what do you want it to do? You have not told us that.

If you truly want our help, you should show some respect to the forum rules, which you have had the opportunity to read but chose not to in case nobody else follows them either. We do.

Thank you all, especially for the suggestion of connecting the atomizer board’s 5V and GND to the same with Ardino. This way I connected a pin from the switch to the Arduino and controlled it via code. The issue is that the loop simulates the “pushing of the button” code over and over and interrupts the atomizer for the selected delay.

void loop()
{
   //Read data and store it to variables hum and temp
  hum = dht.readHumidity();
  temp = dht.readTemperature();
  //Print temp and humidity values to serial monitor
  Serial.print("Humidity: ");
  Serial.print(hum);
  Serial.print(" %, Temp: ");
  Serial.print(temp);
  Serial.println(" Celsius");
    
  if (hum<70) {
    pinMode(inPin, OUTPUT);  // Pull the signal low to activate the power button
    delay(500);  // Wait half a second
    pinMode(inPin, INPUT);  // Release the power button.
    delay(3000);
  }
  if (hum>75) digitalWrite(mosPIN, 0);
    else digitalWrite(mosPIN,1);
delay(1000);
}

In this case if hum<70 then it simulates the click and starts the atomizer and delays for 3 seconds, then runs for another second and then when loop runs again it stops it for 4 seconds. And then all the process again.

Is there a way that I can break the cycle and let it simulate the pushing of the button only once when the condition is met?

@Paul Regarding the disrespect you mentioned, it seemed that you understood what I asked and what help I need. The honest mistake of forgetting to put the code in the right format does not excuse your outburst. You could have just told me to adapt it accordingly. Errare humanum est.

Thank you,
Sorin

void loop()
{
  static bool alreadyPushed = false;

   //Read data and store it to variables hum and temp
  hum = dht.readHumidity();
  temp = dht.readTemperature();
  //Print temp and humidity values to serial monitor
  Serial.print("Humidity: ");
  Serial.print(hum);
  Serial.print(" %, Temp: ");
  Serial.print(temp);
  Serial.println(" Celsius");
    
  if (hum<70 && ! alreadyPushed) {
    alreadyPushed = true;
    pinMode(inPin, OUTPUT);  // Pull the signal low to activate the power button
    delay(500);  // Wait half a second
    pinMode(inPin, INPUT);  // Release the power button.
    delay(3000);
  }
  if (hum>75) {
    digitalWrite(mosPIN, 0);
    alreadyPushed = false;
  } else {
    digitalWrite(mosPIN,1);
  }
delay(1000);
}

You may want to pick some other condition to reset alreadyPushed. Thia just illustrates the general idea.

alreadyPushed is declared as static, which means that its value is preserved after loop() exits like a global variable except it is local to loop().

soriniorgus: @Paul Regarding the disrespect you mentioned, it seemed that you understood what I asked and what help I need.

Yes, I think we were fairly confident that we understood. But we would prefer you to actually say what you need help with (like you have begun to do in post #15), not expect us to guess. Sometimes we will guess wrong and waste our time and yours.

soriniorgus: The honest mistake of forgetting to put the code in the right format does not excuse your outburst. You could have just told me to adapt it accordingly. Errare humanum est.

I'm sorry if it seemed like an outburst. I did feel frustrated, but it was not solely caused by your lack of code tags. It was caused by failure to read the forum guide before making your first post. Use of code tags is just one of many good pieces of advice given there. All that advise is designed to help us help you. Every day, dozens of new forum members make their first post without reading the guide first. Can they honestly say they were unaware of the guide? After all, its at the top of every forum section.

@MorganS You Sir saved the day. Thank you for the tip. That is exactly what I needed, simple and efficient.

Thank you, Sorin