Make a dry contact

Hi,

Is there a way to make a dry contact with arduino?
So not an dry contact as input but just a dry contact (make) as output?

Here is my code, I’ve tried it with pin 13 but no luck so far.

/* THEBULB. THE SO-LOO-TION SENSOR */

#include <Wire.h>
#include <VL53L1X.h>

VL53L1X sensor;

unsigned long interval = 5000;
unsigned long sensorActive;

void setup()
{
  Serial.begin(115200);
  Wire.begin();
  Wire.setClock(400000); // use 400 kHz I2C

  pinMode(LED_BUILTIN,OUTPUT);
  pinMode(13, INPUT_PULLUP);
  pinMode(12, OUTPUT); 
 
  sensor.setTimeout(500);
  if (!sensor.init())
  {
    Serial.println("Let op: de sensor wordt momenteel niet gedetecteerd. Controleer aansluitingen. ");
    while (1);
  }
  
  sensor.setDistanceMode(VL53L1X::Long);
  sensor.setMeasurementTimingBudget(50000);
  sensor.startContinuous(100);

}

void loop()
{  
  Serial.print(sensor.read());

  if (sensor.readRangeContinuousMillimeters () <=1000 && millis() - sensorActive < interval) {  //schakelafstand wordt hier ingevoerd. Onder deze waarde is de schakeling actief. 
    digitalWrite (LED_BUILTIN, HIGH);
    digitalWrite (13, HIGH);
    digitalWrite (12, HIGH); 
    }else {                                              //hoger dan de schakelafstand.  
    sensorActive = millis();    
    digitalWrite (LED_BUILTIN, LOW);
    digitalWrite (13, LOW);
    digitalWrite(12, LOW);  
    }

  if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT");}
  Serial.println();
}

What do you mean with "dry contact"?? electrical isolated?

"dry" is a word related to fluids but not to electrical current or voltages.
best regards Stefan

Dry contact? What's that? I don't think it translated well.

Do you mean open collector/drain output?

Write the pin permanently low, then toggle the pin state between output and input to change state.

Dry contact typically means a relay closure. Arduino energizes the relay coil the external device does whatever it does with the Normally Open, or Normally Closed, contact change.
Can also be the NPN of an optoisolator opening or closing. External device would have its own pullup to VCC and Gnd connections, the collector could pull the signal low, or let it go high.

Hi all,

Haha, sorry, my translation was not good.
Let me try to explain it better

I’m trying to make a contact external just like a pushbutton.
So in my code i’m trying to make contact between PIN13 and GND. When using my multi-meter there’s no beep(contact) when I measure it.
There is a sensor, that triggers my code, that should output an trigger to the external device.

There’s no current or voltage needed, I just want to make a contact-trigger to start an external device.
I’d rather don’t use an relay in this case, and I can not imagine that there isn’t a possibility to make a contact through Arduino.

The setup runs on battery, so the less power I need to use, the better.

There's no current or voltage needed, I just want to make a contact-trigger to start an external device.
I'd rather don't use an relay in this case, and I can not imagine that there isn't a possibility to make a contact through Arduino.

this might be a misconception of how semiconductors of all kind work.

Any semiconductor devices like microcontrollers need a powersupply to work. The IO.Pins really really really only work if the were supplied with voltage.

Anyway there is a solution to your requierements: it is called a bistable relay

That's a special kind of relay that works a little bit different than "standard-relays"

A standard-relay has one switch-position when unpowered and holds the other switch-position as long as it is powered.

A bistable relay switches his position through a very short voltage-pulse to one out of two coils.
One coil for switchstate 1 second coil for switch-state 2
The current to switch is medium but the pulse is so short that this solution needs less energy than a transistor.

recently I used such a relay and tested how short the pulse can be. On this bistable relay just 3 milliseconds.
I put the pulse-length to 20 milliseconds just to make sure it switches with high reliablity. Still very short.

This means you need two IO-ports to switch a bistable relay between its two switch-states.
So what are the voltage and current that you want to switch? I guess pretty low but is important to know that.

As your device is battery-powered please describe what you want to to in the end.
Does the Arduino have to run all the time? Would it be enough to "wake up" every 15 minutes do some short measurements or whatever then can go back "to sleep" for the next 14,5 minutes?

There are other boards than the standard Arduino-Uno to do such tasks with much less power-consumption.

best regards Stefan

kasperzegel:
So in my code i'm trying to make contact between PIN13 and GND.

Pin 13 is connected to the internal LED on most Arduino boards. So perhaps not the best choice...

However...

digalWrite(13, LOW);
pinMode(13, INPUT);
// Pin 13 not connected to anything - it will "float"

pinMode(13, OUTPUT);
// Pin now connected to ground - 0v

pinMode(13, INPUT);
// Pin now back to floating

This connects pin 13 to ground, or nothing, as you requested.

There's no current or voltage needed, I just want to make a contact-trigger to start an external device.

How is the external device going to detect it is closed then? I suppose you mean NO current or voltage needed from Arduino. In that case you do not want pin 13 connected to Ground - Ground is 0V.

It's a mistake to say 0v is "no voltage". It's just 0v with reference to some other voltage.

If you put the negative probe of your meter on the positive supply, then in that case the 0v pin has potential of minus 5v. Measuring voltages is all relative to what you choose as your reference point, and 0v does not necessarily mean same potential as ground.

So if your question is "how do I connect two arbitrary pins together" (and not "how do I connect a pin to ground" - which is a totally different question) then there is no way to do this on Arduino or indeed any common-or-garden microprocessor*. You'll need some external hardware, e.g. relay or opto-issolator.

  • At least that I ma aware of, there may be some niche specialist devices which implement such hardware that I am unaware of.

Okay, clear answer, and yes you're right about what I'm trying to achieve.

The external device needs an external trigger like an pushbutton, I want to trigger this through Arduino,
but I'll need an relay then unfortunately..

Thnks

Hi,
Is this related to this thread?

Tom... :slight_smile:

kasperzegel:
The external device needs an external trigger like an pushbutton, I want to trigger this through Arduino,
but I'll need an relay then unfortunately..

What is this mystery external device, what is the potential on each of the two "pins" that need to be connected together relative to the Arduino 0v, and how much current flows when they are connected?

If one of those pins can be made to share a voltage rail with the Arduino then it is possible. Subject to pin voltage and current limits.

@TomGeorge, please Edit the link, it doesn't work as is.