A Smart Fridge Tracker
Nutribase helps you and your roommates track food items in your fridge, monitor weight changes, and assign ownership. With hardware integration (ESP32 + sensors), it’s a seamless bridge between your physical fridge and a collaborative digital dashboard.
- Real-time Weight Tracking – ESP32 + load sensor logs food weight changes.
- Item Ownership – See who added what (via user profiles).
- Roommate Collaboration – Shared dashboard for households.
- Food Item Descriptions – Showcases weight, price, expiration, time added, and brand.
- 3D-Printed Enclosure – Neatly houses hardware inside your fridge.
- Microcontroller: ESP32
- Sensors:
- Weight sensor (e.g., HX711 + load cell)
- Display: LCD with I2C module
- Misc: Jumper wires, breadboard (3.5" x 2.25"), LED lights
- Enclosure: 3D-printed case
-
Load Cell Wiring:
- Red wire → E+ (HX711)
- Black wire → E- (HX711)
- White wire → A- (HX711)
- Green wire → A+ (HX711)
- HX711 to ESP32:
- DT → GPIO 23
- SCK → GPIO 22
- VCC → 3.3V
- GND → GND
-
LCD Display (I2C):
- SDA → GPIO 21
- SCL → GPIO 22
- VCC → 5V
- GND → GND
-
Power Management:
- Use separate 5V/2A power supply for load cells
- Add 100µF capacitor between HX711 VCC/GND
- React (TypeScript) – Interactive dashboard.
- Libraries: Material-UI, Chart.js (for weight trends).
- Node.js + Express – REST API for fridge data.
- WebSocket – Real-time updates for weight changes.
- MongoDB – Stores users, items, and fridge logs.
- Written in C++ (Arduino Core).
- Posts weight/RFID data to the backend via WiFi.
# Clone the repo
git clone https://github.com/yourusername/Nutribase.git
# Backend setup
cd backend
npm install
cp .env.example .env # Configure MongoDB URI
npm start- Open
/firmware/Nutribase.inoin Arduino IDE. - Install required libraries:
# Install these via Arduino Library Manager: - HX711 (for weight sensor) - WiFiClientSecure (for HTTPS connections)
The ESP32 sends weight data to your backend server via HTTP POST requests. Here's the core functionality:
#include <HTTPClient.h>
#include <WiFi.h>
// Wi-Fi Configuration
const char* ssid = "YOUR_WIFI_SSID";
const char* password = "YOUR_WIFI_PASSWORD";
const char* serverUrl = "https://your-backend-url.com/api/data";
// Weight Posting Interval (ms)
const long postInterval = 10000;
unsigned long lastPostTime = 0;
void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("WiFi connected");
}
void loop() {
if (millis() - lastPostTime >= postInterval) {
lastPostTime = millis();
if (WiFi.status() == WL_CONNECTED) {
HTTPClient http;
http.begin(serverUrl);
http.addHeader("Content-Type", "application/json");
// Get weight from load cell
float weight = LoadCell.getData();
// Create JSON payload
String payload = "{\"weight\":" + String(weight, 2) + "}";
// Send POST request
int httpCode = http.POST(payload);
if (httpCode > 0) {
String response = http.getString();
Serial.println("Server response: " + response);
} else {
Serial.println("Error: " + http.errorToString(httpCode));
}
http.end();
} else {
Serial.println("WiFi disconnected");
}
}
}cd ../frontend
npm install
npm run dev- Update secrets.h with your credentials:
const char* ssid = "YOUR_WIFI_SSID";
const char* password = "YOUR_WIFI_PASSWORD";
const char* serverUrl = "https://your-backend-api.com";
- Upload to ESP32 via USB.
-
Create an account and log in
-
Power On Hardware:
- Connect ESP32 to power source inside the 3D-printed enclosure
- Ensure LCD display lights up (shows "Nutribase Ready")
-
WiFi Connection:
[LCD Display] > WiFi: Connecting... > WiFi: Connected! -
Go to shared group in settings: Invite users to shared group
- Click add food item
- Input all forms
- Click calibrate weight
- Place food on the load cell platform
- Wait for weight stabilization (✔️ appears on LCD)