Tag Archives: electronics

Cost-Reducing the Lunar Clock: IoT really is here

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.

Continue reading Cost-Reducing the Lunar Clock: IoT really is here

Dog Water Bowl Scale, part 1: initial design work

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

Dog Weight Scale Part 9: Soldering the V2 circuit together

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.

Ready to solder more of the circuit
Ready to solder more of the circuit

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.

The completed, soldered circuit
The completed, soldered circuit

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.

The scale circuit temporarily mounted to the plywood base
The scale circuit temporarily mounted to the plywood base

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.

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