Charger for car battery using arduino. Creating an Arduino Controlled Charger


Arduino PWM solar charging controller
How to make a very small, simple and cheap PWM solar charging controller with Arduino Pro Mini for 12V off-grid installations. Size printed circuit board coincides with Pro size mini-boards so they can be clamped together. PCB plans for a universal prototype board.

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

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


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

Circuit and Function Description:

The function is based on the N-channel MOS transistor IRF3205 high side chains. 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 battery voltage and pin 9 controls the MOSFET ON/OFF cycle. The 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 eliminated since there is a regulator included in the Arduino Pro Mini. However, because I used cheap clone board, I don't want to rely on its ability to support higher voltages than 12V for more than long periods time. The LP2950 is very cheap and efficient up to 30 volts, so it's worth having 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 35V minimum 9A Schottky diode) Capacitors 47N/50V x2 ceramic 220P/100V ceramic 1M/50V (1000nF) ceramic 4M7/10V tantalum 1M/35V tantalum x 2

The circuit and code for this charge controller is by Julian Ilett, he is the mastermind behind this clever thing. All this is just refined documentation and suitable PCB design to perfectly match the Arduino Pro Mini board. He shares a video of a 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.

The Electro-Labs team presented a project for Arduino that is not only interesting, but also useful in everyday life, on its blog. In this project, a programmable shield for Arduino was developed that performs the function charger for lithium batteries. Shield includes LCD display and a push-button interface allowing the user to adjust voltage from 2V to 10V and 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 Arduino Uno. The display used is a simple and affordable Nokia 5110 LCD. It is connected via an SPI interface and is powered by a voltage of 3.3V. Since the I/O pins of the arduino operate at 5V, then connect LCD module It is recommended through resistors connected in series to the signal lines. There are two connectors available for connecting Li-Ion batteries. Four control buttons are connected to pins A2-A5 of the Arduino. Battery voltage and charging current are controlled via analog pins A0 and A1. The details of analog-to-digital conversion are explained in the project source code. 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. The shield can work without microcontroller control. When the Arduino is not flashed, the charger defaults to a cutoff voltage of 4.2V and a maximum charging current of 1.1A. The PCB is designed in SoloPSB. The printed circuit board design and the SoloPSB program itself can be downloaded from electro-labs.com. The dimensions of the shield are selected for its location on the Arduino Uno. LEDs, push-button interface, LCD display and battery connectors are located on top for convenience. All other elements are located with reverse side shield.

The LCD display is programmed to show four pages that allow the user to enter charging parameters and control the charging process. On the first page, the user can set the cut-off voltage and maximum charge current, go to the battery status page and start charging. The up and down buttons are used to move between options, and 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 click In this page you can stop the charging process and return to the parameter 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.

An Arduino and its added charging circuitry can be used to monitor and control the charging of NiMH batteries, like this:

Completed device

Rechargeable batteries are in a great way to power your portable electronics. They can save you a lot of money when correct charging. So that you can receive maximum return from your batteries, they must be charged correctly. 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 one yourself. In this article we will look at how you can create a charger controlled by Arduino.

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

Accessories

List of components from left to right:

  • powerful 10 Ohm resistor (minimum 5 watts);
  • resistor 1 MOhm;
  • capacitor 1 µF;
  • MOSFET transistor IRF510;
  • temperature sensor TMP36;
  • power supply 5 volts;

How to charge NiMH AA batteries

Increasing the charging rate increases the risk of battery damage.

There are many ways to charge NiMH batteries. The method you use mainly depends on how quickly 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 at 2500 mA, then you are charging it at a rate of 1C. If you charge the same battery at 250 mA, then you are charging it at a rate of C/10.

During fast charging battery (at speeds above C/10), you need to carefully monitor the battery voltage and temperature to avoid overcharging it. This can seriously damage the battery. However, when you charge your 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 a charge rate of C/10.

Charge circuit

For this charger, the basis is a circuit for controlling the power supply with using Arduino. The circuit is powered by a 5 volt source, such as an AC adapter or computer unit nutrition. Most USB ports are not suitable for of 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 sets the amount of current flowing through the battery. The resistor is added as a simple way to control the current. Monitoring the amount of current is done by connecting each resistor pin to the Arduino's analog input pins and measuring the voltage on each side. The MOSFET transistor is controlled by the Arduino PWM output pin. The pulse width modulation signal pulses are smoothed to DC voltage filter on a 1 MΩ resistor and a 1 μF capacitor. This scheme allows the Arduino to monitor and control the current flowing through the battery.


temperature sensor

The temperature sensor is used to prevent battery overcharging and ensure safety.

As additional measure As a precaution, a TMP36 temperature sensor has been added to the charger to monitor the battery temperature. This sensor produces a voltage that varies linearly with temperature. Therefore, unlike thermistors, it does not require calibration or balancing. The sensor is installed in drilled hole in the battery holder body and glued into the hole so that it presses against the battery when it is installed in the holder. The sensor pins are connected to the 5V bus, to the case and to the analog input pin of the Arduino.

AA battery holder before and after installation on breadboard

Code


The code for this project is quite simple. Variables at the beginning of the source code allow you to configure the charger by entering values ​​for the battery capacity and the exact resistance of the power resistor. Safe threshold variables have also been added. The maximum permissible battery voltage is set to 1.6 volts. The maximum battery temperature is set to 35 degrees Celsius. The maximum charging 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 voltage at the terminals of a powerful resistor. This is used to calculate the voltage across the battery and the current flowing through it. The current is compared with the target value, which is C/10. If the calculated current differs from the target value by more than 10 mA, the system automatically adjusts the output value to correct it.

Arduino uses a serial interface to display all current data. If you want to monitor the operation of your charger, you can connect the Arduino to USB port computer, but this is not necessary since the Arduino is powered by a 5V voltage source from the charger.

Int batteryCapacity = 2500; // battery capacity value in mAh float resistance = 10.0; // measured resistance of the powerful resistor int cutoffVoltage = 1600; // maximum voltage on battery (in mV), which should not be exceeded float cutoffTemperatureC = 35; // Maximum temperature battery that should not be exceeded (in degrees C) //float cutoffTemperatureF = 95; // maximum battery temperature that must not be exceeded (in degrees F) long cutoffTime = 46800000; // maximum charging time is 13 hours, which should not be exceeded int outputPin = 9; // the output signal wire is connected to digital pin 9 int outputValue = 150; // value of the output PWM signal int analogPinOne = 0; // the first voltage sensor is 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; // the second voltage sensor is 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; // the third voltage sensor is connected to analog pin 2 float valueProbeThree = 0; // variable to store the 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 the battery capacity float currentError = 0; // difference between target and actual currents (in mA) void setup() ( Serial.begin(9600); // setup serial interface pinMode(outputPin, OUTPUT); // set the pin as output ) void loop() ( analogWrite(outputPin, outputValue); // write the output value to the output pin Serial.print("Output: "); // show the output values ​​for monitoring on the computer Serial.println (outputValue); valueProbeOne = analogRead(analogPinOne); // read the 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 on the second probe voltageProbeTwo = (valueProbeTwo*5000)/1023; // calculate the voltage on 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 the voltage on the battery Serial.print("Battery Voltage ( mV): "); // show battery voltage Serial.println(batteryVoltage); current = (voltageProbeTwo - voltageProbeOne) / resistance; // calculate the 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 a dependence of 10 mV per degree with a shift of 500 mV // ((voltage - 500 mV) multiplied by 100) Serial.print("Temperature (degrees C) "); // show temperature in degrees Celsius Serial.println(temperatureC); /* temperatureF = (temperatureC * 9.0 / 5.0) + 32.0; //convert to degrees Fahrenheit Serial.print("Temperature (degrees F) "); Serial.println(temperatureF); */ Serial.println(); // additional empty lines to make data easier to read when debugging Serial.println(); if(abs(currentError) > 10) // if the current setting error is large enough, then adjust 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 the battery temperature exceeds the safe threshold ( outputValue = 0; ) */ if(batteryVoltage > cutoffVoltage) // stop charging if the battery voltage exceeds the safe threshold ( outputValue = 0; Serial.print("Max Voltage Exceeded" ); ) if(millis() > cutoffTime) // stop charging if the charge time has exceeded the threshold ( outputValue = 0; Serial.print("Max Charge Time Exceeded"); ) delay(10000); // delay 10 seconds before the next iteration of the loop)

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

Several years ago, I set myself the task of developing a set of inexpensive devices that would allow blind people to better adapt to the world around us. To date, I, together with a team of like-minded people, have managed to implement several projects.

In this article I want to talk about the ultrasonic attachment on the cane and the ultrasonic keychain - full-fledged devices, which are assembled from inexpensive, available modules.

An ultrasonic cane attachment and an ultrasonic keychain are devices for blind people that warn of obstacles located above the level at which they can be detected using a regular cane. Such obstacles can be high-riding cars, barriers, high fences. The ultrasonic attachment is attached to a regular cane, and the ultrasonic keychain is hung around the neck or carried in the hand like a flashlight.

The operation of the devices is based on the reflection of ultrasonic waves from obstacles. By measuring the difference in time between the moment the pulse is generated and the moment the reflected echo signal is received, the distance to the obstacle can be determined.

To develop devices, it is necessary to select a sensor for measuring distance, a control board and a signaling device, select batteries, a method for charging them, and suitable housings.

Ultrasonic sensor

To measure the distance to an obstacle, two devices were tested:
  • Arduino Compatible Ultrasonic Module HC-SR04
  • Car parking sensors HO 3800
Both devices work on a similar principle. The differences lie in the directional pattern of the sensors, the maximum obstacle detection range and design.
Comparison of sensor parameters:

During the tests, it turned out that the HC-SR04 modules have a slightly worse ability to detect obstacles and operate in difficult climatic conditions (cold).

Both sensors, despite their differences, can be used in an ultrasonic cane attachment as a means of measuring the distance to an obstacle, so the main parameter for us when choosing a sensor was the price. We settled on the cheaper HC-SR04 sensor.

Control board

The Arduino platform was chosen as the control board. In our case, the most applicable boards are miniature versions: Arduino Mini, Arduino Nano or Arduino Pro Mini. In general, any other controller that provides similar capabilities can be used.

Batteries

To provide power to the device, it is advisable to use lithium-ion (Li-ion) or nickel-metal hydride (Ni-Mh) battery cells.

When operating in normal climatic conditions, it makes sense to use Li-ion batteries, which have the following advantages compared to Ni-Mh:

At low temperatures, it is preferable to use Ni-Mh batteries.

The voltage at the output of one Ni-Mh battery (1.0 -1.4 V) is not enough to operate the device. To obtain a voltage of 5 V (necessary for the operation of both Arduino and the parking sensor), in addition to batteries, we will use a boost DC-DC converter.

To operate the DC-DC converters we have selected, it is necessary to provide an input voltage of 0.9-6.0 V. To obtain the required output voltage, one could use one Ni-Mh element with a voltage of 1.2 volts. However, as the input voltage decreases, the load capacity of the converter also decreases, so for stable operation It is advisable to supply the device with at least 2 V to the input of the converter (two Ni-Mh elements of 1.2 V each or one Li-ion element with a voltage of 3.7 V). Note that there are DC-DC converters for which an input voltage of 1.2 V is not enough.

Charging batteries

For Li-ion batteries There are many ready-made inexpensive modules with end-of-charge indication.

In the case of Ni-Mh batteries, everything is more complicated. Ready-made embedded solutions on the market in this moment We have not found. To charge Ni-Mh batteries, you can use specialized external chargers or create your own charging circuit.

One way to charge a Ni-Mh cell is serial connection with a battery of two linear stabilizers LM317 (or similar): the first - in current limiting mode, the second - in voltage limiting mode.

The input voltage of such a circuit is 7.0-7.5 V. In the absence of cooling of the stabilizers, it is not recommended to exceed this voltage. The voltage on each Ni-Mh battery during charging should be about 1.45 V (voltage of a fully charged Ni-Mh cell). To avoid overheating and failure of microcircuits, the battery charging current should not exceed 100 mA and can be increased to 200 mA when using appropriate radiators.

The advantage of this charging scheme is that there is no need to control the charging state: when the required voltage on the element is reached, the current will automatically drop to a safe minimum.

Alarm

Depending on the choice of warning channel (auditory or tactile), an actuator is selected - a buzzer or a vibration motor. In addition, you can combine both notification methods, giving the user the ability to switch between them.

During testing of prototypes, we found out that it is most convenient to transmit information about the proximity of an obstacle through vibration, because in this case, the audio channel, which is very important for a blind person, is not occupied. That's why all of our designed and assembled products use vibration to warn of obstacles. The intensity of vibration is proportional to the distance to the obstacle.

Frame

We were unable to find a convenient housing for the ultrasonic cane attachment among the mass-produced housings. To test the device, we used a 3D printed ABS plastic case. To print the case on a 3D printer, we developed the following 3D model:

Test result of prototypes

During the development process, more than 12 product options were collected. Each new product eliminated the shortcomings of the previous ones: during the development process, we reduced the dimensions and weight of the product, selected an ultrasonic sensor that satisfied us both in price and technical specifications, abandoned the use of an audio channel and optimized the device operation algorithm. Together with the blind (Bortnikov P.V., Shalintsev V.A.), tests of all assembled products were carried out. As a result, we obtained the final sample.

Below are the fundamental electrical diagram developed device:

When disassembled, the ultrasonic neck keychain looks like this:

All components used in the assembly, except for the 3D printed housing for the cane attachment, were purchased through AliExpress:

  1. Ultrasonic sensor HC-SR04.
  2. Adruino Pro Mini control board.
  3. Rechargeable battery 3.7 V 300 mAh.
  4. Voltage converter 0.9V ~ 5V to 5V 600 mA.
  5. Charging module AC/DC 220V to 5 V 1 A.
  6. Charger LA-520W.
  7. Alarm: vibration motor for mobile phone 4x10mm DC 3V.
  8. Button PB-22E60.
  9. Housing Gainta G1906 (for key fob).
  10. Transistor: bss138/bcr108 or optocoupler CPC1230N.
The appearance and prices (including delivery from China) of the components used to assemble the ultrasonic head on the cane are shown in the figure:

Of the components used during assembly, the largest contribution to the cost of the device comes from the 3D printed housing.

The appearance and prices (including delivery from China) of the components used to assemble the ultrasonic key fob are shown in the figure:

In the future, you can develop a mount for the Gainta G1906 body and use a device with such a body as an attachment for a cane.

One of the ways to reduce the cost of devices is to save on labor costs and the cost of delivering device components to Russia by deploying production directly in China.

The devices we have developed have the following characteristics:

After conducting preliminary tests of the devices, we were forced to limit the obstacle detection range to 1.5 meters in order to avoid unnecessary triggering when using the devices in a crowded environment. With a continuous change in the vibration level, it is more difficult to determine the approach of an obstacle, so based on the results of preliminary tests, we settled on three vibration levels.
Appearance of the ultrasonic attachment on the cane:

Appearance of the neck keychain:

3D model of an ultrasonic attachment for a cane and source Firmware for Adruino is available for download at



Magnetic induction is a technology you probably remember from high school physics class. For wireless transmission energy you will need two coils: a transmitter coil and a receiver coil. 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 mobile device or to charge the battery.


No less important elements will be inductors, which you can make with your own hands. These simple coils are wound from copper wires and are called air core coils. Creating such a winding for our purpose is very simple. Find a round cylinder with a diameter of about 5 centimeters, and wind the wire around it so that each turn does not overlap another turn, but at the same time is as close to the other turn as possible. A 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 Arduino and inductors, we will need: one NPN transistor type 2N3055, one diode bridge 1A (diode assembly, they have four pins), 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 the components to create a wireless data transmission device is shown in the figure below.



The circuit can be tested using simple code for Arduino given 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. Basically, we can only use one 2N2222 transistor. Connect its base terminal to the first end of the coil and its collector to the other end of the coil. The emitter pin is connected to the battery. As a result, such a simple design might look like this:








2024 gtavrl.ru.