TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: BIEBER
from: ADRIAN
date: 2019-08-09 22:55:00
subject: Re: GPIO problem

In message , Dennis Lee
Bieber  writes
>On Fri, 9 Aug 2019 20:34:12 +0100, Adrian  declaimed
>the following:
>
>
>>Strangely, the behaviour today has changed.  Rather than consistently
>>registering an "on" state, it is doing it on an intermittent basis.
>>
>
>       Sure sounds like it needs either a pull-up or a pull-down... random
>currents could be taking the voltage above and below the threshold for 1/0
>state (Note that most IC modes have a dead zone between 1/0 where anything
>can happen. For CMOS that is normally 30-70% -- on a 3.3V system, that
>would mean ~2.4+V => 1, 1.0-V => 0, and 1.0-2.4 could give anything)
>
>       Documentation implies that it uses the internal pull-up (and the sensor
>tips it to LOW/GND) -- but if that has failed, you might need an external
>resistor connecting the GPIO to 3.3V
>

I'll look into adding that into the circuit.

>       Alternatively, since this is a rain gauge (based upon your comments in
>the source code) -- possibly the switch circuit has gotten wet and is
>conducting (grounding) the output.
>

My initial reaction was that the rain gauge was the source of the
problem, however with it unplugged (and so there was an open circuit
between the two pins), I was still seeing the problem, leading me to
think the problem was with the PI.

>
>       Just as an aside: given that you are relying upon a tight mesh of
>
>open
>read/write
>close
>
>you might want to consider using a context manager style in the code
>
>with open() as fid:
>       read/write
>
>       The context manager will automatically close the file on block exit.
>
>

Thanks for the suggestion.

Adrian
--
To Reply :
replace "bulleid" with "adrian" - all mail to bulleid is rejected
Sorry for the rigmarole, If I want spam, I'll go to the shops
Every time someone says "I don't believe in trolls", another one dies.

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.