Weight Measurement (Load Cell and Force-Sensitive Resistor)

 

EarthWearth: Lulu Wein, Matthew Siegel, Ron Wolf, and Marci Brustman

eToolpage:

Weight Measurement – Load Cell, Force-Sensitive Resistor

 

About:

The load cell is a small metal bar that is designed to convert the forces placed on it into electrical signals, which can be measured by a computer like the Arduino. Basically, it measures weight. It does this, using variable resistors on both sides of the cell, which measure tension and compression. The signals from these resistors are sent through an operational amplifier (described below) and read by the Arduino.

::Desktop:Screen Shot 2015-06-14 at 7.42.08 PM.pngSource: seeedstudio

 

The force-sensitive resistor works in the same way, but it is much thinner, longer, and a little easier to use.

::Desktop:Screen Shot 2015-06-14 at 7.43.58 PM.png

 

 

Source: Trossenrobotics

 

These sensors are used mainly in scales, but you could use them for any project where you want to measure force. In our own project, we tried to use them to measure the weight of objects dropped onto a platform in order to separate garbage and recyclable materials. Weight served as the differentiating factor between garbage and recyclable materials. We knew that when we saw heavier readings on the Arduino, garbage had been dropped onto the platform, and when recyclable items like plastic forks were dropped onto the platform, the readings gave much smaller values.

 

 

Availability:

 

We got the load cell from Amazon and the force-sensitive resistor from Sparkfun. After researching effective ways of measuring weight, we decided to try the load cell. The price of the load cell was $8.19. After working on it for about two months, we realized that it was not working they way we wanted it to. The circuit was extremely confusing and tedious, and the device was really hard to work with. We asked Adam, the representative from CIJE that came to help our class out twice a month, if he knew of any other devices we could use to measure weight. He suggested that we try a force-sensitive resistor to get more accurate readings. It had more accurate readings that worked better for our project. Additionally, the wiring and programming was much more simple and more, effective than the load cell. To give you a sense of how much simpler it was, it took us weeks to wire and program the load cell, whereas it took us 15 minutes to wire and program the force-sensitive resistor. We used the 25-pound model, but other models are available for different weight ranges, depending on what you are trying to accomplish through your project. The cost was only $5.95 on Sparkfun.

 

Instructions:

 

The process of wiring and programming the load cell is much more difficult than doing so for the force-sensitive resistor, which is why it is recommended that you use the force-sensitive resistor, if possible. Instructions for both devices are found below.

 

There is no need to worry about any safety precautions because you will be dealing with low voltages and devices that are very safe! However, it is always a good idea to unplug your Arduino from its power source whenever you are working with it.

 

Load Cell:

 

Materials:

  • Load Cell
  • Arduino Board
  • INA125 chip
  • Wires
  • Power source (computer, battery etc.)
  • Alligator clips or breadboard
  • Kilo-ohm resistor

 

The load cell measures the change in voltage when force is applied, so when the voltage values are high, it means a heavier force has been applied.

 

However, the load cell only outputs a small signal, so in order to actually see how much force has been applied, you have to use an amplifier to boost the signal and make the values larger.

 

We used the INA125 chip:

  • 16 pins, labelled 1-16
  • If you hold up the amplifier vertically, with the “INA125” label at the top, the pin numbers on the left side are 1 through 8 from top to bottom
  • On the right side, the pins are numbered 16-9 from top to bottom.
  • As soon as you begin wiring, disregard pins 13, 14 and 16. They will not be used.

 

The load cell has four wires, and each one is a different color. Each wire has a different function:

  • Red = excitation wire – provides cell with power
    • Use alligator clips or breadboard:
      • Plug into 5V pin on Arduino.
      • Plug into pins 1, 2 (INA125).
  • Black = excitation wire – provides cell with power
    • Use alligator clips or breadboard:
      • Plug into GND pin on Arduino.
      • Plug into pins 3, 5 (INA125).
      • Pin 12 connects to GND via black wire.
  • Green (or yellow) = signal wire – works with amplifier
    • Plug into pin 6 of INA125 (amplifier).
  • White
    • Plug into pin 7 of INA125 (amplifier).

 

 

Other wiring steps/information:

  • Pin 11 (INA125) = “Sense pin”
    • Plug into Analog 0 pin on Arduino.  
      • Pin 10 also connects to Analog 0 → use alligator clips.
  • Pins 8, 9 (INA125) = “Rg pins”
    • Connect to each other with a resistor in between
      • Resistor color code = brown, black, red (1 kilo-ohm)
      • You can move it up or down to change how sensitive it is
  • Connect pins 4 and 15 = Vrefout and Vref5

 

Load Cell Schematic:chematic

https://lh5.googleusercontent.com/GkF-MKOMV6GE3FhYNXQYkhzQtDp0Aep1GaAKaJfyVocUwtOK8S_IaEUqqOonogwgq9m-O31qdpb4sp48Fq11T2nGcmMg9IjWOcst4RozfiXoCdhF4XR0roQ4MXEE7GqC-ymk1jkLoad Cell Wiring:

 

Source: edg.uchicago.edu

 

Code:

 

Once you have finished wiring the load cell, it is time to program it! See the “smoothing” code under “Resource Files” below to see how to get started with the load cell’s code. Then, simply adjust the code so that the load cell will function the way you want it to for your project.

 

Working Load Cell:

 

Push down on the load cell to see a change in the readings on the Arduino’s serial monitor! Pressing down on the sides yields the most change because of the compression it causes on the load cell. If you need help, consult the diagram below.  

 

Video of working load cell:

https://igcdn-videos-c-17-a.akamaihd.net/hphotos-ak-xtf1/t50.2886-16/11083285_1437285143231097_1738476503_n.mp4

 

Force-sensitive Resistor:

 

Materials:

  • Force-sensitive resistor
  • Arduino Board
  • Wires
  • Power source (computer or battery pack)
  • 1000 kilo ohm resistor

 

The wiring for the load cell can be a very tedious and frustrating process, so if you are successful with it that is great! If not, there is no need to worry because there is another “load-measuring” option that works just as well as the load cell.

 

The readings that will be displayed on the serial monitor will change based on how much force is applied to the circle at the top of the force-sensitive resistor. The readings show the voltage between the two outer leads of the resistor. When force is applied, the voltage increases.

 

Wiring:

  • Connect one lead (silver piece at bottom of force-sensitive resistor) to GND on Arduino.
    • Resistor between lead and GND – 1000 kilo ohm (brown, black, green)
  • Connect other lead to 5V on Arduino.

 

 

 

 

 

::Desktop:Screen Shot 2015-06-14 at 7.35.10 PM.pngForce-Sensitive Resistor Wiring:

 

Source: sparkfun

 

Code:

 

Once you have finished wiring the force-sensitive resistor, it is time to program it! See the “smoothing” code under “Resource Files” below to see how to get started with the resistor’s code. Then, simply adjust the code so that the load cell will function the way you want it to for your project.

 

Working Force-Sensitive Resistor:

 

Once you have completed all of these steps, push on the circle at the top of the force-sensitive resistor to see a change in the readings printed to the Arduino’s serial monitor.

 

Resource Files:

 

We used a few libraries and code samples in our final sketch. Our readings from the load cell and, later, the force-sensitive resistor were very noisy (viz. they varied a lot). Because of this, we couldn’t use the resulting values to differentiate between garbage and recycling, which was what our project aimed to do. We did some research and found quite a few solutions, some from Arduino’s official site and some by enthusiasts. We ultimately settled on one of the official code samples rather than a full-fledged library to keep our code manageable. We also used the standard Arduino library for controlling Servo motors, SoftwareServo, to control our platform’s rotation. Luckily, since both the load cell and theforce-sensitive resistor return easy-to-read analog values from 0 to 5 volts, this code applies to both. Just make sure to check what values your weapon of choice returns using AnalogReadSerial so you know where your readings end up.

 

Here is the important part of the smoothing code, slightly modified:

 

1 void loop() {

2   total -= readings[index];

3   readings[index] = analogRead(sensor_pin);

4   total += readings[index];

5   index++;

6   if(index = reading_count)

7     index = 0;

8   average = total / reading_count;

9   Serial.println(average);

10 }

 

As far as the variable names go, “total” is the sum of all readings stored in the array (list of fixed size) “readings”, while “index” is the location in “readings” we are currently looking at. “memory” is the number of readings we’ve set Arduino to remember and average together. First, we set the total to itself less the oldest reading (i.e., the one at the current index). (2) We then set the oldest reading to our newest reading using “analogRead()” (3) and replace the value we just subtracted from the total with this new value (4). Next, we move to the next index (5), wrapping back to the first index (7) once we’ve reached the last item in our array “readings” (6). Finally, we divide our total by the number of readings we added together to get it, getting back our average reading (8) and printing it out (9).

The array syntax we used for “readings” is fairly simple. All that’s needed is to initialize the array using “type array[size];” where type tells us how much storage is used for each entry in the array (usually “int”), array is the array’s name, and size is some constant that tells us how many values it stores. If size is a number such as “5” or “32”, you have nothing else to worry about. However, you’re not allowed to refer back to a variable when you initialize an array, since an array’s size can’t vary. All this means for you is that if you’re using a separate variable for your size, such as “int array_size = 18” you have to put “const” before your initialization, like this: “const type size;” (in our example, “const int array_size = 18”). (For more on types, visit the official C++ guide and scroll down to “fundamental data types”.)

 

Advice:

 

The load cell was very hard to work with; the wiring was complicated and it was not very sensitive. If you are working with heavy weights (multiple kilograms) then we recommend using the load cell, but in all other cases, we recommend that you use the force-sensitive resistor because it is flexible and easy to wire. It is also long and thin and it can be used for anything. Even with the force-sensitive resistor, we didn’t get perfect readings, but it is more effective than the load cell.