{"id":836,"date":"2015-05-27T21:07:03","date_gmt":"2015-05-27T20:07:03","guid":{"rendered":"http:\/\/www.andrewwhyman.com\/blog\/?p=836"},"modified":"2015-05-27T21:07:03","modified_gmt":"2015-05-27T20:07:03","slug":"arduino-pwm-charge-controller-version-2","status":"publish","type":"post","link":"http:\/\/www.andrewwhyman.com\/blog\/electronics\/arduino-pwm-charge-controller-version-2\/","title":{"rendered":"Arduino PWM Charge Controller Version 2"},"content":{"rendered":"<p>A few weeks ago I finished the final version of my 2nd Arduino PWM Charge Controller. I have been working on this since October 2014 on and off when time has permitted. Knowing that I am going to be using the power box soon for camping, I thought it would be a good idea to finish it.<\/p>\n<p><a href=\"http:\/\/www.andrewwhyman.com\/blog\/electronics\/arduino-pwm-charge-controller\/\">You can see the post I made about version 1 of the charge controller here.<\/a><\/p>\n<h3><strong>So what&#8217;s new?<\/strong><\/h3>\n<p>A lot is new on this version feature wise, so let me list them one by one&#8230;<\/p>\n<p>&#8211; LCD Display<br \/>\n&#8211; Current Sensor<br \/>\n&#8211; Voltage Sense Input<br \/>\n&#8211; Temperature Sensor<br \/>\n&#8211; Lower Power Consumption<\/p>\n<h3><strong>LCD Display<\/strong><\/h3>\n<p><a href=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/screen.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-837\" src=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/screen.png\" alt=\"screen\" width=\"320\" height=\"282\" srcset=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/screen.png 320w, http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/screen-300x264.png 300w\" sizes=\"auto, (max-width: 320px) 100vw, 320px\" \/><\/a><\/p>\n<p>I thought long and hard about whether I wanted to put an LCD on this project or not. Ultimately I decided yes because I would be replacing the entire module that runs the existing screen with a new board anyway, so why not combine them?<\/p>\n<p>My biggest concern with this was power consumption. LCD displays are not always known for their low usage, however I was confident I would be able to make this work. I have a lot of experience using the small Nokia style displays which are 80&#215;48 pixels. By all means it is not a large display but it is only monochrome and is LED backlit.<\/p>\n<p>Using the screen on it&#8217;s own is less than 1mA when it is not being updated. I don&#8217;t know the exact figure, but its pretty negligible. With the LED backlight on, the power consumption depends on the brightness at which you run the LED&#8217;s. For this project I run it at 2 different levels depending on\u00a0whether it is daytime or nighttime.<\/p>\n<p>Daytime gets a higher brightness to combat ambient light a little more easily, whereas nighttime gets a lower brightness as there is little ambient light to worry about.<\/p>\n<h3><strong>Current Sensor<\/strong><\/h3>\n<p>The current sensor (ACS712 based) is not required as it is there only as a visual reference (but I could code something into the firmware to make it calculate total power if I wanted to). All this does is show the current power flow from the solar panels to the battery.<\/p>\n<h3><strong>Voltage Sense Input<\/strong><\/h3>\n<p>I had issues with voltage sensing on the first version of the charge controller when large currents were passing through the board and the cabling. So on this version I have made an (optional) voltage sense input so that you can run a 3 wire setup. This should reduce any issues with voltage sensing. So far I have not noticed any problem not using it on my own setup, but the option exists should it ever be needed on longer cable runs for example.<\/p>\n<h3><strong>Temperature Sensor<\/strong><\/h3>\n<p>Using a DS18B20 DALLAS temperature probe I have put the temperature inside the power box onto the display. Although it is not currently implemented in the firmware, it would be possible to have charge voltage temperature compensation built into the programming.<\/p>\n<h3><strong>Lower Power Consumption<\/strong><\/h3>\n<p>The biggest win from re-making this charge controller is that I was able to focus more on power consumption as a major factor. From the beginning I was trying to get it as low as possible. To do this I had to\u00a0be careful on not only the components I used, but also on the programming and how long some components were left active.<\/p>\n<p>For example:<\/p>\n<p>During the day, the LCD LED backlight runs at a higher brightness, pulling around 3-4mA. At night, the LED is dimmed to reduce power consumption.<\/p>\n<p>The current sensor is active for just a very short fraction of time every second, just long enough to get a reading. The sensor uses 10mA when active, so this was definitely necessary. At night it does not get probed for\u00a0a reading.<\/p>\n<p>The CPU frequency remains at 2MHz at all times, except when probing the temperature probe in which it returns to 16MHz for less than 1 second. The temperature\u00a0only gets updated once every 60 seconds during the day and every 4 minutes at night.<\/p>\n<p>The RGB LED showing the status at a quick glance uses a very low PWM output of around 5% duty. As a result the power consumption is\u00a0very low, though I do not remember the exact amount of current. By not using PWM or using\u00a0100% PWM, the LED is unnecessarily bright and that just wastes power. At night, the LED flashes blue every time the CPU wakes up (4 second intervals) just to signal it is still alive and aware it is night time.<\/p>\n<p>Total power consumption when the CPU is in sleep is just 2mA. That&#8217;s 3mA lower than the old charge controller when it was in sleep.<\/p>\n<h3><strong>Images<\/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: 50%;\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-836 gallery-columns-2 gallery-size-medium'><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/IMAG0741.jpg'><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"210\" src=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/IMAG0741-300x210.jpg\" class=\"attachment-medium size-medium\" alt=\"\" aria-describedby=\"gallery-1-838\" srcset=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/IMAG0741-300x210.jpg 300w, http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/IMAG0741-1024x715.jpg 1024w, http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/IMAG0741-900x629.jpg 900w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>\n\t\t\t<\/dt>\n\t\t\t\t<dd class='wp-caption-text gallery-caption' id='gallery-1-838'>\n\t\t\t\tThe LCD front panel.\n\t\t\t\t<\/dd><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/IMAG0730.jpg'><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"201\" src=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/IMAG0730-300x201.jpg\" class=\"attachment-medium size-medium\" alt=\"\" aria-describedby=\"gallery-1-839\" srcset=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/IMAG0730-300x201.jpg 300w, http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/IMAG0730.jpg 800w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>\n\t\t\t<\/dt>\n\t\t\t\t<dd class='wp-caption-text gallery-caption' id='gallery-1-839'>\n\t\t\t\tTesting the firmware with a programmer to allow easy updating.\n\t\t\t\t<\/dd><\/dl><br style=\"clear: both\" \/><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/IMAG0719.jpg'><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"219\" src=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/IMAG0719-300x219.jpg\" class=\"attachment-medium size-medium\" alt=\"\" aria-describedby=\"gallery-1-840\" srcset=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/IMAG0719-300x219.jpg 300w, http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/IMAG0719.jpg 800w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>\n\t\t\t<\/dt>\n\t\t\t\t<dd class='wp-caption-text gallery-caption' id='gallery-1-840'>\n\t\t\t\tSolder covered traces to help with current flow.\n\t\t\t\t<\/dd><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/IMAG0718.jpg'><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"254\" src=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/IMAG0718-300x254.jpg\" class=\"attachment-medium size-medium\" alt=\"\" srcset=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/IMAG0718-300x254.jpg 300w, http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/IMAG0718.jpg 800w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>\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<a href='http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/IMAG0739.jpg'><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"170\" src=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/IMAG0739-300x170.jpg\" class=\"attachment-medium size-medium\" alt=\"\" aria-describedby=\"gallery-1-842\" srcset=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/IMAG0739-300x170.jpg 300w, http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/IMAG0739-1024x579.jpg 1024w, http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/IMAG0739-900x509.jpg 900w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>\n\t\t\t<\/dt>\n\t\t\t\t<dd class='wp-caption-text gallery-caption' id='gallery-1-842'>\n\t\t\t\tSome circuit breakers for protection.\n\t\t\t\t<\/dd><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/IMAG0740.jpg'><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"170\" src=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/IMAG0740-300x170.jpg\" class=\"attachment-medium size-medium\" alt=\"\" aria-describedby=\"gallery-1-843\" srcset=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/IMAG0740-300x170.jpg 300w, http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/IMAG0740-1024x579.jpg 1024w, http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/IMAG0740-900x509.jpg 900w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>\n\t\t\t<\/dt>\n\t\t\t\t<dd class='wp-caption-text gallery-caption' id='gallery-1-843'>\n\t\t\t\tSafety and neatness through heat shrink.\n\t\t\t\t<\/dd><\/dl><br style=\"clear: both\" \/><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/IMAG0738.jpg'><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"170\" src=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/IMAG0738-300x170.jpg\" class=\"attachment-medium size-medium\" alt=\"\" aria-describedby=\"gallery-1-844\" srcset=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/IMAG0738-300x170.jpg 300w, http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/IMAG0738-1024x579.jpg 1024w, http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/IMAG0738-900x509.jpg 900w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>\n\t\t\t<\/dt>\n\t\t\t\t<dd class='wp-caption-text gallery-caption' id='gallery-1-844'>\n\t\t\t\tThe final installation.\n\t\t\t\t<\/dd><\/dl>\n\t\t\t<br style='clear: both' \/>\n\t\t<\/div>\n\n<h3><strong>Specs<\/strong><\/h3>\n<p>&#8211; 255 step PWM power control<br \/>\n&#8211; Solar panel\u00a0and battery voltage aware<br \/>\n&#8211; Over\/undershoot protection (software)<br \/>\n&#8211; Over-voltage (15.0v) protection (software)<br \/>\n&#8211; Automatic Bulk (14.5v) and float (13.5v) modes<br \/>\n&#8211;\u00a0Solar panel to battery current display<br \/>\n&#8211;\u00a0Temperature display<br \/>\n&#8211; RGB\u00a0status LED<br \/>\n&#8211; LCD backlit display showing battery voltage, solar panel voltage, charge mode, current, watts, temperature\u00a0and\u00a0PWM %<br \/>\n&#8211;\u00a0Voltage sense input<br \/>\n&#8211; Re-programmable with updated firmware<br \/>\n&#8211; 2mA at night, 7mA (15mA peak) during the day power consumption<\/p>\n<h3><strong>Circuit Wizard\u00a0Layout and Arduino Sketch<\/strong><\/h3>\n<p><span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"http:\/\/www.andrewwhyman.com\/blog\/wp-content\/uploads\/2015\/05\/arduino_pwm_charge_controller_v2_files.zip\">Download<\/a><\/span>\u00a0(14KB)<\/p>\n<p><em>Apologies that there are no components listed for you to make this yourself. I do not have it to hand at the moment but I will update it here if I remember in the future.<\/em><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A few weeks ago I finished the final version of my 2nd Arduino PWM Charge Controller. I have been working on this since October 2014 on and off when time has permitted. Knowing that I am going to be using the power box soon for camping, I thought it would be a good idea to [&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-836","post","type-post","status-publish","format-standard","hentry","category-electronics"],"_links":{"self":[{"href":"http:\/\/www.andrewwhyman.com\/blog\/wp-json\/wp\/v2\/posts\/836","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=836"}],"version-history":[{"count":9,"href":"http:\/\/www.andrewwhyman.com\/blog\/wp-json\/wp\/v2\/posts\/836\/revisions"}],"predecessor-version":[{"id":854,"href":"http:\/\/www.andrewwhyman.com\/blog\/wp-json\/wp\/v2\/posts\/836\/revisions\/854"}],"wp:attachment":[{"href":"http:\/\/www.andrewwhyman.com\/blog\/wp-json\/wp\/v2\/media?parent=836"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.andrewwhyman.com\/blog\/wp-json\/wp\/v2\/categories?post=836"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.andrewwhyman.com\/blog\/wp-json\/wp\/v2\/tags?post=836"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}