Weekly Calf Weight Monitoring with Raspberry Pi and Odoo

Tracking calf weight on a regular basis is a practical way to monitor growth and overall health. By combining a Raspberry Pi, a load cell, and Odoo, farmers can automate this task and keep accurate records without manual effort.

Required Hardware

  • Raspberry Pi (e.g., 3B+ or 4)
  • Load cell (e.g., 50 kg)
  • HX711 amplifier module for signal conversion
  • Wi-Fi connection to Odoo (via REST or XML-RPC API)

How It Works

The HX711 module reads the analog signals from the load cell and converts them into digital values. A Python script on the Raspberry Pi translates these readings into kilograms and sends the data to Odoo once per week. Each log entry contains the animal ID, the weight, and the date, ensuring that growth can be monitored over time.

Example Python Script

import time
import requests
from hx711 import HX711

# HX711 Setup
hx = HX711(dout_pin=5, pd_sck_pin=6)
hx.set_scale_ratio(2280)  # Calibration value – adjust as needed

# Odoo API
ODOO_URL = 'http://your-odoo-instance.com/api/weight_log'
AUTH_TOKEN = 'your_api_token_here'

def send_to_odoo(animal_id, weight):
    payload = {
        'animal_id': animal_id,
        'weight_kg': round(weight, 2),
        'date': time.strftime('%Y-%m-%d')
    }
    headers = {
        'Authorization': f'Bearer {AUTH_TOKEN}',
        'Content-Type': 'application/json'
    }
    response = requests.post(ODOO_URL, json=payload, headers=headers)
    print(f"Odoo response: {response.status_code}")

try:
    print("Weighing in progress...")
    weight = hx.get_weight_mean(20)
    print(f"Measured weight: {weight:.2f} kg")

    send_to_odoo(animal_id=42, weight=weight)
    print("Weight successfully sent to Odoo.")

except KeyboardInterrupt:
    print("Process stopped")
finally:
    hx.power_down()

Wiring HX711 to Raspberry Pi

  • VCC → 3.3V (Pin 1)
  • GND → GND (Pin 6)
  • DT → GPIO5 (Pin 29)
  • SCK → GPIO6 (Pin 31)

Benefits and Recommendations

This setup allows farmers to track calf weight consistently and link data directly into Odoo for easy visualization and reporting. With dashboards, alerts, and long-term analysis, herd management becomes more data-driven and efficient. Ensuring proper calibration of the load cell and stable connectivity will help achieve accurate results.

Conclusion

Automating calf weight measurement with Raspberry Pi and Odoo offers a reliable, low-cost solution to monitor animal growth. By reducing manual work and improving accuracy, farmers gain better insights into livestock health and farm performance.