Our cat Snowy 😸 has been enjoying her meals over winter. I wanted to start collecting data on her eating habits, and analyse her weight over time. This data is collected with food and cat weight measurements; alongside phots taken by two cameras. Data is collected and images processed locally using a Raspberry Pi. At the risk of body-shaming our cat, updates are posted regularly to Twitter snowydata.
There are two scales — one for weighing the cat; and an independent weight measure for her food. As Snowy enters the cat scale, an initial measurement is taken for her current weight along with an starting weight for her food. An overhead and lateral camera takes a photo every 5 seconds.
When Snowy leaves the cat scale, a calculation is made between the initial and current cat and food weight measurements to determine how much food has been eaten and her current weight. Two camera images are selected, text is overlaid the photos — and a Tweet is sent to announce her latest meal.
I needed to build two scales — one for the food and one for the cat. So another excuse for online shopping for a collection of load cells and load cell amplifiers.
Load cells are pretty neat. They measure weight (or, more accurately, directional force). Each load cell is able to measure the electrical resistance that changes in response to (and is proportional to) the force applied.
For weighting the food; I used a single “straight bar” load cell which can translate up to 1kg of pressure (force) into an electrical signal. To weigh the food I had the load cell mounted between two wooden boards. The weight of the food is measured by the strain resistance measured across the load cell.
A load cell amplifier is used to get measurable data out from a load cell. I used an HX711 — which is an analogue-to-digital converter (ADC) designed to act as interface between the analogue world of weigh sensors to a digital input for the Raspberry Pi.
To accurately weigh Snowy I needed a larger scale. I wanted a surface large enough for her body and tail so she could be weighted whist she was eating. The first step required measuring the length of a cat
I used four load cell weighing sensors — one for each corner of the cat weighing station. The 50kg load cells and another HX711 amplifier module was around $5. The peculiar thing about these sensors is they don’t sit flush to a surface, and the centre of each sensor needs a gap for it to flex when a load is applied. You can 3D print a bracket — but I found I could build 4 brackets with some scrap wood cut with a Dremel.
The wooden brackets provided sufficient clearance for the foot of the load cell to flex, while still holding the perimeter of the sensor.
Finally I was ready to connect the five load cells to the two HX711 amplifier modules — and in turn to the Raspberry Pi; a tiny and very cheap computer. I found this guide very helpful for providing wiring details to build a digital Raspberry Pi scale.
My first experiment was a dismal failure. After waiting an eternity for Snowy to approach the weigh station, she quickly discovered a flaw in my design.
To encourage Snowy to step onto the scale when eating, I placed small triangular walls on the side of her feed station. This worked well, and Snowy appreciated the additional privacy while eating
A camera was mounted above and next to the feed station — and the entire contraption was painted.
This blog covers the initial hardware steps for the ongoing catfit data project. Further blogs will describe data processing, trend analytics and data visualisation.