Fads to Obsessions and Beyond...

Free domain for life, exceptional technical support, website transfer

IV-Curve Tracer (for solar cells)

A IV curve tracer (for solar PV cells) is constructed using a MOSFET as a digitally controlled variable load via a MCP4921 DAC. A PIC18F248 microcontroller interfaces the DAC with user input provided by PC/RS232 (USB-TTL converter). The collected data is output either to PC/RS232 or to a web server via WIFI using a ESP8266.

The system collects solar cell voltage, current, temperature and ambient light level at user defined intervals (with date/time stamp via RTC function). The collected data is transferred to a WAMP server where PHP code stores the information to mySQL database, with IV-curves and other statistical analysis of the solar-cell data provided by a web-based graphical user interface (GUI).

The power supply for DIY projects located "remote" from AC/wall sockets, generally rely upon batteries, optimally recharged via solar cells. For example, the Garden Light Project for illuminating a walking path made from six salvaged high current LED's and controlled via Bluetooth/PIC microcontroller.

Solar cell battery charge regulators obviously add to the cost of such a DIY project (and while relatively minor, require mounting and wiring etc). This lead to the investigation of constructing DIY solar cell battery charge controllers. Which in turn, via exploring maximum power point tracking (MPPT) charge controller algorithm/circuitry, resulted in this project for monitoring the voltage-current(IV) characteristics of solar cells I had on hand (partly to determine if a MPPT approach would produce significant power/charge advantage over a simpler design).

Further, concurrently I was learning about utilising the ESP8266 WiFi module to enable WiFi connection of DIY projects to the home intranet/web servers. Thus, the IV-curve tracker was a good example of a project that would benefit from WiFi connection to the home intranet and a WAMP server to store collected voltage, current, temperature and ambient light data to a mySQL database. Thus this project had a two-fold objective of collecting IV-curve data from solar cells under various ambient real world conditions and practice receiving and storing data via WiFi/HTML/php/mySQL (with a web-based GUI enabling IV-curve calculations and statistical analysis).

The actual circuit used to realise the IV-curve tracer is discussed in the Circuit Details and Schematic Diagram sections, with example results detailed in the Testing/Experimental Results Section. These sections also contain details about the ESP8266 WiFi transfer of collected data to the web server/mySQL database. Some further background material on IV-curve tracing for solar cells follows.

Solar Cell Maximum Power Point (MPP)

A solar cell converts light directly into electricity by the photovoltaic effect, and as such has a non-linear relationship between applied light, ambient temperature (and other factors) and the maximum power that can be produced (1). A full discussion of the IV characteristics of a solar cell and maximum power requires consideration of the photovoltaic effect (and associated quantum physics concepts), silicon dopants and the notions of PN junctions with charge carriers such as "holes" through to dark current, PN junction baising and the Shockley diode equation. A relatively "math" free and "intuitive" discussion of such topics in relation to the photovoltaic and operation of solar cells is given in the following reference (2).

However, for the purpose of background to the utility of having a IV-curve tracer (and hence the DIY project to construct such a device), consideration of the IV-curve's (obtained "manually" by using a DIY Dummy Electronic Load under differing illumination conditions) in the following figure is sufficient.

  • Figure 1: Solar Cell IV-curve's (experimental data using electronic dummy load)

    Figure 1: Solar Cell IV-curvesFigure 1: Solar Cell IV-curves

    Figure 1: Solar Cell IV-curves

The solid red line in Figure 1 (with data points denoted by the red squares) shows that for a particular illumination level the voltage of the solar cell decreases as the current increases, and that the current plateau's over much of the range. If for each data point in the IV curve, the voltage is multipled by the current (i.e., calculate the power at the particular voltage) the resultant calculated power can be plotted against voltage (the dotted red line in Figure 1 is the PV curve corresponding to the solid red line which is the IV curve). It is readily apparent from the PV curve (e.g. dotted red line in Figure 1) that there is a particular voltage and current for which the power from the solar cell is a maximum (for the particular light illumination level and ambient temperature).

The data for Figure 1 was produced by using a DIY Dummy Electronic Load to increase the load on a solar cell and measure the corresponding voltage. The readings where performed on a cloudless day at noon in order to obtain relatively consistent illumination conditions (with the readings taken as quickly as possible). In order to "reproducibly" vary illumination conditions, various layers of shade cloth were used to cover the solar cell (see the Photographs Section for this "manual" IV curve recording setup). The "green" and "blue" lines in Figure 1 show the effect of illumination level on the IV curve of the solar cell. Hence, the PV curve and resultant maximum power point.

Battery Charging and Solar Cell MPP

While the data from Figure 1 shows that the solar cell MPP changes in response to illumination level (with temperature being another major factor) how does this impact on battery charging?

A battery typically has a much smaller internal resistance than the resistance of the solar panel. Hence, when a solar panel is connected to a battery, the voltage across the solar panel will be approximately equal to the open circuit battery voltage (i.e., the solar cell voltage will be "pulled down" to match the battery voltage). With this in mind, the following example calculation/scenario shows the potential utility of using maximum power point tracking (MPPT) as part of a solar cell charger controller.

From the specifications of the solar cell (used to determine the data in Figure 1) voltage at maximum power (Vmp) is 16.4V with current at maximum power (Imp) 0.54A. Therefore, power at MPP is 16.4V x 0.54A = 9.5W. This solar cell is then used to recharge a battery which has a voltage of 12V. The solar cell voltage will be "pulled down" to 12V hence the power transfered to the battery will be 12V * 0.58A = 6.96W (not the previously calculated 9.5W available). This is a loss of approximately 36.5%. From the data obtained in Figure 1 of the solar cell under actual operating conditions (which takes into account the age etc of the solar cell) Vmp=13.7V and Imp=0.5A therefore Pmax=6.85W. Again, if the solar cell was used to recharge a battery currently at 12V this would equate to approximately 12.4% loss of potential power available.

A charge controller with MPPT determines the MPP of the solar cell (Vmp and Imp) together with the state of charge of the attached battery, and then changes the voltage supplied from the solar cell (by DC-DC conversion either buck and/or boost circuitry) to maximise the power transfered to the battery. "The function of a MPPT is analogous to the transmission in a car. When the transmission is in the wrong gear, the wheels do not receive maximum power. That's because the engine is running either slower or faster than its ideal speed range. The purpose of the transmission is to couple the engine to the wheels, in a way that lets the engine run in a favorable speed range in spite of varying acceleration and terrain" (3).

The most benefit from MPPT comes from when the solar cell is located in a cold climate (increasing temperature of a solar cell decreases the voltage) and if the battery being recharged is deeply discharged. The "literature" about MPPT (particularly from those selling MPPT controllers and competing devices) seems to have a healthy "disagreement" if MPPT is worth it (i.e., the cost of a MPPT charge controller for a potential extra 10% in power, or just spend the equivalent money on extra solar cells which are comparatively cheap).

However, the actual circuity involved in a MMPT charge controller, in addition to that of a PWM based controller for example, is relatively minor. In the case of DIY projects that would benefit from incorporating a solar cell charge controller for trickle charging the battery source, and which have a microcontroller as part of the necessary functionality in any case, a MMPT function potentially does not add significant cost (setting aside the time to develop the MMPT firmware/algorithm). Since I'm not actually spending money on purchasing an off-the-shelf MMPT controller, and I can't make a solar cell, but I can make a MMPT controller (and the potential fabrication/component costs are minor), seems like MMPT for a DIY controller has benefit.

The circuitry/approach used for the IV-curve tracer is discussed further in the Schematics and Circuit Details Sections.

The Testing/Experimental Results Section discusses the data obtained from the IV-curve tracker and the WAMP server software/web interface etc for receiving and storing the data via WiFi.

The Construction Notes/Trouble Shooting Section details some of the difficulties encountered in producing a working prototype, which lead to changes in the circuitry (e.g., signal filtering, high/low side current sensing options etc).

The circuit consists largely of the usual minimum requirements for a PIC microcontroller (PIC18F248 dealt with here) that is, power supply, oscillator (external crystal oscillator - 24MHz) and in-circuit serial programming (ICSP). A AD586B voltage reference IC is used to produce a 5V reference for input to the MCP4921 DAC pin6 and the ADC reference pin of the PIC18F248.

The majority of the circuit is based upon the DIY PIC Development Board.

Circuit Operation

The circuit is powered from a 12V battery (and or a surplus charger from a disused laptop (in this case supplying 16-24V with 65W max) which provide not only a safer option (compared to construction from a suitable transformer, rectifier, connection to AC wall socket etc) but also a much more economical option (generally zero cost for a surplus charger, compared to ten's of dollars for a suitable transformer, let alone cost of ancillary circuitry, PCB etc).

The 12V is converted to 5V for the PIC microcontroller via a DC-DC step-down (buck) switch mode power supply based upon the LM2596 adjustable version (see SMPS for details). A LM317T, is used to provide the regulated 3.3V required by ESP8266 WiFi module. The power supply circuit is given in the Schematics Section. The LM317T circuit is the standard design direct from the datasheet, with input and output capacitors to provide smoothing and the resistor/potentiometer to provide selection of output voltage.

A MAX232 is used to enable RS-232 communication between the PIC microcontroller and an attached PC.


The MCP4921 DAC is controlled/configured via a SPI interface that has 20 MHz clock support. The full scale range of the DAC output is user configurable via SPI command to be VRef or 2*VRef by setting the gain selection option bit. The configuration register also provides for a user selectable device shutdown mode. In shutdown mode, the MCP4921 internal circuits are turned-off for power savings, but the device is still available to respond to SPI commands.

SPI commands and data are sent to the device via the SDI pin, with data being clocked-in on the rising edge of SCK pin. The communications are unidirectional, thus the data cannot be read out of the MCP4921. The CS pin must be held low for the duration of a write command. The write command consists of 16 bits and is used to configure the DAC’s control and data latches. More detail about firmware control of the MCP4921 is given here.

The MCP4921 DAC enables a user selectable, digitally controlled voltage to be applied to the gate of the n-channel MOSFET (Q1). Thus the MOSFET acts as a digitally controlled variable load to the solar cell. Resistor R2 and capacitor C5 form a "reconstruction filter" (used to smooth the analog signal from the digital source) for the DAC output.


Voltage from the solar cell (the design allows a maximum of 20V) is scaled by the voltage divider formed by resistor R5 and potentiometer RV1 to limit the input voltage to the PIC ADC to a maximum of 5V (as set by the PIC ADC specifications). Capacitor C12 acts with resistor R5 as a low pass filter on the input voltage from the solar cell. The sampled voltage is buffered by the opamp U7:A before being sampled by the PIC ADC.

The prototype circuit incorporates both a "high side" current sensor (the MAX471) and the option for using a differential amplifier (formed by the opamp U6:A and associated resistor and capacitor network) for measuring current "low side" with resistor R6 as the sense resistor. The MAX471 has the benefit of providing a 1V/A output (or other scaled value depending upon the value of resistor R4 - see the MAX471 component testing page for further details) and also the ability to provide current direction (via pin 9). However, the MAX471 is powered by the sensed current and can only operated down to ~4V. This means the MAX471 cannot be used to obtain a IV-curve from a solar cell for the full range of voltages down to Isc. The disadvantage of the differential amplifier and sense resistor is the necessary low side connection, requirement to calibrate the gain, etc.

A LM35 temperature sensor enables measurement of the solar cell temperature (the sensor is taped to rear side of the solar cell). The LM35 provides a 10mV/degree celsius output which is measured using the PIC ADC. A stable 5V reference is provided to the LM35 using the CD4050 as a buffer. Similarily, the light dependent resistor has a 5V reference buffered input, with the voltage across the LDR being measured as the upper leg of a voltage divider formed with R9 (in this configuration, low light levels [increasing resistance] gives lower voltage).

The ESP8266-WIFI module is incorporated as per the datasheet. However, note that since the ESP8266 is a 3.3V device, a voltage divider is used on the input (TX line) from the PIC microcontroller to drop the 5V to ~ 3.3V for input to the ESP8266. Conversely, the TX line from the ESP8266 has the 3V output level shifted to 5V using a portion of the CD4050 hex non-inverting buffer.


The firmware enables connection of the PIC18F248 with a PIC via RS-232 in order to allow user input/selection of various functionality such as setting the real time clock (RTC) formed by firmware using the timer1 onboard the PIC18F248. Similarily, user input from PC via RS-232 enables connecting the PIC/ESP8266 to a WiFi network, manual reading of sensor values and starting/stopping IV-curve collection with sending collected data to mySQL database via the WiFi connection to a WAMP server.

Even though RS-232 is now largely superceded on the majority of "consumer" equipment (due to relatively low transmission speed compared to current norms and large voltage swing of signal lines) it is mature technology (i.e., well known and now low cost) that is readily and easily applicable in the DIY environment, and with USB-to-RS232 converters being cheaply available, still very useful to the DIY hobbyist in interfacing projects to PC's, laptops etc. Further details about the interfacing/implementation of RS232 communications with a PC via PIC microcontroller, using CCS C compiler, is given in the RS-232 communications page.

Further details on the firmware is given in the Testing/Experimental Results Section.

Note: Image loading can be slow depending on server load.

  • Microcontroller and I/O components

    IV-Curve Tracer SchematicIV-Curve Tracer Schematic

    Silver Membership registration gives access to full resolution schematic diagrams.

    IV-Curve Tracer Schematic

  • Sensors/Peripherals

    IV-Curve Tracer SchematicIV-Curve Tracer Schematic

    Silver Membership registration gives access to full resolution schematic diagrams.

    IV-Curve Tracer Schematic

This project did not require a PCB.

The construction was done using prototyping board. See the photographs and schematic diagram sections.

Qty Schematic Part-Reference Value Notes
8R1, R5, R9-R1410K1/4W, 10% 
2R2, R1710001/4W, 10% 
1R31001/4W, 10% 
1R420001/4W, 10% 
2R6, R180.1 ohm1/4W, 10% 
2R7, R850K1/4W, 10% 
1R152.2K1/4W, 10% 
1R163.3K1/4W, 10% 
1R19330 ohm1/4W, 10% 
3C4, C5, C140.1uF 
7C6-C11, C131uF 
1Q1STP16NF06n-channel MOSFET 
Integrated Circuits
1U1PIC18F248PIC microcontroller  datasheet
1U27805Linear Voltage Regulator  datasheet
1U3MAX232ERS232 Driver/Receiver datasheet
1U4MCP492112-Bit Digital Analog Converter DAC datasheet
1U5AD586B5V Voltage Reference datasheet
1U6LM358Ndual operational amplifier datasheet
1U76358Ndual operational amplifier datasheet
1U8ESP8266WiFi SoC module datasheet
1U9CD4050hex non-inverting buffer datasheet
1U10LM35Temperature Sensor datasheet
1J1CONN-H55-pin connector for ICSP
1X124MHzCrystal Oscillator
1LDR1light dependent resistor 
1Z1MAX471 breakout board 
Description Downloads
IV-Curve Tracer - Bill of Materials Text File Download

The initial testing involved checking the output voltage from the AD586 voltage reference IC was indeed 5V. I only have a DMM and the output from the AD586 was 5V within the accuracy/resolution available.

More information to come.

More information to come.

As a general precauation double check polarity of power connections etc before powering up the various IC's and or circuit.

This project was only constructed on bread-board to test the microcontroller firmware driver. However, if the MCP4921 was to be used in a design to be built on DIY PCB, consideration of decoupling capacitors, proximity of digital signal lines to analog power traces etc would need to be incorporated.

Also, the quality of the power supply to the MCP4921 and the reference voltage input to the MCP4921 Vref pin will obviously affect the noise etc on the MPC4921 Vout pin.

More information to come.

Comments/Questions (1)

Topic: IV Curve Tracer
panacell says...
good job
15th February 2021 3:01am
Page 1 of 1

Add Comment/Question

Only Logged-In Members can add comments

"If we could sell our experiences for what they cost us, we'd all be millionaires".

Please donate any amount to help with hosting this web site.

If you subscribe (only $2/annum) you can view the site without advertisements and get emails abouts updates etc.



Only logged-in users with correct Membership Level can download.

Membership starts at only $2, so join now!