Solar and mains complementary lighting system controller based on PIC

Publisher:点亮未来Latest update time:2010-06-23 Source: 电子技术应用 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Solar lighting is one of the main uses of solar energy for human development and utilization. However, due to the discontinuity and intermittency of solar radiation, as well as the high investment and cost of pure solar lighting systems and the immaturity of some technologies, solar lighting systems often fail to light up the load due to insufficient battery voltage on consecutive rainy days. Combining solar energy with city electricity to form a dual power supply complementary lighting system can not only effectively solve the problem of unstable solar energy utilization, but also appropriately reduce the capacity of solar cells and batteries, reduce the cost of developing and utilizing solar energy technology, and meet the system reliability and economic requirements at the same time [1-2].

1 Main functions and components of the controller

The controller designed in this paper is used for the complementary lighting system of solar energy and mains electricity in streets and residential areas at night. According to the actual lighting conditions, the controller is designed to have the following functions:

(1) Supports 12 V DC system operating voltage;
(2) Supports charging and discharging currents up to 4 A;
(3) Supports both DC and pulse charging modes;
(4) Has the function of reducing the brightness of semiconductor lighting fixtures by half late at night;
(5) Automatically switches to AC power supply when the battery is low;
(6) Can detect the voltage of the solar cell and automatically switch the working mode;
(7) Can detect the voltage of the battery and control the charging and discharging process of the battery;
(8) Has anti-reverse charging protection, overcharging protection, over-discharging protection and load short-circuit protection functions;
(9) Has electronic clock and timing functions.

Figure 1 shows a schematic diagram of the controller peripheral circuit with PIC16F877A as the core [3]. It is mainly composed of PIC microcontroller (with internal A/D), clock circuit, voltage sampling circuit, switch drive circuit, clock control and digital tube display circuit. The microcontroller PIC16F877A is the core of the controller, and the peripheral circuit includes switch control circuit (C1~C3), digital tube display and drive (A~G/Dig_EN1~Dig_EN6) circuit, working status display, etc.

2 Main circuit design and device selection

2.1 PIC16F877A

The microcontroller is the core of the controller. When the system is working, it needs to collect the voltage of the solar cell and the battery. The output voltage of the solar cell is greatly affected by external factors such as temperature and solar radiation intensity, which requires the system to have high real-time performance, that is, the system response speed is required to be fast. Therefore, the design uses the mid-range PIC microcontroller 16F877A with an internal A/D module and a 14-bit instruction width. It is a mid-level PIC product with high performance while maintaining a low price.

The controller designed in this article mainly uses the following resources of PIC16F877A:

(1) 16 KB of in-system programmable Flash, 1 KB of on-chip SRAM, and 10,000 erase/write cycles. The program storage space is large enough and no additional memory expansion is required; the 10,000-time erase/write cycle facilitates program debugging;
(2) Two 8-bit timers/counters with independent prescaler and comparator functions. Used for key debounce and timing;
(3) One 16-bit timer/counter with prescaler, comparison and capture functions. Used to adjust the duty cycle of the PWM control signal and control the charging switch;
(4) 8-channel 10-bit ADC. Two of the ADC channels are used to sample the solar cell operating voltage and the battery operating voltage respectively;
(5) Two interrupt sources are used, external interrupt and timer interrupt, for timing and key pressing respectively;
(6) Programmable I/O ports. Some I/O ports use their second function, and others are used to expand the controller system function.

2.2 Voltage sampling circuit

The controller needs to collect two voltage signals, namely the solar cell output voltage and the battery terminal voltage. Both signals are changing DC analog signals, and the sampling signal should be able to accurately reflect the detection value. In the design, a simple voltage divider resistor network is formed by using precision resistors with an accuracy of 0.1%, and precision capacitors and inductors with very small leakage current are connected in parallel at the output end of the voltage divider resistor network for filtering to reduce the impact of current leakage on measurement accuracy [4]. The sampling circuit is shown in Figure 2.

2.3 Control switch drive circuit

The main control objects of the controller are three control switches C1~C3. They are the battery charging switch, battery discharging (power supply) switch and mains power supply switch. The state of the switch is controlled by the single chip microcomputer according to the working state of the system: during the day, the solar cell charges the battery, switch C1 is closed, the solar cell converts solar energy into electrical energy and stores it in the battery. When the battery voltage is overcharged, the controller disconnects the charging switch C1; at night, the battery mainly supplies power to the load, switch C2 is closed, when the battery voltage is insufficient (undervoltage), the battery power supply switch C2 is disconnected, and the controller automatically switches to mains power to supply power to the load (C3 is closed). Figures 3, 4 and 5 are the drive circuits of the switches when the battery is charged, discharged and powered by mains, respectively.

In the charging control circuit, a Schottky diode is used to protect the battery from reverse charging, preventing the battery from reverse charging the solar cell at night. At the same time, a protection circuit is designed to prevent the battery from overcharging. In order to control the charging method of the battery, the charging control signal is a PWM signal output by the microcontroller. The control signal of the battery discharge (power supply) switch is directly controlled by the high and low levels output by the microcontroller, realizing the late-night half-power power supply function. A relay is used in the AC power supply switch circuit [5].

3 Controller Performance Test

This paper conducts a preliminary test on the functions of the designed system controller, and some test results are as follows.

(1) Indicator light test system working status

Battery pulse charging test. When TVcc>0.7 V, it is daybreak; at this time 12 V

(2) Oscilloscope test battery charging waveform

Use an oscilloscope to detect the gate voltage of the charging switch Q2 to detect the charging condition of the battery. The output waveform of the battery under pulse charging is a pulse waveform.

In addition, the controller's power supply control function, charging and power supply mode conversion function, and the performance of the entire system when the controller is working were tested and analyzed. The test results show that the system controller can complete various functions well and operate well.

The system controller based on PIC16F877A designed in this paper makes full use of the internal resources of the microcontroller and has the characteristics of simple structure and low power consumption. The debugging experiment proves that the functions of the controller are well completed, with high practical value and good application prospects, which has reference significance for the promotion and application of solar LED lighting systems.

Reference address:Solar and mains complementary lighting system controller based on PIC

Previous article:Design of Audio Signal Analyzer Based on Microchip 16-bit MCU
Next article:Design of digital controlled current source based on single chip microcomputer PIC16F877A

Recommended ReadingLatest update time:2024-11-16 21:43

Application of PWM applet on PIC16F877A
    /*This program is used to make the CCP1 module generate a PWM waveform with a resolution of 10 bits and a duty cycle of 50%*/     #include "p18f458.h"     /*CCP1 module PWM working mode initialization subroutine*/     void CCP1INIT()     {       CCPR1L=0X7F;     CCP1CON=0X3C; /*Set the CCP1 module to PWM mode and
[Microcontroller]
Basic functional modules of PIC16F877A microcontroller
  The PIC16F877A microcontroller is a mid-range product of MicroChip. It uses a 14-bit RISC instruction system and integrates an A/D converter, EEPROM, analog comparator, timer/counter with comparison and capture functions, PWM output, asynchronous serial communication (USART) circuit, etc.   1) Program memory and sta
[Microcontroller]
Basic functional modules of PIC16F877A microcontroller
PIC16f877a MCU DS18b20 source code
//Debug summary: //The obvious problem is that in the write timing and read timing, the PIC MCU writes 1 to the bus by changing the direction to the input direction and pulling up the data line with a pull-up resistor, rather than outputting 1 in the output direction, which is different from AVR. //When the 8 bits of
[Microcontroller]
PWM function of PIC16F877A microcontroller
Description: Set PWM operation  To configure the CCP module for PWM mode, follow these steps: 1. Write to the PR2 register to program the PWM period. 2. Write to the DCxB9:DCxB0 bits to program the PWM duty cycle. 3. Clear the appropriate TRIS bit to make the CCPx pin an output. 4. Write to T2CON to program the TM
[Microcontroller]
PWM function of PIC16F877A microcontroller
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号