arduino powered solar battery charger

15
http://www.instructables.com/id/Arduino-powered-Solar-Battery-Charger/ technology workshop living food play outside Arduino powered Solar Battery Charger by skygate on August 31, 2014 Table of Contents Arduino powered Solar Battery Charger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Intro: Arduino powered Solar Battery Charger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Step 1: Basic principle of operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Step 2: Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Step 3: Heat Calculations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Step 4: Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Step 5: BOX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Step 6: Testing the charger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Step 7: Final toughs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

Upload: marius-danila

Post on 22-Dec-2015

142 views

Category:

Documents


10 download

DESCRIPTION

Arduino Powered Solar Battery Charger

TRANSCRIPT

Page 1: Arduino Powered Solar Battery Charger

http://www.instructables.com/id/Arduino-powered-Solar-Battery-Charger/

technology      workshop      living      food      play      outside     

Arduino powered Solar Battery Chargerby skygate on August 31, 2014

Table of Contents

Arduino powered Solar Battery Charger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

Intro:   Arduino powered Solar Battery Charger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Step 1:   Basic principle of operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

Step 2:   Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

Step 3:   Heat Calculations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

Step 4:   Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

Step 5:   BOX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

Step 6:   Testing the charger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

Step 7:   Final toughs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

Page 2: Arduino Powered Solar Battery Charger

http://www.instructables.com/id/Arduino-powered-Solar-Battery-Charger/

Intro:  Arduino powered Solar Battery ChargerThe following design is for a Solar battery charger ran by an Arduino Nano. It can handle a standard lead acid 12V battery, like for a scooter or a car. Furthermore thedesign has been tested and runs with 90% efficiency under 70?C (158?F). It can take up to 20V on the input site of the charger. Also in order to improve the efficiency aMPPT tracker is implemented in the code to ensure that the maximum power of the panel is being used.

Page 3: Arduino Powered Solar Battery Charger

http://www.instructables.com/id/Arduino-powered-Solar-Battery-Charger/

Page 4: Arduino Powered Solar Battery Charger

http://www.instructables.com/id/Arduino-powered-Solar-Battery-Charger/

Step 1: Basic principle of operationThe basic operation of our selected circuit can be represented by the block diagram. The design consists of a buck converter regulated by the Arduino that measuresvoltage and current in the system and the voltage of the battery. Based on the measurements the Arduino controls the duty cycle with which the buck converter is drivenand so it calculates the current output to the battery.

Step 2: CircuitCircuit (intro)

The indication is done by 4 LEDs as visible on the circuit schematics. Also there is a reset button pulled onto the front board for easy access, if the code gets stuck. Thisbutton was very useful during initial testing.

Also in this build for the current measurement an AD8212 current sensing OP-AMP is used. This device proved to be unreliable for the application and is recommendedto be replaced with an ACS712 breakout board.

Description of circuit operation (refer to Charger circuit V1.pdf)

Q2 is the main switching MOSFET for the buck converter and Q3 is the synchronous switching MOSFET. The MOSFET are driven by U2 which is an IR2104 MOSFETdriver. The IR2104 takes the PWM signal (Digital_pin_9) from the Arduino input on pin 2 and uses it to drive the switching MOSFETs. The IR2104 can also be shut downwith setting pin 3 to low. Since Q2 is an NFET it needs a gate drive voltage that is 10V higher than the source voltage which is the solar input. So the IR2104 uses acharge pump circuit made of D2 and C6 to boost the gate drive voltage to turn on the high side MOSFET. D3 is a fast switching diode that should start conducting beforeQ3 and in that way increase the efficiency (Increase of 1-2%).

Q1 keeps the battery from being discharged at night. Q1 turns on when Q2 is on from voltage through D1. R4 drains the voltage off the gate of Q1 so it turns off when Q2

Page 5: Arduino Powered Solar Battery Charger

http://www.instructables.com/id/Arduino-powered-Solar-Battery-Charger/

turns off.

L1 is the main inductor that smooth’s the switching current and along with C8 smooth’s the output voltage.

In order to measure the battery and solar panel voltages R2, R3, C1 and R6, R7, C9 are set as voltage dividers. In this case the capacitors C1 and C9 smooth any pulsesin the signal and give a clean measurement to the ADC. C4 is the input filter capacitor that smooth’s any input current pulses.

In order to read the current in the system there is an Rshunt resistor. The voltage drop across is amplified 100 times by U1 and fed to the ADC of the Arduino.

The 3 LEDs are connected to the digital pins of the microcontroller and serve as an output interface to display the charging state.

Charging Data Serial Monitor

The current code is designed so it can display the data on to the Arduinon serial monitor. It will display the input voltage of the panel the current voltage of the battery andthe Current that the charger is currently drawing.

In V2 a I2C 16x2 line display is added to display the data.

Parts list

The parts list for the entire circuit with the designators is contained within the "Parts list V1" file.

For the micro controller any arduino running on the AtMega168/AtMega328/32u4 (Arduion Uno, Nano, Micro) can be used, as long as it runs on a 5V logic level and at atleast 16Mhz. An Arduino Mega can be used however the core for the timer will need to be rewritten so the MOSFETs in the circuit run at 10khz frequency.

All of the components can be ordered from Farnell / RS online / or your favorite hobby shop. Furthermore some components like mosfets and the Arduino board can bebought very cheaply on Ebay.

For the current sensing as mentioned before a ACS712 hall effect sensor will provide more linear and stable data compared to the OP-AMP. Also a breakout board won;tbe necessary since the chip is easily sold-arable on a proto shield.

Furthermore a I2C display like this can be used for displaying the measured data. An I2c display is necessary since on a standard Adruino UNO there will be not enoughavailable pins.

File Downloads

Charger circuit v1.pdf (71 KB)[NOTE: When saving, if you see .tmp as the file ext, rename it to 'Charger circuit v1.pdf']

ArduinoNano30Schematic.pdf (200 KB)[NOTE: When saving, if you see .tmp as the file ext, rename it to 'ArduinoNano30Schematic.pdf']

Parts list for V1.xlsx (11 KB)[NOTE: When saving, if you see .tmp as the file ext, rename it to 'Parts list for V1.xlsx']

Page 6: Arduino Powered Solar Battery Charger

http://www.instructables.com/id/Arduino-powered-Solar-Battery-Charger/

Step 3: Heat CalculationsHeatsink

In order to ensure that the mosfets will stay within proper operation temperature and handle the power passing trough them a heat sink is required. In the current case asingle heat sink of 5.5C/W is used for the 3 MOSFETs.

File Downloads

Heat calculations.pdf (326 KB)[NOTE: When saving, if you see .tmp as the file ext, rename it to 'Heat calculations.pdf']

Step 4: CodeThe code works a a simple state machine. The flowchart describes the basic principle of operation.

For the MPPT the program basically compares the current power output to the previous one, in the previous iteration of the code. The power is calculated based on thecurrent and voltage measured from the arduino. If the voltage is then too big, compered to the current, the duty cycle decreases and vice versa.

Important note: The maximum duty cycle is set to be 99.9%, due to the charge pump in the mosfet driver which needs a frequency to operate.

For the switching frequency timer 1 is used tithe the timer library included in the code. This is needed to achieve the frequency of 10kHz. Furedermore in the Chargercode archive file the two libraries for the LCD are included. The I2C LCD needs to be connected to analog pin 4 and 5 of the Arduino and the Serial.print statements inthe code need to be changed to lcd.print.

I am also uploading the main ino file as a request, separately. Note that you will need the libs requested in order to for it to compile and run.

Page 7: Arduino Powered Solar Battery Charger

http://www.instructables.com/id/Arduino-powered-Solar-Battery-Charger/

File Downloads

Charger code.zip (456 KB)[NOTE: When saving, if you see .tmp as the file ext, rename it to 'Charger code.zip']

solar_charger_code.ino (19 KB)[NOTE: When saving, if you see .tmp as the file ext, rename it to 'solar_charger_code.ino']

Step 5: BOXFor the current prototype a custom box was designed and build using a laser cutter. However since a laser cutter is not easily available everywhere, it is better for astandard hardware box to be used. Example box . The size can be as big as you want as long as the circuit fits inside.

It is important for the circuit to be protected from accidental touch, since it handles quite a large amount of power and could cause bodily harm if not handledproperly and if something goes wrong. Furthermore the heat sink can get quite hot at high power.

Page 8: Arduino Powered Solar Battery Charger

http://www.instructables.com/id/Arduino-powered-Solar-Battery-Charger/

Step 6: Testing the chargerSolar Panel Test

The build circuit was tested with an actual solar panel, in order to ensure that the it can handle the power of 50W.

Temperature Test

The temperature test was carried out in a small temperature chamber at 70 ?C. The charger setup was placed in the chamber and turned on. The circuit was in operationuntil the chamber reached 70?C. After that the charger was left to operate at 70?C for 30min. After the test the temperature of the heat sink was measured with a laserthermometer that showed a temperature of 77.2?C (IMAGES).

User Manual

Finally an user manual is available in the attached PDF files.

Page 9: Arduino Powered Solar Battery Charger

http://www.instructables.com/id/Arduino-powered-Solar-Battery-Charger/

Page 10: Arduino Powered Solar Battery Charger

http://www.instructables.com/id/Arduino-powered-Solar-Battery-Charger/

Page 11: Arduino Powered Solar Battery Charger

http://www.instructables.com/id/Arduino-powered-Solar-Battery-Charger/

Page 12: Arduino Powered Solar Battery Charger

http://www.instructables.com/id/Arduino-powered-Solar-Battery-Charger/

Page 13: Arduino Powered Solar Battery Charger

http://www.instructables.com/id/Arduino-powered-Solar-Battery-Charger/

File Downloads

User manual.pdf (544 KB)[NOTE: When saving, if you see .tmp as the file ext, rename it to 'User manual.pdf']

Step 7: Final toughsThe final build functioned perfectly, although there were many issues during the development processes and more that a few burned parts :).

As mentioned before a few improvements can be made, mainly in the displaying of the charge data on a display.

Finally this is a good project for anyone that wishes to get some experience with power electronics and arduino programing.

Related Instructables

COMPACT-CAR-BATTERY-TESTER-ANALYZER-INDICATOR byajoyraman

Renew yourSealed LeadAcid (SLA)battery withDistilled Water!by vanwinklec

Increase batterylife forelectronics byPlasmana

Light ElectricVehicle: One-Passenger @15mph, 210#Curb Weight byshastalore

Solar CarBattery ChargerDIY byTimAnderson

PIC12F629Lead-AcidBatteryDesulfator(Photos) bymichaelsanjay

Advertisements

Comments

22 comments Add Comment

 skygate says:  Sep 6, 2014. 12:44 PM  REPLYHI all

If you like the project vote for it on the contest pages.

Best Regards

G3

 bret.tschacher says:  Nov 29, 2014. 2:52 PM  REPLYSkygate, I like the instructables a lot but I am having issues with the downloaded codes not compiling as they are. I would like to know why that is. I haveposted comments on a couple of other projects that I really need to get working. If you can help , it would sure be appreciated. I look at the circuits and cansee that they are viable but I have almost no experience with code writing, and that is holding me up.

 kimnguu says:  Dec 5, 2014. 7:13 AM  REPLYHello Bret.

his code worked fine without problem when i compile it

Page 14: Arduino Powered Solar Battery Charger

http://www.instructables.com/id/Arduino-powered-Solar-Battery-Charger/

 bret.tschacher says:  Dec 5, 2014. 9:40 AM  REPLYKImnguu, I have looked at many different projects on Arduino and have copied codes by download and also by hand from the pages and to this day Ihave yet to get any of them to compile, and get the circuits to work. I get errors like undefined parameter, error expected this or that. I have workedwith some of this and gotten some errors to go away but only get so far and stopped with another error I cannot clear. There has to be somethingeither in the download files that is not coming through cause of me not having pro access or something. Like I said, I have hand written them, anddownloaded and gone directly to Arduino Suite with the file and hit the compile tab and they don't work.

 bret.tschacher says:  Dec 21, 2014. 1:31 PM  REPLYOk , it took me a little bit of time and I now have some progress. I have a compiled code that I need to go back to and look closer at it. I am notexactly sure about some of it cause the language is not all in English but I think it will do what I need to do. I'm pretty sure now it was cause Ididn't have the latest version of Arduino which I went to the official site and downloaded new stuff. L

 ChrisS8 says:  Dec 21, 2014. 7:55 AM  REPLYbret.tschacher, do you import the libraries correctly? I have just downloaded the code and compiled it first time, with nothing else done than addingthe libraries to the correct place

 mayureshrao says:  Dec 16, 2014. 9:51 PM  REPLYhello sir can share the complete design details of this project

 deba168 says:  Feb 17, 2015. 5:12 AM  REPLYYou can see my instructable

http://www.instructables.com/id/ARDUINO-SOLAR-CHARGE-CONTROLLER-Version-30/

 jlj0425 says:  Jan 18, 2015. 1:16 AM  REPLYdo you have code that use ACS712 instead of AD8212

 bret.tschacher says:  Nov 29, 2014. 2:44 PM  REPLYI have been trying to work with some of these projects posted on the net at Instructables for a while now in an attempt to learn something about coding. I havedownloaded a couple of projects with the code files and Everytime I get a source code I run it through the verification and they NEVER work! There are alwayserrors in the files as I download them. Why? How can anyone be impressed with these projects if none of them will work? I thought I was doing somethingwrong but as I said, I am downloading the codes from the given links and none of them have worked yet. The last one I was working with had so many errors init, I started going over it and I have managed to reduce the number of errors but there is one I cannot get past yet. That project is the dual axis solar trackingsystem with servos. I can get compiled up to only one servo and then it refuses to recongnize the second set of instruction for the other servo. I need to have afunctional code and then get this charging system working so I can finish my off grid power system. I want to use multiple charge controllers so if somethinggoes wrong with the system it isn't All down but only the section that failed, the rest of them will continue working, sort of like micro inverters - micro chargers foreach panel in the system then connect them in parallel. If one goes down it will be indicated by the LEDs.

Page 15: Arduino Powered Solar Battery Charger

http://www.instructables.com/id/Arduino-powered-Solar-Battery-Charger/

 bret.tschacher says:  Dec 21, 2014. 1:32 PM  REPLYI think I'm making some progress with it. I just need to get back to it without any distractions. I got a compiled code that is not all in English in the notessection so it is tough figuring out what the guy is trying to do.

 bret.tschacher says:  Nov 29, 2014. 2:47 PM  REPLYIf anyone has any help to give on these please go to facebook and find me or email me at [email protected]

 mayureshrao says:  Dec 16, 2014. 9:51 PM  REPLYhello sir can share the complete design details of this project

 mayureshrao says:  Dec 16, 2014. 9:51 PM  REPLYhello sir can share the complete design details of this project

 ChargerE says:  Sep 27, 2014. 8:23 PM  REPLYHi!

I want to add a LCD and follow your suggestion to replace all the Serial.print with lcd.print, but the code seem to not work (i.e. the code can't compile). Ihave already added your given lib "__MACOSX" & "LiquidCrystal" but it still can not compile.

Could you teach me how to do so, thanks!

 bret.tschacher says:  Nov 29, 2014. 3:30 PM  REPLYI see you are also having issues with compiling code for these projects. There is something wrong with the files that you downloaded. I have been fightingthis for awhile myself. If you learn anything please let me know as I think we both are working with the same problem.

 beppe2810 says:  Nov 25, 2014. 7:47 AM  REPLYhi dear,

I am very much interested in your design, bat my battery bank is 2x12v 100ah battery in series outputing 24v (Charging current 10A).

Can you suggest the change to be made to the power section?

Tanks - Beppe

 ibenkos says:  Oct 18, 2014. 2:27 PM  REPLYSmart idea! I really like this project. Thanks for shearig :)

 xalpage says:  Sep 26, 2014. 12:18 PM  REPLYThanks for sharing!

I have a question. Can you use this to charge a LIC( Lithium Ion Capacitor)?

 Randy Lahey says:  Sep 14, 2014. 9:16 AM  REPLYThis is Tim Nolan's design.

 deba168 says:  Sep 15, 2014. 6:35 AM  REPLYYah it is Tim Nolan's design.The author modified according to his requirement.

 deba168 says:  Sep 6, 2014. 11:17 AM  REPLYIts looks really nice and professionalThanks for sharing..