{"id":992,"date":"2017-06-04T12:49:24","date_gmt":"2017-06-04T11:49:24","guid":{"rendered":"http:\/\/www.andrewwhyman.com\/blog\/?p=992"},"modified":"2017-06-04T12:49:24","modified_gmt":"2017-06-04T11:49:24","slug":"arduino-pwm-charge-controller-v3","status":"publish","type":"post","link":"http:\/\/www.andrewwhyman.com\/blog\/electronics\/arduino-pwm-charge-controller-v3\/","title":{"rendered":"Arduino PWM Charge Controller V3"},"content":{"rendered":"<p>This project has been a relatively long time in the making, but here it is, the next iteration of the controller.<\/p>\n<h3>Specifications<\/h3>\n<ul>\n<li>3x P-Channel FQP27P06 in parallel for lower total resistance<\/li>\n<li>Low quiescent current 5v regulator for minimal power consumption<\/li>\n<li>2x40A diodes in parallel for lower total resistance<\/li>\n<li>30A hall effect current sensor<\/li>\n<li>Modular design\u00a0to enable upgrading of the power board<\/li>\n<li>Current design limit 10A (may be capable of more but untested)<\/li>\n<li>Power consumption: 7mA (no solar input) to 35mA<\/li>\n<\/ul>\n<h3>Features<\/h3>\n<ul>\n<li>Voltage reading (accurate to +\/- 0.02v) for\u00a0battery and solar panel\n<ul>\n<li>Translates into a percentage reading with hysteresis<\/li>\n<li>Software over-voltage protection<\/li>\n<\/ul>\n<\/li>\n<li>Current reading (accurate to +\/- 0.1A)\n<ul>\n<li>Continuous polling<\/li>\n<li>Records power flow in Ah and Wh<\/li>\n<li>2 sets of records for running and total records<\/li>\n<li>Readings stored in EEPROM in case of CPU reset<\/li>\n<\/ul>\n<\/li>\n<li>255 step PWM controlled output\n<ul>\n<li>Adjusted up to 700 times per second<\/li>\n<\/ul>\n<\/li>\n<li>3 charging modes\n<ul>\n<li>Bulk<\/li>\n<li>Absorb<\/li>\n<li>Float<\/li>\n<\/ul>\n<\/li>\n<li>Night detection to lower power consumption\n<ul>\n<li>Lower CPU frequency<\/li>\n<li>Turns off current sensor<\/li>\n<li>Lowers backlight brightness<\/li>\n<\/ul>\n<\/li>\n<li>Button\u00a0for additional functions\n<ul>\n<li>Changes screens<\/li>\n<li>Resets power flow totals<\/li>\n<\/ul>\n<\/li>\n<li>Over temperature cut-off\n<ul>\n<li>Protects diodes and MOSFETs from damage<\/li>\n<li>Override available in case of temperature probe failure<\/li>\n<\/ul>\n<\/li>\n<li>Firmware upgradable<\/li>\n<li>RGB status LED\n<ul>\n<li>Red = Bulk<\/li>\n<li>Orange = Absorb<\/li>\n<li>Green = Float<\/li>\n<li>Blue = Night \/ No solar input<\/li>\n<li>White = Power up sequence<\/li>\n<\/ul>\n<\/li>\n<li>Multiple\u00a0screens available\n<ul>\n<li>Full information screen<\/li>\n<li>Volts, Watts, Amps<\/li>\n<li>Volts,\u00a0Wh, Ah<\/li>\n<li>Rotating screen\n<ul>\n<li>Volts, Watts, Amps<\/li>\n<li>Battery %, Wh, Ah<\/li>\n<\/ul>\n<\/li>\n<li>Graphical screen\n<ul>\n<li>Battery bar<\/li>\n<li>Volts<\/li>\n<li>Battery %<\/li>\n<li>Amps<\/li>\n<li>Watts<\/li>\n<li>Ah<\/li>\n<li>Wh<\/li>\n<\/ul>\n<\/li>\n<li>Power\n<ul>\n<li>Hold button on this screen to reset values<\/li>\n<\/ul>\n<\/li>\n<li>Total Power\n<ul>\n<li>Hold button on this screen to reset values<\/li>\n<\/ul>\n<\/li>\n<li>Temperature override\n<ul>\n<li>Hold button on this screen to enable\/disable temperature override<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3><strong>Gallery<\/strong><\/h3>\n\n\t\t<style type=\"text\/css\">\n\t\t\t#gallery-1 {\n\t\t\t\tmargin: auto;\n\t\t\t}\n\t\t\t#gallery-1 .gallery-item {\n\t\t\t\tfloat: left;\n\t\t\t\tmargin-top: 10px;\n\t\t\t\ttext-align: center;\n\t\t\t\twidth: 33%;\n\t\t\t}\n\t\t\t#gallery-1 img {\n\t\t\t\tborder: 2px solid #cfcfcf;\n\t\t\t}\n\t\t\t#gallery-1 .gallery-caption {\n\t\t\t\tmargin-left: 0;\n\t\t\t}\n\t\t\t\/* see gallery_shortcode() in wp-includes\/media.php *\/\n\t\t<\/style>\n\t\t<div id='gallery-1' class='gallery galleryid-992 gallery-columns-3 gallery-size-full'><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"230\" height=\"203\" src=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2017\/06\/IMAG0954.jpg\" class=\"attachment-full size-full\" alt=\"\" \/>\n\t\t\t<\/dt><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"230\" height=\"210\" src=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2017\/06\/IMAG0956.jpg\" class=\"attachment-full size-full\" alt=\"\" \/>\n\t\t\t<\/dt><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"230\" height=\"204\" src=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2017\/06\/IMAG0957.jpg\" class=\"attachment-full size-full\" alt=\"\" \/>\n\t\t\t<\/dt><\/dl><br style=\"clear: both\" \/><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"230\" height=\"203\" src=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2017\/06\/IMAG0959.jpg\" class=\"attachment-full size-full\" alt=\"\" \/>\n\t\t\t<\/dt><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"230\" height=\"197\" src=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2017\/06\/IMAG0960.jpg\" class=\"attachment-full size-full\" alt=\"\" \/>\n\t\t\t<\/dt><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"230\" height=\"197\" src=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2017\/06\/IMAG0961.jpg\" class=\"attachment-full size-full\" alt=\"\" \/>\n\t\t\t<\/dt><\/dl><br style=\"clear: both\" \/><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"230\" height=\"194\" src=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2017\/06\/IMAG0962.jpg\" class=\"attachment-full size-full\" alt=\"\" \/>\n\t\t\t<\/dt><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"230\" height=\"195\" src=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2017\/06\/IMAG0963.jpg\" class=\"attachment-full size-full\" alt=\"\" \/>\n\t\t\t<\/dt><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"230\" height=\"201\" src=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2017\/06\/IMAG0964.jpg\" class=\"attachment-full size-full\" alt=\"\" \/>\n\t\t\t<\/dt><\/dl><br style=\"clear: both\" \/>\n\t\t<\/div>\n\n<h3><\/h3>\n\n\t\t<style type=\"text\/css\">\n\t\t\t#gallery-2 {\n\t\t\t\tmargin: auto;\n\t\t\t}\n\t\t\t#gallery-2 .gallery-item {\n\t\t\t\tfloat: left;\n\t\t\t\tmargin-top: 10px;\n\t\t\t\ttext-align: center;\n\t\t\t\twidth: 50%;\n\t\t\t}\n\t\t\t#gallery-2 img {\n\t\t\t\tborder: 2px solid #cfcfcf;\n\t\t\t}\n\t\t\t#gallery-2 .gallery-caption {\n\t\t\t\tmargin-left: 0;\n\t\t\t}\n\t\t\t\/* see gallery_shortcode() in wp-includes\/media.php *\/\n\t\t<\/style>\n\t\t<div id='gallery-2' class='gallery galleryid-992 gallery-columns-2 gallery-size-medium'><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon portrait'>\n\t\t\t\t<a href='http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2017\/06\/IMAG09492.jpg'><img loading=\"lazy\" decoding=\"async\" width=\"257\" height=\"300\" src=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2017\/06\/IMAG09492-257x300.jpg\" class=\"attachment-medium size-medium\" alt=\"\" srcset=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2017\/06\/IMAG09492-257x300.jpg 257w, http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2017\/06\/IMAG09492-768x895.jpg 768w, http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2017\/06\/IMAG09492-879x1024.jpg 879w, http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2017\/06\/IMAG09492.jpg 1614w\" sizes=\"auto, (max-width: 257px) 100vw, 257px\" \/><\/a>\n\t\t\t<\/dt><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon portrait'>\n\t\t\t\t<a href='http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2017\/06\/IMAG0916.jpg'><img loading=\"lazy\" decoding=\"async\" width=\"168\" height=\"300\" src=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2017\/06\/IMAG0916-168x300.jpg\" class=\"attachment-medium size-medium\" alt=\"\" srcset=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2017\/06\/IMAG0916-168x300.jpg 168w, http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2017\/06\/IMAG0916-768x1371.jpg 768w, http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2017\/06\/IMAG0916-573x1024.jpg 573w\" sizes=\"auto, (max-width: 168px) 100vw, 168px\" \/><\/a>\n\t\t\t<\/dt><\/dl><br style=\"clear: both\" \/>\n\t\t<\/div>\n\n<h3><strong>Flaws in the design<\/strong><\/h3>\n<p>As with anything I make, not everything always goes according to plan. There is one flaw with the project that I found whilst I was writing the software. The ambient temperature probe\u00a0picks up heat from the voltage regulator through the copper tracks, making it slightly inaccurate (it reads high). If I had to re-make the control board I would move it further away from the regulator and put a large copper pad around it to take away any heat that is transmitted.<\/p>\n<h3>Challenges<\/h3>\n<p>There were several challenges in this version of the controller.<\/p>\n<p>Initially I wanted to use N-Channel MOSFETs because they have lower resistance and are easier to drive. However I quickly found that this wouldn&#8217;t work without some complex drive circuitry. For loads\u00a0N-Channel is easy, but for power shunting from a solar panel it requires complex drive circuitry in the form of a charge pump or a MOSFET driver. Needless to say I wasn&#8217;t prepared for that set back so I decided to go with P-Channel once again.<\/p>\n<p>Another challenge was the software. In order to get the best possible\u00a0voltage control the software has to run as quickly as possible. This means making it as efficient as possible because of the limited CPU speed. I quickly found that using timers was the best way to get around this. The main control loop runs unrestricted but\u00a0non-essential code runs less frequently. The screen updates every 500ms, and everything else runs every 1 second.<\/p>\n<h3>Circuit Layout<\/h3>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-1023\" src=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2017\/06\/charge_controller_v3.png\" alt=\"\" width=\"700\" srcset=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2017\/06\/charge_controller_v3.png 922w, http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2017\/06\/charge_controller_v3-300x226.png 300w, http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2017\/06\/charge_controller_v3-768x578.png 768w\" sizes=\"(max-width: 922px) 100vw, 922px\" \/><\/p>\n<p>I realise that many of the components are not labelled, sorry!<\/p>\n<h3>Code<\/h3>\n<p><span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2017\/06\/Version_3.00.zip\">Version_3.00<\/a><\/span> (12KB) &#8211; 04\/06\/2017<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This project has been a relatively long time in the making, but here it is, the next iteration of the controller. Specifications 3x P-Channel FQP27P06 in parallel for lower total resistance Low quiescent current 5v regulator for minimal power consumption 2x40A diodes in parallel for lower total resistance 30A hall effect current sensor Modular design\u00a0to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"amp_status":"","footnotes":""},"categories":[14],"tags":[],"class_list":["post-992","post","type-post","status-publish","format-standard","hentry","category-electronics"],"_links":{"self":[{"href":"http:\/\/www.andrewwhyman.com\/blog\/wp-json\/wp\/v2\/posts\/992","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.andrewwhyman.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.andrewwhyman.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.andrewwhyman.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.andrewwhyman.com\/blog\/wp-json\/wp\/v2\/comments?post=992"}],"version-history":[{"count":21,"href":"http:\/\/www.andrewwhyman.com\/blog\/wp-json\/wp\/v2\/posts\/992\/revisions"}],"predecessor-version":[{"id":1037,"href":"http:\/\/www.andrewwhyman.com\/blog\/wp-json\/wp\/v2\/posts\/992\/revisions\/1037"}],"wp:attachment":[{"href":"http:\/\/www.andrewwhyman.com\/blog\/wp-json\/wp\/v2\/media?parent=992"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.andrewwhyman.com\/blog\/wp-json\/wp\/v2\/categories?post=992"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.andrewwhyman.com\/blog\/wp-json\/wp\/v2\/tags?post=992"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}