HOME  |  NEWS  |  BLOGS  |  MESSAGES  |  FEATURES  |  VIDEOS  |  WEBINARS  |  RESOURCE CENTER  |  INDUSTRIES
REGISTER   |   LOGIN   |   HELP
Blogs
Gadget Freak

Gadget Freak Case #217: Finding the Sun With a Microcontroller

View Comments: Threaded|Newest First|Oldest First
Beth Stackpole
User Rank
Blogger
Placement is everything
Beth Stackpole   6/22/2012 7:14:52 AM
I could have used Jerald's gadget a couple of weeks back when we were experimenting with solar lighting in a couple of gardens in the back yard. Took a few days (perhaps more since we did it in a good stretch of rain) before we got the small main panel situated properly. Jerald's invention could have saved us some serious time!

naperlou
User Rank
Blogger
Re: Placement is everything
naperlou   6/22/2012 8:05:20 AM
NO RATINGS
This could also be used for tanning.  Either instructions could be given to the user, or a movable platform could be moved automatically.  The microcontroller could allow one to add an audible roll over tone. 

All kidding aside, it is interesting that Jerald found he had to use so many photo transistors, and that he had experimented to find the result.  Good work.

78RPM
User Rank
Silver
Re: Placement is everything
78RPM   6/22/2012 1:59:30 PM
NO RATINGS
Yes, Naperlou, I tried using two photocells to find the brighter direction right/left. The trouble was that after the motor and photocells turned, they now found another decision -- go right or left.  The motor turned erratically.  I looked at charts of the sun's path and found that 110 degrees of east/west scan would be a useful range of solar energy for any latitude up to 49 degrees.  30 samples gives us 3.67 degrees of precision, so the the microcontroller could go to sleep for 3 minutes between scans. -- Jerald C

78RPM
User Rank
Silver
Re: Placement is everything
78RPM   6/22/2012 2:03:41 PM
NO RATINGS
Thanks, Beth, I'm working on documenting my work with directing a motor to do the output portion of this project.  For now, I hope others see its usefulness as an input device to multiplex many inputs to a single pin. -- Jerald C

Charles Murray
User Rank
Blogger
Today's method?
Charles Murray   6/22/2012 5:12:11 PM
NO RATINGS
Jerald: What method (prior to yours) have solar panels used to find the sun?

78RPM
User Rank
Silver
Re: Today's method?
78RPM   6/22/2012 5:41:29 PM
NO RATINGS
Charles,

Your question is exactly the one I asked when I started the project.

Their methods are probably proprietary but I believe most of them would use the brute force method of calculating the sun's position. If one searches for solar position calculations, one finds that the calculation is far from simple.  While C code is available free online, it would take a microcontroller that supports a multiple precision instruction set, an input of latitude/longitude, current time, real time clock, look-up trig tables, etc.  While my approach is not purely minimalist, I wanted my device to just look up and say, "Where's the sun?"

Jerald C

Charles Murray
User Rank
Blogger
Re: Today's method?
Charles Murray   6/25/2012 7:36:27 PM
NO RATINGS
Nice work, Jerald. What I find interesting about your design is that it uses a solution that a human brain would use. No human would calculate the sun's position in order to find it quickly. Asking, "where's the sun?" should work for machines, too.

Nancy Golden
User Rank
Platinum
Great Project
Nancy Golden   6/22/2012 5:19:32 PM
NO RATINGS
I think this is a great project - very useful for efficient collection of solar energy! I particularly like PICs for these types of projects - they are so versatile and just plain fun. The inexpensive programmers that Microchip sells don't break the bank either and their MPLAB IDE is free and very user friendly. Great job!

mrdon
User Rank
Gold
Re: Great Project
mrdon   6/23/2012 3:28:07 PM
NO RATINGS
Nancy, Microchip provides a variety of cool PIC micrcontrollers and tons of great app notes and source code examples. I've used them in several projects and the ease in which to get them running is truly amazing. This project is just one of several examples of how microcontroller technology can easily be implemented. Great project idea!

gsmith120
User Rank
Platinum
Re: Great Project
gsmith120   6/25/2012 7:25:18 PM
NO RATINGS
Nancy, I agree this is a great project.  PIC processors are used a lot of places.  I have played around with their development kits.  It's always nice to see/read about the different projects people develop. 

notarboca
User Rank
Gold
Source Code
notarboca   6/24/2012 10:33:54 PM
NO RATINGS
Jerald, your project is wonderful and stimulating on a number of levels.  It is simple and elegant, from the design, to the selection of microcontroller for your purpose, to your use of multiplexing.  Perhaps I have missed something, but is source code available for this project?

Thank you so much for sharing this excellent design.

j-allen
User Rank
Platinum
Solar tracker
j-allen   6/25/2012 9:25:31 AM
This is indeed a clever solution to a non-problem.   We would really need it if  the sun behaved like an aerobatic airplane.  In actuality it "moves across the sky" at a reliable 15 deg/hour, so a simple clockwork or synchronous-motor heliostat is perfectly adequate.  Even if there were a small aiming error, the derivative of the cosine is very weak in the vicinity of 0 deg, so your solar panels would still produce full output. 

ervin0072002
User Rank
Gold
Re: Solar tracker
ervin0072002   6/25/2012 9:55:48 AM
NO RATINGS

Hm NREL.GOV has a C source code available to the public to track the sun using time stamp and a single microcontroller. The only problem is the feedback loop. LVDT's or RVDT's can get expensive so it might be simpler to have an array of 10cent phototransistors with a microcontroller I don't know? And have a direct feedback loop between light intensity and position of sensor (assuming that sensor is in the same plane as your collector (dish or trough is fine). as to this being a non-problem I disagree. Current systems (reflector and aim mechanism) are way too expensive. It is roughly 200% of the current competing costs. It's hard to invest in solar because of the initial investment. I think cheaper ways to solve this problem are always a big plus.

78RPM
User Rank
Silver
Re: Solar tracker
78RPM   6/25/2012 11:26:12 AM
NO RATINGS
The position of the sun is not as simple a problem as you might think. Go to www.analemma.com as a start.  Did you know that the longest day of the year has neither the earliest sunrise nor the latest sunset? For your learning fun, just browse for "Solar Position." It is tempting to say our collecter position is close and that's good enough, but in this day when engineers try to get energy efficiency on the order of microwatts, we want all the energy we can attain.  I hope the other suggested uses for the multiplexing project do not get lost in the discussion.

Jerald Cogswell

Droid
User Rank
Platinum
Has the sun gone wobbly?
Droid   6/25/2012 9:47:10 AM
NO RATINGS
This is really cool. However, since when did the position of the sun become unpredictable requiring us to "find" it. By the way - you could also look up "fearlessthinker" on youtube.  He has built a similar sun tracker.

John E
User Rank
Silver
Not very simple
John E   6/25/2012 11:10:10 AM
The solar trackers that I have seen all had a much simpler tracking system.  The rough aiming was done with a simple timer and the fine control done with 4 photodiodes placed in the sided of an x shaped metal or plastic extrusion that extended 3or 4 inched outward, and shaded the diodes that were pointed fathest away from the sun.  The tracker moved towards whichever diode had the most light on it.  This was all done with analog circuitry. 

Gregarious2
User Rank
Iron
Re: Not very simple
Gregarious2   6/25/2012 5:58:22 PM
NO RATINGS
I've used the quad cell method ( both analog and digital ) with concentrator systems and it works quite well as part of a servoed tracker. Digital was a bit easier to cope with the sun behind clouds, sunset vs sunrise positions, etc... conditions. Hamamatsu once sold a photodetector array ( S9132  ) that output XY position of a bright spot using an on board row column multiplexer scheme. You clocked the chip and looked for maxval on the x and y data streams. I think it was under $30.

One thing I've noticed here in Hawai'i with a huge boom on PV systems. ( we currently pay .45 / kwh ) Most of the installers seem to go for aesthetics rather than efficiency. Driving through any neighborhood, you will see most PV arrays are flat to the roof pitch  in whatever direction the house is pointed. The lucky folks face south.

78RPM
User Rank
Silver
Re: Not very simple
78RPM   6/25/2012 6:49:00 PM
NO RATINGS
Hi, Gregarious2.  Aloha, Brah. I lived in Hawaii for 22 years.

It's fun to see people think of all the alternative solutions. There is no one right way. It depends upon your application and design goals.

My problem with analog quad cell was that the motors were constantly being nagged, "this way; oops cloud; this way." The MCU could be programmed with some hysteresis / forgiveness and sleep to save energy. Again, if you are using a parabolic channel to focus along a water pipe, you need high accuracy. In Hawaii, you have solar power to waste. Here in Montana we want that boy aimed as accurately as we can.

Hey, Dudes: anybody want to comment about applications for multiplexing apart from the solar application?

Jerald Cogswell

Gregarious2
User Rank
Iron
Re: Not very simple
Gregarious2   6/25/2012 7:58:07 PM
NO RATINGS
Aloha kaua...

Yep, the analog quad cell / baffle arrangement worked well for detection but in a purely analog system, the servo motors were always being tickled. Digital lets you add hysteresis, averaging and any other sort of condition mediation you'd like. It's also stepper friendly. It works pretty well here in Hawai'i but I did much of my tracker work in Seattle, land of grey skies. 

Everyone usually manages to settle on a solution that works for their situation ( cost, available parts, space, time,  etc..  ) It's fun to learn from the diversity.

At 40-60K$ for a home PV system, I want to see every watt I can possibly get. I wonder if the contractor panels have to be marked" this side up"?

cvandewater
User Rank
Gold
Re: Not very simple
cvandewater   6/25/2012 6:54:47 PM
NO RATINGS
The aestetics are not only depending on the whim of the home owner, but often also simply required by local ordinance or even by law. and then also on technical feasibility. I installed a solar system on my 40 deg sloped roof (which was pretty ideal) in The Netherlands, while the roof was pointing S-W, which was not idea but even for that relative large error in orientation, the reduction in total output was less than 10%. Besides that it was not allowed to mount the panels any other way than parallel to the roof and it would also be rather infeasible to mount panels at an angle on a sloped tile roof, while it is trivial to mount panels a few inches above the tiles in an array. The array covered the majority of the roof surface and I already had to appear in front of the commission judging the aesthetics of the neighborhood because they did not like my design (after a neighbor complained - probably jealousy). When I showed a cleverly taken picture with the blue sky reflecting on both the (blue) panels and the 3 windows in the roof as well as the hot water collector, so they all appeared in the same surface and matching color, nicely contrasting to the yellow brick of the walls, they saw the idea of the complete surface and no longer applied the standard law that you have to stay away from windows with solar panels and approved my design. Pfoei. (This was a 3kWp array plus a solar hot water panel of 6x6ft embedded between 3 tilting windows of 3x6ft)

kf2qd
User Rank
Platinum
A question of efficiency
kf2qd   6/25/2012 12:21:53 PM
NO RATINGS
I have thought about a solar tracker - say you have a day when it starts out sunny, but gets heavy overcast. Do you keep tracking, hoping for sun, or do you shut down your tracker because there isn't enough power coming off the panel to replace wha the tracker uses? Or the day starts off cloudy and the sun comes out at noon. If 2 of these days some in sequence it was cheaper to quit tracking when the sun faded, and start tracking when the sun reached some minimum intensity.

 

For solar power you really need to consider the total power budget of every component. If a given component uses too much power, and a tracker running when there is no sun is a total waste of power, then it means you won't have power for other, possibly more important uses. If I don't run the tracker on a day with no sun, I have power for lights that night so a disabled resident can see their way to the restroom.

 

So - on a day with plenty of sun, solar tracking is a plus. An a day with no sun, tracking the "non-existant" sun is a total loss.

78RPM
User Rank
Silver
Re: A question of efficiency
78RPM   6/25/2012 1:01:12 PM
NO RATINGS
to kf2qd, I agree that the MCU program should include inputs and logic to stop tracking when the sun is dim. BTW, I've messaged the editor to include my source code in the link. There should also be a hysteresis in searching, i.e., consider letting the MCU and motors sleep for 2 or 3 minutes before making a correction. Hysteresis is more important for a small collector than a big array. And let's remember that not all collectors are flat panels. If we use a parabolic channel to focus light along a pipe, we need high aiming accuracy -- and we need to stop tracking when ambient conditions or temperature say it's a waste of energy.

Jerald Cogswell

Rob Spiegel
User Rank
Blogger
Re: A question of efficiency
Rob Spiegel   6/25/2012 2:58:30 PM
NO RATINGS
Just to let everyone know, the source code will soon be posted. 

Mydesign
User Rank
Platinum
Re: A question of efficiency
Mydesign   6/26/2012 5:21:00 AM
NO RATINGS
1 saves
Rob, oh that’s great. I think there after we can make/test the same product in our own lab. Hope you will provide the source code without much delay.

Rob Spiegel
User Rank
Blogger
Re: A question of efficiency
Rob Spiegel   6/26/2012 1:50:34 PM
NO RATINGS
Hi Mydesign. The source code has now been added to the end of the build instructions. So, click on the build instructions link and you're there.

Mydesign
User Rank
Platinum
Re: A question of efficiency
Mydesign   7/3/2012 4:55:58 AM
NO RATINGS
1 saves
Rob, thanks. I had gone through the source code and trying for an implementation. I will let you know within a couple of days that, whether it's working fine or not.

Rob Spiegel
User Rank
Blogger
Re: A question of efficiency
Rob Spiegel   7/3/2012 12:54:34 PM
NO RATINGS
Thanks, Mydesign. We are certainly eager to see the gadget. 

78RPM
User Rank
Silver
Re: A question of efficiency
78RPM   6/29/2012 12:13:23 AM
NO RATINGS
Dear Mydesign,

Have fun making the circuit and entering the program.  I hope the focus of the device shifts to its multiplexing purpose. Everyone is focused on the solar application, but the sensors can be anything.

The program compares TWO banks (vertical and horizontal) of 30 analog sensors EACH. It uses one-byte precision or a maximum of 256 digital values.  256 divided by 30 sensors gives approximately 1 in 8 chance of two sensors having the same value.  If you modify the PIC program to sense all 64 possible switches of the MUX into one pin of the MCU, you should consider right justifying the bits to get 10 bits of precision or 1024 values. This involves modifying the code at comments provided in the code. Contact me with any questions.

Think of other applications for MULTIPLEXING now.

The author.

cvandewater
User Rank
Gold
Re: A question of efficiency
cvandewater   6/25/2012 7:08:28 PM
NO RATINGS
@kf2qd: You probably never measured the output of a solar panel when a cloud appears. It is simply actually - the output power is linear with the amount of light.

Since it does not get pitch dark when a cloud appears, the solar panel does not stop delivering power. It may be half the amount and on very severely overcast (dreadful dark grey rainy days as there are in The Netherlands) the output may be in the order of 10%, but they still deliver power.

Since the tracker should consume a minuscule amount of power, it has a very large gear reduction since it does not move fast, so it can be powered by a small motor and even that motor needs to operation only part time, there is no reason to stop tracking when "the sun disappears" behind a cloud. The power consumed by the tracker should be in the order of 1% of the array output and it has the potential to double the daily energy output - depending on latitude and shadowing.

At the end of the day the panels are typically parked in more or less horizontal position anyway, which is safety in case a storm comes at night.

Note that the tracker will not lose the sun even when it is clouded for a long time, since the sun has a predictable path. So, as long as you do not completely reset your tracker and it has either a clock or knowledge of the previus sun position it can continue to point the panels to the correct position even when it has no good measurements for some time (or ever - it may be completely based on time and latitude to calculate the sun position).

I wonder why so many sensors were used. I know that it is in theory possible to make a tracker with a single photo sensor, but the simplest systems I have seen always use two pairs of sensors, one in X and one in Y direction to find the sun when starting from any orientation.

herbissimus
User Rank
Silver
non electrical tracking solution
herbissimus   6/25/2012 1:43:53 PM
NO RATINGS
zomeworks, a company in new mexico has a totally non electrical solution to the tracking problem thats quite popular with cattle ranchers with desert watering holes that uses 2 canisters of freon (or similar) connected with piping so that when the panels shade one it becomes heavier tilting the panels appropriately. there's lots of ways to skin this cat !

http://www.zomeworks.com/photovoltaic-tracking-racks/

78RPM
User Rank
Silver
Any Analog Solutions?
78RPM   6/25/2012 6:59:30 PM
NO RATINGS
It's me, the author again. Does anyone have a good circuit for Gadget Freak that finds the sun with analog comparators?  I tried using several op amp comparators all voting on who had the brightest signal. It didn't work very well. Show me where I went wrong. Maybe you used your method for some other purpose.

Jerald Cogswell

componenx
User Rank
Iron
Re: Any Analog Solutions?
componenx   7/2/2012 4:24:00 PM
NO RATINGS
I built a a simple tracker in the mid-80's using 5 small, matched solar cells, voltage comparators and two shading strips.  I forget how the motors were driven, just that it wasn't very pretty and it used dual battery packs.  It worked really well, though.

 I've also seen a cone shaped design which had 4 parallel holes with CdS cells at the bottom and a reference cell at the tip.

mrdon
User Rank
Gold
Re: Any Analog Solutions?
mrdon   7/22/2012 9:34:50 PM
NO RATINGS
The motors were probably driven by discrete or IC based H-Bridge circuits. These circuits are commonly used to provide directional control for motors.

kf2qd
User Rank
Platinum
Interresting solution -
kf2qd   6/27/2012 10:33:32 AM
NO RATINGS
That freon, or maybe Propane as it has some similar properties and is somewhat cheaper, solution for moving the collector is an interresting solution. I'll have to think about that one.

Chris PE
User Rank
Gold
Bob Pease must be rolling in his grave.
Chris PE   7/3/2012 11:21:37 AM
NO RATINGS
I tried to understand "almighty" processors being used everywhere. From MP3 players to refrigerators and even coffee machines.Why do we love to complicate things? I agree with John E , who described a design similar to the one , that I published  (with Bob Pease blessing) about 30 years ago in Popular Electronics. Hundreds of trackers are using it and it has only 4 photo resistors and simple differential-servo system.I had tons of positive feedbacks and never heard anything negative on it , except that some people did not understand how servo works and what kind of transistors to use on an output.Sixty phototransistors?Isn't it a bit of overshoot?It would be great for navigation , but to move solar panels we do not need such a sophistication.Just my humble opinion.....I always loved analog.

Cadman-LT
User Rank
Gold
Re: Bob Pease must be rolling in his grave.
Cadman-LT   7/3/2012 11:31:06 AM
NO RATINGS
I thought that this had to have already been done..for the solar. As it turns out I was right.

78RPM
User Rank
Silver
Re: Bob Pease must be rolling in his grave.
78RPM   7/4/2012 6:45:39 PM
NO RATINGS
Hi, Chris,

I mostly agree with you. In fact, I tried connecting four photocells to four opamp comparators. I ran the non-inverting of one into the inverting of the next one in a ring.  The binary search for right/left, up/down didn't work.  It kept getting distracted by clouds and rocks and shadows and the motors went wild like a hound dog on a scent.  If anyone has an efficient analog design, I'm interested.


But, again, I'm disappointed that everyone focuses on the solar application -- but then I guess I should have changed the title.  The circuit and program is really about multiplexing in general.  When I did aircraft flutter tests back in 1980 this little circuit would have been more powerful than the DEC PDP 11/70 we were using.

Jerald Cogswell

Chris PE
User Rank
Gold
Re: Bob Pease must be rolling in his grave.
Chris PE   7/5/2012 1:06:56 PM
NO RATINGS
@Jerald,

I have my old design for sure. All this interference and "chatter" can be eliminated by integration and delay of a signal that is usually splendidly done by installing a capacitor in the output driving circuit.

Best Regards,

Chris

charly5139
User Rank
Iron
Re: Bob Pease must be rolling in his grave.
charly5139   7/22/2012 5:04:59 PM
NO RATINGS
Here in Europe, I would choose a microcontroller with a built-in RTC (real-time-clock). Knowing time and date, I can predict when the sun appears on the horizon, the elevation and when it disappears again in the evening. On cloudy, rainy days it might be useful not to switch on the servos. However, if the sun shows some erratic behavior which makes it necessary to follow it by an X/Y-tracker, your circuit might be better... (but I've never seen this on our planet).

Regards

Charly

mrdon
User Rank
Gold
Re: Bob Pease must be rolling in his grave.
mrdon   7/22/2012 9:22:00 PM
NO RATINGS
I remembered Forrest Mims describing his solar tracking device in the defunct Science Probe Magazine. It consisted of an analog circuit driving a dc motor. The detectors for the circuit were solar cells attached to the dc motor. Based on the sun's position,  the motor will point the solar cells in the direction of the sunlight. As explained and demonstrated in this project, a small microcontroller can enhance the performance of such a basic sun tracking device. Cool project!!

radioman63
User Rank
Iron
Re: Bob Pease must be rolling in his grave.
radioman63   8/27/2012 11:04:50 AM
NO RATINGS
Yes!  I remember reading that article 30 years ago.  Would you be able to point me towards a copy of it?  Thanks.

Partner Zone
More Blogs from Gadget Freak
Andrew Morris designed a circuit that could detect a stroke victim's groan and convert the sound into a signal so caregivers would know when help was needed.
We see Gadget Freak projects from all walks of life, but many of our most imaginative gadgets are created by budding engineers.
A team of Colorado State University students has created a gadget that guides a remote control airplane through the sensors in a glove.
Jerald Cogswell created a sonic telescope to grab sound and bring it as close to the user as the image.
Bernard R. Smith Jr. created a bridge rectifier that eliminates the flicker in LED light strings.
Design News Webinar Series
5/30/2013 11:00 a.m. California / 2:00 p.m. New York / 7:00 p.m. London
5/29/2013 11:00 a.m. California / 2:00 p.m. New York / 7:00 p.m. London
6/25/2013 11:00 a.m. California / 2:00 p.m. New York / 7:00 p.m. London
6/27/2013 11:00 a.m. California / 2:00 p.m. New York / 7:00 p.m. London
Blogs from Our Sponsors
From Dell / Intel®
New Paradigms in Design Work
Scott Hamilton, vertical market strategist for Dell Precision workstations, 5/2/2013    5
Early in my career, I worked as a draftsman and remember the days of drawing on vellum with numbered pencils and Mylar with plastic lead. This was a fun experience in the sense that I ...
From Dell / Intel®
Increased Workstation Performance Is as Easy as 'DPPO'
Trey Morton, Dell, 4/25/2013    2
I've been using workstations for more than 10 years and love finding ways to get more performance from my system. With demanding professional applications that require more power each ...
From Dell / Intel®
Taking Some of the Grit out of Manufacturing
Kirsten Billhardt, Manufacturing Industry Marketing Strategist, Dell, 3/26/2013    5
A lasting memory from my first job as an engineer in an auto assembly plant is standing on hard concrete at six in the morning, vending-machine coffee clutched in hand, listening to ...
Quick Poll
The Continuing Education Center offers engineers an entirely new way to get the education they need to formulate next-generation solutions.
Jun 24 - 28, Design Your Own Android App
SEMESTERS: 1  |  2  |  3


DN Radio
Sponsored by
NEXT UPCOMING BROADCAST
For industrial control applications, or even a simple assembly line, that machine can go almost 24/7 without a break. But what happens when the task is a little more complex? That’s where the “smart” machine would come in. The smart machine is one that has some simple (or complex in some cases) processing capability to be able to adapt to changing conditions. Such machines are suited for a host of applications, including automotive, aerospace, defense, medical, computers and electronics, telecommunications, consumer goods, and so on. This radio show will show what’s possible with smart machines, and what tradeoffs need to be made to implement such a solution.
Twitter Feed
Design News Twitter Feed
Like Us on Facebook

Sponsored Content

Technology Marketplace

Datasheets.com Parts Search

185 million searchable parts
(please enter a part number or hit search to begin)
Copyright © 2013 UBM Canon, A UBM company, All rights reserved. Privacy Policy | Terms of Service