Good morning Hydrosys friends, I need your help to solve a problem:
I have two water level switches coupled to the GPIO's of the irrigation board, each measuring the water level in a string of capillary boxes in the greenhouse.
Both are connected in the same way (GND and data), but behave differently. One of them does randomly shift level, despite the switch is not activated. I have tried to switch left and right switches, but the problem remain on the same GPIO pin, leaving switch and cable errors out of the equation.
Have you experienced anything similar?
Do I need to add a pull-up resistor to the GPIO?
I have attached a visual of the data as well as a logfile, showing the readings on the time of error.
Brgds
Lars
ok, it's quite updated, no big differences with the current one.
I am using 3.35g
I don't see big differences in changing from Pull-up to Pull-down. Anyway I'd expected to have a continuous line instead of a graph with spikes. I made several changes to the interrupt function and visualization among the versions, which version are you using?
Txs. Angelo, that solved the graph issue. I changed the "left" around 6:15 and the right around 9:15 as you can see on the attached pic.
Can I use this setting and still get the actuator cut off at the negative edge from the water level sensor?
I can easily switch the logic from a negative edge to a positive (use pull down instead of pull up). Would that be better?
Brgds
Lars
It is definitely something SW related.
Can you try to change the setting of the Activation mode to "second Edge + Level"?
Hi Angelo, Yes, I refer to GPIO 4 (and 18) on the Automation Board. I am using those two in the interrupt section to stop the water valve on the left and right section of the watering system, once the water has reached a certain level in the box.
Reading_Pin_4_Left is the analogue reading of GPIO 4 (multiplied by 10), so I understand the actual voltage on the pin (has simply connected the GPIO to the ADC on the Automation board).
What puzzles me is the hourly "flip" of the GPIO reading. The analogue does not show any change, why I suspect it is something SW-related.
I have attached the interrupt setting, based on GPIO4, FYI. There is a similar one for the GPIO 18.
Hope that can help cast some light over this :-)
Brgds
Lars
Hi Lars, the PIN reading are definitely semi-random, two points:
Did you set something on the Interrupt page?
Just to be sure there is no misunderstanding PIN 4 indicates the GPIO 4 on the raspberry pinout as below (not the pin position).
Hi Angelo, some progression on this issue, however the "strange" reading seem to remain.
I have now added pull-up resistors on both GPIO's - and has established voltage measurement with two analog channels for both GPIO pins (4+18)
Looking at the analog readings, they seem to reflect the water switch level. But for some reason the reporting from the GPIO seem to vary with an hourly frequency, as the data graph shows. Most of the time they seem to be correct, however once every hour, they "flip".
Does this make any sense to you?
Brgds
Lars
Made a deeper analysis on the issue, I found out that if the interrupt is not set, the pull-up is also not set. This is clearly not the right behavior, so I'm fixing this issue. I think with this fix the inconsistency in reading should be fixed too.
yes, pull-ups can work in parallel, no need to change the "neg". The voltage of 1.73 is definitely too low for the PIN to activate properly. At this point you can use directly the value from the analog inputs to control your actuators (no need to use GPIO pins or pull-up). As benefit you can also precisely set the voltage threshold to activate it and monitor the voltage level at same time.
Grazie mille, that works fine. Measuring pin 04 = 2,81V Measuring pin 18 = 1,73V Both disconnected from any switches/gauges I reckon that could be the cause of the problems. I'll try to add external pull-ups. Should I then switch the logic to "pos" or can I leave it on "neg"? I reckon the pull-ups will just work in parallel. Brgds Lars
Hello,
here the configuration you can use for the Analog0 pin (ADCchannel=0):
BTW, can you advice on an appropriate HW config setting line for measuring the voltage on one of the ADC channels?
Brgds
Lars
Hi Lars,
The raspberry GPIO can be set to have an internal pull-up, which if I remember correctly should be around 10K. This is set using the "neg" in the HardwareSetting. Can you please also share your configuration file? in Hardwaresetting page in the section download file, click the "Hardware Config" button to get the link for downloading the file.
In case the cable are quite long it might be a good idea to put an external pull-up with less than 10K Ohm.
On the other side, in case you have the automation board, then I suggest to connect the GPIO also to an analog input pin, so that you can monitor the voltage and see if there are anomalies.