An Arduino Nano ESP32-based counter to track available stock of one item. It automatically gets and uploads the current stock with Arduino Cloud. You can also report the current stock on the dashboard. The stock is displayed by an SSD1306 OLED screen and controlled by 2 push buttons.
Project Introduction
The IoT Stock Counter is a smart utility device designed to simplify inventory management. By leveraging the power of the Arduino Cloud, this system allows you to monitor and update the quantity of a specific item from anywhere in the world. Whether you're tracking office supplies, retail stock, or home pantry items, this compact device provides both physical interaction and remote visibility.
Hardware Infrastructure
- Arduino Nano ESP32: The heart of the project, providing powerful processing and built-in Wi-Fi for cloud connectivity.
- SSD1306 OLED Display (128x64): A sharp, high-contrast screen used to display the current stock count and Wi-Fi connection status.
- Push Buttons (x2): Used for manual stock adjustment. One button increments the count, while the other decrements it.
- Breadboard and Jumpers: Facilitate quick and organized wiring of the components.
IoT & Cloud Workflow
This project utilizes the Arduino IoT Cloud to synchronize data between the physical device and a digital dashboard:
- Real-time Sync: Every time a button is pressed locally, the stock variable is updated on the Nano ESP32 and immediately uploaded to the cloud.
- Remote Monitoring: You can view the live stock count on your smartphone or computer via the Arduino Cloud dashboard.
- Remote Control: The dashboard also features an input field, allowing you to manually override or reset the stock count from the web interface, which then syncs back to the OLED display.
Functional Logic and User Interaction
The software logic is designed for ease of use and reliability:
- Button Debouncing: The code includes timing checks to ensure that a single button press is only counted once, preventing accidental double-counts.
- Persistent Storage: By syncing with the cloud, the device ensures that if power is lost, it can retrieve the last known stock value as soon as it reconnects to the Wi-Fi.
- Dynamic UI: The OLED screen provides clear feedback. When a button is pressed, the screen updates instantly, and a "Syncing" icon may appear to confirm the cloud upload is in progress.
Practical Applications
This system is highly scalable. While this prototype tracks one item, the logic can be expanded to monitor multiple bins or integrated with a barcode scanner for a professional-grade inventory solution. It is an excellent example of how IoT can solve mundane problems through creative engineering.