Hi, my doing a college project to sort out two objects of same dimensions but different materials, e.g. aluminium and steel. I saw the tutorial for interfacing a load cell with an arduino board (https://community.robotshop.com/blog/show/interfacing-a-load-cell-with-an-arduino-board) as well as the amplifier and LCD (https://community.robotshop.com/tutorials/show/arduino-5-minute-tutorials-lesson-8-wheatstone-shield-amp-lcd) one. I got the arduino (I’m using an Elegoo uno R3), load cell amplifier (RB-Onl-38) and the 5Kg load cell (RB-Phi-118) and followed the interfacing a load cell with an arduino board tutorial. I’m wondering can I adjust this arduino code to to send an output, e.g. light up a red LED, if the aluminium weight is measured and another output if the steel is measured, e.g. a blue LED. Also in terms of hardware, how would I connect the LEDs to the arduino/ load cell amplifier.
Thanks very much.
Hey!
I suggest that you try to learn a bit of programming and electronics before starting this project.
Here is a tutorial on how to light up a led with an arduino: http://www.circuitbasics.com/arduino-basics-controlling-led/
If you have an Android phone, electrodroid is a cool app that will help you with basic circuits: https://electrodroid.it/electrodroid/
I can’t really help you more until you have a clearer idea of what you are doing.
Good luck!
Hi, I recently made some progress with the arduino code.
This is what I have:
const int analogPin = A0;
const int ledPin1 = 13;
const int ledPin2 = -;
const int threshold1 = 340;
const int threshold2 = 350;
void setup() {
// put your setup code here, to run once:
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
int analogValue = analogRead(analogPin);
if ((analogValue > threshold1) && (analogValue < threshold2)) {
digitalWrite(ledPin1, HIGH);
} else {
digitalWrite(ledPin1, LOW);
digitalWrite(ledPin2, High);
delay(5000);
digitalWrite(ledPin2, LOW);
}
Serial.println(analogValue);
delay(1);
}
This code is allowing me to light up the inbuilt LED (pin 13) on the arduino when I place the aluminium block on the strain gauge (I’m getting an output of about 345 from the aluminium block so the lower and upper thresholds of 340 and 350 respectfully work just fine). I’m just wondering now how to connect an external LED for the steel block indication as the load cell amplifier shield IS taking up the pins on the arduino.
Thanks.
Hello there!
You can find in the documentation of the shield that it only takes the following pins:
- A0: Strain 1 input
- A1: Strain 2 input
- 5V, 3.3V and GND pins are used to power the shield
Here is a download link to the documentation: https://www.robotshop.com/media/files/zip2/strain_gage_load_cells_shield_documentation_v1.2.zip
What this means is that it is possible to use every remaining pins of the connectors on the shield to connect your LED.
Even if it says that the 5V, 3.3V and GND pins are used to power the shield, you can use those to power the LED.
Feel free to ask any other question
Cheers!