To create the circuit to get meaningful data back into the raspberry pi requires a few steps. As the changes in resistance are tiny, the signal from the sensor must first be amplified - I am using the AD620AN ( datasheet ) and use a 50Ω resistor to set the gain to 1000. After the signal is amplified it then needs to be sent to an A/D converter before we can read it back into the Pi. Currently we are using the MCP3008 ( datasheet ).
Once the circuit is in place, we can begin calibrating the sensor and taking measurements:
So there we have it! Reading weight with the Raspberry Pi.
I've learned quite a bit through this process and am happy with the results so far, however it must be said this current approach may not be the best solution. There are quite a few issues with taking weight measurements that have come to light in this process:
- Temperature compensation - I have read many places and noticed in my own research that the readings from these sensors are prone to "drift" due to changes in temperature. This means that the same weight reading taken at different times of the day (i.e. different temperatures) can be inconsistent; my initial testing has seen up to 6lbs difference!
- Mounting the sensor - in order for the readings to be consistent, the load must be placed squarely on the sensor plate. The form factor of the sensor might make this a little tricky.
- Constant strain drift - when these sensors are placed under constant load/strain the readings will drift - something in the neighborhood of a few percentage points of the weight every half hour. It may be worth experimenting with better sensors. The current ones are the cheapest on the market.
Despite these issues, I think its good to press on. The next steps is to tidy up all of the sensor code I have then start to write the logging software in order to keep track of our readings. I will also start looking to design a prototype PCB so all the circuitry can come off the breadboard and go onto a custom PCB.