Black Lives Matter - Action and Equality. ... Adafruit is part of the Stop Hate for Profit campaign. Adafruit is open and shipping.
0

Incorrect analog readings on Pyportal D3 and D4 connectors
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Incorrect analog readings on Pyportal D3 and D4 connectors

by Jeeg76 on Tue Apr 21, 2020 3:43 pm

Hello everyone. Forgive my English and my inexperience, I am a noob whit python and microcontrollers.
I have a Pyportal to which I have connected several analog sensors, like moisture sensor and water level sensor (3 pin, + - sig).
I connected them with a jst cable, and I have coded this example:

Code: Select all | TOGGLE FULL SIZE
import time
import board
from analogio import AnalogIn
 
analog_in = AnalogIn(board.D3)
 
while True:
    print(analog_in.value)
    time.sleep(1)


The problem is that: I always have a high reading that never changes (64480) or changes very little, even if, for example, I put the moisture sensor in water. On an esp8266 the sensor works perfectly. Pyportal works well, I have uploaded complex examples such as the weather station and they work well ... This happens on both D3 and D4 .....
Thanks for your help

Jeeg76
 
Posts: 5
Joined: Sun Mar 15, 2020 1:11 pm

Re: Incorrect analog readings on Pyportal D3 and D4 connecto

by dastels on Tue Apr 21, 2020 4:25 pm

I would start by examining the soldered connections.
Ensure that the JST connector is firmly seated in the socket.

Dave

dastels
 
Posts: 2802
Joined: Tue Oct 20, 2015 3:22 pm

Re: Incorrect analog readings on Pyportal D3 and D4 connecto

by Jeeg76 on Wed Apr 22, 2020 7:54 am

I rechecked the connections, the jst connectors seem to be inserted correctly and work properly, tested on an esp8266 the sensors work using just that cable. I also noticed that if I read, with nothing attached, a value is still returned. It's normal?
I tried to test the pyportal temperature sensor and it works and the led also works regularly. I physically checked the card and it seems to have no defects, as far as I can understand, I'm inexperienced :)

i use this cable https://www.adafruit.com/product/4046
and this https://shop.pimoroni.com/products/3-pi ... 1-housings

I will try to test the readings or writings digitally

Jeeg76
 
Posts: 5
Joined: Sun Mar 15, 2020 1:11 pm

Re: Incorrect analog readings on Pyportal D3 and D4 connecto

by adafruit2 on Wed Apr 22, 2020 11:46 am

try changing the onboard JST-voltage jumper from 5V to 3V

adafruit2
Site Admin
 
Posts: 19223
Joined: Fri Mar 11, 2005 7:36 pm

Re: Incorrect analog readings on Pyportal D3 and D4 connecto

by Jeeg76 on Wed Apr 22, 2020 2:56 pm

How i can make that? I need to cut the trace on 5v -3v on i2c connector?
thx

Jeeg76
 
Posts: 5
Joined: Sun Mar 15, 2020 1:11 pm

Re: Incorrect analog readings on Pyportal D3 and D4 connecto

by dastels on Wed Apr 22, 2020 3:19 pm

If you look next to the I2C connector you will see 3 pads, labelled 5, V, and 3. There is a small trace between 5 and V. Carefully cut that and connect V and 3. A blob of solder will do the job.

Dave

dastels
 
Posts: 2802
Joined: Tue Oct 20, 2015 3:22 pm

Please be positive and constructive with your questions and comments.