Hi,
I have problems with the input signals. They switch on and off, but also when I do not want to ....
My longest cable (utp6) with a switch is 25 meters from the Arduino located and, I think, and the cable picks up disturbance.
Now I want to change the input method to:
If this is implemented in the sourcecode I prevent that a wrong (peak) signal will activate some events in homeseer and wake me up at 3am....
I already set the debounce but this makes no difference (tried it with 5000ms in homeseer and in the arduino code, but switch is directly on in homeseer)
I did also some hardware on the input (10nF to ground,100R to +VDD , 10uF over the input.) but no real changes.
The Arduino sees less then 3V as a zero and here is the problem, peaks can be also negative and so less then 3V.
So I tried to solve it in the software from Greig.
If anyone has the same problem they can solved with only a few lines of code (the bold one).
Find the Input Setup-part in the homeseerboardXX.ino, and change into:
Compile it with Arduino1.5.6-r2, upload and ready.
Now it runs for 2 weeks and now no more waking up at night anymore!
Me so happy!
Alex
I have problems with the input signals. They switch on and off, but also when I do not want to ....
My longest cable (utp6) with a switch is 25 meters from the Arduino located and, I think, and the cable picks up disturbance.
Now I want to change the input method to:
Code:
If (input signal == LOW) { wait for 500ms if (input signal still is LOW) { send status to homeseer } else { do nothing with this input } }
I already set the debounce but this makes no difference (tried it with 5000ms in homeseer and in the arduino code, but switch is directly on in homeseer)
I did also some hardware on the input (10nF to ground,100R to +VDD , 10uF over the input.) but no real changes.
The Arduino sees less then 3V as a zero and here is the problem, peaks can be also negative and so less then 3V.
So I tried to solve it in the software from Greig.
If anyone has the same problem they can solved with only a few lines of code (the bold one).
Find the Input Setup-part in the homeseerboardXX.ino, and change into:
Code:
//*********************************Input Setup******************************* byte InPinArray[30] = { 0 }; byte Debounce = 300; byte count = 0; byte NoOfInPins = 0; int InStateArray [(sizeof(InPinArray) / sizeof(InPinArray[0]))]; unsigned long PrevDebounce [(sizeof(InPinArray) / sizeof(InPinArray[0]))]; void InputCheck() { byte pinread; [B] byte pinread2;[/B] for (count = 0; count < NoOfInPins; count++) { if (millis() - PrevDebounce[count] > Debounce) { pinread = (digitalRead (InPinArray[count])); [B] for (int w = 0; w < 10; w++) { //******* modification for input errors **************** 20151026 Alex Houben delay (1); pinread2 = (digitalRead (InPinArray[count])); //digital read is approximately 9ms if (pinread != pinread2) { return; } } .... .... .... [/B]
Compile it with Arduino1.5.6-r2, upload and ready.
Now it runs for 2 weeks and now no more waking up at night anymore!
Me so happy!
Alex
Comment