Dog Weight Scale Part 8: Electronics, version 2

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.

I snapped off 4 pins for a connector
I snapped off 4 pins for a connector

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).

Ready to press the plastic part down to the surface of the breadboard
Ready to press the plastic part down to the surface of the breadboard
I've used the pliers to press the plastic part down to the level of the breadboard
I’ve used the pliers to press the plastic part down to the level of the breadboard

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.

showing how the plastic is now near the middle of the pin length. Perfect!
showing how the plastic is now near the middle of the pin length. Perfect!

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.

The breadboarded circuit is nearly complete
The breadboarded circuit is nearly complete

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!

I've transferred one of four load sensor circuits to the protoboard
I’ve transferred one of four load sensor circuits to the protoboard

In my next post, I solder the rest of the scale circuit to the protoboard and test-mount it onto the plywood base.

Dog Weight Scale Part 7: Choosing Matching Resistors

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.

A Load Sensor paired with two external resistors
A Load Sensor paired with two external resistors

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.

The breadboard of one Load Sensor plus Amplifier
The breadboard of one Load Sensor plus Amplifier

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.

Measuring the results of using various pairings of resistors
Measuring the results of using various pairings of 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.

 

Dog Weight Scale part 6: Calculating the Dog’s Weight and Position

In my previous post I found the center of gravity of the top plywood circle of the Dog Bed Weight Scale. This post goes through the math of calculating the weight W on the scale and the position {X, Y} of that weight’s center of gravity.  That is, how much does our dog PIppa weigh when resting on the bed, and what is her position on the bed?

The physics of levers says two things about a “Class 1 Lever” (a seesaw):

The actual weight is the sum of the sensed weights
The actual weight is the sum of the sensed weights
The Moments around the fulcrum must sum to zero
The Moments around the fulcrum must sum to zero
  1. The weight experienced by the fulcrum (W) must equal the weights placed on the seesaw (W1 and W2).  If this were not true, the seesaw would sink into the ground or fly into the air.
  2. The Moments (rotational force) around the fulcrum must sum to zero.  If this weren’t true, the seesaw would tip.

So calculating W, the weight of the Dog (Pippa!) is easy.  It’s the sum of the weight sensed by each of the four Load Sensors:

W = A + B + C + D

Calculating the {X, Y} of the weight’s center of gravity takes a little math.  We’ve already said that A, B, C, and D are the weights sensed by the four Load Sensors. In the figure below, U and V are the dimensions of the scale (the rectangle formed by the four Load Sensors), X and Y are the to-be-calculated position of the weight’s center of gravity.

Variables involved in the Center of Gravity calculation
Variables involved in the Center of Gravity calculation

To calculate X and Y, we use a property of the center of gravity: that for any line going through the center of gravity, the sum of the Moments on one side of the line balance (equal) the sum of those on the other side of the line.

Imagine a knife-edged fulcrum runs all the way under the line PQ. Because PQ goes through the center of gravity, the Moments perpendicular to that line segment must sum to zero.

Calculating X
Calculating X

AX + DX = C(U-X) + B(U-X)
so
AX + BX + CX + DX = CU + BU
so
X = (C + B) / (A + B + C + D) * U

We calculate Y in the same way we calculated X:

Imagine a knife-edged fulcrum runs the length under the line RS. Because RS goes through the center of gravity, the Moments perpendicular to that line segment must sum to zero.

Calculating Y
Calculating Y

AY + BY = C(V-Y) + D(V-Y)
so
AY + BY + CY + DY = CU + DU
so
Y = (C + D) / (A + B + C + D) * V

We’re not quite done: What we’ve calculated is the center of gravity and weight of everything on the scale: the top plywood circle, the bed, bedclothes, and the dog.  In the figure below, suppose T is the weight of the Top plywood circle, bed, and bedclothes, W is the measured weight, and P is the to-be-calculated position and weight of the dog, Pippa.

Calculating the dog's weight and center of gravity
Calculating the dog’s weight and center of gravity

We have to do one more lever calculation: Imagine a fulcrum at W.  Because of the laws of levers:

T * L1 = P * L2
W = T + P

We know T (weight of plywood top, bed, bedclothes) from calibration.  Pippa’s weight, P, is just

P = W – T

Further, we know the position of W from the calculations above. From the position of W we calculate the distance, L1, from the location of T to the location of W, by the distance calculation.

L1 = sqrt((X – (U / 2))^2 + ,(Y – (V/2))^2)

Now that we know T, L1, and P, we can calculate L2:
L2 = T * L1 / P
From there we can use vector addition to calculate the X and Y of Pippa’s center of gravity.

In my next post, I set up the first of the four Load Sensor plus Load Cell Amplifier combinations.

May 1 update: I did a search that I should have done when I started the project: “load sensor center of gravity”, and found a nice formula from Loadstar Sensors, who make commercial products to measure center of gravity.  Incidentally, they make products that measure your dynamic center of gravity (like happens in a golf swing) – which is pretty impressive.  Anyway, their formula for center of gravity is

X = (W1X1 + W2X2 + W3X3 + W4X4) / (W1 + W2 +W3 +W4)

Translating into our terminology, W1 = A, W2 = B, W3 = C, W4 = D and X1 = 0, X2 = U, X3 = U, X4 = 0.

so

X = (0 + BU + CU + 0) / (A + B + C + D)

So

X = U (B + C) / (A + B + C + D)

Which is equivalent to our formula of

X = (C + B) / (A + B + C + D) * U

Finding that page gives me a lot more confidence that our center of gravity calculation is correct.

Dog Weight Scale Part 5: Center of Gravity and a mounting Fail

In my previous post I described how to calibrate a load sensor. This post shows how to measure center of gravity, and shows a failed attempt to mount the load sensors to the scale.

Now that I’m using 4 load cell amplifiers rather than 1, I can calibrate each load sensor separately.  This in turn will let the Arduino calculate Pippa’s real weight accurately regardless of what part of her bed/scale she’s lying on.

The easiest way to calibrate all 4 load sensors is to do it all at once:

  1. Find the center of the scale
  2. Place a known weight at the center of the scale.  Each load sensor will support an equal amount of that weight.  That is, for weight W, each sensor sees W/4.
  3. Write down X = W/4
  4. read the values from each of the load sensors: Y1, Y2, Y3, Y4
  5. repeat steps 2 and 3 until you have a table of {X, Y} pairs for each load sensor and for a variety of weights.
  6. Using the calculations in the previous post, calculate the M and B values for each load sensor (M1, B1, M2, B2, M3, B3, M4, B4)
  7. Now the Sketch can load the M (SCALE) and B (OFFSET) for each of the four HX711 Load Cell Amplifiers.

For that calibration to work best, the weight must be placed at an equal distance from each load sensor. So one of the things we must do is to mark the Center of Gravity (not necessarily the center) of the plywood top of the scale.

Remember that the top circle of plywood rests on the 4 load sensors.  Ideally its center of gravity should be resting in the center of the square defined by the support point of each of the four load sensors. Two things can make the center of gravity of the top plywood circle different than the center of the circle: 1) errors cutting out the circle: if the saw blade drifted outside the circle for a while, that extra weight can move the center of gravity to one side, and 2) plywood doesn’t have uniform density: it can have voids, patches, and grain differences that can move the center of gravity.

So we need to measure the center of gravity of the top plywood circle.

One handy thing about the center of gravity is that if you suspend an object from a single point, the object’s center of gravity is somewhere directly below that point.  Do that twice for a flat object (like the top circle of plywood) and you can know exactly where the center of gravity is.

For a circle of plywood, the rough location of the center of gravity is obvious, but for a more complex shape, say a 1950’s kidney-shaped dog bed, it’s a little harder to guess the location correctly.

Of course, an easier way to find the center of gravity, if you have a few friends to help you, is to balance the top plywood circle on the point of a nail.  Once you have it balanced, tap the plywood so that the nail point marks the center of gravity.

Lacking the time of a few friends, to find the center of gravity of the top plywood circle, we need a hand drill and bits, a drill guide to drill nice straight holes, a weight on a string (i used a plumb bob, but some washers tied to the end of a string work fine), a nail, and (not pictured) a board to put the nail into.  This board will suspend the weight of the plywood.

What you need to find the center of gravity
What you need to find the center of gravity

Pick any place near the edge of the circle of plywood and drill a hole there.  The hole needs to be slightly larger diameter than that of the nail, so that the plywood can hang freely from the nail.

Drill one hole near the edge of the top plywood circle
Drill one hole near the edge of the top plywood circle

Hold the plywood circle next to the board (I used a 2×4, slightly taller than the diameter of the plywood circle) and drive the nail through the hole you just drilled, into the board.  In this way, the plywood hangs freely from the nail.  Now hang the weight on the string from the nail, and mark where the string falls, near the middle of the plywood circle.

Hanging a weight from the nail
Hanging a weight from the nail
Mark the line near the middle
Mark the line near the middle

(Note that the center of gravity isn’t quite the center of the plywood circle – the intersection of the two lines I used to make the circle)

Remove the nail and repeat for another point about a quarter of the way (90 degrees) around the circle from the first hole.  The intersection of those two marks is the center of gravity.

The center of gravity has been marked
The center of gravity has been marked

The load sensor mounting Fail

I’ve tried a few ideas for mounting the Load Sensors so they won’t slide off their mounting blocks, but nothing so far has worked out.  What follows is another example of a fail.

I’m getting close to breaking down and designing a little 3D-printed part to hold the Load Sensor in place, but I’m not there yet.

So I said to myself “Hey, I should be able to hold down the Load Sensor with a pair of bolts and washers, so that friction keeps it from sliding.”

The concept looked good.

test layout of two washers to hold down the Load Sensor
test layout of two washers to hold down the Load Sensor

I drilled a test hole to see how things would line up vertically: the load sensor, the washer angled on top of that, and the bolt holding the washer down.

Sensor base plus washer plus bolt head equals FAIL
Sensor base plus washer plus bolt head equals FAIL

To my dismay, the bolt head was very close to the top of the load sensor.  The top plywood circle is supposed to rest only on the four Load Sensors – the contact point is that little bump in the middle of the Load Sensor.  If the bolt head is nearly the same height as that bump, the plywood might rest on it as well, causing the weight seen by the Load Sensor to be completely wrong.

A little desperate, I tested whether the bolt alone, without the washer, might be low enough.  Nope.

The bolt without the washer is still worryingly high
The bolt without the washer is still worryingly high

So I’m going to (once again) set aside the issue of how to keep the Load Sensors from slipping, and in my next post turn my attention to the math to find the weight, W, on the scale and the center of gravity {X,Y}, of that weight.

Dog Weight Scale Part 4: Calibration and its difficulties

Calibrating the scale using exercise weights
Calibrating the scale using exercise weights

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
5 314463.125
10 368162.167
15 422683.000
20 477253.222
25 531089.727

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
14.861
14.721
14.513
14.912
15.239

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.

Dog Weight Scale part 3: the woodworking and assembly

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.

Measuring a load sensor using a caliper
Measuring a load sensor using a caliper

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.

Marking the first hole to drill
Marking the first hole to drill

Step 2: remove the board (so the drilling doesn’t damage it) and use a Drill Guide to complete the marked hole.

Drilling a vertical hole, using a drill guide
Drilling a vertical hole, using a drill guide

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.

Marking the 3rd hole
Marking the 3rd hole

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.

Setting the router to counterbore holes
Setting the router to counterbore holes
Counterboring the mounting holes
Counterboring the mounting holes

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.

Chiseling out the little disk of leftover wood
Chiseling out the little disk of leftover wood

Here’s what the 3 boards look like, fastened to the plywood base.

The boards mounted onto the plywood base
The boards mounted onto the plywood base
The back of the plywood base, showing the counterbored holes
The back of the plywood base, showing the counterbored holes

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.

The load sensor support blocks
The load sensor support blocks
Cutting slots with a scrollsaw
Cutting slots with a scrollsaw
The slot lets the sensor's "T" bar move
The slot lets the sensor’s “T” bar move

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.

The load sensor support block keeps the top plywood circle from crushing the electronics
The load sensor support block keeps the top plywood circle from crushing the electronics

I then cut out the top plywood circle. This circle will lay on top of the four load sensors.

The top circle of the scale
The top circle of the scale

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).

Test-fitting the dog bed to the top plywood circle
Test-fitting the dog bed to the top plywood circle

I then assembled the whole thing and started testing.  Pippa helped.

The assembled base of the weight scale
The assembled base of the weight scale
Pippa resting on the assembled scale
Pippa resting on the assembled scale

In my next post, I get to try out the circuit and try to weigh some standard weights.

5 things Project Runway taught me about creative work

Red and white warning sign at Beaumaris Castle

I started watching Project Runway years ago as a guilty pleasure.  My wife had watched it for a while and slowly drew me in because, unlike other reality/survivor shows, it minimized the People Behaving Badly aspect of competition.

As I watched more and more – the show has run more than 17 seasons – I realized that Project Runway is really a show about how to do creative work and live the creative life.  It even won a Peabody Award for using the Reality genre to inform and enlighten.

Continue reading 5 things Project Runway taught me about creative work

Dog Weight Scale, part 2: the electronics

As I said in the previous post, I’m using 4 Sparkfun load sensors, a Load Sensor Combinator board, a Load Cell Amplifier board, and an Arduino 101 to build a scale I can put under our dog’s bed, to passively weigh her whenever she’s in bed.

In the previous post, I cut the base for the scale from a sheet of plywood.  In this post, I’m assembling the circuit.

To begin with, the load sensors come with about 14″ of wire attached.  Because my scale has a 20″ radius, I need to solder more wire to each load sensor wire.  For convenience I used some (very) old CAT3 cable I have lying around. CAT3 cable was made for old phone lines, and has two twisted pairs of cables inside an insulating sleeve.

First, so you don’t forget, cut a length of heat-shrink tubing for each load sensor wire, and slip it over the wire. I admit I’ve soldered wires together in the past and too late discovered I didn’t add the heat shrink tubing before I soldered. Choose a tube diameter about twice the diameter of the wire you’re using.

Preparing to solder (note the heat shrink tubing is on the wire)
Preparing to solder (note the heat shrink tubing is on the wire)

I really like the gooseneck quad soldering tool here. It’s similar to Sparkfun’s Third Hand Kit.

You can look up how to solder wires together. The method I prefer is to hold the two wires in an “X” pattern, then wind each one around the other, then solder.  This gives a nice “in-line” solder.

Once the soldering is done, slide the piece of heat shrink tubing into place and heat it to form a nicely insulated connection. I like using a heat gun rather than messier things like a hair drier or matches.

Using a heat gun to shrink the heat-shrink tubing
Using a heat gun to shrink the heat-shrink tubing

Once the connections are done, it’s good to double-check the connections with a multimeter.  In this case, the Load Sensor’s White-to-Blue/Black resistance should be about twice the resistance between White and Red or Red and Blue/Black.

Double-checking that the connections are good
Double-checking that the connections are good

The Load Sensor board and Load Cell Amplifier board come without headers.  I like to connect everything with removable connections (like a header and plug) in case I need to replace or fix a part later. So the next step is to solder headers on all the connections of these two boards.

The boards as they come from Sparkfun
The boards as they come from Sparkfun
The same boards, with all the headers soldered in place
The same boards, with all the headers soldered in place

It turns out I didn’t need to put headers in for the side pins labeled GND, SIG, and 5V; those are for an optional temperature sensor.

The next step is to crimp Molex connectors onto the wires. I’m sure I’m not doing this like a pro, but it works well enough.

To start strip a small amount of insulation from the wire.

A stripped wire ready for the crimp connector
A stripped wire ready for the crimp connector

Then use crimping pliers to crush the crimp connector around the wire.  The outside crimp should grip the insulation of the wire; the inside crimp should grip the uninsulated wire.  I’ve recently switched from non-ergonomic pliers to crimping pliers that automatically release when you’ve pressed hard enough – old-style pliers can contribute to repetitive stress injuries, which you want to avoid.

Crimping the connector onto the wire
Crimping the connector onto the wire

With these pliers there are 3 wrong ways to crimp the connector, and one right way.  You may need to experiment to find which jaw to use (front or, as pictured, back) and which way the connector has to face (the left or, as pictured, right side of the pliers).

Once you have all the pins for a connector crimped onto their wires, it’s time to press the connectors into the shroud (the black plastic cover).  Line up each pin’s “barb” with the hole in the shroud so that once you slide the pin in a bit, it latches.

One connector with the three pins pushed to the first stop
One connector with the three pins pushed to the first stop

Once you have pushed all the pins to the first stop, you then can push them further to the second, final stop.  You may need to use needle nose pliers to push the end of the wire until each “barb” clicks into place. Having all the pins click into place means that they won’t pull out accidentally, and you have a nice, solid connector.

All the pins are pushed to the second 'click'
All the pins are pushed to the second ‘click’
The connector pushed into the corresponding header
The connector pushed into the corresponding header

You need to connect each load sensor to the Load Sensor Combinator board, the Combinator board to the Load Cell Amplifier board, and the Amplifier board to an Arduino.  I’m first using an Arduino Uno to get the weight measurement working before I switch to an Arduino 101.

The completed circuit
The completed circuit

At this point, I did a test layout of the circuit on the plywood base. I wanted to double-check that the Load Sensor wires were long enough before I started the mechanical work.

Testing that the circuit fits the plywood base correctly
Testing that the circuit fits the plywood base correctly

In my next post, I complete the assembly of the scale.

 

Dog Weight Scale, part 1: cutting the circular base

I want to learn how to use Load Sensors to continuously weigh stuff with an Arduino, so I thought it would be fun to continuously weigh our dog, Pippa, while she sleeps in her bed each night.  The project is a little like Nate Seidle’s Beehive scale, but simpler.

The idea is to turn Pippa’s bed into a scale. Pippa’s in fine shape right now, but it’s always good to keep an eye on your dog’s weight, and a custom-made scale is a great way to do it.

My plan is to wire 4 Load Sensors into a Sparkfun Load Sensor Combinator board and Load Cell Amplifier board, then to an Arduino 101, and from there, send the results via the 101’s built in BLE (Bluetooth Low Energy) radio.  From there I’ll need to build a gateway to relay the data to a server, but that’s another project.

The ongoing project files, including a project diary and Bill of Materials (parts list) are on my CurieBLEWeightMonitor Github repository.

It Begins

I measured Pippa’s bed and bought a pair of 4’x4’x3/4″ plywood sheets, to cut into circles: one for the bottom of the scale and one for the top.

Cutting a plywood circle is a lot of fun, because you can use geometry (I admit it: I’m a geometry nerd).

First, (assuming the plywood sheet is roughly square), draw two lines, each one connecting opposite corners.  Their intersection will be close to the center of the plywood sheet.

Finding the center of the plywood
Finding the center of the plywood

(Ignore the circle on the plywood for now: I reenacted drawing the cross-lines after I’d drawn the circle)

Next (I love this part), draw a circle centered on that intersection, using a beam compass.  A beam compass is a lovely thing for drawing very large circles and arcs: instead of having two arms like a normal pair of compasses, a beam compass has a point at one end, and a pencil that slides along the beam.  I bought a beam compass kit that attaches to a yardstick to form a beam compass, and I love it.

A beam compass kit
A beam compass kit

Here’s me drawing a 41″ diameter circle centered on the plywood sheet.

Drawing a circle using a beam compass
Drawing a circle using a beam compass

Once the circle is drawn, you can cut it out with a jig saw.

Cutting the circle with a jig saw
Cutting the circle with a jig saw

Ta Da!  Now I have a nice, circular base for my Pippa-Weight scale.

What a lovely circle of plywood
What a lovely circle of plywood

In the next blog, I’ll be soldering the electronic parts together.