In my previous post I started the electronics and software for an Arduino Sketch for an ESP8266 WiFi microprocessor and several MAX31820 temperature sensors, that will eventually estimate and upload the level of water in our well water tank.
I’ve begun another Arduino/ESP8266 project: reporting the level of water in our well tank. This project will involve the ESP8266, MAX31820 temperature sensors, some mechanical work, sending data to a web-based database, and interpreting the temperature data to estimate the well water level.
I have to confess that sometimes I need a push to make the right design choice.
It’s been a long time – way too long – since I worked on my Lunar Clock project. In the meantime, Sparkfun has introduced new, inexpensive microcontrollers aimed at Internet-of-Things applications. I knew one of those new microcontrollers would be perfect for the Lunar Clock, but I dragged my feet.
In my previous post, I covered the mechanical construction of the scale. In this post, I finish assembling the scale, calibrating it, and installing it.
After painting I put feet on the scale so it won’t soak in water spilled on the floor.
…then bolted the Arduino 101, Load Cell, and Load Cell Amplifier to the bottom plate. Continue reading Dog Water Bowl Scale, Part 3: Final assembly and installation
Now that my Dog Bed Weight Scale is sending data, I’m going to have a go at a water bowl scale. The idea is that, like the bed, the bowl will periodically send its weight to a cloud. This data should tell me when Pippa drinks, when we refill her bowl, and (maybe) how much she drinks.
The work-in-progress sources on Github, contain the beginnings of the Arduino 101 Sketch, Bill of Materials (Parts List), mechanical design/construction details, and a day-by-day project diary. Continue reading Dog Water Bowl Scale, part 1: initial design work
In my previous post I described how to use long break-away headers, and started soldering the circuit together. In this post I finish transferring the scale circuit from the breadboard to a protoboard, and do a quick test mount of the circuit on the plywood scale base.
A reminder: I found that the Load Cell Amplifier was (by design) so sensitive to changes in resistance that just touching the resistors on my solderless breadboard caused large changes in the Amplifier output. So I wanted to solder all the parts down.
I’m generally terrible at soldering on protoboards, so I tried out one of Sparkfun’s Solder-able Breadboards. This board has internal connections that copy those of a solderless breadboard, making it easy to transfer your circuit from a solderless breadboard to this Solder-able Breadboard, without redesigning the layout and without having to solder two wires together – everything is soldering one wire into one hole.
In almost no time, I had transferred the half Wheatstone bridge per Load Sensor to the board, and soldered the wires, resistors, Load Sensor connectors, and Load Cell Amplifier connectors in place.
Once I had everything soldered together, I plugged in the whole circuit and (temporarily – that’s another story) mounted the parts to the plywood bottom part of the scale.
You can see in the above circuit the four Load Cell Amplifier board (the small red boards), one per Load Sensor, the protoboard in the center, and the Arduino. Each Load Sensor is also plugged into the protoboard. Compare this picture to the one of the solderless breadboard in my previous post – it’s very, very similar.
In my next post, I 3d-print a Load Sensor holder.
It’s a good time to recap: This project is a scale that will sit underneath my dog Pippa’s bed, so that I can measure her weight automatically, at night while she sleeps. The project-in-progress is Open Source, at my CurieBLEWeightMonitor Github repository. I occasionally tweet about it (among other things) as @bneedhamia.
In my previous post I covered how to choose matching resistors for the Load Sensor to convert the Load Sensor into a Load Cell that can be wired into Sparkfun’s Load Cell Amplifier. In this post, I nearly finish building the breadboarded circuit and start transferring it to a soldered protoboard.
It’s probably worth saying a word about Long Break-Away Headers. These headers are longer than regular ones, and are great for plugging connectors into connectors and (for this project) plugging connectors into a solderless breadboard. Standard length headers are designed to be soldered in, and aren’t long enough to use in solderless breadboards or to attach connectors to Arduino I/O pins.
Step 1: snap off the number of pins you need for the connector. For example, I’m using a lot of 4-pin Molex connectors, so I use a pair of needle-nose pliers to snap off a set of 4 pins.
Step 2: The plastic separator needs to be centered on the length of the pins. An easy way to do this is to plug the long ends of the pins into a breadboard, then use needle-nose pliers to press the plastic part down to the surface of the breadboard. The plastic is often stiff, so I hold the pliers with one hand and press the tip of the pliers down with my thumb, using strong, even pressure (don’t bend the pins).
Once this is done, the header’s plastic separator is close to half way along the length of the connector, and the pins are ready to be plugged into a connector.
Meanwhile, I’ve finished everything on the breadboarded scale circuit except choosing the final pair of matching resistors. It’s all going well. In the picture below you can see the four Load Cell Amplifier boards (the small rectangular boards), the 3-pin connectors for each of the Load Sensors, and of course, the Arduino.
Earlier I’d noticed that the breadboarded circuit tends to drift: small changes in the mechanics of the circuit (like touching a resistor) make significant changes in the measured Load Cell Amplifiers’ outputs, which might affect the measured weight from the scale.
I found Sparkfun sells the perfect thing for me: a solderable breadboard. It has the same mechanical layout and electrical connections as a standard half-sized solderless breadboard, So it’s easy to transfer a circuit from a breadboard to the protoboard, and solder all the parts down. It’s especially nice for me because my protoboard connection skills are terrible: my protoboard circuits usually look like a mess, and are very difficult for me to wire up.
At any rate, I’ve transferred the first Load Sensor circuit to the protoboard and soldered it together – it works great!
In my next post, I solder the rest of the scale circuit to the protoboard and test-mount it onto the plywood base.
In my previous post, I worked through the calculations of weight and center of gravity when using four Load Cell Amplifiers instead of one. In this post, I build the circuit for the first of the four Load Sensor / Load Cell Amplifier combinations I’ll be using.
The Sparkfun Load Cell Amplifier is designed to connect a Load Cell to an Arduino. A Load Cell contains a full (4 resistor) Wheatstone Bridge, but a Load Sensor contains only half of a Wheatstone bridge. To connect a Load Sensor to a Load Cell Amplifier, I need to add two resistors: R3 and R4 in the following diagram. The dotted box represents the Load Sensor. The triangle in the middle of the diagram represents the Load Cell Amplifier. As the weight on the Load Sensor increases, R1 decreases, which causes the voltage V1 to increase, causing the digitized amplifier output to increase.
Once I’d built the circuit, the next task was to find the right pair of resistors, R3 and R4. In the photo below, R3 and R4 are the two resistors at the left; the Load Cell Amplifier is the small red board in the center, and of course the Arduino is on the right.
R3 and R4 need to have a ratio that is close to the ratio of the two (matched) resistors that are in the corresponding Load Sensor, so that the digitized voltage difference, V1 and V2 in the above schematic, is near zero.
The tricky part is that a normal multimeter shows that the two resistors of the Load Sensor are equal, and that R1, above, changes by only an ohm or so with pressure. That multimeter isn’t accurate enough to show the differences in resistance that you need to measure.
So either you can buy a high-precision multimeter (expensive), or you can use the Load Cell Amplifier to measure the resistances. I decided the use the Amplifier.
I ordered a bunch of 1Kohm, 0.1% resistors. Then I picked 4 of them (I could have used more, but that’s more work), labeled them A, B, C, and D, then started measuring the ADC values of various pairings of those resistors.
First I removed the two resistors and connected S+ to S-, (V1 to V2 in the schematic above) to give the ADC a 0V value. I then measured the ADC output. It was 5720, so 5720 corresponds to 0V difference between V1 and V2 in the schematic above. That number is the 0V goal: I want to choose a pair of resistors that produces an ADC value that’s closest to 0V.
So I disconnected V1 from V2, plugged in a pair of resistors (say, A = R3 and B = R4) and read the raw value from the HX711 library, via hx711.read().
After a few tests I found that C = R3 and D = R4 produced an ADC value of -29993. That value was the one that was a) negative and b) closest to the 0V value of 5720. Even though -29,993 is much bigger (in absolute value) than 5,720, the other combinations produced values 10 times that of the C and D combination.
I wanted a negative number, to give more range for the Load Sensor. As the weight on the Load Sensor increases, the voltage read by the Load Sensor Amplifier increases, so starting from a slightly negative voltage gives the amplifier more range than if you started from a slightly positive voltage. I’m still not quite sure whether the ideal zero-weight offset would be 0V, or some slightly negative voltage.
In my next post, I show the progress of the circuit so far, show how to use Long Break-Away Headers, and start transferring the circuit to a soldered protoboard.
In my previous post I finished assembling the Dog Bed Weight Scale, at least enough to allow testing it. In this post, I relate how I calibrated and tested it.
Using the Bogde HX711 Load Cell Amplifier library and examples, and the Sparkfun HX711 Example Arduino Sketches, I quickly wrote a little Sketch to output the raw value from the scale (SCALE = 1.0 and OFFSET = 0L). The library made talking to the HX711 trivial.
The HX711 library assumes a linear relationship of load sensor output to weight. Using small exercise weights, I measured the average output for 5, 10, 15, 20, and 25 pounds. I’m using Pounds for the moment for my convenience; once all this works, I’ll switch to kg.
|X Weight (lbs)||Y Average reading|
Now for a little Algebra: the formula for a line is Y = MX + B, where M is the slope of the line and B is the intercept. Put in terms of the HX711 library, M is the SCALE and B is the OFFSET. Given two (X, Y) pairs, you can calculate the slope and intercept of the line:
M = (Y2 – Y1) / (X2 – X1)
B = Y – MX (using the M value calculated above)
I calculated M and B using the 5 and 10 lbs weights, the 10 and 15 lbs weights, etc. I then averaged the M values and the B values, resulting in
M = 10831.330 B = 260248.752
So I plugged in the M value via hx711.set_scale() and the B value (rounded to an integer) via hx711.set_offset(). Impressively, my scale now reported in lbs; math works!
Next I wanted to check how linear the output was.
Because each sensor can take up to 50kg (about 110 lbs) and there are 4 sensors, the sensors (but not the plywood) can take a combined weight of 200kg (about 440 lbs).
I weighed myself on my bathroom scale (264.1 lbs) and stood in the center of my new Dog Scale (266.063 lbs). If the scale were perfectly linear, and the calibration numbers were exactly correct, I should have weighed the same on the Dog scale as on the bathroom scale. Instead, the Dog Scale weighed 0.7% high relative to the bathroom scale. For our 44 lb dog, Pippa, that percentage would be about 1/3 lb (or about 150g), which isn’t too bad.
Another measurement I made was short-term noise. I made 24 measurements of a zero weight and calculated the Standard Deviation. 3 Standard Deviations covers a good amount of the range of noise; for this measurement 3 Standard Deviations = 0.007 lbs. That tells me that most of the time a single measurement will be +/-0.007 lbs from the average, which means that I don’t really have to average multiple readings to get a good measure (but I probably will anyway, just to be safe).
I also measured creep: the slow change in the reading of a constant weight over a long time. I don’t know much about creep, but Nate Seidle’s Beehive scale article talks about it in detail. To measure it, I placed 25 lbs on the scale and left it for 2 days. What began as 25.122 lbs ended up reading as 24.917 lbs, a creep of about 0.8%, with no sign of stopping. So I should expect some creep during the 8-12 hours that Pippa might spend in bed.
Unlike a beehive, Pippa will shift about in her bed, sometimes lying near one edge, sometimes near another edge, and sometimes in the center. To test how matched the load sensors are, I measured a 15 lb weight in the center of the scale and directly over each of the 4 sensors.
|Measured weight of a 15 lb weight at the center and over each sensor|
So Pippa’s measured weight could vary from reality by as much as 0.7 lbs depending only on her position in her bed. That’s too much for what I want to do.
Unfortunately, I can’t correct for mismatch in the individual load sensors’ response curves. The 4 sensors are wired together in one Wheatstone bridge, and calibration happens on the amplified output of that bridge.
I want to redesign the scale to have each load sensor connected to a separate amplifier and separate pins on the Arduino, so I can get a more accurate measure of Pippa’s weight as she shifts around on her bed. Interestingly, that change will also enable the Arduino to calculate where Pippa is lying in the bed – that is, where her center of gravity is – which might be interesting information.
In my next post, I find the center of gravity of the top plywood piece, and attempt a way to mount the Load Sensors to the bottom plywood piece.
In my previous post I described the electronics of the Dog Bed Weight Scale. In this post, I’m doing the final woodworking and assembly – at least enough assembly to test the thing.
First I needed to design some sort of support for the load sensors. Because of the design of the sensor – a “T” bar surrounded by a “C” shaped bar – I needed to make blocks that were 1) tall enough to keep the top piece of plywood from resting on or crushing the electronics and 2) cut out to allow the “T bar to bend below the “C” shaped part as weight was added. You can find plenty of videos of people trying to use load sensors by mounting them on a flat surface; that won’t work.
So, to design the blocks, I first measured the dimensions of the load sensor, using a Caliper, then drew up a simple design from that.
Meanwhile, I drilled the mounting holes for the boards. Because the plywood base is so large (~41″ in diameter), I couldn’t use the drill press. So to make nicely perpendicular holes, I used a Drill Guide. I really like the one I use because it’s metal and it has a guide for each drill bit I use, creating nicely straight holes.
Because I was feeling a bit lazy, I didn’t measure and mark the holes for the electronics boards. Instead I used the old “mark and drill” method.
Step 1: holding the board in place, drill just enough to mark the first hole – don’t drill deep.
Step 2: remove the board (so the drilling doesn’t damage it) and use a Drill Guide to complete the marked hole.
Step 3: Place the board back, drop the first bolt into the new hole, then mark the second hole as in step 1. Repeat for all the board’s holes.
To prevent the bolts from sticking out from the bottom of the plywood, I chose 3/4″ bolts for 3/4″ plywood. Because the bolts don’t stick out, I needed to counterbore the bottom of these holes so I can attach the nuts. Again I couldn’t do this on the drill press, so I used a plunge router, set to bore just a little into the plywood.
Because the router bit I used has a space in the middle, the counterbore holes leave a little disk of wood, I used a chisel to clean out the remaining little disk of wood to make the counterbore flat.
Here’s what the 3 boards look like, fastened to the plywood base.
I then cut the blocks that will support the load sensors. These are just temporary blocks, to let me test the circuit. The real blocks will (somehow) hold the load sensors in place and keep them from slipping from side to side.
I chose the thickness of the blocks to make sure that the plywood top wouldn’t rest against or crush the electronics. See how the cross-section of the load sensor support block is taller than the circuitry.
I then cut out the top plywood circle. This circle will lay on top of the four load sensors.
For good measure, I placed Pippa’s bed on the top piece of plywood. It’s a good fit. Yes, that’s an Encyclopedia Britannica and a VCR in the cabinet…Pippa’s a Retro Girl (seriously, what can you do with old encyclopedias? I can’t bring myself to cut them up for papier mache).
I then assembled the whole thing and started testing. Pippa helped.
In my next post, I get to try out the circuit and try to weigh some standard weights.