Hey!
I'm fairly new to arduino and coding in general. I thought I'd get the hang of it quicker but now I have a deadline coming up and I dont know how to complete it in time so any help would be great!
I'm connecting a Joy-it 20kg to an arduino uno. I want it to light up an LED, ideally multiple LEDs depending on the weight. Eg. 0-5kg = red LED light up, 5-10kg = yellow LED light up, 10-20kg = green LED light up. I've done this project previously but with a DIY pressure plate (essentially when two charged copper plates touch the pressure is detected) and it worked out well, i just want to make the next prototype more technical.
This was my previous code (DIY pressure plate);
const int touchPin = 2; // Pin connected to the touch sensor
const int ledPin = 13; // Pin connected to the LED
void setup() {
pinMode(touchPin, INPUT);
pinMode(ledPin, OUTPUT);
digitalWrite(touchPin, HIGH); // Enable internal pull-up resistor if not using external pull-up resistor
}
void loop() {
int touchValue = digitalRead(touchPin);
if (touchValue == LOW) { // Touch detected
digitalWrite(ledPin, HIGH); // Turn on the LED
} else {
digitalWrite(ledPin, LOW); // Turn off the LED
}
}
Any help with code and the layout of the breadboard/arduino is more thank welcome!
You shared a Joy-it link in Post #6. Open that link. Scroll down until you see the image I posted in Post #9. Click on "SEN-Pressure Manual" in the language of your preference.
Do you have known weights or means to apply a known force to the sensor to do an end-to-end verification? The numbers I provided are approximations from eyeballing the graph.
Is this for work, school or fun?
Happy to help.
Give me a Solution check and I'll be on my way.
Hey 2112 thanks sm, i have to do other work rn but will be back on it tmr. Its to measure bottles and cans in a fridge to do an automated stock in-take. It's for a uni project.
Your numbers worked so far :), gonna next sort out the LED light up system. Shouldn't be too crazy, your help really got the ball rolling. Thanks!