Rpi 3 B+ with AutomationHAT 5VDC input not stable


I am using AutomationHAT with Rpi 3B+ . What I am trying to achieve is monitor input line for a high signal. This input line is connected output of a 24V to 5VDC converter which is driven by a relay. This relay controls a 24VDC motor. So basically as the relay contacts are closed the AutoHAT input should be reading 5VDC via the 24 to 5VDC converter and hence expect input.read() to be 1.

What I am seeing is this input is not stable and keeps toggling between 0 and 1 when the input signal is high. Any help is appreciated.

Use a scope to check your power supply. I have attempted to use some cheap ones that have very high ripple on them and will make a RPi or Arduino unstable. Also keep them away from the Pi or Arduino as they can emit a large amount on EMI.