What methods are available to determine the state of a dry contact (open/close) on a relay? What CRBasic command(s) would be used and what would the wiring look like? I'm looking at a relay connected to an AC source that will open or close depending on whether AC power is on or not. I need the datalogger to know the state of the dry contact on the relay so it knows if AC power is available or not.
Hi
you can use a digital or analog input. You can connect one terminal of the relay to a fixed 5V and the other terminal to a digital or analogue input.
For safety, I would keep this channel connected to the ground via a very high resistance to avoid false measurements when the relay is open, keeping it fixed at zero.
Then when the relay is closed you will have the digital channel high or the analog channel will go to 2500mV (having the limit at 2500 mv you have to divide the voltage by 2).
it is clear that with the digital port it is much simpler but I don't know what you are already using and what is free.
How frequently do you need to know if the status changes?
you can simply use the shortcut application, included in the free software and you will be guided in creating a simple program.
IE
BeginProg
'Main Scan
Scan(10,Sec,1,0)
'Default CR300 Datalogger Battery Voltage measurement 'BattV'
Battery(BattV)
'Default CR300 Datalogger Processor Temperature measurement 'PTemp_C'
PanelTemp(PTemp_C,50)
PortSet (C2,1 )' this give 5V to one terminal of rele'
' now you can use analog input or digital
' - analog input
' but having the limit at 2500 mv you have to divide the voltage by 2
'Generic Single-Ended Voltage measurements 'SEVolt'
VoltSe(SEVolt,1,mV2500,1,True,500,50,1,0)
If SEVolt > 2000 Then PStat = true
If SEVolt > 500 Then PStat = false
' or digital
'Generic Port Status measurement 'PStat'
PortGet(PStat,C1)
Some loggers like the CR6 and CR1000X have internal pullup resistors that can be switched on.
If you have the pullup resistor on, you just need the digital channel and a ground connection.
PortPairConfig (C1,1,1) 'Turns pullup resistor on PortGet (AC_On,C1 )
I plan on using two different dataloggers, a CR350 and CR800. For each datalogger the dry contact would be in the normal-closed position when AC power is available.
For the CR350, one VX terminal would be used as 3.3V output using the SWVX or PortSet command. Input would be read on one C terminal using CheckPort of PortGet command. I assume I would need a pull-down resistor wired between the C terminal and ground (G) to ensure the state of 0 when the contact is open. How would I size the pull-down resistor?
For the CR800, C3 terminal would be used as 5V output using the PortSet command. Input would be read using C4 terminal using the CheckPort or PortGet command. I assume I would need a pull-down resistor wired between C4 terminal and ground (G) to ensure the state of 0 when the contact is open. Again, how would I size the pull-down resistor?
Additionally, when the 3.3 or 5V is read on a C terminal, is a short circuit created when the contact switch is closed or does the datalogger have internal resistance? I assume the answer to this is also tied to how to size the pull-down resistor.
100KOhm will be OK.
It could be lower but this produces an increase in consumption, when the relay is closed this resistance is powered and consumes energy, which is always a problem in battery-powered systems. However, when the relay is closed, a short circuit does not occur because the logger inputs have a high impedance and there will be resistance towards ground.
CR800 C channels have pulldown resistors internally. You can do 5V to the switch and right back to a C channel.
The SWVX or PortSet command would be used to use one VX terminal as a 3.3V output. Using the CheckPort of PortGet command, input would be read on a single C terminal. To guarantee the condition of 0 while the contact is open, I believe I would require a pull-down resistor attached between the C terminal and ground (G).
This post is under review.