Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Wemos S2 Mini Solar-Powered Battery Monitoring System with Wi-Fi Connectivity

View and Edit Project In Cirkit DesignerImage of Wemos S2 Mini Solar-Powered Battery Monitoring System with Wi-Fi Connectivity

Circuit Documentation

Summary

This circuit is designed to monitor the voltage and power of a solar panel and a battery. It uses a Wemos S2 Mini microcontroller to read the voltages from the solar panel and battery through voltage dividers and then sends the data to an MQTT server. The circuit is powered by a 12V battery, which is regulated down to 3.3V using a Mini-360 DC-DC Step Down Buck Converter. A fuse is included for protection.

Component List

  1. Wemos S2 Mini

    • Description: Microcontroller used for reading voltages and sending data to the MQTT server.
    • Pins: EN, GPIO 3, GPIO 5, GPIO 7, GPIO 9, GPIO 11, GPIO 12, 3.3V, GPIO 1, GPIO 2, GPIO 4, GPIO 6, GPIO 8, GPIO 10, GPIO 13, GPIO 14, VBUS, GND, GPIO 16, GPIO 18, GPIO 33, GPIO 35, GPIO 37, GPIO 39, GPIO 15, GPIO 17, GPIO 21, GPIO 34, GPIO 36, GPIO 38, GPIO 40
  2. Mini-360 DC-DC Step Down Buck Converter

    • Description: Converts 12V from the battery to 3.3V for the Wemos S2 Mini.
    • Pins: Input -, Input +, Output +, Output -
  3. Resistor (10k Ohms)

    • Description: Part of the voltage divider for the battery.
    • Pins: pin1, pin2
  4. Resistor (8.2k Ohms)

    • Description: Part of the voltage divider for the solar panel.
    • Pins: pin1, pin2
  5. Resistor (33k Ohms)

    • Description: Part of the voltage divider for the battery.
    • Pins: pin1, pin2
  6. Resistor (47k Ohms)

    • Description: Part of the voltage divider for the solar panel.
    • Pins: pin1, pin2
  7. Fuse

    • Description: Provides overcurrent protection.
    • Pins: Terminal 1, Terminal 2
  8. Solar Panel

    • Description: Provides power to the circuit.
    • Pins: +, -
  9. 12V Battery

    • Description: Powers the circuit.
    • Pins: VCC, GND
  10. SD30CRMA MPPT

    • Description: Maximum Power Point Tracking (MPPT) controller for the solar panel.
    • Pins: GND, VIN, BAT

Wiring Details

Wemos S2 Mini

Mini-360 DC-DC Step Down Buck Converter

Resistor (10k Ohms)

Resistor (8.2k Ohms)

Resistor (33k Ohms)

Resistor (47k Ohms)

Fuse

Solar Panel

12V Battery

SD30CRMA MPPT

Documented Code

#include <WiFi.h>
#include <PubSubClient.h>
#include <ArduinoJson.h>
#include <driver/temp_sensor.h>

// Definície pre časovanie
const long INTERVAL = 5000;           // Interval merania (5 sekúnd)
unsigned long lastMsg = 0;
unsigned long lastWifiCheck = 0;
const long wifiCheckInterval = 30000;  // WiFi kontrola každých 30 sekúnd

// Kalibračné konštanty podľa použitých rezistorov
const float BATTERY_RATIO = (33.0 + 10.0) / 10.0;    // Batéria: 33k a 10k
const float SOLAR_RATIO = (47.0 + 8.2) / 8.2;        // Solar: 47k a 8.2k

// Nastavenie pinov
const int STATUS_LED = 15;  // GPIO15 pre S2 Mini
const int BATTERY_PIN = 1;