Pages: [1]   Go Down
Author Topic: Arduino dry contact input  (Read 640 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How do you do this?
Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 524
Posts: 26473
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
// read D2 and send result 10 times a second.
// reports as High unless pin is pulled Low/connected to Gnd
byte pinX = 2;
void setup(){
pinMode(pinX, INPUT);
digitalWrite (pinX, HIGH); // enable internal pullup
Serial.begin(9600);
}
void loop(){
Serial.print(digitalRead(pinX));
delay(100);
}
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Wow, that seems easy in code. How would a circuit look that would work with this code?
Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 524
Posts: 26473
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You either have a button that connects the pin to Gnd, or you have the output of some other device that pulls the pin low.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

0
Offline Offline
Newbie
*
Karma: 0
Posts: 15
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey CrossRoads.
The code looks great.
I'm after the same info.
I need to be able to recognise when a clean contact has been closed without sending 5v back through the same contacts.
Hard for me to explain sorry.
Hope you can help.
Logged

UK
Offline Offline
Tesla Member
***
Karma: 101
Posts: 6306
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Forgive my ignorance but I have never heard of "dry contact input" before - what does it mean?

...R
Logged

Green Bay, WI
Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It's pretty hard to tell if an electrical contact is closed if you can't send electricity through it.

Is there already something connected to these contacts?

Perhaps if you explain what you are looking to do a bit more someone can help you.
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17263
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Forgive my ignorance but I have never heard of "dry contact input" before - what does it mean?

...R

"Dry contacts" mean one is simply wiring to a set of switching contacts that contain no voltage from any other external source. A button switch is an example of a set of dry contacts, a relay is another example of having dry contacts available for the user to utilize in any way they want up to the electrical limits of the contact ratings.

Lefty
Logged

Pages: [1]   Go Up
Jump to: