# Truck weight measurements with NODE RED

**URL:** https://discourse.nodered.org/t/truck-weight-measurements-with-node-red/14463
**Category:** Share Your Projects
**Created:** [18 August 2019 20:22 UTC](https://discourse.nodered.org/t/truck-weight-measurements-with-node-red/14463 "2019-08-18T20:22:31Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![iungo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iungo/32/8099_2.png) [@iungo](https://discourse.nodered.org/u/iungo)
#### Post date: [18 August 2019 20:22 UTC](https://discourse.nodered.org/t/truck-weight-measurements-with-node-red/14463/1 "2019-08-18T20:22:31Z")

</div>

I'm developing an automated truck weight measurement system based on Node-Red.

What I expected from this system:

1. Truck numberplate recognition.
2. Search truck data in the database.
3. Automatically put truckload data to the UI.
4. Show overload/underload info in the UI.
5. Show each axle balance in the UI
6. Save all entered arrived and departed vehicles load in the database.
7. Save data to the cloud and visualize it.
8. Connect to the database of the warehouse to control the actually departed truckload.

You can find this project on [hackaday.io](http://hackaday.io). Here the link:

> **[LOAD CELL to MODBUS](https://hackaday.io/project/166758-load-cell-to-modbus)**
>
> An idea of this device was born when I worked on the Automatic Weight Control system for trucks, which can weigh trucks, read license plates(CV system), save truck weight data in the database, control automatic gates, etc etc etc... This project...

In "DETAILS" I explain the details about my Load cell - Modbus converter,  
In "PROJECT LOG" I explain some details about the test setup.

All hardware, exclude raspberry pi is my own development.

Unfortunately, I'm not so good in English( If I have any mistakes in the description, please, be patient, or tell me how to fix it.)

If you have any questions, feel free to ask me here.  
If you have any advice, I will gladly consider this.

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [18 August 2019 20:41 UTC](https://discourse.nodered.org/t/truck-weight-measurements-with-node-red/14463/2 "2019-08-18T20:41:19Z")

</div>

Now that is a heavyweight project !

---

<div class="post-metadata">

### Author: ![iungo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iungo/32/8099_2.png) [@iungo](https://discourse.nodered.org/u/iungo)
#### Post date: [18 August 2019 20:56 UTC](https://discourse.nodered.org/t/truck-weight-measurements-with-node-red/14463/3 "2019-08-18T20:56:36Z")

</div>

Yes, I think)

In the past, I developed the system for airport lane friction coefficient measure. Now it uses in 14 airports. It has the same principles (load cell, ADC, data transfer (serial to WIFI interface)). I wrote laptop client software and UI myself on c++.

But after that, I found Node-Red. And I was impressed with possibilities and fascinated support.

---

<div class="post-metadata">

### Author: ![iungo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iungo/32/8099_2.png) [@iungo](https://discourse.nodered.org/u/iungo)
#### Post date: [19 August 2019 11:13 UTC](https://discourse.nodered.org/t/truck-weight-measurements-with-node-red/14463/4 "2019-08-19T11:13:14Z")

</div>

TEST SETUP

 ![test%20setup](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/f/f62c7c3d8a6dba51b4d25c99dca90f40e4fa3c94.jpeg)

1, 2, 3, 4, 5, 6. Independent weight scales. Each consists of the load cell and Loadcell-Modbus converter (PCB w/o housing)  
7. DIN enclosure with Raspberry PI3 B+ inside.  
8. IOTON PI-FACE (my interface for Raspberry PI with RS485, RTC, UPS, power controller, WATCHDOG, GPIO connector for modules e.t.c.)  
9. IOTON DIO4.1 (my universal isolated I/O module)  
10. OMRON E3S-X3CE4 (photoelectric switch)  
11. LED traffic light for the driver.  
12. IP camera for the license plate recognition.  
13. Truck model (I need to add one more axle)  
14. Interchangeable license plate model.

---

<div class="post-metadata">

### Author: ![iungo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iungo/32/8099_2.png) [@iungo](https://discourse.nodered.org/u/iungo)
#### Post date: [21 August 2019 07:24 UTC](https://discourse.nodered.org/t/truck-weight-measurements-with-node-red/14463/5 "2019-08-21T07:24:57Z")

</div>

Noise test.

Test setup:  
 ![noise-test-setup](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/c/c53095b3def9e13980970b01cc9ed62f3cf1a9b3.png)

Left to right: 0.2ton Load cell, my Load cell - Modbus interface (in stainless steel housing), MICRIO MPU & DI8 input module.

500 samples video (16sec):

As you can see, I have around 120 counts of noise Peak-to-Peak.

Lets calculate the counts... 24bit = 2^24 = 16 177 216 counts. Noise of my system = 120 counts. So I will have 16 177 216 / 120 = 134810 noise free counts, it's around 17 bits. Not so bad.

For 200 kg sensor (in real life it has 400 kg full range, 200 kg for tension and 200 kg for compression), I will have an accuracy of around 200 000 \* 2 / 134810 = 3 gram.

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [21 August 2019 18:20 UTC](https://discourse.nodered.org/t/truck-weight-measurements-with-node-red/14463/6 "2019-08-21T18:20:24Z")

</div>

Maybe the smooth node may help average over a number of readings as well...

---

<div class="post-metadata">

### Author: ![drmibell](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/drmibell/32/8424_2.png) [@drmibell](https://discourse.nodered.org/u/drmibell)
#### Post date: [21 August 2019 22:32 UTC](https://discourse.nodered.org/t/truck-weight-measurements-with-node-red/14463/7 "2019-08-21T22:32:47Z")

</div>

> [@iungo](#):
>
> around 17 bits. Not so bad.

Not bad at all!

If you're using the AD7799 ADC, that's just about the best you could expect. I assume you are measuring with no load in an electrically quiet environment. What happens in the "real world", particularly with a load and some mechanical noise?

---

<div class="post-metadata">

### Author: ![iungo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iungo/32/8099_2.png) [@iungo](https://discourse.nodered.org/u/iungo)
#### Post date: [22 August 2019 05:09 UTC](https://discourse.nodered.org/t/truck-weight-measurements-with-node-red/14463/8 "2019-08-22T05:09:23Z")

</div>

Yes, the smooth node is very convinient tool in Node-Red.  
But in this case, I use ADC in very slow mode (freq 4.17 Hz).

Also I thinking about digital filter implementation inside my device(I think it will be sliding average filtering) with conrol filter parameters thru Modbus registers, for easy usage with old PLCs with CodeSys p.e. for example.

---

<div class="post-metadata">

### Author: ![iungo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iungo/32/8099_2.png) [@iungo](https://discourse.nodered.org/u/iungo)
#### Post date: [22 August 2019 05:22 UTC](https://discourse.nodered.org/t/truck-weight-measurements-with-node-red/14463/9 "2019-08-22T05:22:17Z")

</div>

Noise with load is not a big problem(really, I did this measurement on the video with loaded load cell, load = load cell weight, around 400gram).  
To eliminate mechanical noise I'm using hard analog filtering (second-order 5hz).  
Much more dangerous - bad thermal stability of the load cell. But I implement temperature measurement, and I have load cell temperature data in one of Modbus registers. So I can do some compensation for the temperature disturbances.

Also, I have another variant of my device mounting(I think it's the best noise immunity solution). Also I will have an actual loadcell temperature data. I think I will get the stainless steel enclosure for it next week.

 ![6778711564079142224](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/c/c681fb5bd8414acc0c7c7fd53d3433730d6fd712.jpeg)

---

<div class="post-metadata">

### Author: ![iungo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iungo/32/8099_2.png) [@iungo](https://discourse.nodered.org/u/iungo)
#### Post date: [22 August 2019 06:55 UTC](https://discourse.nodered.org/t/truck-weight-measurements-with-node-red/14463/10 "2019-08-22T06:55:51Z")

</div>

Maybe it's a little bit off-topic. But I have a video about my device PCB assembly. I think it's the fastest method for prototyping and low mass production. Maybe it will help save time for somebody)

how to save money on stencils, and how to made paste printing tool for fast, double side printing:

> **[Save money on stencils and printing.](https://hackaday.io/project/166682-save-money-on-stencils-and-printing)**
>
> This is the part of my big project IOTON MICRIO (Raspberry PI based Programmable Logic Controller for home and industrial automation). I'm rarely doing things for fun, mostly I'm doing useful things, and have fun from it). This article is about how...

---

<div class="post-metadata">

### Author: ![iungo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iungo/32/8099_2.png) [@iungo](https://discourse.nodered.org/u/iungo)
#### Post date: [25 August 2019 13:07 UTC](https://discourse.nodered.org/t/truck-weight-measurements-with-node-red/14463/11 "2019-08-25T13:07:54Z")

</div>

Small video about how this system works:

- 0:00 - description.
- 0:23 - usage for simple weight scale application.
- 1:03 - usage for Automated 3-axle Truck Weight Measurement System.
- 2:47 TODO list
- 3:00 What next?

---

<div class="post-metadata">

### Author: ![iungo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iungo/32/8099_2.png) [@iungo](https://discourse.nodered.org/u/iungo)
#### Post date: [29 August 2019 17:50 UTC](https://discourse.nodered.org/t/truck-weight-measurements-with-node-red/14463/12 "2019-08-29T17:50:07Z")

</div>

I think Node-Red is a very convenient tool for hardware test purposes.  
In the past, I used mainly Simulink, but now I can solve near all tests for the slow processes with Node-Red.

Yesterday I did preliminary load cell temperature drift test.

Here my test setup:

 ![drifttest](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/e/e2c1f1cf7542e607de4068de1efc49b2f02a38b5.jpeg)

I understand it's not so accurate setup for measurements(I need thermal chamber for accurate measurements), but let's look on the results:

 ![Temp%20drift%2016](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/f/ff264f4332fc80be578ffb9f504d826c665d691d.jpeg)  
As you can see I have 16000 / 30 = 533 counts temperature drift for 1 degree Celsius. It's more than 4 times higher than noise, and it's unacceptable for accurate measurement.

I use expensive hi-class (C3) load cell. Let's calculate how the load cell meets specifications.  
 ![sensor%20data](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/b/b7278ed95acbb2e90e7384b7581ac60d508ff3eb.png)

C3 - accuracy class

Temperature effect on zero balance TKzero must be less or equal +//0.0014% for 1 degree Celsius from the full scale.

My ADC has 24bit resolution, so the number of counts = 2^24 = 16 777 216 and calibrated exactly for this load cell full scale

Temperature drift = 533 counts

So:

TKo = 533 / 16 777 216 / 2 \* 100 = 0.0016%

It's slightly higher then I see in the specification.

Let's calculate temperature drift error in grams. I use 200kg load cell which works in both directions (tension and compression) so it has 400kg full scale.

TKo = 533 / 16 777 216 \* 400 000 = 12.7 gram/1 degree Celsium.

It's a significant error in measurements.

Why it's a significant error? Because standard deviation with filtering (20 values mean) only 0.65 gram for 400 000 gram full-scale load cell.

 ![standart_deviation](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/5/564f944d53f06d7285ca7cc85f54719cd825ebad.png)
