The circuit and working principle of solar charger based on microcontroller

The recent lighting systems, including solar lights, home lighting systems, street lamps, garden lamps, water heaters, and solar battery packs, are all powered by solar energy. If you are considering how to convert this natural form of energy into the power for these devices, then let me tell you. This conversion system consists of only four main components: solar photovoltaic (PV) components, rechargeable batteries, solar charge controllers, and loads.

Here, the PV components capture the light, the rechargeable batteries act as energy storage, and the loads include the devices to be powered. The solar charge controller takes into account the fact that sufficient charge is stored in the battery according to the capacity of the rechargeable battery. Therefore, it plays a crucial role in the entire system and becomes a key link between the solar panels, the batteries, and the loads.

The common component LCD depicts the current state of the system.

The circuit and working principle of a solar charger based on a microcontroller.

The "solar charger based on a microcontroller" project is fabricated around the PIC16F877A (IC1) microcontroller as the main component. In addition to this, the project also uses the regulator 7805 (IC2) and some discrete components. The entire circuit layout of the solar charger based on a microcontroller is shown in Figure 1.
Discussing the central component; PIC16F877A, which provides an ideal solution for hobby and industrial development, and at the same time proves itself worthy of popularity and power. This IC adopts the Harvard architecture. The charging control operation is performed by this component through the solar panel.

The fascinating facts about the core component; An 8-bit microcontroller has low power consumption but optimal performance. Many features such as 8kB flash, 256-byte EEPROM, 368-byte RAM, 33 input/output (I/O) pins, a 10-bit 8-channel analog-to-digital converter (ADC), and 3 timers make this device more attractive. To ensure reliability, it also has an on-chip R-C oscillator, which is crucial in the synchronous I2C interface. The number of simple instructions that this device can handle is 35. Most of these instructions are single-cycle, and the branches have double-cycle instructions.
For the LCD interface with the microcontroller, the data pins D0-D7 of the LCD module are connected to the port pins RB0-RB7 of the microcontroller. Similarly, the RS (register selection), R/W (read/write), and E (enable) of the LCD are connected to the port pins RD1, RD2, and RD3. For contrast control, a preset VR3 is used. To perform a manual reset operation, a switch SW1 is included in the circuit. The basic clock frequency required by the microcontroller is provided by a 4MHz crystal oscillator and a combination of two 33pF capacitors.

Three specific pins of the microcontroller monitor the status of parameters. These port pins RA0, RA1, and RA2 collect the required input to continuously check the battery voltage, charging current, and solar panel voltage respectively. Therefore, based on the collected information, the entire process is controlled and meaningful information is displayed on the LCD module. Once the port pin RA3 becomes high, the connection between the solar panel and the battery is established, and then the transistor T1 becomes saturated and the relay RL1 is energized.
The +5V regulated power supply for the microcontroller and LCD module is provided by the regulator 7805. Depending on the voltage, the charging process can be carried out in two different ways - boost and trickle. 12V is the defining parameter to determine whether the battery is charged in the boost mode or the trickle mode. For voltages lower than 12V, the charging is completed in the boost mode, and for higher voltages, the trickle mode is activated. In the trickle mode, the battery is charged at the discharge rate.

The "Solar Charger Based on Microcontroller" project also provides necessary information about the energy limit collected by the solar panel. These information is used to estimate the exact energy that can be extracted from the sun itself.

Construction and Testing of a Solar Charger Based on a Microcontroller

Figures 2 and 3 show the exact single-sided PCB layout based on the PIC16F877A microcontroller and its complete component layout respectively. It is highly recommended to perform the assembly process on the PCB to avoid time and assembly errors to a certain extent. However, extra care must be taken when assembling the components, and overlooked errors must be carefully checked. To eliminate possible damage to the IC during the assembly process, an IC socket is used. To ensure safety, the power supply voltage (5V) is checked at the test point TP1 as shown before placing the IC.
Figure 2: Soldered edge PCB of a microcontroller-based solar charger
Figure 3: Module side PCB of a microcontroller-based solar charger
In order to avoid further complications, before implementing the circuit, the system will calibrate the voltages of the battery and the solar energy. Moreover, this is done in the following ways: -

Battery voltage | Solar charger based on microcontroller

Disconnect the battery used in the project. Then apply 20V at the input point of IC2 (7805) to ground. At pin 2 of IC1 (PIC16F877), use a multimeter to check the voltage value. After that, adjust the preset VR1 to obtain 5V to make the necessary adjustments to the circuit. Similarly, perform a voltage test at pin 4 of IC1 (PIC16F877) to ensure that the voltage at this point is 5V. When the battery is reconnected to the system, the voltage value at pin 2 of IC1 (PIC16F877) must be approximately 3V.

Solar voltage | Solar charger based on microcontroller

Remove the solar panel in the circuit. Connect a 12V battery to the positive terminal of the solar energy related to the ground, and then monitor the voltage level at pin 4 of IC1 (PIC16F877). Now, the preset VR2 is adjusted to obtain 3V. At pin 7 of IC1 (PIC16F877), we can check whether the relay RL1 is enabled.

After completing all these calibration steps, the "solar charger based on microcontroller" circuit can be implanted. This circuit generates solar energy, and the value is calculated and displayed on the LCD in units of watts per second. To obtain the energy in units of watt-seconds, the power is integrated.

The information list on the LCD is in the following order:

   
  1. Battery voltage (millivolts)
  2. Battery current (milliamps)
  3. Energy (watt-seconds)
  4. Power (watts)
  5. Solar panel voltage (millivolts)
  6. Charger mode: boost or trickle.