tonsai
Posts: 3
Joined: Tue Jan 12, 2021 9:43 am

Alarm Contacts

Tue Jan 12, 2021 10:07 am

Hi, I'm fairly new to rasberrypi and I'm looking for a solutions to measure and alarm on the output from a machine. The machine can provide a special cable to provide alarm signalling in the following format:

Alarm contact / Customer feedback contact

1 - Function

The machine cabinet is equipped with a set of potential-free alarm contacts at connection X1.

The contact (X1) is for remote alarm of the following malfunctions (pin 1; 2; 3;):
  • - Liquid level warning and alarm

    - ECU problems

    - Pressure (high/low)

    - Compressor stop

The Remote Alarm contact signal is reset to “Normal” when the acknowledge button of the alarm box is pressed and the audible alarm is off!

The contact (X1) is also for remote alarm of the following malfunction (pin 4; 5):
  • - Discharge Alarm
2 Connection details

Specifications for X1

Connector type HAN Q5 (6-pin)

Maximum load 230 VAC 6 A
not protected by a fuse

Code: Select all

Connector	Pin	Function(Indication)	State
X1		5	Release Alarm		Common
X1		4	Release Alarm		Normally Closed
X1		3	Remote Alarm		Common
X1		2	Remote Alarm		Normally Open
X1		1	Remote Alarm		Normally Closed
Where do I begin, I've got a raspberry pi and a bread board.

Any help/advice really appreciated. The goal here is to send an email/text message to notify when there is a problem.

I believe this is a HAN Q5 connector (I'm getting the cable this week).
https://uk.rs-online.com/web/p/heavy-du ... s/8430027/

Thanks
Mike

blimpyway
Posts: 591
Joined: Mon Mar 19, 2018 1:18 pm

Re: Alarm Contacts

Tue Jan 12, 2021 12:52 pm

Find tutorials on how to connect and use simple push buttons with raspberry pi's GPIO

Those contacts you mentioned should behave just like buttons which your machine "pushes" on or off.


Regarding what every contact means ... you better link or attach real documentation, your description on what you understood of it is incomplete, sketchy, very probably inaccurate.

deepo
Posts: 698
Joined: Sun Dec 30, 2018 8:36 pm
Location: Denmark

Re: Alarm Contacts

Wed Jan 13, 2021 9:26 pm

This is a start:
https://projects.raspberrypi.org/en/pro ... -computing

In essence you have two contactor pairs in your plug, one for when the alarm is turned on, and another for when the alarm is turned off.
If you are not familiar with normally open and normally closed and common, have a look here:
Image
When there is no alarm there is a no connection between common and normally open, while there is connection between common and normally closed.
When the alarm is active the opposite is the case.

There is no potential in the plug, so you need to provide the +3.3V from the RPi to detect anything on the two contactors.
But have a look at the Physical Computing to better understand how you can setup the inputs, and then Google for a guide on how to send an email in Python.
Have fun!

BMS Doug
Posts: 4422
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: Alarm Contacts

Wed Jan 13, 2021 11:14 pm

You will need to use two or three GPIO pins to monitor the signals.

X1 common fault is on wires 1 and 2 with the common connection on wire 3. (1 and 2 are the inverse of each other, when 1 is active 2 will be inactive and vice versa)

X1 discharge alarm is on wire 4 with the common connection on wire 5.

connect the common wires (3 & 5) to 3v3 and then connect the signal pins to your GPIO inputs.
I would use a set of 10k pulldowns on the inputs to eliminate false positives and connect an inline 1k resistor to each, to mitigate the risk of accidents. You can get a pre-made board that has the pulldown connections if you want to save yourself the soldering.
https://thepihut.com/products/pud-board ... stor-board
Doug.
Building Management Systems Engineer.

tonsai
Posts: 3
Joined: Tue Jan 12, 2021 9:43 am

Re: Alarm Contacts

Thu Feb 18, 2021 2:45 pm

Thanks all for your comments and advice, really appreciate advice so far. I've got my PUD board for the pull up and pull down.

Looking at this example could you advise where I would add my connections in place of the switches in the example.

https://thepihut.com/blogs/raspberry-pi ... -pud-board

Image

deepo
Posts: 698
Joined: Sun Dec 30, 2018 8:36 pm
Location: Denmark

Re: Alarm Contacts

Thu Feb 18, 2021 8:41 pm

Replace one button with pin 5 and 4 from the X1 connector.
Replace the other button with pin 3 and 2 from the X1 connector.
And see what happens.

tonsai
Posts: 3
Joined: Tue Jan 12, 2021 9:43 am

Re: Alarm Contacts

Mon Feb 22, 2021 1:00 pm

All good so far, I think for a novice, but I have a couple of questions:

- Why do I need PUD board if there are PU PD resistors built into the Raspberry Pi
- My code for Pin 2 (GPIO17) seems to need the inverse logic to read out the correct result. (It outputs 0 for closed. and 1 for open)
- I've not attached a wire (like the red/black for the other IOs) from the PUD UP/DOWN for the GPIO27(Pin4), but it still works)

Code: Select all

# Write your code here :-)
#Notes for X1 connector
#Connector	Pin	Function(Indication)	State
#X1		    5	Release Alarm		Common
#X1		    4	Release Alarm		Normally Closed
#X1		    3	Remote Alarm		Common
#X1		    2	Remote Alarm		Normally Open
#X1		    1	Remote Alarm		Normally Closed

from RPi import GPIO
from time import sleep

GPIO.setmode(GPIO.BCM)
# X1 Connector PIN1 - Normally Closed
GPIO.setup(18, GPIO.IN) 
# X1 Connector PIN2 - Normally Open
GPIO.setup(17, GPIO.IN) 
# X1 Connector PIN3 -Normally Closed
GPIO.setup(27, GPIO.IN)

while True:
        #Connector	Pin	Function(Indication)	State
        #X1		    1	Remote Alarm		    Normally Closed
    if GPIO.input(18) == 1:
        print ("X1-Pin1  Status:Good closed! Normally closed")
        print ("-----------------------------")
    if GPIO.input(18) == 0:
        print ("X1-Pin1  Status:Bad Open! Normally closed")
        print ("-----------------------------")
        #Connector	Pin	Function(Indication)	State
        #X1		    2	Remote Alarm		    Normally Open
    if GPIO.input(17) == 1:
        print ("X1-Pin2  Status:Good open! Normally Open")
        print ("-----------------------------")        
    if GPIO.input(17) == 0: 
        print ("X1-Pin2  Status:Bad closed! Normally open")
        print ("-----------------------------")

        #Connector	Pin	Function(Indication)	State
        #X1		    4	Release Alarm		    Normally Closed 
    if GPIO.input(27) == 0:
        print ("X1-Pin4  Status:Bad Open! Normally Closed")
        print ("-----------------------------")
    if GPIO.input(27) == 1:
        print ("X1-Pin4  Status:Good closed! Normally Closed")
        print ("-----------------------------")
    sleep(2)
print ("-----------------------------")
# except:

GPIO.cleanup()()
This is the output I get when I run the code above and don;t press any buttons:

Code: Select all

-----------------------------
X1-Pin1  Status:Bad Open! Normally closed
-----------------------------
X1-Pin2  Status:Good Open! Normally open
-----------------------------
X1-Pin4  Status:Bad Open! Normally Closed
-----------------------------
This is the output if all buttons are pressed:

Code: Select all

-----------------------------
X1-Pin1  Status:Good closed! Normally closed
-----------------------------
X1-Pin2  Status:Bad closed! Normally open
-----------------------------
X1-Pin4  Status:Good closed! Normally Closed
-----------------------------
Image

ghp
Posts: 1757
Joined: Wed Jun 12, 2013 12:41 pm
Location: Stuttgart Germany
Contact: Website

Re: Alarm Contacts

Mon Feb 22, 2021 7:14 pm

Why do I need PUD board if there are PU PD resistors built into the Raspberry Pi
The internal resistors are quite large and voltage spikes 'easily change the level' . Smaller resistors as used on this add on board increase current through the wires and make errors less probable.

BMS Doug
Posts: 4422
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: Alarm Contacts

Mon Feb 22, 2021 8:00 pm

Additionally a 1k in-line resistor (included in that board) eliminates the risk of shortcircuiting a GPIO if the Pin gets accidentally set into outpu mode.

But you don't need the board, its just advised that you use a 1k inline and a 10k pull up or pulldown (all of which that board can do).
The pull up or pulldowb can all be omitted if you prefer, with small risk of signal loss if uaing the weaker internal pull up down resistors.
You could alternatively build your own hardware to provide the pull up or down and the inline resistor.
Doug.
Building Management Systems Engineer.

stevend
Posts: 346
Joined: Fri Oct 11, 2013 12:28 pm

Re: Alarm Contacts

Mon Feb 22, 2021 8:38 pm

Minor point on alarm contacts.
Where you have a changeover contact, it's often preferable to use the "normally closed, open for alarm" pair of connections. That way in the event that the lead becomes disconnected you get an alarm. This is a "fail safe" scenario.

More sophisticated systems might have a separate detection loop purely to detect whether the cable is conencted.

Return to “Automation, sensing and robotics”