Introduction: Build an IoT Industrial Scale!
What does a baby elephant weigh?* How much impact force does a jump have?? How can you tell if a rain barrel is full without looking inside??? Answer all these questions and more by building your very own Internet of Things (“IoT”) industrial scale using the SparkFun OpenScale board!
This project is intended for folks with a lil' bit of background using Arduino or other microcontrollers. But, whether this is your first or 137th project, check out the links throughout the tutorial or leave a comment if you have any questions!
Read time: ~ 10 min.
Build time: Approx. 2 - 3 hours
*To weigh a baby elephant, you might need to be a zookeeper or otherwise have an elephant friend.. but you could always weigh Fido and/or kitty!
Step 1: Materials!
To follow along and build your own scale, here are all the parts I used:
- OpenScale (+ mini USB to USB cable)
- Four (4) Load Cells(or strain gauges depending on needs and budget)
- Particle Photon microcontroller or other data logger (+ micro USB to USB cable)
- Breadboard (or PCB board)
- 22 gauge stranded wire (breadboard wires also work)
To make the system wireless:
All these parts can be found in the wish list here.
Scale & Casing
- Terminal blocks (5)
- Three (3) M3 screws per load cell (total of 12)
- One (1) project case (to protect the electronics)
- One (1) base board, and one (1) top board (for the scale platform)
- My base board was ~ 16" x 16" and my top board was ~ 12" x 14".
- Both boards should be sturdy and not flex or dent.
- Wood slats to frame the sides of the top board to hold it in place.
- Four (4) feet for base
Step 2: But Wait! There's More! (aka Helpful Background Info)
First of all, how do we measure weight??
Also called load sensors, strain gauges measure electrical resistance changes in response (and proportional) to, well, strain! Strain is how much an object deforms under an applied force, or pressure (force per area). Check out this super awesome tutorial for more info on how strain gauges work.
Usually what you’ll find in a bathroom scale is a load cell, which combines four strain gauges in a wheatstone bridge. This project uses four disc compression load cells rated at 200 kg.
Here's some additional background material to learn more about the components and tools used in this project:
- Serial Terminal Basics
- OpenScale Applications and Hookup Guide
- Getting Started with Load Cells
- Photon Development Guide
As usual, don’t forget to read the Datasheet for the Load Cells and any other components you with to use in your project.
Step 3: Build the Electronics! Pt. 1
Connect the Load Cells!
Load cells have four signal wires:
- Red: Excitation+ (E+) or VCC
- Black: Excitation- (E-) or ground
- White: Output+ (O+), Signal+ (S+)+ or Amplifier+ (A+)
- Green (or blue): Output- (O-), Signal- (S-), or Amplifier (A-)
They also have bare (or yellow) grounding wires to block outside (electromagnetic) noise.
Connect all five load cell wires in parallel to the OpenScale terminal blocks with the corresponding labels. You might need to switch the green and white load cell wires – check this by adding weight to the load cells. If the weight is decreasing, switch the wire orientation.
The OpenScale terminal blocks are a bitcramped with four load cells, so I used the terminal blocks pictured above. If you have a case for the electronics, remember to put the connectors INSIDE the case before connecting them to the load cells (not speaking from experience or anything..).
Step 4: Build the Electronics! Pt. 2
Connect the OpenScale to a data logger!
In addition to printing, reading, and gathering data from the Arduino serial monitor (see “Reading Load Cells!”), we can add a Photon microcontroller to connect to WiFi and upload the measurements to the Internet!
Connect the OpenScale “Serial Out” ground (“GND”) port to the Photon GND, and the OpenScale “TX” port to the Photon “RX” port. If your data logger needs power, connect the OpenScale 5V port to the data logger Vin port. That’s it!
Step 5: Build the Base & Case!
1. Plan out, measure, and mark location of load cells.
Load cells should be at least 1" in from the top platform board sides and installed equidistant and on the same plane (aka same height) with each other.
Each load cell needs three M3 type screws, which requires fairly precise measurements. I opted for a quick & easy solution: make a plastic stencil that marks the load cell outline and the location of the screw holes. The plastic I used was cut from a discarded strawberry container (yay, free and upcycled!).
2. Drill holes for load cell screws and attach load cells to base board.
3. Attach feet to base.
4. Secure the scale platform.
Place platform on top of the load cells. Attach wood slats to sides of base with wood glue and/or screws to secure the platform in place laterally, but not vertically. AKA, be sure that there is no resistance to the board pushing downward.
Add brackets on opposite sides for a more secure hold.
5. Place electronics into project box container (or tupperware) and drill holes for cables.
6. Admire your handiwork!
Step 6: Connect the OpenScale!
One of the awesome features of the OpenScale program is that it outputs data to the Arduino IDE serial monitor (9600bps). All we need to do is plug in our OpenScale via USB, select the appropriate board (Arduino Uno) and port, and you can read the load cell data directly from the Arduino Serial Monitor. More info on how to do this here.
Enter ‘x’ to bring up the OpenScale settings menu. Entering ‘x’ again leaves the menu and the OpenScale will start printing data!
We also need to remove the serial trigger from the OpenScale. Do this by going to the menu, inputting ’t', and turning the serial trigger to OFF.
You can change various other settings on the OpenScale using the serial monitor, including units (lbs/kg), print rate, decimal places, etc. You can adjust, or peruse, the entire OpenScale program by downloading it from GitHub!
Note: If you are connected to another microcontroller, the OpenScale does not send data when in the menu mode.
Step 7: Tare & Calibrate the Open Scale!
We'll need to tare the OpenScale each time it is powered up. To tare the scale, remove all weights from the scale and open the OpenScale settings menu. Input ‘1’ in the OpenScale menu, wait for it to finish taring, then exit the menu and check that the output is close to zero (+/- 5 lbs). If the reading is still off, taring again should fix the problem – if not, check that the load cell grounding wires are properly connected to ground.
We also need to calibrate the OpenScale to get accurate measurements. It’s also recommended to re-calibrate the system every few weeks (or days) to avoid creep (slow change in reading over time).
To calibrate the scale:
- Remove all weights (except the platform).
- Open the OpenScale menu and select ‘2’ to open the calibration setting.
- Place a (known) weight on the scale and adjust the calibration factor using ‘+’ and ‘-’ until the scale reads out the calibration weight within a reasonable margin in error.*
Also, the load cell output varies with temperature (‘cause heat causes expansion), so we need to keep the system at a constant temperature (or use different calibration factors at different temperatures.
*My experimental uncertainty was about +/- 5 lbs.
Step 8: Program the Photon!
Write a program for the Photon that will read in the serial output data from the OpenScale and push it to the IoT platform of your choice. Or you can use/modify my code :)
Here’s the GitHub repository for the IoT scale.
This program reads data from the OpenScale and pushes it to ThingSpeak (also prints it to the Photon serial monitor). ThingSpeak is super easy (and free!) to set up, the only downside is that it only allows data to be posted every 15s.
What you need to do to make the program work for your setup:
- Include your WiFi SSID (network name) and your WiFi password in lines 53 & 54, and lines 69 & 70.
- Set up a ThingSpeak channel!
- Name the channel and write a brief description.
- Include at least one field name. If you want to push more data, like temperature or a timestamp, include those corresponding fields.
- Save the channel!
Read through the comments in the program code for more information on how the program works.
Step 9: Test & Refine!
Prototype complete! Have your favorite human or animal stand (or awkwardly lay..) on the scale to check that it works as expected.
Check thoroughly to see if there is anything that needs to be fixed, secured, and/or improved. During my build process I noticed that a lot of the wood I was using to test would get dented by the load cells, resulting in inaccurate readings.
Step 10: Lessons Learned & Next Steps
My initial goal for this IoT scale was to gather data on the forces due to jumping (specifically in parkour). Alas, the OpenScale is intended for constant loads and the fastest print rate is 505 ms, which is too slow to get accurate readings on impact force.
Fortunately, we can still use the scale to gather general data and use this design as a foundation for future versions. Some quick and well-timed preliminary testing by a professional jumper (~165 lbs) resulted in the readings plotted on the graph above. It shows a single jump, where the landing corresponds to the highest reading (~ 230 lbs), and the point just before that (~ 135 lbs) is when his feet were in the air. (The weight decrease + little blip after the the peak is when he was stepping off the scale.)
In addition to an updated program to print data faster, I’ll need waaay more data and a consistent, controlled procedure to determine any kind of reasonable relationship between impact force, jump height, and weight. Also, the top platform was a bit dented after these tests, so I’ll need a sturdier wood, or metal, scale platform.
Overall, this was a cool proof-of-concept and an informative preliminary test! Plus, there are tons of other practical uses for this simple Internet-connected scale!
Step 11: Education Extension & Beyond!
Beyond being a great hands-on project for computer science, engineering, and electronics courses, this is a handy experimentation tool for physics classrooms! Use it to illustrate the difference between weight and mass, demonstrate how acceleration relates to force, or use the on-board temperature sensor to estimate the mathematical relationship between thermal expansion and load cell output.
- Use the system to measure the weight of a rain barrel and notify you when it is full.
- Make a bathroom scale that keeps track of your weight (or your animal’s weight).
- Monitor the weight of your Halloween candy to be sure that no one is sneaking some from under your nose.
Fourth Prize in the
Circuits Contest 2016
Third Prize in the
IoT Builders Contest
3 years ago
Have you looked at this site, https://www.barventory.com/copy-of-become-a-distri...
His idea came from this project.
Reply 3 years ago
Hah! Thanks for the info -- I hadn't seen that project, but always glad these tutorials are useful for folks :) Out of curiosity, how do you know he was inspired by my build?
Reply 3 years ago
I told the guy who started the company, Jeff. He came to me with this https://www.instructables.com/id/IoT-Weighing-Scale/ I made one for him you can see my version in the above link. Next he wanted to track the weight of a keg, so I showed him your project. I didn't make one of your scales. He seems to be making good money selling your idea. :(
Reply 2 years ago
hah! that's such an adorable lil' scale! I love it :) Thanks for the info, that actually makes me super happy that someone was able to build a small business off this idea! My goal isn't to manufacture things but rather to show folks what's possible, hence why my projects are open source :) but i really appreciate the heads up! i suppose i would have appreciated a shout-out but eh, glad to have helped someone do something they love, solve a problem, and make new types of jobs. <3
3 years ago
Ah, this guide is so good! I'm super impressed. Do you reckon you could rely on this as a cheaper alternative to some of the professional scales out there (e.g. https://www.meltrons.com/ ) if you're not technically using it in a professional setting. Or, rather, in more of a hobbyist / small business setting? I have to weigh furniture before shipping it out to clients and only need a close-enough weight for shipping calculations. Some of the industrial options are *pricey*. Oof!
Reply 3 years ago
Thank you!! Apologies for the delay, just seeing your comment. yes, this project should be sufficient for your hobbyist/small business application. Definitely a much cheaper alternative, which is why I wanted to build it! I used it to estimate impact force of a jump (also for small-business applications), and it was good enough for me to get actual in-situ data to which I could compare my calculations and determine if they were reasonable. it will be a lot easier to use as an actual scale :) hope that helps! lmk if you have any other Qs.
6 years ago
Great Project: I have been looking for something like this for a year now. What is the max weight this will measure 4X200kg? I have a 6x6 post in my shop. I want to find a way to see how much weight is on the post. I am guessing it to be 3-5 US tons. Do you have any idea if this project would be scaled up to measure that range?
Thanks .... and keep these great projects coming!
Reply 6 years ago
Thank you! Glad you found it useful! 200 kg equates to about 440 lbs, so my initial thought was that with even weight distribution across 4 load cells you could put as much as 4 * 440lbs = 1760 lbs, so theoretically it should be able to handle 1700 lbs. Since 1 ton is ~ 2000 lbs, the post would likely be a bit much with this first design. But! You can definitely use geometry w/ some levers to reduce the weight distribution even further, which is how bathroom scales work. Hope this helps, LMK if you have any other questions! :D
6 years ago
Reply 6 years ago
lolol thank you, he's a pretty entertaining pooch ^.^