Hello all! New to the Arduino world here, and hitting a small speedbump, hoping for some assistance. Yes, I searched, didn't find anything helpful.
I am making a system to monitor how full my Keg and CO2 canister are, and display this on a LCD screen. It also monitors temperature, and light (so it can power off the LCD when the fridge door is closed). I chopped out the code so I'm only playing with the flexiforce sensors and the LCD. I have wired up the OpAmp and Sensors in the way the datasheet from the FlexiForce manufacturer recommend, but no matter how much pressure I put on the sensor, the display always reads 0. Even in the raw for in the Serial window output. Here is how mine is wired:
And here is the code:
#include <SoftwareSerial.h>
#include <OneWire.h>
int kegSensorPin = A0;
int coSensorPin = A2;
SoftwareSerial lcdSerial(4,3); // pin 2 = TX, pin 3 = RX (unused)
void setup() {
Serial.begin(9600);
lcdSerial.begin(9600);
delay(500); // wait for screen to clear
}
void clearLcd(){
lcdSerial.write(0xFE); //command flag
lcdSerial.write(0x01); //clear command.
}
void initLcd() {
clearLcd();
lcdSerial.write(254); // move cursor to beginning of first line
lcdSerial.write(128);
}
void loop(){
initLcd();
float rawKegWeight = analogRead(kegSensorPin);
float rawCoWeight = analogRead(coSensorPin);
// THIS SECTION FOR DEBUG PURPOSES
Serial.print("Keg: ");
Serial.println(rawKegWeight);
Serial.print("CO2: ");
Serial.println(rawCoWeight);
//The math here will need to be modified to reflect 100 for full
//and 0 for empty. For now it's a percentage of all on or all off.
int kegWeight = rawKegWeight * (100.0 / 1023.0);
int coWeight = rawCoWeight * (100.0 / 1023.0);
lcdSerial.print("Keg: ");
lcdSerial.print(kegWeight);
lcdSerial.print("%");
lcdSerial.write(254);
lcdSerial.write(192); // move to second line
lcdSerial.print("CO2: ");
lcdSerial.print(coWeight);
lcdSerial.print("%");
delay(1000);
}
And here are the diagrams as given by the manufacturer on the datasheets:
As you can see, the voltage divider circuit as provided by FlexiForce is different than the opamp. I've built it both ways. The way I show in the drawing outputs 0. The way the OpAmp manufacturer suggests makes the output jump to 100 (1023). I'm no EE, so I might have wired this up wrong, but I'd love any input. I have a multimeter, but I'm not sure what to look for, because in either way I've wired it up I get 0v or 5v as output.
Thanks for the help!