What is a loadcell? How can it be used in your project?

Introduction

The force transducer measures a stress applied by the user or an object and transmits it to the arduino board in the form of a voltage. It consists of a force cell. The force cell is a strain gauge used to measure force.

The force transducer measures a stress applied by the user or an object and transmits it to the arduino board in the form of a voltage. It consists of a force cell. The force cell is a strain gauge used to measure force.

The force sensor can read a value ranging from 0 newtons to 10 newtons, which corresponds to 1kg. You can find sensors up to 2-3 kg on arduino.

Depending on what you need for your project, there are force transducers of different sizes and precision.

Some sensors also have a conversion module to amplify the signal and convert it into a digital value. These sensors are plugged into a digital terminal on the Arduino board.

Here is a kit of different pressure sensors using a conversion module:

The force sensor pins

  • Vcc: Must be connected to the 5v of your Arduino board
  • GND & Signal: This pin is connected to a 9.1 kilo-ohm resistor, an analogue terminal and earth.

Display value on serial monitor

We’ll now see how to display the force values on the serial monitor in Newton-metres:

#define force_sensor A0 // force sensor pin

void setup() {
  Serial.begin(9600); // initialise serial monitor
}
void loop() {
  
  int reading_value = analogRead(force_sensor); // we read the value coming from the force sensor
  // display the value on the serial monitor
  Serial.print("Loadcell value: ’);
  Serial.print(reading_value);
  Serial.println("milli Newton meter");
  delay(100); // pause to wait for next value
}

Measuring force with LEDs

We’re now going to look at how to light up LEDs as a function of force in Newton-metres.

#define force_sensor A0 // force sensor pin
// define leds
#define led_white 2 
#define led_blue 3
#define led_green 4 
#define led_yellow 5 
#define led_orange 6 
#define led_red 7 

void setup() {
  // define output leds
  pinMode(led_white, OUTPUT);
  pinMode(led_blue, OUTPUT);
  pinMode(led_green, OUTPUT);
  pinMode(led_yellow, OUTPUT);
  pinMode(led_orange, OUTPUT);
  pinMode(led_red, OUTPUT);
}
void loop() {
  
  int reading_value = analogRead(force_sensor); // we read the value coming from the force sensor
  // if the value is greater than 2 newton-metres, we turn on the white LED
  if (reading_value > 200) { 
    digitalWrite(led_white, HIGH);
  }
  else digitalWrite(led_white, LOW); // Turn off the LED if this is not the case
  
  // Turn on the blue LED if the value is greater than 4.5 Newton metres
  if (reading_value > 450) {
    digitalWrite(led_blue, HIGH);
  }
  else digitalWrite(led_blue, LOW);
  // the green LED is lit if the value is greater than 5.5 Newton-metres 
  if (reading_value > 550) {
    digitalWrite(led_green, HIGH);
  }
  else digitalWrite(led_green, LOW);
  // The yellow LED is lit if the value is greater than 6.5 Newton-metres 
  if (reading_value > 650) {
    digitalWrite(led_yellow, HIGH);
  }
  else digitalWrite(led_yellow, LOW);
  // The orange LED is lit if the value is greater than 8 Newton-metres
  if (reading_value > 800) {
    digitalWrite(led_orange, HIGH);
  }
  else digitalWrite(led_orange, LOW);
  // The red LED is lit if the value is greater than 9 Newton-metres
  if (reading_value > 900) {
    digitalWrite(led_red, HIGH);
  }
  else digitalWrite(led_red, LOW);
}