How to set up smartphones and PCs. Informational portal
  • home
  • Mistakes
  • Arduino PWM solar charging controller. Budget device based on Arduino for the blind (open hardware)

Arduino PWM solar charging controller. Budget device based on Arduino for the blind (open hardware)



Magnetic induction is a technology you probably remember from high school physics classes. To transmit power wirelessly, you need two coils: a transmitter coil and a receiver coil. The alternating current in the transmitter coil generates a magnetic field which induces a voltage in the receiver coil. This voltage can be used to power a mobile device or to charge a battery.


No less important elements will be inductors that you can make yourself. These simple coils are wound with copper wires and are called air-core coils. Creating such a winding for our purpose is a very simple task. Find a round cylinder with a diameter of about 5 centimeters, and wind the wire around it so that each turn does not overlap the other turn, but at the same time is as close as possible to the other turn. The round cylinder can be, for example, a PVC tube. You may need to use duct tape or tape in 2-3 places to keep the structure stable.


In addition to the Arduino and the inductors, we will need: one 2N3055 NPN transistor, one 1A diode bridge (diode assembly, they have four leads), one LED, one 100 ohm resistor, two 47 nF capacitors, a 9 V battery to power the Arduino , and preferably two prototyping boards. The diagram for connecting components to create a wireless data transmission device is shown in the figure below.



The circuit can be tested with the simple Arduino code below.


void setup() ( pinMode(13,OUTPUT); ) void loop() ( digitalWrite(13,HIGH); delay(0.5); digitalWrite(13,LOW); delay(0.5); )

However, a simple wireless power transfer device can be made without an Arduino. In principle, we can only use one 2N2222 transistor. Connect its base lead to the first end of the coil and the collector to the other end of the coil. The emitter terminal is connected to the battery. As a result, such a simple construction may look like this:




   Thank you for your interest in the information project site.
   If you want interesting and useful materials to come out more often and have less advertising,
   You can support our project by donating any amount for its development.

Arduino PWM Solar Charging Controller
How to make a very small, simple and cheap PWM solar charging controller with an Arduino Pro Mini for 12V off-grid setups. The PCB is the same size as the Pro mini-board, so they can be clamped together. PCB plans for a universal prototype board.

Connecting and using this Arduino solar charge controller is very simple - there are 2 input leads from the solar panel (+ and -) and 2 output leads go to the lead acid battery. The base of the solar panel and the batteries are connected together. Any load must be connected directly to the battery terminals and the charge controller will automatically handle the rest.

The Arduino regularly measures the lead and acid battery voltage according to a certain value, switches to the MOSFET to charge the battery from the solar panel, and switches the MOSFET off when the battery is fully charged. When the load is drawing power from the battery, the controller detects the voltage drop and immediately starts charging the battery again. During the night when the solar panel stops producing, the controller waits until the panel starts outputting again.


The positive wire to the solar panel needs a protective Schottky diode mounted directly on the cable (wrapped in heat shrink tubing). This is not included in the main PCB as it makes it easier to replace it and cool it down at the same time. You can easily make the board a little longer to fit in a different type of diode.

Schematic and Functions Description:

The function is based on the N-channel MOSFET IRF3205 in the high side of the circuit. This requires a gate voltage higher than 12V to turn on the MOSFET correctly. To eliminate the need for an external MOSFET driver, it is driven by a charge pump created with diodes, 2 capacitors, and two Arduino PWM output pins (3 and 11). Pin A1 measures the battery voltage and pin 9 controls the MOSFET ON/OFF cycle. An Arduino Pro Mini integrated LED connected to pin 13 is used to show the current cycle of the PWM signal.

The voltage regulator and all the capacitors around (C6, C5 and C4) could be omitted as there is a regulator included in the Arduino Pro Mini. However, because I was using a cheap clone board, I don't want to rely on its ability to support higher voltages than 12V for longer periods of time. The LP2950 is very cheap and efficient up to 30 volts, so it's worth having it on board anyway.


Parts List: Low Power Voltage Regulator LP2950ACZ-5.0 Transistors 2N3904 2N3906 x 2 N-channel MOSFET IRF3205 Resistors 82K (1%) 20K (1%) 220K x3 (0.4W is enough) 4K7 (0.4W is enough) Diodes 1N4148 x 5 P6KE33CA 90SQ035 (or any similar Schottky diode 35V min 9A) Capacitors 47N / 50V x2 ceramic 220P / 100V ceramic 1M / 50V (1000nF) ceramic 4M7 / 10V tantalum 1M / 35V tantalum x 2

The schematic and code for this charge controller is by Julian Ylett, he is the inspiration behind this smart thing. It's all just sophisticated documentation and a matching PCB design to perfectly match the Arduino Pro Mini board. It shares a video of the more efficient Arduino MPPT charge regulator, but its construction is much more complex and the project is not yet complete. If you can improve the code or design in any way, please share your improvements in the comments.

Not only an interesting, but also a useful project for Arduino in everyday life was presented by the Electro-Labs team on their blog. In this project, a programmable shield for Arduino was developed, which acts as a charger for lithium batteries. The shield includes an LCD display and a pushbutton interface that allows the user to adjust the voltage from 2V to 10V and the current from 50mA to 1.1A. The device also provides the ability to control the charging process.

The shield is based on the LT1510 chip and is controlled by the Arduino Uno. The display uses a simple and affordable Nokia 5110 LCD. It is connected via the SPI interface and is powered by a voltage of 3.3V. Since the I / O pins of the arduino work at 5V, it is recommended to connect the LCD module through resistors connected in series to the signal lines. Two connectors are available for connecting Li-Ion batteries. Four control buttons are connected to Arduino pins A2-A5. The battery voltage and charging current are controlled via analog pins A0 and A1. The details of analog-to-digital conversion are explained in the source code of the project. Two SMD LEDs are used to indicate the operation of the device.

The schematic diagram of the project was developed in SoloCapture from the SoloPCBtools package. Shield can work without microcontroller control. When the Arduino is not programmed, the charger, by default, has a cut-off voltage of 4.2V and a maximum charge current of 1.1A. The printed circuit board is designed in SoloPSB. The PCB design and the SoloPSB program itself can be downloaded from electro-labs.com. The dimensions of the shield are chosen for its location on the Arduino Uno. LEDs, button interface, LCD display and battery connectors are located on top for convenience. All other elements are located on the reverse side of the shield.

The LCD display is programmed to display four pages that allow the user to enter charging parameters and control the charging process. On the first page, the user can set the cutoff voltage and the maximum charge current, go to the battery status page and start charging. The up and down buttons are used to move between options, while the right and left buttons are used to change parameters and select options. The second page shows the battery status. In it you can see the current voltage on the battery. The third page shows the charging voltage and current. Left or right button on this page can stop the charging process and return to the setting page. When the battery voltage reaches the set value, the charger stops and displays the message "Charge Complete". To exit, press the left key.

The Arduino and the charging circuit added to it can be used to monitor and control the charging of NiMH batteries, like so:

Finished device

Rechargeable batteries are a great way to power your portable electronics. They can save you a lot of money when properly charged. In order to get the most out of your batteries, they need to be charged properly. This means you need a good charger. You can spend a lot of money buying a ready-made charger, or you can have fun making it yourself. In this article, we will look at how you can create an Arduino controlled charger.

First, it is important to note that there is no universal charging method that is suitable for all batteries. Different types of batteries use different chemical processes to make them work. As a result, different types of batteries need to be charged differently. In this article, we cannot cover all battery types and charging methods. Therefore, for simplicity, we will focus on the most common type of AA size battery, the Nickel Metal Hydride (NiMH) battery.

Accessories

Parts list from left to right:

  • powerful resistor 10 ohms (minimum 5 watts);
  • resistor 1 MΩ;
  • capacitor 1uF;
  • MOSFET transistor IRF510;
  • temperature sensor TMP36;
  • 5 volt power supply;

How to charge NiMH AA batteries

Increasing the charge rate increases the risk of battery damage.

There are many ways to charge NiMH batteries. Which method you use mainly depends on how fast you want to charge your battery. The charge rate is measured in relation to the battery capacity. If your battery has a capacity of 2500 mAh, and you charge it with 2500 mA, then you charge it at a rate of 1C. If you charge the same battery with 250 mA, then you charge it at C/10.

When charging a battery fast (above C/10), you need to carefully monitor the battery voltage and temperature to ensure you don't overcharge it. This can seriously damage the battery. However, when you charge the battery slowly (at a rate below C/10), you are much less likely to damage the battery if you accidentally overcharge it. Therefore, slow charging methods are generally considered safer and will help you increase battery life. Therefore, in our homemade charger, we will use the charge rate of C / 10.

charge circuit

For this charger, the basis is a circuit for controlling the power supply using the Arduino. The circuit is powered by a 5 volt source, such as an AC adapter or computer power supply. Most USB ports are not suitable for this project due to current limitations. The 5V source charges the battery through a powerful 10 ohm resistor and a powerful MOSFET transistor. The MOSFET transistor controls the amount of current flowing through the battery. The resistor is added as an easy way to control the current. Current control is done by connecting each end of the resistor to the Arduino's analog input pins and measuring the voltage on each side. The MOSFET transistor is driven by the Arduino's PWM output pin. The pulses of the pulse-width modulation signal are smoothed to a constant voltage by a filter on a 1 MΩ resistor and a 1 μF capacitor. This circuit allows the Arduino to monitor and control the current flowing through the battery.


temperature sensor

The temperature sensor serves to prevent battery overcharging and ensure safety.

As an added precaution, a TMP36 temperature sensor has been added to the charger to monitor battery temperature. This sensor produces a voltage that is linearly dependent on temperature. Therefore, unlike thermistors, it does not require calibration or balancing. The sensor is mounted in a drilled hole in the battery holder housing and glued into the hole so that it is pressed against the battery when it is installed in the holder. The sensor pins are connected to the 5V rail, to the case, and to the Arduino analog input pin.

AA battery holder before and after installation on breadboard

The code


The code for this project is quite simple. The variables at the beginning of the source code allow you to customize the charger by entering the battery capacity and the exact resistance of the power resistor. Safe threshold variables have also been added. The maximum allowable battery voltage is set to 1.6 volts. The maximum battery temperature is set to 35 degrees Celsius. The maximum charge time is set to 13 hours. If any of these safety thresholds are exceeded, the charger turns off.

In the body of the program, you can see that the system constantly measures the voltages at the outputs of a powerful resistor. This is used to calculate the values ​​of the voltage on the battery and the current flowing through it. The current is compared to the target value, which is C/10. If the calculated current differs from the target value by more than 10mA, the system automatically adjusts the output value to correct it.

The Arduino uses the serial interface to display all current data. If you want to control your charger, you can connect the Arduino to your computer's USB port, but this is not necessary as the Arduino is powered by the charger's 5V supply.

Int batteryCapacity = 2500; // battery capacity value in mAh float resistance = 10.0; // measured power resistor resistance int cutoffVoltage = 1600; // maximum battery voltage (in mV) that must not be exceeded float cutoffTemperatureC = 35; // maximum battery temperature that should not be exceeded (in degrees C) //float cutoffTemperatureF = 95; // maximum battery temperature that should not be exceeded (in degrees F) long cutoffTime = 46800000; // maximum charge time of 13 hours, which must not be exceeded int outputPin = 9; // output wire connected to digital pin 9 int outputValue = 150; // PWM output value int analogPinOne = 0; // first voltage probe connected to analog pin 0 float valueProbeOne = 0; // variable to store the value on analogPinOne float voltageProbeOne = 0; // calculated voltage on analogPinOne int analogPinTwo = 1; // second voltage probe connected to analog pin 1 float valueProbeTwo = 0; // variable to store the value on analogPinTwo float voltageProbeTwo = 0; // calculated voltage on analogPinTwo int analogPinThree = 2; // third voltage probe connected to analog pin 2 float valueProbeThree = 0; // variable to store value on analogPinThree float tmp36Voltage = 0; // calculated voltage on analogPinThree float temperatureC = 0; // calculated sensor temperature in degrees C //float temperatureF = 0; // calculated sensor temperature in degrees F float voltageDifference = 0; // difference between voltages on analogPinOne and analogPinTwo float batteryVoltage = 0; // calculated battery voltage float current = 0; // calculated current flowing through the load in (mA) float targetCurrent = batteryCapacity / 10; // target output current (in mA) is set to // C/10 or 1/10 of battery capacity float currentError = 0; // difference between target and actual current (in mA) void setup() ( Serial.begin(9600); // setup serial interface pinMode(outputPin, OUTPUT); // set pin as output ) void loop() ( analogWrite (outputPin, outputValue); // write the output value to the output pin Serial. print("Output: "); // show the output values ​​for control on the computer Serial. println(outputValue); valueProbeOne = analogRead(analogPinOne); // read input value on the first probe voltageProbeOne = (valueProbeOne*5000)/1023 // calculate the voltage on the first probe in millivolts Serial.print("Voltage Probe One (mV): "); // show the voltage on the first probe Serial.println( voltageProbeOne); valueProbeTwo = analogRead(analogPinTwo); // read the input value at the second probe voltageProbeTwo = (valueProbeTwo*5000)/1023; // calculate the voltage at the second probe in millivolts Serial.print("Voltage Probe Two (mV): " ); // show the voltage on the second probe Serial.println(voltageProbeTwo); batteryVoltage = 5000 - voltageProbeTwo; // calculate battery voltage Serial.print("Battery Voltage (mV): "); // show battery voltage Serial.println(batteryVoltage); current = (voltageProbeTwo - voltageProbeOne) / resistance; // calculate charge current Serial.print("Target Current (mA): "); // show target current Serial.println(targetCurrent); Serial.print("Battery Current (mA): "); // show actual current Serial.println(current); currentError = targetCurrent - current; // difference between target and measured currents Serial.print("Current Error (mA): "); // show current setting error Serial.println(currentError); valueProbeThree = analogRead(analogPinThree); // read the input value of the third probe, tmp36Voltage = valueProbeThree * 5. 0; // converting it to voltage tmp36Voltage /= 1024.0; temperatureC = (tmp36Voltage - 0.5) * 100 ; // conversion based on 10 mV per degree with a 500 mV offset // ((voltage - 500 mV) times 100) Serial. print("Temperature (degrees C)"); // show temperature in degrees Celsius Serial.println(temperatureC); /* temperatureF = (temperatureC * 9.0 / 5.0) + 32.0; //convert to Fahrenheit Serial.print("Temperature (degrees F) "); Serial.println(temperatureF); */ Serial.println(); // extra blank lines to make it easier to read the data when debugging Serial.println(); if(abs(currentError) > 10) // if the current setting error is large enough, then adjust the output voltage ( outputValue = outputValue + currentError / 10; if(outputValue< 1) // выходное значение никогда не может быть ниже 0 { outputValue = 0; } if(outputValue >254) // output value can never be higher than 255 ( outputValue = 255; ) analogWrite(outputPin, outputValue); // write new output value ) if(temperatureC > cutoffTemperatureC) // stop charging if battery temperature exceeds safe threshold ( outputValue = 0; Serial.print("Max Temperature Exceeded"); ) /* if(temperatureF > cutoffTemperatureF) / / stop charging if battery temperature exceeds safe threshold ( outputValue = 0; ) */ if(batteryVoltage > cutoffVoltage) // stop charging if battery voltage exceeds safe threshold ( outputValue = 0; Serial.print("Max Voltage Exceeded" ); ) if(millis() > cutoffTime) // stop charging if charge time exceeds threshold ( outputValue = 0; Serial.print("Max Charge Time Exceeded"); ) delay(10000); // delay of 10 seconds before the next iteration of the loop )

You can find the downloadable version of the source code at the link below.

Top Related Articles