Eliminate GPIO input Interference on existing Nurse call system
Budget: $30 – $250 AUD
A previous Freelancer wrote some code for me that works as a nurse call system.
SUMMARY
The existing code does the following;
18 GPIO’s are connected to inputs and a pull down resistor.
Each of the inputs can be pressed once or double clicked and thus the system is able to produce a total of 36 different messages.
Each time a button is pushed a message is displayed with the time in seconds since the message was posted and a sound is made.
Only the last three messages are displayed on the screen.
PROBLEM
The inputs are sensitive to electrical interference and false triggers occur when other electrical devices in the building are switched on.
SOLUTION
I have found information on a forum that details this issue.
https://forums.raspberrypi.com/viewtopic.php?t=53548
The solution is based on the assumption that the electrical noise event that is happening is extremely brief, much quicker than someone pushing a button and letting go. So by creating a callback function that would sleep for a very short time, and then check to see if the GPIO is still HIGH the software is able to determine if the input is from a button push or from electrical interference.
The following code is suggested;
Code: Select all
def my_event_callback_function():
print('Callback function called!')
time.sleep(0.01) # need to filter out the false positive of some power fluctuation
if GPIO.input(10) != GPIO.HIGH:
print('quitting event handler because this was probably a false positive')
return
# otherwise, do your button handling code here :)
print('Button was actually pressed, or GPIO event actually happened')
GPIO.add_event_callback(10, my_event_callback_function)
Please can I have bids for someone to add this code to my existing software ?
SUMMARY
The existing code does the following;
18 GPIO’s are connected to inputs and a pull down resistor.
Each of the inputs can be pressed once or double clicked and thus the system is able to produce a total of 36 different messages.
Each time a button is pushed a message is displayed with the time in seconds since the message was posted and a sound is made.
Only the last three messages are displayed on the screen.
PROBLEM
The inputs are sensitive to electrical interference and false triggers occur when other electrical devices in the building are switched on.
SOLUTION
I have found information on a forum that details this issue.
https://forums.raspberrypi.com/viewtopic.php?t=53548
The solution is based on the assumption that the electrical noise event that is happening is extremely brief, much quicker than someone pushing a button and letting go. So by creating a callback function that would sleep for a very short time, and then check to see if the GPIO is still HIGH the software is able to determine if the input is from a button push or from electrical interference.
The following code is suggested;
Code: Select all
def my_event_callback_function():
print('Callback function called!')
time.sleep(0.01) # need to filter out the false positive of some power fluctuation
if GPIO.input(10) != GPIO.HIGH:
print('quitting event handler because this was probably a false positive')
return
# otherwise, do your button handling code here :)
print('Button was actually pressed, or GPIO event actually happened')
GPIO.add_event_callback(10, my_event_callback_function)
Please can I have bids for someone to add this code to my existing software ?