Solar-powered projects

The solar set used is from Aliexpress and can be purchased here: *

In the following picture you can see how to measure the state of charge of the battery with the microcontroller via the analog input.

The selection of resistors is calculated via the voltage divider using this formula.

Spannungsteiler Formel

Structure of the circuit

The sketch

					const int batterieLevelPin = 0; //A0
const int intervallTime = 2000; // millis
unsigned long lastMessureTimeChange = 0;
const float batterMaxVoltage = 4.2;
const float batterMinVoltage = 3.27; 

void setup() {
void loop() {
  if (millis() - lastMessureTimeChange > intervallTime) {
    int batterieState = analogRead(batterieLevelPin);
    lastMessureTimeChange = millis();
    int batteriePercent = map(batterieState, 0, 1023, 0, 100);
    float batterieVoltage = map(batterieState, 0, 1023, batterMinVoltage, batterMaxVoltage);
    Serial.print("  Batterie Level ist: ");
    Serial.print(" %\f");
    Serial.print("  Batterie Spannung ist: ");
    Serial.println(" Volt");

Power supply from the module

To avoid voltage peaks, an electrolytic capacitor with a size of 100-1000 µF is connected to the circuit in parallel with a ceramic capacitor with 100 nF via the power supply.

To generate a constant voltage, an LDO (HT7333) is used, which in this example regulates the voltage to 3.3 volts.

Click here for the sketches on Github

Watch the video

★☆★ If you want to support the channel via ★☆★

or via

Twint Spenden Code

Letzte Aktualisierung am 15.04.2024 / Affiliate Links / Bilder von der Amazon Product Advertising API