{"id":597,"slug":"arduino-solar-cell-input","title":"Arduino Solar Cell Input","excerpt":"Here we go. As I mentioned a few days ago, I\u0026rsquo;m horsing around with analog input to my Arduino, in the form of input via a solar cell. For the win. It …","content":"\u003cp\u003eHere we go. As I \u003ca href=\"https://swantron.com/solar-panel-led-set-up/\"\u003ementioned a few days ago\u003c/a\u003e, I\u0026rsquo;m horsing around with analog input to my Arduino, in the form of input via a solar cell. For the win. It turns out, that I\u0026rsquo;m getting far better with my casual electronics experimentation\u0026hellip;I will chalk this one up as a win\u0026hellip;My basic set-up is this\u0026hellip;Radio Shack solar cell, breadboard, florescent light source, Arduino, and a notebook.\u003c/p\u003e\n\u003ch3 id=\"step-1-gauge-light-source-via-multimeter\"\u003eStep 1: Gauge light source via multimeter\u003c/h3\u003e\n\u003cp\u003e\u003cimg src=\"/uploads/2010/06/solar-test.jpg\" alt=\"test\" title=\"solar-test\"\n  loading=\"lazy\"\n  decoding=\"async\"\n/\u003e\n\n1.7 V\u0026hellip;no need to toss in a resister, as the Arduino can handle 5V without issue. Good to go.\u003c/p\u003e\n\u003ch3 id=\"step-2-interface-with-arduino-via-breadboard\"\u003eStep 2: Interface with Arduino via breadboard\u003c/h3\u003e\n\u003cp\u003e\u003cimg src=\"/uploads/2010/06/breadboard-setup.jpg\" alt=\"setup\" title=\"breadboard-setup\"\n  loading=\"lazy\"\n  decoding=\"async\"\n/\u003e\n\nThis could have been a direct setup, but for the sake of not soldering a solid lead to my solar cell array, I chose to twist the crap out of the existing + and - leads of the wire outs on the unit, and cram them into the breadboard. USB connected to the Arduino, of course.\u003c/p\u003e\n\u003ch3 id=\"step-3-chop-in-some-code-for-the-arduino\"\u003eStep 3: Chop in some code for the Arduino\u003c/h3\u003e\n\u003cp\u003eThis was the tricky part\u0026hellip;not that tricky, however:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-cpp\" data-lang=\"cpp\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e \u003cspan style=\"color:#a6e22e\"\u003esetup\u003c/span\u003e() {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  Serial.begin(\u003cspan style=\"color:#ae81ff\"\u003e9600\u003c/span\u003e);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e}\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e \u003cspan style=\"color:#a6e22e\"\u003eloop\u003c/span\u003e() {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#66d9ef\"\u003eint\u003c/span\u003e v \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e analogRead(\u003cspan style=\"color:#ae81ff\"\u003e0\u003c/span\u003e);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  Serial.print(v);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  Serial.print(\u003cspan style=\"color:#e6db74\"\u003e\u0026#39; \u0026#39;\u003c/span\u003e);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  delay(\u003cspan style=\"color:#ae81ff\"\u003e900\u003c/span\u003e);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e}\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003e\u003cimg src=\"/uploads/2010/06/arduino-wired.jpg\" alt=\"enhance\" title=\"arduino-wired\"\n  loading=\"lazy\"\n  decoding=\"async\"\n/\u003e\n\u003c/p\u003e\n\u003cp\u003eNote the lack of comments? I\u0026rsquo;m a flipping math dude, so that is wholly optional in my book. Long story short, Wiring is a stripped cousin of C++\u0026hellip;I have to void setup and loop here, since I am not concerned with anything once I let \u0026rsquo;er rip. I will touch on the programming specifics at a later date, but inquiring minds can find this info quite easily on the Arduino project\u0026rsquo;s main page, or on Wikipedia. Knock your socks off. I added the delay for sake of real-time monitoring, and matched the baud rate to which I had configured my USB connection. ttyUSB0 would be that in question\u0026hellip;9600 would be the rate.\u003c/p\u003e\n\u003ch3 id=\"step-4-read-input-via-serial-monitor\"\u003eStep 4: Read input via serial monitor\u003c/h3\u003e\n\u003cp\u003e\u003cimg src=\"/uploads/2010/06/solar-arduino1.jpg\" alt=\"solar\" title=\"solar-arduino1\"\n  loading=\"lazy\"\n  decoding=\"async\"\n/\u003e\n\nAs you can see, it is pretty much constant, with some fluctuation due to my set-up. Noisy, yes. Cheap components, yes.\u003c/p\u003e\n\u003ch3 id=\"step-5-testing-zero-state\"\u003eStep 5: Testing \u0026lsquo;zero\u0026rsquo; state\u003c/h3\u003e\n\u003cp\u003eHere, I have employed my box of smokes. American Spirit Lights, to be precise.\n\u003cimg src=\"/uploads/2010/06/experiment-setup.jpg\" alt=\"cigs\" title=\"experiment-setup\"\n  loading=\"lazy\"\n  decoding=\"async\"\n/\u003e\n\u003c/p\u003e\n\u003ch3 id=\"step-6-gauge-system\"\u003eStep 6: Gauge system\u003c/h3\u003e\n\u003cp\u003eHere, I\u0026rsquo;m altering between \u0026lsquo;on\u0026rsquo; and \u0026lsquo;off\u0026rsquo; states. I start with the \u0026lsquo;off\u0026rsquo; (smokes on solar panel) configuration for a time, remove the box to open the system to \u0026lsquo;max input\u0026rsquo; for appx 7 secs, and then place the box to remove the input energy.\u003c/p\u003e\n\u003cp\u003e\u003cimg src=\"/uploads/2010/06/arduino-solar-two.jpg\" alt=\"for the goddamned win\" title=\"arduino-solar-two\"\n  loading=\"lazy\"\n  decoding=\"async\"\n/\u003e\n\u003c/p\u003e\n\u003cp\u003eMost definitely for the win\u0026hellip;with the experimental noise, that could be considered effectively zero.\nFor the win. In summation, I have read in analog, as intended. Lessons learned? Pretty straight forward I suppose. My cheap-o solar cell is rated for a max of 6V, which I was far under. If I was to use this setup with a stronger light source, I would need to take this into consideration. I didn\u0026rsquo;t perform any data transformation, as I was not concerned with \u0026lsquo;actual voltage input values\u0026rsquo; in this case\u0026hellip;merely relative. Most importantly, I was able to knock out the task I had set out to do. Hopefully, I can ride my EE high and get cranking on something awesome, like a netbook robot. With some lasers.\u003c/p\u003e\n","date":"2010-06-14T18:41:13Z","permalink":"https://swantron.com/2010/06/14/arduino-solar-cell-input/","link":"https://swantron.com/2010/06/14/arduino-solar-cell-input/","path":"/2010/06/14/arduino-solar-cell-input/","featuredImage":"/uploads/2010/06/solar-test.jpg","categories":[],"tags":[]}