Currently working on a more off-the-shelf solution to weighing my plants in situ with a commercial load cell.
Tracking plant health through weight
To make the experience fit your profile, pick a username and tell us what interests you.
We found and based on your interests.
Currently working on a more off-the-shelf solution to weighing my plants in situ with a commercial load cell.
data.zipManual and Automated Weight Datax-zip-compressed - 21.05 kB - 08/26/2021 at 21:41 |
|
Turns out the platform wasn't the cause of the wobbliness of the data. It has continued and arguably gotten worse.
It looks like there's almost a periodic quality to the wobbliness.
Here's what I'm going to do:
I'm sharing the data that went into this graph in the cleverly-named "data.zip" file found on the main project page. It contains two files: auto.csv and manual.csv. Each contains datetime iso strings (created using datetime.isoformat() in Python) and corresponding values in ounces.
While investigating ready-made boards for reading load cells, I stumbled across the HX711 load cell amplifier. The HX711 has 24 bits(!!) of resolution instead of the paltry 12 from the ADC I was using.
Sparkfun has a great intro to load cells (link here) complete with some example code. The code fit nicely in a sketch I wrote to send data to a database via HTTP processed by a PHP script server-side.
I designed and 3D printed a base with the load cell to match my planter.
I know you're all really here for the internal shot though:
If you think that platform looks a little thin, you're right. Below is the data I collected by hand, and by sensor with the thin platform and the thicker platform. Note the line where I changed from thin to thick platforms.
There's a good deal of variation before the stand replacement (and a little after). I don't exactly know why, but I thought the deflection of the platform was somehow reducing the deflection at the load cell. Will that remaining wiggle go away with an even thicker platform? I may try it, but I might also say this is good enough based on how well it seems to track the manually-entered weights.
While a strain gauge integrated into the PCB is an interesting idea, it may be easier to move forward with the commercial load cell right now. The latter would allow me to focus more on developing the software side of things more, which is what I'm really trying to learn in all of this. The former could potentially make for a more affordable product with a lower BOM cost, but that's probably something to worry about later.
It's likely that I'll spin up a board (sounds so professional) to make wiring the ESP32, power, load cell, and HXT711 breakout board easier.
This setup is great for my little idiosyncratic planter, but it'd be great if it worked with the more common 6" planters found at every garden center (at least in the US, I'm sure they're 150 mm or so elsewhere). That's a pretty easy change and gives me a lot more room to work with for the electronics.
The model will have to be done before I can get the edge profile for a PCB.
The ESP32 sketch needs work. Ideally it should serve up a status webpage when in operation. It should also allow for remotely taring the scale. When it's not connected to the network, it should instead serve up a page that allows you to connect to the network and log you in as a user. All that I've done on those fronts is start to learn the terms to search for (like captive portal). Well that's not entirely true, I've also tried (and failed) to get captive portal examples to work.
My kludged together web interface is gross so I'd also like to convert it to run on Flask. I've worked through a practice Flask project but have a little more planning to do before I'm ready to implement it.
Weighing plants for better plant health is a nice idea in the abstract, but I was really motivated by one plant in particular. This willow leaf ficus:
I've had it for about 8 years and it's always looked about this terrible. I wasn't sure whether I was over/underwatering or possibly just not giving it enough light. It did better in the summers when it got to live outside, but unfortunately that changes both of those variables.
In January, I watched one of those many YouTube videos on creating bonsais from relatively normal-looking plants. I gave it a shot, to largely terrible effect.
Side note: I'm not terribly fond of describing these mini-tree sort of things as bonsais. Bonsai comes with many cultural connotations and the perception of right and wrong ways of doing things. I just want interesting-looking plants, so I try to avoid calling them bonsais. But, bonsai is a pretty effective word for giving someone else the rough idea of what you're going for, so I do slip up and use it periodically.
In between the previous two pics, I moved from Atlanta to Seattle, which probably didn't help the plant at all. The repotting really exacerbated the watering issue. Since the root system was tiny (not a healthy plant), the bigger pot made it harder to tell whether the soil by the roots was dry. I was worried that the plant was going to completely die if I didn't do something, so I risked the stress of repotting into a much smaller planter (designed by me in Fusion 360 in two snap-together parts to print without support). This next picture is 2 months later.
About at this point, I started tracking the weight of all of my plants each day in a little notebook. That was far too much work, so a Raspberry Pi Zero W database with a local network website followed shortly. Anyways, here's a plot of the weight of this particular plant, starting at the end of April and going until July 2nd.
Couple of things stand out to me about this graph, aside from my clear lack of skill in creating compelling graphics. First is that the time between watering is decreasing (or frequency of watering is increasing if you'd rather be positive about it). This is likely due to a rebound in the number of leaves, which use up the water in the process of photosynthesizing the plant food.
The other is a lack of an upward trend in the maximum weight. As the plant grows more, it should be increasing in mass, yet this graph implies the opposite. I have two guesses for why: my measurement and watering schedules are missing the maximum weight in each watering cycle or the weight of the plant is pretty negligible compared to the soil, water, and pot. The first certainly contributes, especially since I tend to weigh, then water, then weigh again the next day. Measuring more continuously with an in situ scale should reveal the contribution of the timing, but I suspect the growth I've seen has also been negligible.
If you're lucky, the commercial electronics you're looking to open up will be assembled with screws. This is especially true if space isn't a particular concern. Those screws often hide though, under things like rubber feet, screen decals, and even product decals. If you're unlucky, there will be adhesives or even ultrasonic welding of plastic parts.
I was lucky. With the exception of a screw hidden under the faceplate, all of the screws were pretty easy to find and the whole thing came apart without the need to destroy anything.
I was surprised to find no other resistors on the board, so the Wheatstone bridge is a full bridge (4 strain sensors). Upon some research, I discovered this is actually pretty standard for load cells. Sparkfun has a great article on getting started with load cells.
I was also surprised to see capacitors at every leg of the Wheatstone bridge. Perhaps these are for smoothing purposes?
The cutout in the load cell is to ensure that deformation occurs there instead of distributed evenly throughout the bar. That cutout looks like someone drilled two separate holes. I assumed this was because of manufacturability, but was wrong. This geometry creates 4 weak points, allowing for the placement of 4 strain gauges: 2 in compression and 2 in tension.
Also no ADC or op-amp, unless they're under the epoxy blob, so either the microcontroller has a better ADC than the Nano, or the values are different enough that more resolution isn't needed. Looks like there's a spot for another IC, but it isn't populated.
Surprisingly, there's no locking connector for the LCD, it just gets held on the PCB via the enclosure. Based on other teardowns of scales, this looks like it's pretty standard.
The individual strain gauge elements of this load cell appear to be 748 Ohms, very respectable, especially when compared to my gentleman's 3 Ohms.
I ran the scale with no modifications (well, sprawled across my desk) and put a 6.24 oz weight on the scale (my wire strippers). My multimeter, which measures to 0.001 V, couldn't detect a change in voltage under load (1.273V at both junctions of the Wheatstone bridge). This means it can't be using a 10-bit ADC because those measure down to 0.003V with a 3V reference voltage.
Time to desolder the leads to the load cell and try using it with my ADS 1015 and a Nano. Based on the prices I've seen on load cells, this may be a better approach than rolling it all into one custom PCB.
I'm not sure there's a way for me to get a more sensitive strain gauge on a board than what I currently have. The only ways I know to make it more sensitive are to increase the resistance in the trace that makes up the strain gauge. To increase resistance, the trace needs to be longer or thinner. Thinner isn't possible because of the board manufacturer and longer increases the cost of the boards and takes up more space. The other thing I could do to try is getting an ADC with more than 12 bits of resolution, which will also be pricey.
I wanted to embed a strain gauge in a PCB. I'm not sure this makes any practical sense, but thought it might be convenient to avoid the wiring and hassle of attaching a strain gauge to a load cell by embedding the strain gauge with the rest of the wiring to make this an I2C-powered sensor. Also in this version were a status LED, ATTiny85, and resistors to make a quarter bridge Wheatstone bridge.
So where did things go wrong? Well I didn't even think to calculate what resistance the of the strain gauge would be. It was very low, like under 1 ohm. This was pretty problematic because it meant I needed a current-limiting resistor, which I didn't think to include. I really should've put a spot for a 0 ohm resistor just in case, but that didn't occur to me.
Even when I bodged in a current-limiting resistor I couldn't detect any change in voltage as a result of a load, because the voltage drop across the current-limiting resistor left very little resolution for the actual strain gauge. I ended up bodging in some more wires to cut the ATTiny85 out of the picture entirely to allow for easier debugging with an Arduino Nano.
I thought this might still be salvageable (spoiler: it wasn't) if I just hooked up an ADC with better resolution. I bought a breakout board for an ADS 1015, which has 12 bits of resolution compared to the Arduino Nano's 10 bits. Still no noticeable difference when a physical load was applied.
To fix the issues of the first PCB, I decided to design a new strain gauge right at the limits of my manufacturer's trace width and spacing capabilities (6 mil and 6 mil). Instead of a quarter bridge, this one would be a half bridge, which means a strain gauge on both the top and bottom surface. One would be in tension and the other in compression, creating a larger voltage difference. Instead of using an ATTiny85, I planned on an ADS 1015, even though you can't actually source them right now. I can always lift one off these breakout boards if everything else appears to be working.
Finally, with this version I could actually detect a change as a result of a physical load! The change wasn't quite as extreme as I would've liked, so I have some more tweaking to do. I'm also currently only at the stage of detecting voltage changes, not translating those into strain or weight yet.
Try to actually calculate strain and weight from the data I'm currently getting and compare those to known weights.
Investigate commercial scales and see if I can set something up with a commercial load cell for comparison.
Create an account to leave a comment. Already have an account? Log In.
Nice work and writeup. I have been working on beehive weight and temp/humidty for health. Currently moving from ESP8266 to ESP32 and hope to add microphone and video/picture posting. I had trouble with that "bar" strain sensor for vertical weight and keeping BOM cost low so went to the human weight scale "bump" sensors.
https://www.tindie.com/products/techforge/beecorder-beta-wifi-hive-health-datalogger/
Thanks, Steen! Beekeeping does seem like a perfect application for using weight. I wonder what the issues were with the bar strain sensor? I can imagine that eccentricities in the load might be a bigger factor with something as large as a hive. Have you seen any temperature dependence with the human weight scale sensors?
The single bar sensor would require some complex metal work to allow (I think) the proper moment arm that I think you designed into your stand. My two bump design allows a half-bridge configuration as found in other more expensive beehive monitors. Even more accurate would be a 4 sensor full bridge configuration. Definitely I see temp/humidity dependence, but that could be due to my wood base compression... Last winter with few bee activity there was regularly up to 4lbs variance during a 24hr period. Perhaps some interesting time series math is needed here to tease out daily or temperature variation.
Hi Kevin,
Good work.
This reminds me of one of my projects:
www.c2o.pro.br/hackaguas/ar01s25.html
Translated by Google Translator:
https://tinyurl.com/yd948zsa
Best Regards,
Markos
Hi Markos,
Thanks for sharing your excellent write-up! It sounds like you had a much more sophisticated programming approach than I have. How did the experiment end up going? I'm particularly interested in how the set point for when to water was determined.
Warm regards,
Kevin
Hi Kevin,
This project was made for a friend biologist who had to do several experiments with ~80 potted plants in a greenhouse, controlling the amount of water used in irrigation. Throughout the experiments, water replacement in the pots was done manually, 3 times a week, weighing each pot on a scale and adding enough water to replace the pot's original weight at the beginning of the experiment.
Calibration was done by placing known weights on the scale and determining a calibration equation by linear regression. (https://tinyurl.com/y4rxxs7u).
Best Regards,
Markos
I love this idea.
Load cells are highly temperature sensitive. I did a project several years ago where I could actually pick up when the AC was running on the load cell value. If your plant is sitting in the sun I would expect to see changes over the course of each day. I added a simple NTC temperature sensor to the side of the load cell and was able to compensate for changes in temperature with pretty good success.
Thanks for sharing this, Brandon! It sounds like that may be exactly the problem I'm running into. I'll see if I can implement something similar. I noticed that in my data there was a bit of a periodic nature to the wobbles which would seem to align with a daily cycle.
Thanks again!
Interesting project. Do you already have an idea on how to handle plants that grow pretty quickly? How well would that work with something like peppers or tomatoes, where the plants gets heavier quickly, and then you have fruits growing that add to the weight of the plant? Do you think you could factor that plant growth out of the value and still get a good indication on soil wetness over the plants life in such a situation?
That's a really good question, and unfortunately I don't know just yet. Your comment does give me the idea that working with fast growing plants might be a good way to force some learning on that topic.
I suspect that the soil can only maintain a certain amount of water, no matter how large the plant grows. If that's true, then if you know the fully watered weight and dry weight (needs watering) at some point in time, the difference between those two should give you weight of the water. If you take the maximum weight (after watering) and subtract the water weight (constant?), then that should give you the weight at which you should water the plant.
Let me know if you end up giving it a try!
Yea, i'll probably prefer to go with capacitive humidity sensing for my gardening needs for now. It's a bit more tryed and tested i think, and that makes it a bit easier for the lazy engineer i am. :)
Would be interesting to find out if the amount of water the pot can retain really does not change over time. I would guess that over time the soil gets compacted, parts of it get transformed (consumed) into the plant, and then there is the entire root system growing, that takes up space in the pot/soil... At that point, the type of plant and soil really start to make a difference too, i guess.
Become a member to follow this project and never miss any updates
Glad someone posted about the temp issue, found that the load sensors / ht711 also drift if read or under load for prolonged periods and the weight should be removed occasionally. Led me to think of some similar pot weighing madness but maybe with a servo operated shim/wedge to lift it the tiniest bit and take the weight off of the scales/load-cell