Now by using digitalWrite(RelayPin, LOW);
we set the relay to low
and by using the command digitalWrite(RelayPin, HIGH);
we are setting relay to high.
Now at the end we have added this self documented code :
if (IsAutofilling == true){ //Autofill Weight = GetCurrentWeight(); WeightTared = (Weight-Tare); TempString = WeightTared; TempString=TempString + "/"; TempString=TempString + WeightLimit; TempString=TempString + "gr"; WriteToLCD("",TempString); if (WeightTared<WeightLimit){ digitalWrite(RelayPin, HIGH); } else { digitalWrite(RelayPin, LOW); IsAutofilling = false; } } else if (IsWeighting == true){ //Show Weight and tared weight Weight = GetCurrentWeight(); WeightTared = Weight - Tare; TempString = Weight; TempString = TempString + "/tared"; TempString = TempString + WeightTared; TempString = TempString + "gr"; WriteToLCD("",TempString); }
The code can be downloaded from here: LiquidFillerPart2
Below you can watch a demonstration video.
Notice that the load cell works only one way. If you try to flip the load cell it is not sensible anymore.
So you have to find the working side of the load cell.
That's all for now.
In the next liquid filler article we will cover the kicad schematic and we will make the PCB.
Stay tuned !!!
Pingback: How To Connect Load Cell To Arduino? | Click & Find Answer !