rbaron / b-parasite

🌱💧 An open source DIY soil moisture sensor
1.85k stars 143 forks source link

Battery voltage drop after update #183

Closed ericu65 closed 3 months ago

ericu65 commented 4 months ago

Hi,

I've been using 5 boards (fully JLCPcb assembled except the backside) of version 2.0.0 for the last 7 months with almost no issues using BTHomev2. Recently I've noticed two of my boards have started corroding so I cleaned them up, removed the corrosion, recoated them in two layers of Plastik 70 and replaced with a new battery. I left them in water for a week to confirm default calibration was still usable but it only went up to 90% moisture reading so I decided to update them to the latest firmware. I cloned the latest master, updated the toolchain from 2.4.0 to 2.5.2 and built them with the following config without connecting VCC and using the on-board battery: image

While for the prior week the voltage had been pretty stable following the battery change: image Immediately after flashing, both boards' battery measurement dropped significantly within a couple of 10m update cycles: image

I measured the same voltage with a multimeter (although about 50mV higher as I expect the voltage is measured by the firmware under load).

Strangely after a week first one of the boards, then the other. started increasing its voltage magically (again, confirmed with a multimeter). They are both still just in a cup of water so no change to the environment: image

Any idea what could explain this behaviour? Initially, I thought the battery consumption during flashing was the culprit but the voltage dropped within 30 minutes after disconnecting and the latest increase is not explainable by this.

PS. Wonderful OSHW you've created here. Thank you.

rbaron commented 4 months ago

Hey @ericu65,

This is both interesting and intriguing, and I can't say I've experienced a similar issue yet. Specially seeing the battery voltage going up! Given you confirmed the odd behavior with a multimeter (in-circuit I'm assuming), one wild idea is that it could be related to ambient temperature. I'm not super convinced, because the temp variation would have to be kinda large.

For example, check out this chart from a CR2032 datasheet:

image

There is a correlation between temp and voltage reading, which could explain the first graph if in your test you used colder tap water, for example -- but I would expect the voltage to slowly go back up as the temp settles back. Or it could explain the second chart (voltage going up) if you moved the sensor indoor from outside.

Do you recall doing any of these?

A couple of other (relatively far fetched) ideas:

ericu65 commented 4 months ago

Hi @rbaron

Thanks for looking into it. I think this rules out a known change in the way the voltage ADC pin is read. That was my main concern, either a change from version to version, or a misconfigured build, which seems to not be the case. Out of the 5 these two have given me the most trouble regarding excessive battery usage often needing to change them every 2 months so it's likely something electrical that would explain these swings I see here too. Seems to be pretty stable now and I've put them in soil. image

To your good points:

Notice the calibration referencing VCC working beautifully with no change to moisture during the voltage swings - really nicely done: image

Since there's nothing to be fixed I will close this shortly.

Thank you