Introduction: DIY Smart Battery Monitor With NodeMCU, ADS1115, SMS Alerts, and MongoDB: Complete Guide

There's a NodeMCU microcontroller connected to an ADS1115 Analog-to-Digital Converter (ADC), both mounted on a breadboard. The ADC is wired to a shunt resistor, which is part of a circuit connected to a battery, likely for monitoring voltage drops across the shunt to measure battery usage. This setup allows for real-time data collection about the battery's state, which can be uploaded to a server or cloud service for monitoring and analysis. To see this in action: https://youtu.be/NTwmsFVzf2c

Step 1: Diagram

The circuit diagram shows the NodeMCU microcontroller connected to an ADS1115 ADC. The SDA (Data Line) and SCL (Clock Line) on the ADS1115 are connected to the corresponding D2 and D1 pins on the NodeMCU, enabling I2C communication. The VCC pin on the ADS1115 is connected to the 3V3 pin on the NodeMCU to supply power, and the GND (Ground) is linked to the GND on the NodeMCU to complete the circuit. The ADS1115's A1 pin is connected to one side of the shunt resistor, and the other side of the shunt is linked to the battery bank's negative terminal, which allows for the measurement of the voltage drop across the shunt when current flows. This setup is designed for precise monitoring of battery usage by tracking the voltage drop across the shunt resistor to calculate the current draw from the battery. Do see the Step by step: https://youtu.be/o8SodRMNmwI

Step 2: Code

battery monitoring and data logging system utilizing a NodeMCU and an ADS1115 ADC to measure the voltage drop across a shunt resistor. It calculates the current draw and estimates the remaining battery capacity. The system is configurable for various deployment scenarios, dynamically downloading specific settings based on the device's MAC address. The loop continuously measures battery data, calculates averages, and sends SMS alerts if certain thresholds are crossed. Data is uploaded to MongoDB, allowing tracking and analysis. This code represents a customizable and scalable approach to battery management in IoT applications. Code here: https://github.com/darkmatter2222/Arduino_Battery_Backup_Monitor

Step 3: MongoDB Charting

The MongoDB dashboard shows two key pieces of information regarding battery management. The first section displays the remaining percentage of charge for two batteries: 'Deep Freezer' and 'Fiber Internet', with the 'Deep Freezer' at full charge (100%) and the 'Fiber Internet' at zero charge (0%). Below these indicators is a line graph titled 'Mean Current Per Minute', which plots the average current in amperes over time for both batteries. The data points show fluctuations in current usage over time, allowing for monitoring and analysis of the batteries' performance. Example Dashboard: https://charts.mongodb.com/charts-homeautomation-snhch/dashboards/bce944aa-81ec-43b3-b50e-45cdf96755d5

Step 4: SMS Alerting

The SMS functionality in the battery monitoring system is demonstrated in the image, where the user receives real-time alerts via Twilio. These messages inform the user when the current draw from a battery, named 'Fiber_Internet', exceeds or drops below a predefined threshold of 0.2 amps. This alert mechanism is essential for immediate notification, allowing for swift response to potential issues with the battery's performance, such as unexpected high usage or return to normal levels, ensuring efficient battery management.