Hi Josh,
It sounds like that’s arrised from this PR: Plant_io Basic Setup Guide | Automatically Water a Seedling Based on Soil Moisture - #8 by Marc67778
You could try the old values:
self.curr_sens = self.mf.normalise_x(moving_ave, 27500, 50000)
or set your own min and max using the following code:
import machine
import utime
soil_moisture = machine.ADC(28)
# A handy function for mapping values
def map_range(x, in_min, in_max, out_min, out_max):
mapped = (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min
return int(max(min(mapped, out_max), out_min))
while True:
soil_moisture_raw_reading = soil_moisture.read_u16()
print(soil_moisture_raw_reading)
# # Uncomment the 2 lines below for the mapped reading
# soil_moisture_filtered_reading = map_range(soil_moisture_raw_reading, 15000, 50000, 0, 100)
# print(soil_moisture_filtered_reading)
utime.sleep(0.5)
Hey @Justin264431
That’s quite strange - if you run off of USB what does the battery voltage say? The Pico might be in a brown-out state and isnt able to completely run/save?
It shouldnt matter whether its on or off when reconnected - keen to get to the bottom of this!
Liam