The Cerebral Forum

Solar Projects => Heliostat Projects => Topic started by: Jim McMillan on March 16, 2011, 09:40:15 PM

Title: Mechanical Design
Post by: Jim McMillan on March 16, 2011, 09:40:15 PM
Hi Guys,

I'm trying to put together a heliostat design to use with Gabriel's Arduino program. I'm impressed with what has been done so far with simple hardware and wood structures, but I would like to come up with something a little more solid and permanent while still keeping costs as low as possible. There are a few basic design parameters that I will need to nail down before much progress can be made. I'm hoping you folks can give me a little feedback.

1. What is the minimum resolution  needed? I know I can do better than say 0.1 degree steps, and .01 is probably not that difficult, but how good is "good enough"? Is there any disadvantage to really fine resolution?

2. How about repeatability? Any slop or flex in the mechanism will affect this of course. It wouldn't be very hard to design a really tight and rigid system using precision motion components but it gets expensive in a hurry. Again how does one decide what is "good enough"?

3. How big should the mirror be? I'm thinking about using 12x12 inch mirror tiles since they are cheap and available, but what is the trade-off between multiple small machines and fewer bigger ones? Clearly there is no simple answer to that, but it's something to ponder. If the electronics and mechanism can be made cheap enough, I like the idea of smaller machines that can be deployed in numbers to meet the task at hand, as opposed to fewer big, heavy, expensive machines. Plus, starting small will give me a chance to get everything working and gain some knowledge which can then be applied to something bigger if desired.

Any thoughts/ideas? I'm looking forward to being part of this group and seeing what we all come up with.

Regards,
Jim
Title: Re: Mechanical Design
Post by: zininzelfdoen on March 18, 2011, 10:01:20 AM
Hi Jim.

We @zininzelfdoen are working on a system that uses two linear actuators to move 3 mirrors of 0.5 m2. We will still have an interesting (experimental) job to adapt software and electronics for using sattelite actuators. Maybe we can help eachother with this.
These are the actuators I ordered, they are really cheap. Believe me, we spent ages finding them for this price. Uptill now we are working on getting the normal software to work. Later we will try to make it apt for the new design.

http://www.miracle-moon.nl/shop/satelliet/accessoires/draaibaar/jaeger-superjack-10-inch.php5 (http://www.miracle-moon.nl/shop/satelliet/accessoires/draaibaar/jaeger-superjack-10-inch.php5)

kind regards,
daan
Title: Re: Mechanical Design
Post by: Gabriel on March 18, 2011, 03:00:24 PM
Hey Jim,

I'll try to answer your questions based on what I've noticed so far with my own heliostat.

1. The minimum resolution in large part depends on how far away your target is. The window I reflect the light into is about 50' away from the heliostat, and I think that 0.1 degree steps would actually probably be good enough for it. The sun moves 0.25 degrees per minute, and I have my heliostat update its position every 3 minutes. Even though it is 0.75 degrees off by the time it finally updates, it still stays on target fairly well. You can see this for yourself in the time lapse video I made on the heliostat projects homepage of this site.

So it's up to you how far you want to go with the resolution I guess. More certainly wouldn't hurt. The only disadvantage I can think of is that a higher resolution heliostat might be slow compared to a low resolution one. Not a big deal once everything is up and running since the sun itself isn't very fast, but it can be a pain when debugging if you have to wait a long time for the machine to reset itself.

2. From what I've seen with my heliostat, rigidity (or in my case the lack of it) is not too terribly detrimental to the heliostat's success. I can forcibly move mine along either the altitude or azimuth directions a degree or two, but it still ends up returning to its original position and reflecting the light to correct spot. Granted, that spot is only 50' away. Like before, it mostly depends on how far away you'd like to reflect the light. Make it better than I did obviously, but don't break the bank to do it.

3. I like the idea of several smaller machines too since they are more discrete. Something large would look odd (or more odd) if it sits in the front yard like mine does. Somewhere between 1-2 square meters might be about right?
I would make it as large as possible without being unwieldy, if that makes sense.

As far as keeping the costs down is concerned, I think it really just comes down to sitting down with some actual numbers and doing the calculations to see what size turns out to be the cheapest.
A few things that I have found out when building mine are:

Hook up wire for the stepper motors is one of the more expensive items (unless someone knows of a cheap source that I wasn't able to find), and the more heliostats you have the more you'll need of it.

Making the electronics and wiring everything together for each heliostat is very time consuming.

Aligning each heliostat and programming the targets is also very time consuming. I have ideas for making this task go faster by adding features to the Arduino program, but either way it will still take time out of the day.

Like you said, I would start small and first see if you can just get everything to work right.


Take Care!
Gabriel

Title: Re: Mechanical Design
Post by: Jim McMillan on March 19, 2011, 06:46:36 PM
Thanks for the input guys.
Daan, I have seen actuators like that here in the US, but never seriously considered them for my project.  A DC servo type drive like that may be more appropriate for the bigger systems, but for now I'm going to stick with steppers. I am more familiar with them and also I have some left over from my CNC projects. In fact I have a couple dozen smallish NEMA-23 motors that are too weak for anything but the smallest CNC machines. I'm thinking they should be powerful enough to handle a 1 or 2 square meter mirror depending on how I do the gearing.
Speaking of gearing, I'm thinking about using worm gears. I discovered a real simple way to make them using a spiral tap to cut the teeth. They can give extremely high ratios in a small space, and because they won't "back-drive" you can de-power the steppers when they are not moving, just as you can with screw drives.

Another "geometry" question, how big of an issue is having the mirror hinged near the glass surface? I understand there will be some non-linear "shifting" of the reflection if the hinge is at some distance from the mirror, but at what point does this become a problem? Can the software be set up to compensate?
Title: Re: Mechanical Design
Post by: Gabriel on March 20, 2011, 06:05:14 AM
Any errors added due to the mirror being hinged away from the glass surface will be negligible, so I wouldn't worry about it. I've played around with this before in Sketchup using simulated reflected lines, and didn't notice an issue.
Title: Re: Mechanical Design
Post by: Jim McMillan on March 21, 2011, 11:27:29 PM
Well I did a little CAD doodling, and here's a concept for an AZ-EL drive using NEMA-23 steppers and worm drives. The cross shaft would be supported at the ends of the big square tube by a bushing in a plate that is not currently shown, or maybe just a solid plastic plate with a hole in it. I'm thinking steel rod or maybe even black iron pipe for the shafts, threaded rod or a sawed-off bolt for the worm screws, and brass or plastic for the pinion gears. The axis shafts would turn in plastic or bronze bushings where they pass through the square tube and end plates. Right now I'm showing a 12x12 inch mirror, but it could be scaled up to whatever the motors and gear-train could handle.
Any thoughts/comments?
Jim
Title: Re: Mechanical Design
Post by: Jim McMillan on March 21, 2011, 11:34:15 PM
More pics.
Title: Re: Mechanical Design
Post by: Jim McMillan on March 21, 2011, 11:34:48 PM
One more.
Title: Re: Mechanical Design
Post by: Jim McMillan on March 25, 2011, 11:38:26 PM
I have a question regarding the electronic hardware.
When I went to order my real-time-clock module I came across some comments on the Sparkfun site regarding the accuracy of the DS1307 module.
Check out the comments on the bottom of this page:
http://www.sparkfun.com/products/99 (http://www.sparkfun.com/products/99)
Any thoughts/comments? I don't mind spending a little more for a better clock if it will help keep things tracking better.
I assume it would take some tweaking of the Arduino program though, and my programming skills are rudimentary at best.
So, I'm thinking I'll just stick to the DS1307 and existing code, unless someone wants to update the program for a more accurate clock.
Jim

PS. An update on the gearbox design - I had the idea that using standard threaded pipe nipples and fittings from Home Depot would be a simple and cheap way to do a prototype, and would be easily reproducible by others since the stuff is so readily available.  2 trips and $50 worth of plumbing parts later I'm still not quite there. The main trouble is that the fittings and tapered threads are very non-precision so I need to figure out a way to compensate. So... I still think my general concept is workable but I'm still scratching my head over what materials to use.
Title: Re: Mechanical Design
Post by: Gabriel on March 26, 2011, 05:35:46 AM
I think some of the comments there are an exaggeration or quite possible made by individuals with a faulty chip, but supposedly there will be some time loss/gain as the months go on. I was a little disappointed that Sparkfun didn't make that more clear when I first bought the chip, otherwise I might have upgraded to something more accurate myself. That said, my RTC has kept the correct time for about six months now. Worse case scenario, I just have to update the time every 6-12 months. I don't mind that since I'm always tinkering with the program anyway, but other people might not want to do that.

The same chip is available at this link. It's a little cheaper, but it needs to be soldered together. This is what I'm using now since I replaced the one from Sparkfun after I thought I fried it by accidentally wiring it wrong. Turns out I just drained the battery though. After replacing it it works again. Always nice to have a backup I guess.
http://www.adafruit.com/index.php?main_page=product_info&products_id=264&zenid=610967d039a114f29a28fe12c82de4a9 (http://www.adafruit.com/index.php?main_page=product_info&products_id=264&zenid=610967d039a114f29a28fe12c82de4a9)


I just noticed that the same site also has another clock module which is supposedly more accurate.
http://www.adafruit.com/index.php?main_page=product_info&cPath=42&products_id=255 (http://www.adafruit.com/index.php?main_page=product_info&cPath=42&products_id=255)

According to them, "The I2C interface is very straightforward and virtually identical to the register addresses of the popular DS1337 and DS1307 RTCs, which means that existing code for the Arduino, Basic Stamp, Cubloc, and other controllers should work with no modification."

So I guess that it should work with the Arduino Sun Tracking / Heliostat program without having to rewrite any of the code. If you try it and it works, let me know so that I can recommend it to people.

Good luck with your design!
Title: Re: Mechanical Design
Post by: Jim McMillan on March 30, 2011, 12:09:39 AM
Thanks Gabriel.
I dropped the water-pipe version for now, but may pick it up again later. It would be nice to come up with a design that can be built "tinker-toy" fashion using Home Depot parts, but for now I'm going to just buy some raw stock and do a little machining since I have the tools. Once I get something working I can focus on making something easier for those with more basic tools.
Looks like I'm going with the Adafruit clock. That's where I bought my Arduino and they were easy to deal with. Was thinking about trying their "motor shield" as well after looking at Bernard's postings, but your transistor driver is so simple and the code is proven so I'll probably stick with that. For some future machine I might want to go with a more powerful, commercially made stepper driver. To that end, have you thought about doing a "step and direction" type output to accommodate this?
Regards,
Jim
Title: Re: Mechanical Design
Post by: Gabriel on March 30, 2011, 06:52:01 AM
Hey Jim,

The code is based off of the Arduino Stepper motor library (http://arduino.cc/en/Reference/Stepper?from=Tutorial.Stepper (http://arduino.cc/en/Reference/Stepper?from=Tutorial.Stepper)) , so it would be easy to switch to a "step and direction" driver board.
At the top of the Arduino_SunTracker tab, you'll see "Stepper Motor Setup" section of the code.

Just replace the

  //Pins used for altitude stepper motors
  Stepper altStepper(int(steps), 2, 3, 4, 5);
  //Pins used for azimuth stepper motors
  Stepper azStepper(int(steps), 6, 7, 8, 9);

with

  //Pins used for altitude stepper motors
  Stepper altStepper(int(steps), 2, 3);
  //Pins used for azimuth stepper motors
  Stepper azStepper(int(steps), 4, 5);

and it should work with most of the typical two pins per motor driver boards.


Take Care,
Gabriel Miller
Title: Re: Mechanical Design
Post by: Jim McMillan on April 03, 2011, 11:17:47 PM
Thanks for that info Gabriel. I'll refer back to it when I get to that stage.
Well, I finally cut some metal. See pics below. I still need to make the pinion gears, bore the end plates for the crass shaft, and add some bushings. Also need to figure out a mount. Since I already have a bunch of galvanized pipe and fittings from the first aborted attempt I think they'll get used for that.
I'm moving and starting a new job next week so might not make much progress for the next couple weeks. Will keep chipping away and ordering parts though.
Jim
Title: Re: Mechanical Design
Post by: Gabriel on April 04, 2011, 06:55:56 PM
Wow!

That's looking really good! It looks like it should be very precise too. I can't wait to see how those worm gears come together.

Congrats on the new job!
Title: Re: Mechanical Design
Post by: Jim McMillan on April 06, 2011, 12:42:09 AM
Thanks. I think I went a little overboard using 1/4 inch wall tubing, in fact the whole thing seems like a bit of overkill. I figure I gotta start somewhere and I can always lighten it up in the next version, or keep adding mirrors until something breaks.
FYI - the ACME screws I'm using are 10 TPI and I'm shooting for 36 teeth on the pinion gears. My motors are 400 steps per turn. If I did my arithmetic right that's 0.025 degree per step.
Jim
Title: Re: Mechanical Design
Post by: Jim McMillan on April 24, 2011, 03:49:23 PM
Progress...

Well I've got my Arduino running. Wound up using the DS1307 clock after all, since the better one was backordered. I set the time and ran a test program on the Arduino and it seems to be keeping the correct time. Then I assembled and installed the Adafruit "motor shield" and tested it using some example programs. Was able to run both of my steppers together and separately. They were pretty weak running on 5V from my computer's USB port, but did fine with a 9V power supply plugged into the Arduino. So, all I need to do now is wire up some limit switches and the electronics are done.
I still haven't got the pinion gears made because I'm waiting for the tap to cut them with.  Had a little fiasco with shipping, I was in the middle of a move and it wound up in the wrong place. Should have it straightened out next week. Meanwhile I'll get the limit switches mounted and wired. Might have this thing together in a week or two if all goes well.
Then I'll be bugging you all for help with the software!
Jim
Title: Re: Mechanical Design
Post by: Gabriel on April 25, 2011, 02:21:45 PM
It sounds like it's coming together. Hopefully using the wormgears should make set up easier for you. I had a small test heliostat set up that used wormgears, and it worked on the first try. This was using a computer with a parallel port to control the heliostat not an Arduino, but it does go to show how many issues you should hopefully avoid using wormgears.

I should have a little bit more free time soon with the semester coming to a close in a couple of weeks, so I'll be around more to answer questions or work out any bugs if needed.
Title: Re: Mechanical Design
Post by: Jim McMillan on May 04, 2011, 02:00:41 PM
I agree that worm gears seem like a good choice. The key (for us DIY types anyway) is being able to make them economically. I chose ACME threaded rod for my prototype because I had a bunch of 1/2-10 ACME threaded rod in my junkbox. I think if you were trying to do it with hardware store parts that plain-old threaded rod would work OK too. I also considered using smaller rod, but the beauty of 1/2 inch is that there is room to drill a 1/4 inch hole in the end for direct coupling to my 1/4 inch stepper shafts. Also there is enough material so you can turn the other end down to fit a 1/4 inch bushing and have a nice shoulder remaining to take thrust loads.
Still waiting on that dog-gone ACME tap, but they tell me it has been shipped. Hopefully it will arrive by the weekend so I can get those gears cut.
Got the limit switches on and made some little cams to actuate them.
Gabriel, have you incorporated the changes in your software to allow use of the Adafruit "motor shield" ? Bernard posted his Dutch version, which I have downloaded, but I'd like to get your latest English version if possible. My current configuration is:
Arduino Uno
Adafruit motor shield to drive the steppers.
Only one machine at this time, no shift registers.
DS1307 clock
Motors are 6V, .85A, .9 deg per step. They seem to have pretty good torque running off of the Adafruit board with a 9V external supply. Some accel/decel ramping might be nice but probably not needed due to the high gear ratio and the small (12x12in) mirror that I'm using for testing.
Step resolution .025 degree per full step. May change slightly depending on how the gear cutting goes.
One limit switch on each axis.
This is getting exciting!
Jim
Title: Re: Mechanical Design
Post by: Gabriel on May 07, 2011, 10:45:23 AM
You seem to be getting pretty close. My exams for this semester are now finished, so I will finally have the chance to do some in depth work on the Arduino program, and the site in general.

I'm going to put together a simpler program designed specifically for worm gears. This way I can cut back on a lot of the features which will invariably just confuse people. It shouldn't take long, so, unless something comes up, I'll upload it here in a day or so.

I'll look into the motor shield. I'm planning on rearranging the program so that people can more easily drag and drop their own code for controlling stepper motors. Once that's done it should be a piece of cake to modify it for the Adafruit board.

I'm still trying to figure out how to get the acceleration to work. Like you said, it isn't really necessary for what you are doing, but it's something I'm wanted to add for awhile, so I'll go ahead and try to figure it out.

Have fun!
Gabriel

Title: Re: Mechanical Design
Post by: Jim McMillan on May 07, 2011, 07:16:55 PM
That sounds wonderful Gabriel.
Well the tap arrived today, so I'm running out of excuses for not finishing this thing! I'll be "making chips"  tonight as the machinists like to say. Hope it works! The main concern is that the pitch diameter comes out right since my design doesn't have provisions for adjusting the shaft spacing.
Here are a couple pics of the mount. The two pipe flanges with the springs between are to enable fine leveling adjustment. I still need to mount the Arduino board. It'll probably just be strapped to the square tube next to the steppers for now. On the next one I think I'll make provisions for it to live inside the square tube to keep everything nice and tidy.
Title: Re: Mechanical Design
Post by: Jim McMillan on May 07, 2011, 07:18:16 PM
The other pic...
Title: Re: Mechanical Design
Post by: Jim McMillan on May 08, 2011, 01:05:48 PM
Damn, I screwed up on a basic dimension and it looks like I need to re-make the aluminum parts, or at least modify them.
The good news is that the gear cutting went well. Pics attached.
Title: Re: Mechanical Design
Post by: Gabriel on May 10, 2011, 06:11:04 PM
Yeah it looks like the gear cutting went really well! They should be perfect for the job. Is that black stuff the threads are cut into just some sort of plastic?

I've spent the last few days rewriting and modifying large chunks of the Arduino Sun Tracking / Heliostat program. Everything I've thought of adding or improving over the 9 months since I first released it has finally been done. The program is a lot cleaner now too. I doubt that I've made it any easier to understand should someone want to look under the hood, but, for those who don't care, it should be a lot easier to set up.

I'm still double checking some things and am also still trying to figure out how to get that Accelstepper code to work with it, but it should hopefully be finished soon. and by finished, I mean finished. :)

Title: Re: Mechanical Design
Post by: Jim McMillan on May 13, 2011, 11:17:48 AM
Gabriel,

Lol. Is anything ever REALLY finished?

About the program, personally I'm not concerned about it being easy to understand. I just want something I can use to run my machine and that has some provisions for customizing the setup. My only special request would be to have provisions for plugging in code for the Adafruit motor shield and possibly some "step and direction" code to interface with common commercial stepper drives.

I've been meaning to ask, is there anything I can do to help support your efforts? Obviously you've put a lot of work into this project and, as a beneficiary of that work I would like to contribute. I noticed a link for contributions on your home page. Are cash donations preferred, or would some custom gears and/or mechanisms be more useful? My little Taig mill and lathe are pretty handy for that kind of stuff.

The pinion gear in the photo is made of Delrin (a.k.a. Acetal) plastic. Turns out that this sample was cut too deep so didn't work very well with my current shaft spacing. I think the key is to make the circumference of the blank evenly divisible by the number of teeth desired, and then advance the tap into the blank by a distance equal to the depth of the worm screw threads. Originally I thought that the "pitch diameter" would be less than the outside diameter, as it is with regular spur gears. In this case however, the first pass "locked in" the tooth count, then as I went deeper and the circumference decreased the bottom of the threads started overlapping. If you look closely at the pic, you can see a good tooth profile on the sides of the "groove", and the threads getting real thin at the bottom. The good news is that almost anything will work, but if you want accurate control over the tooth count and shaft spacing it takes a little planning.

Jim
Title: Re: Mechanical Design
Post by: Gabriel on May 14, 2011, 07:14:32 PM
Ha ha, no but I wish it would be really finished. At the very least it is finished enough that I can stop thinking about it so much. So far it looks like I finally figured out that Accelstepper bug. Or maybe I shouldn't say figured out so much as I made it disappear without being entirely sure why doing what I did made it suddenly work. I'm going to let it run awhile longer before I document and release it, but if you are ready for it now I can go ahead and post it here. I designed the program to be as adaptable as possible. Adding the Adafruit motor shield code should be a piece of cake I think, and changing it to "step and direction" code would be even easier. I have no way of testing the Adafruit code on my own though sense I don't have one. You'll be the first to try it in conjunction with the AccelStepper library.

If you really want to donate, PayPal is generally the easiest. The donations that people have given so far have all gone straight back into improving the heliostat project. Of course, another equally good contribution is just to help with the overall design, which is basically what you are doing now. 

At some point I'm going to end up building some more heliostats, and I'll try and copy what you did with the wormgears when making them. I don't have the sort of tools that you do for working with metal, but I have ideas for how to work around it. Basically what I'm striving for is something that is accessible to as many people as possible. I may try putting together a Sketchup model when I have the chance, and, depending on how this summer goes, maybe even try building one or two.

Take Care,
Gabriel
Title: Re: Mechanical Design
Post by: Jim McMillan on May 14, 2011, 11:21:15 PM
Hey Gabriel,
Sounds good. I'll kick in a little via the PayPal link and continue to post my progress here.
It would be pretty easy to set up a jig for cutting the gears. You just need a way to hold the blank as it spins while you rotate the tap against it while keeping the two rotating axes roughly perpendicular. A drill press with the drive belt removed could hold the blank while you spin the tap against it with a hand drill. Or instead of a drill press you could make something with a couple skate bearings and some hardwood blocks. I'm sure there are lots of low-tech ways it could be done by applying a little imagination. It mainly depends on what kind of tools and materials you have at hand I suppose.
I'm looking forward to the new software, though I'm not quite ready for it so you may as well hold off posting until you're ready. I got the machine cobbled together and moving using some really ugly gears since I trashed all my Delrin stock trying to make them come out perfect. I ordered some more Delrin, and now that I figured out the process I think the new ones will be a piece of cake. Unfortunately I won't be able to spend much time on it again till next weekend since I'm working a lot during the week. On the other hand it's fortunate that I am working because now I can afford to buy the parts I need!
Question on the limit switches: I gathered from some of your instructional posts that you are using only one input (pin 13) and that both switches are in series. I attached a little sketch of what I think you had in mind. Is this correct?
Jim
Title: Re: Mechanical Design
Post by: Gabriel on May 15, 2011, 05:24:20 AM
Thanks Jim,

I made a wormgear once before using my CNC machine. It was fairly low tech aside from the fact that I used a CNC machine to make it. I might go that route again.

Gah, no sorry that's a typo (which I already fixed). The limit switches should be wired in parallel not series. Sorry about the confusion.

Thanks again,
Gabriel
Title: Re: Mechanical Design
Post by: Jim McMillan on May 15, 2011, 11:42:43 AM
Like this?
Title: Re: Mechanical Design
Post by: Gabriel on May 15, 2011, 01:39:26 PM
That looks right.
Title: Re: Mechanical Design
Post by: Jim McMillan on May 19, 2011, 11:00:49 PM
Thanks Gabriel.
I've got her all wired up and running with a stepper test program. About all that's left is to mount the mirror. Should get that done this weekend. There will be some fine tuning to do on the mechanical bits. Right now I've got almost 2 degrees of backlash in the AZ axis, but close to zero in the EL. Feels like most of the slop is in the gear teeth. I think I'll swap the AZ and EL gears to see what happens. I can live with some backlash on the EL since the weight of the mirror will tend to bias it in one direction.
Looks like I have a little more work to do on the gear cutting. I made two new ones tonight. This time I started with a 1.146 diameter blank, hoping to get 36 teeth to mesh with the 1/2-10 acme screws. My reason for picking that number is because it gives about a 3.6 inch circumference so with a 10 pitch screw I would get 10 degrees of axis motion for one turn of the stepper. It just seemed like an easy ratio to work with.
Anyhow, I'm finding it's a little harder than I thought to get predictable results from the "tap and free-wheeling blank" method. I tried 3 times on the same size blank and got three different tooth counts (37, 38, and 39). The trouble seems to be that the first revolution after the tap touches the blank is what determines the tooth count, and from there you're locked into that count. If there is a little slippage on that first turn the tooth count will be off. Next time I think I'll try and "pre-slash" the blank with the right number of teeth and then do the free-wheel thing with the tap to finish up. I have a CNC rotary indexer for my mill so I'll probably use it to pre-cut the blanks with a tiny end mill or engraving v-bit, though I'm thinking there is probably a simpler way. For now I have two pretty decent looking gears; 37 teeth on the EL and 39 on the AZ. I guess I'll just work out the right numbers to plug into the software for now.
So, Gabriel, how's that software update coming along...? I might be ready to give it a whirl this weekend!
Jim
Title: Re: Mechanical Design
Post by: Gabriel on May 20, 2011, 08:58:53 AM
Yeah it looks like you have about got it finished. That's one very clean build.

I have attached the most recent version of the Arduino program with some slight modifications for your set up. I commented out the shift register code because you said you aren't using them, and I also implemented Bernard's code for the Adafruit motor shield.

I have also given up on trying to get the AccelStepper library to work for the time being. It works well some of the time, but there are other times that it inexplicably causes the program to freeze for no reason that I can see. The only thing I can figure is that maybe it has something to do with memory overflow.

Hopefully the program should work for you bug free on the first try, but, if not, let me know so I can try to fix it. You'll be the first to try this using both wormgears and the Adafruit shield.

Most everything you need should be at the top of the "Jim's Arduino Sun Tracker V9.9" tab. It all should be pretty well explained in the code's comments and in the earlier version of the program's documentation page on this site.

The one major difference from the old version is the way you program in the settings for each machine. It's a lot cleaner now, especially if you are trying to set up multiple machines. It is now set up using an array of arrays. Each line in the array contains the settings for one machine. If more machines are needed, just change the numberOfMachines variable and add the appropriate number of lines.

The code looks like this...

////////////////////////////////////////////////////////////
//START MACHINE SETTINGS
////////////////////////////////////////////////////////////    

 //Put how many machines you want to control here
 #define numberOfMachines 1

 const float MachineSettings[][17] PROGMEM = {
 //Setting #    0      1     2      3     4     5     6     7      8     9    10     11    12    13    14       15    16
                 {  0  ,   2 ,   50 ,  -1 ,   0  ,  0  ,  0  ,  0  ,  -1 ,   50 ,  1 ,   0 ,   0 ,    0 ,    0    ,    -60,   60 },
              //{  1  ,   2 ,   20 ,  -1 ,   20 ,  20 ,  90 ,  1   , -1 ,  20 ,   1  ,  16 ,  11 ,  90 ,  1   ,  -60 , 60 }
              
  };

You'll find comments below this code that specify which setting does what. I think you should be able to figure it out, but, if not, let me know.


Also, under the tab "TargetControl" and below several lines of commented out code that you aren't using, you'll find where you can program the altitude and azimuth for your target.

  MachineTargetAlt[0] = 0;
  MachineTargetAz[0]  = 0;


Let me know how it goes.

Thanks!
Gabriel

Title: Re: Mechanical Design
Post by: Jim McMillan on May 20, 2011, 11:17:18 AM
Thanks for replying back so quick.
I like the way the machine came out in general, but there is still plenty of room for improvement. Next one will have all the the electronics, including limit switches, mounted inside the square tube, which will need to be slightly longer. Should be really clean then! I will also add better shaft bushings and attempt to make the whole thing weather proof.
Thanks for all the work on the code. I'll be digging into it tonight, and hopefully have something to report by tomorrow.
Cheers!
Jim
Title: Re: Mechanical Design
Post by: Jim McMillan on May 20, 2011, 07:02:30 PM
It's alive!
I updated the code with my current location (Tucson, AZ, 32.132, 110.876) and fiddled with some of the machine setup stuff. Still need to do the alignment, but when I powered it up I was pleased to see it find the limit switches and then head off in the right general direction with both axes, then periodically update position west and down as you would expect this time of day. The sun is just going over the hill now, so I think I'll call it a night and celebrate the first baby steps with dinner and some of the local cerveza. Maybe do some studying later tonight if my brain is still working after that...
This is getting exciting!
Jim
Title: Re: Mechanical Design
Post by: Jim McMillan on May 20, 2011, 09:30:22 PM
Well the thing went and parked itself at 2100 local time. So far so good! I'm far to lazy to get up before dawn to see it come alive again, but maybe I'll tie some tin cans to it or something so it lets me know when it wakes up in the morning.
One thing I'll want to change eventually is to put in a Mosfet switch or something to shut off the power to the stepper driver between updates. The motors do waste some power (heat) but my heavy housing makes a good heat-sink and it gets just slightly warm after being on for a couple hours.
Gabriel I believe you mentioned that point as one of the advantages of your basic controller, that it doesn't energize the motors except during stepping. Anyhow, it should be simple to add a few lines of code to switch one of the digital outputs on whenever it needs to move somthing. I may take that on as one of my first forays into Arduino programming. Gotta start learning it eventually!
More tomorrow...
Title: Re: Mechanical Design
Post by: Jim McMillan on May 21, 2011, 10:59:09 AM
The machine woke up around sunrise and started doing it's thing.

Now I need to start getting things aligned.

Just to make sure I've got my reference angles right,  I am assuming the following with respect to the way the mirror is facing:

AZ zero ref = south, east is -, west is + ; EL zero ref = horizon, up is +, down is -). Am I looking at this correctly?

There is little binding problem in the EL gear which I need to resolve, but I'll be running it on the bench most of the day so I can make sure everything is behaving right before setting it up outside.

Jim
Title: Re: Mechanical Design
Post by: Gabriel on May 21, 2011, 11:41:25 AM
Sounds like its going really well! I'm glad that the Adafruit code is working like it should. It's always kind of nerve wracking uploading code that you haven't tested yourself.

It sounds like you have the right idea with the reference angles. There is a forum thread at this link which has some pictures that might be helpful.
http://cerebralmeltdown.com/forum/index.php?topic=289.0 (http://cerebralmeltdown.com/forum/index.php?topic=289.0)

It might just be a typo, but the lat and long you gave (Tucson, AZ, 32.132, 110.876) should have a negative longitude instead of a positive one like this,(Tucson, AZ, 32.132, -110.876).

If you wanted to try and use a MOSFET to turn the power on and off to the stepper motors, you could put the code for doing so inside the machineOn, and machineOff functions. I commented out all of it because it contains the code for the shift registers, but you could easily use it as a template for controlling the MOSFET.

Good Luck!
Gabriel
Title: Re: Mechanical Design
Post by: Jim McMillan on May 21, 2011, 12:39:35 PM
Yes it is going very well. I'm so excited I can hardly stand it.
You're right about the -110. That's what I entered in the program. Just typed it wrong here.
I just checked the sun position against  a NOAA online calculator. It is within about .2 deg in both AZ and EL. I noticed my Arduino clock is off by about a minute which probably accounts for the offset. So far everything seems to be working exactly as it should. I think I'll rig some kind of gun-sight instead of a mirror and run it in the straight sun tracking mode for a while and see how accurate it is before I throw in the additional complication of the heliostat mode.
Thanks for the tip on the "machine on/off" functions.
Cheers!
Jim

Title: Re: Mechanical Design
Post by: Jim McMillan on May 22, 2011, 12:44:42 AM
Just a quick report - the thing tracked through the day as far as I could measure with a digital protractor and compass in the shop. It nailed the sunset within a minute.
Tomorrow she's going outside with the "gunsight" setup. I made a little target where I can mark where the shadow falls throughout the day. From that and a little basic trig I should get a pretty good read on the overall tracking accuracy of the system.
Jim
Title: Re: Mechanical Design
Post by: Gabriel on May 22, 2011, 07:04:56 AM
If you have been able to track the sun so well thus far, then the heliostat tracking should also work well. I've been meaning to thoroughly check the sun tracking in a real life set up, but it sounds like you did that for me.  8)

I would be interested in seeing how consistent the reflected light stays in one place with a system as rigid as yours.

Gabriel
Title: Re: Mechanical Design
Post by: Jim McMillan on May 22, 2011, 02:21:23 PM
Well the angles tracked pretty well yesterday, but it was indoors. Today is the first time it's been outside, and I didn't get started till almost noon. Had a little trouble sorting out the AZ alignment, but I think I have it fairly close now. For some reason the whole compass deviation thing is giving me fits. I understand the concept just fine, but always get myself confused over which way to apply the offset when going from "true" to "mag" and back. Then when I add in the different zero reference that the heliostat uses, and the +/- 90 thing, my brain gets tied in knots. Banging my head on the wall a few times usually helps untangle things.
I'll watch it till sundown and report back. Probably won't get to the heliostat part until next weekend as I still haven't started on the mirror mount.
Jim
Title: Re: Mechanical Design
Post by: Jim McMillan on May 22, 2011, 07:50:57 PM
Looks like I have some more tinkering to do. The tracking got progressively further behind throughout the afternoon, a couple degrees after about 3 hours, but re-homing it brought it back to where it should have been. I didn't notice it yesterday because I was fiddling with the code and it would re-home every time I re-uploaded some changes so it never got very far behind.
I suspect I'm losing some steps on each update cycle. My motors are pretty weak but the Adafruit driver is just about maxed out. There is an option to upgrade the driver with some stronger chips and I can also raise the supply voltage to give the motors a little more "kick".  I'll order the chips tomorrow. Meanwhile I'll play around with slowing down the step speed (currently at 25) to see if that helps at all, but homing is painfully slow already so that's not a great option. Getting that accel/decel driver working might help, but for now I'll pursue the "brute force" approach.
Overall I'd consider this first test run a great success, as it has demonstrated that the software works, at least in the sun tracking mode, and has clearly shown where improvement is needed in the machine.
Jim
Title: Re: Mechanical Design
Post by: Jim McMillan on May 23, 2011, 06:29:06 PM
Well I decided to try and confirm the cause of the position lag with more certainty before beefing up the driver. To that end I wrote a little program that moves one axis in many short increments in one direction, then returns to the start point in one continuous movement. I was thinking that if it was losing steps due to insufficient torque, it would most likely happen at the beginning of each movement, so with multiple small movements you would see an accumulating error. So far there is no apparent error after several dozen cycles.
So... now I'm wondering if it is an accumulation of round-off errors in the code. I read somewhere on this site that there was a round-off error whenever a fractional number of steps was called for. Seems to me that it would be more or less of a problem depending on things like gear ratio and such.
Maybe something else is going on, but that was just a thought.
Any ideas?
Title: Re: Mechanical Design
Post by: Jim McMillan on May 23, 2011, 08:53:58 PM
Some more info...
I was able to make it lose occasional steps by increasing the motor rpm to 40, but it's solid at 25 where I was at yesterday.
Some careful studying of my record from yesterday (I was marking shadow position hourly on my test target) shows about 2 degrees of AZ offset over 3 hours, and a little under 1 on the EL. This was measured by noting shadow positions after a 3 hour run before and after re-homing and then measuring the horizontal and vertical distance between the marks, then doing some trig based on the length of the shadow rod to get the offset angles. It comes out to a loss of about 26 steps per hour in elevation, and about 13 in azimuth. The machine is set to update every 3 minutes, so that's 1.33 and .66 steps per update cycle. Admittedly these are very rough measurements, but maybe there's a clue in there somewhere. If it were caused by the suspected round-off error, I think it would average about 1/2 step per update cycle. There's enough uncertainty in my measurements that it could easily be in that range. Or not... I'm mostly speculating. Will try and get some better measurements.
Jim
Title: Re: Mechanical Design
Post by: Gabriel on May 24, 2011, 05:12:24 AM
When I updated the program, I tried compensating for the round off error by saving the lost steps and then adding them back in during the next cycle. I'll have to double check it this afternoon to make sure I didn't leave something out by accident.

If might help if you could upload your sketch with your settings so that we are both looking at the same thing.

Thanks,
Gabriel
Title: Re: Mechanical Design
Post by: Gabriel on May 24, 2011, 09:29:59 AM
Hey Jim,

I took a close look at the code, and there is indeed a bug with how it compensates for lost steps. I sort of have it fixed I think, but I am still trying to figure out why I'm getting different answers depending on whether I simulate the program to calculate the total number of steps taken after a reset versus the total number of steps during an all day simulation.

Once I get it all worked out I'll upload the fixed version.

Thanks for catching the bug,
Gabriel
Title: Re: Mechanical Design
Post by: Jim McMillan on May 24, 2011, 11:19:12 AM
Here's what I'm running now. I'll try and get some more measurements this week to see how repeatable it is.
I'm in no rush for the update, will be outta town over the long weekend and probably won't be back into it until the following weekend.

Meanwhile I have ordered some chips to beef up my motor driver. The AFStepper function has a "Double" mode that is supposed to produce more torque, but presumably draws more current as well, and I'm already at the limit of the driver chips. I figure a bit more torque can't hurt, especially when I start hanging mirrors on it.

Thanks for looking into the software.

Jim
Title: Re: Mechanical Design
Post by: Gabriel on May 24, 2011, 12:26:23 PM
Here's the program with the bug fix. I merged the more recent version of it with the settings you gave me. It wasn't too terribly difficult to figure it out, and I managed to fix one other small bug while I was at it. There shouldn't be any steps lost at all now when updating the machine's position.

I've been working to get a CNC machine put together so that I can try and cut out some parts for a new and improved heliostat. It will be based largely off of your design. I managed to find a set of 6 mirrors for 20 dollars at Target and bought two of them for a total of 12 mirrors. This will give me just over one square meter.

It should be fun!

Thanks again for letting me know about the bug,
Gabriel
Title: Re: Mechanical Design
Post by: Jim McMillan on May 24, 2011, 02:28:27 PM
Wow that was quick. Thanks. I'll try and give it a good test before I take off for the long weekend. Will let you know how it goes.
What kind of CNC are you building? That's been a hobby of mine for a few years as well. I have a CNC Taig micro mill and their manual lathe, and a couple little Dremel sized router tables that work great for placards and circuit boards and such. Also have been working on a big heavy 4x6 foot machine for a couple years now, but I haven't made much progress on it lately since it's sitting in a shed back home in MN. I work on the road and live in a trailer - one of those "toy hauler" rigs with a 12x8 foot garage/shop in the back. Can't do any real big stuff in there, but I have it pretty well set up for the smaller stuff.
Haven't looked at your CNC stuff on this site since I've been focused on the heliostat, but will check it out.
Sounds like a good deal on the mirrors. I bought a box of 12x12 mirror tiles from Home Depot awhile back. Don't remember what I paid, but it seemed like a good deal at the time. I'll probably just mount one for now while I'm working the bugs out, but once I get the "mark 2" version built I will add more.
Cheers!
Jim
Title: Re: Mechanical Design
Post by: Jim McMillan on May 24, 2011, 08:11:21 PM
Ok, I got in a 2.5 hour run this afternoon. It fell behind maybe a half degree over the first few updates, then it stayed within about a quarter degree for a good 2 hours, at which time I re-homed and it shifted about 3/4 degree back to roughly it's starting point. That's all well within the 1 degree or so of slop of the machine, most of which is backlash in my ho-made gears. Also, it appears the two axes are out of perpendicular, by roughly 1/4 degree. I'll need to be a little more careful building the next one, or else allow for some adjustment in the design. Even so, I think 1 degree overall accuracy should be perfectly usable for a backyard setup.

At any rate, it's hard to be positive based on just a few data points, but it does appear to be tracking considerably better, and it seems to be well within the mechanical limits of this machine. I'll let it run all day tomorrow and report back again.

There is one thing I'm struggling to understand with the AZ alignment. I think I got it right, but please correct me if I'm wrong. When I set it up to do the test I just rotate the whole machine to line up the shadow rod with the sun so there is no shadow. (the shadow rod is a 24 inch dowel mounted perpendicular to what would be the mirror plane) I figured this would be more accurate than a compass, especially if done early or late in the day. Once the sun sets and it goes to the park position, (east, ccw, to the switch then pulled back 4 degrees) it should then be pointing 4 degrees to the right (CW rotation) from my selected AZ switch position (motor setting 15), correct? So, in other words, since I have setting 15 at -94, it should park at -90 (due east -TRUE- in this case). Make sense? Also, I'm assuming you are using -TRUE- headings, not -MAGNETIC- for all calculations. The only time I'd need to convert to MAG is when using a magnetic compass to align things, right?
Jim
Title: Re: Mechanical Design
Post by: Gabriel on May 25, 2011, 04:34:39 AM
If it worked well for 2.5 hours then odds are it should work well all day.

From what you described, it sounds like you understand the concept perfectly fine. What you did with the shadow rod is probably the easiest / best way to do it. And you are correct, magnetic south is never used for any of the calculations.

The CNC I'm building is just the basic x,y,z type made mostly with woodworking in mind. I've sort of just been making it up as I go along using whatever metal parts I can scrounge up. I've built two others in the past, but they didn't really turn out to be very rigid. The one I'm building now has very little play in the y and z axes, but I'm still trying to get the x-axis in order. I think the best thing to do would be to have two leadscrews along the x-axis to keep it nice and square with the y-axis. That's pretty much all I have left to figure out before it's finished.

Gabriel
Title: Re: Mechanical Design
Post by: Jim McMillan on May 25, 2011, 07:24:17 PM
I thought it made sense, but when I would try and confirm with compass readings I would get all confused again. As it turns out my compass was all over the place due to the proximity of my truck and trailer. I can get good readings in some directions but it's up to 20 degrees off in others. Since I was a little unsure about all the variables, these faulty readings threw doubt on everything.
Now that I got that straight, I see these things are much easier to align than I had feared. I used a bubble level for the vertical shaft and EL homing alignment, and the sun shadow in morning or evening for the AZ alignment.
When I get the mirror mounted and go into heliostat mode, I imagine there will be a few more alignment tricks to figure out. How do you obtain the AZ and EL of your target?
I have a digital level I got from Home Depot for $40 that I could use to eyeball the elevation angle, but the AZ is a bit more tricky without reliable compass readings.
Is there a way to slew the machine manually till it points at the target, then read machine position from the serial monitor window? That would really be slick. Even cooler would be a targeting mode where you would just aim the machine with some left-right-up-down buttons, hit a "save" button and that would be your new target. Guess I better get busy learning how to program!

Anyhow, the machine ran all day with a max error of a little over 1 degree. Towards evening I remembered I hadn't re-set the DS1307 clock since I got it a couple months ago. Last I had checked it was a minute or so off. When I re-set it the thing went to almost zero error. Will leave it out and get one more day of tracking in before I bring it back into the shop to add the mirror.

I took these pics a few minutes ago, just before sunset. Check out the shadow at the base of the rod. The rod is 3/8 by 24 inches. Other than updating the clock, I haven't touched a thing since I aligned it yesterday afternoon.

Jim
Title: Re: Mechanical Design
Post by: Jim McMillan on May 25, 2011, 07:29:38 PM
Got an error saying the upload folder is full and the pics won't upload. Guess I'm hogging up too much of your server space!
Sorry.

By the way, on the CNC stuff, have you checked out CNC Zone? Lot's of good info there.
Title: Re: Mechanical Design
Post by: zininzelfdoen on May 26, 2011, 06:32:35 AM
Hi Jim,

This is what we just build (http://zininzelfdoen.files.wordpress.com/2011/05/img_6125.jpg?w=301&h=432). It's not the cheapest design, but it's a start!
Title: Re: Mechanical Design
Post by: Jim McMillan on May 26, 2011, 10:36:21 AM
Nice! I like the way you're linking multiple mirrors on one actuator, that and the t-slot extrusion frame should make for an easily scalable design. Looks like a servomotor drive, how are you doing position feedback, is there an encoder in the actuator assembly?
Jim
Title: Re: Mechanical Design
Post by: Jim McMillan on May 26, 2011, 11:30:16 AM
I deleted a few of my old pics, let's see if this works now.
Title: Re: Mechanical Design
Post by: Gabriel on May 26, 2011, 05:11:22 PM
Awesome two success stories in one day! Were you able to make use of my code zininzelfdoen? I saw more of your pictures at your site. It looks really good.

Your machine's tracking is looking really good Jim. You're making me want to hurry up and build a better one of my own.

The way I set up my heliostat's target altitude and azimuth was to just try some numbers that looked like they were close to where I wanted the light reflected. If it was off by a certain amount, I just kept adjusting the alt and az variables in the program and re-uploading it. I was experimenting with the program so much that I had to keep re uploading it anyway.

If someone had a lot of targets or heliostats (or both) to set up, then this method would be extremely tedious.

I actually had some code for the Arduino where I could press buttons on the keyboard to change the alt and az of the target. It was pretty basic, but it did make it go quicker. I'm not sure what I did with the code though. I think everything you mentioned should actually be possible, and is also all stuff that I've wanted to try and implement.

There is a lot that could be added around the core program I think. For example, targets could be scheduled to change during different times of the day, or they could be controlled by a temperature sensor. I know they have those wireless x-bee modules for the Arduino which could possibly be used to control the targets from a computer located comfortably inside. It might also be possible to use the Arduino to log the amount of solar isolation your location is getting throughout the year, or even for real time measurements on how much energy you're currently getting.

So yeah, there is a lot that could be tried.  ;D

Title: Re: Mechanical Design
Post by: zininzelfdoen on May 27, 2011, 11:36:07 AM
Hi Gabriel (and Jim),

Great to see there is so much activity around the heliostats! In the picture you see we actually don't run any software, we are just testing the mechanical design and we wanted to see what it really does inside a building. Bernard is on a long holiday (in the US) so we don't really get to programming right now, but we will once he is back. My first next plan is to exchange the current actuators with stepper actuators. Maybe simply by replacing the normal DC with a stepper. I will ask Inge, who graduated on this prototype to share her CAD files.

Keep up the good work!
daan
Title: Re: Mechanical Design
Post by: Jim McMillan on May 27, 2011, 12:39:37 PM
Gabriel,
I've got a few other ideas as well. Some of them, such as a manual "target designator" one, could be done as separate sketches for possible incorporation into your main core program, and will be a good way for me to learn some programming skills.
By the way, in the last test my machine ran for 50+ hours with a maximum error of about 1 degree. I think I can improve on that with better mechanical precision in the machine. I'd like to get it down to 1/4 degree or so. There didn't appear to be any accumulating errors like on the first run, just some variation throughout the day, I'm guessing mostly due to uneven spacing of the gear teeth and some non-perpendicularity of the AZ and EL shafts.
Daan, have you looked into using encoders? I think that there are benefits to using that method over steppers, especially in bigger machines.
Jim
Title: Re: Mechanical Design
Post by: Jim McMillan on June 10, 2011, 06:56:03 PM
Just a quick update...
Haven't posted in a couple weeks, and have been too busy to work on the machine. It's been running on the bench in my shop for just about the whole two weeks, and seems to be still doing its thing day after day.
I hope to try the heliostat mode outside this weekend.
Title: Re: Mechanical Design
Post by: Jim McMillan on June 11, 2011, 05:29:32 PM
Finally got a mirror mounted, switched the software to heliostat mode, and set it up outside again a couple hours ago. The target is about 25 feet from the machine and the center of the reflection has been dithering around within about a 4 inch area, which is about 3/4 degree. About what I expected given the basic accuracy of the mechanism as measured previously in the straight tracking mode.  I'll let it run all weekend and report back.
Jim
Title: Re: Mechanical Design
Post by: Jim McMillan on June 12, 2011, 07:03:21 PM
Heliostat test, day 2. It drifted off about 2 degrees by this evening. I'm pretty sure it is mostly mechanical alignment since I did it kind of quickly and while the sun was pretty high yesterday. I put it back in sun tracking mode and did the "shadow alignment" this evening, then reloaded the heliostat sketch and re-marked my target position before sunset. Will let it run and see what it looks like tomorrow.

Say Gabriel, how can I speed up the update rate? I found the code where you can switch between 3 and 5 min. I tried changing the 3's to 1's in that line but it seemed to lose time or something after that. The update rate did change to one minute, but it would stop tracking before it got to the horizon at the end of the day. It was running in the shop so I don't know how it affected the tracking throughout the day, but every evening I would find it stopped about ten degrees above the horizon (more or less, I didn't measure it). When I changed the 1's back to 3's it went all the way down to the horizon again at the end of the day. This was in sun-tracking mode.

Jim
Title: Re: Mechanical Design
Post by: Gabriel on June 13, 2011, 04:59:12 AM
Hey Jim,

I think what you did should have worked. I can't think of anything in that code that would cause that kind of behavior. My only guess is that it has something to do with the comparison between two floating point numbers. Because of how they are represented in binary form, two numbers which look like they should be equal are not in binary form.

I should probably change that code to use > statements or something at some point.

Anyway, you  can switch to minute updates by commenting out the if statement entirely instead of just changing the 3 to a 1. I've done that before and never had the problem you described.

Sometime I will have to make is so that you can use even shorter increments of time by adding seconds into the mix. I didn't do it before because the program previously didn't compensate for fractional steps, but now that it does I'll have to try it out and see how it does.


Good Luck,
Gabriel
Title: Re: Mechanical Design
Post by: Jim McMillan on June 13, 2011, 06:57:22 PM
Come to think of it, when I reverted back to the 3 minute setup I didn't actually change them back to 3s and re-install, but simply re-loaded the previously saved 3 minute version. Something else I fiddled with may have been causing the trouble. Will try it again next time I update something.
Well it made it through another day with pretty good tracking, though the target shifted about minus 2 degrees in azimuth and about one degree up in elevation between noon and sunset, but did wind up right where it was yesterday at sunset. Haven't been able to see it in the morning since my trailer is in the way. I know the AZ changes real fast around noon. That, combined with a little miss-alignment may be all that is causing it. It's pretty amazing it works as well as it does given all the ways I could have screwed up. Hopefully the next machine will have tighter tolerances. I think it just comes down to minimizing variables in the mechanical design, construction, and alignment.
I've gotta say, Gabriel, you've accomplished something incredible here with this program. My hat is off to you.
Jim
Title: Re: Mechanical Design
Post by: Gabriel on June 14, 2011, 06:10:03 PM
Thanks! I'm really glad the program is working out for you. Your help getting all the bugs worked out has been awesome, so thanks for that as well.

Gabriel
Title: Re: Mechanical Design
Post by: Jim McMillan on June 17, 2011, 06:37:46 PM
Well, there's good news and bad news...
I've had the machine running in heliostat mode all week and it tracked reasonably well (+/- 2 deg) for the first few days.
Then yesterday I noticed the reflection had moved west and down for a total of about 6 degrees offset from the original starting position. I tried re-aligning the machine thinking something had got bumped out of alignment but the offset remained. It shows up in both heliostat and suntrack mode to a similar degree. I checked the clock time, it was about 25 sec fast but I don't think that's enough to account for that much error. I used one of the online sun position calculators and checked it against what the Arduino was reporting. It showed about 5 degrees difference in elevation and 3 degrees in azimuth. I think there is something funny going on with the sun position math.
I'll try the new software this weekend and report back.
Jim

PS. I've attached a zip file with my sketches in it. The "...Tucson_hel" and "...Tucson_trk" are the files I'm using currently for heliostat and suntrack modes.
Title: Re: Mechanical Design
Post by: Gabriel on June 18, 2011, 09:49:40 AM
I found the bug, and I think I have it fixed. I updated and attached the programs you sent me. Try them and see if they work again.

The problem wasn't really with the calculations. For the newest version of the program, I moved the table into flash using the Program Memory library. The new table was working when I did the main testing on it, but I guess it decided to start spitting out incorrect values when I re-wrote other parts of the program.

The values were correct for May when you were doing your initial testing but have been drifting further and further off ever since.

Anyway, I fixed it by using a different Arduino library called Flash which is quite a bit less confusing to use and is also supposed to be less buggy then the Program Memory library.

You will need to download and install the library for the updated programs to work.

http://arduiniana.org/libraries/Flash/ (http://arduiniana.org/libraries/Flash/)

With it getting hotter in the summer months, I've left my own heliostat off until I can find something useful to do with the excess heat energy.

Thanks for catching the bug and let me know if you find anything else wrong.
Gabriel





Title: Re: Mechanical Design
Post by: Jim McMillan on June 19, 2011, 07:05:06 PM
Thanks for the updated files Gabriel. I re-did the alignment yesterday evening and it has been running since. I didn't get a read on it in the morning, but early this afternoon it was pointing about 2 degrees low. Now it's back to almost exactly at the same spot as it was when I set it up 24 hours ago.  I still don't trust the mechanism or alignment to be any better than about +/- 1 degree, so for now I'm calling it good. I'll let it run all week again and let you know if I see anything outside that 2 degree window.
I'm going to be a bit preoccupied with work for a while, but hopefully in the next few weeks I can get a couple new, tighter-tolerance machines built and also set up a better test range so I can give you some more comprehensive test results. Meanwhile I'll just let it run and see what happens!
Cheers,
Jim
Title: Re: Mechanical Design
Post by: zininzelfdoen on June 21, 2011, 05:00:55 AM
Gabriel,
I've got a few other ideas as well. Some of them, such as a manual "target designator" one, could be done as separate sketches for possible incorporation into your main core program, and will be a good way for me to learn some programming skills.
By the way, in the last test my machine ran for 50+ hours with a maximum error of about 1 degree. I think I can improve on that with better mechanical precision in the machine. I'd like to get it down to 1/4 degree or so. There didn't appear to be any accumulating errors like on the first run, just some variation throughout the day, I'm guessing mostly due to uneven spacing of the gear teeth and some non-perpendicularity of the AZ and EL shafts.
Daan, have you looked into using encoders? I think that there are benefits to using that method over steppers, especially in bigger machines.
Jim

Hi Jim, sorry for the very late reply.
I have considered encoders yes. The thing is though that in the actuators we use (superjack, miracle-moon) there is supposedly a Hall-sensor that provides feedback. So we want to use this instead of any other encoder. We haven't figured out how it works exactely though. We will, especially if you guys make the software-jump to DC.
At this point I don't have any time to work on the project regrettably. But the good news is, I will make an assignment for students again so they can work on the project. I will ask them to do so in co-operation with this forum. Of course students have to pick the project, but as they will, form september they will join this forum. They will mostly work on hardware  since they are industrial designers. Goog luck till then!
Title: Re: Mechanical Design
Post by: Jim McMillan on June 26, 2011, 11:11:04 PM
Thanks Zin.

I'll be following your servomotor progress, but for now I'm sticking to steppers. They are simple and predictable and they seem to be working for me.

A quick update, my machine ran consistently all week. I don't get sun until late morning, but it starts about 2 degrees low and rises to the point where I calibrated it late in the afternoon. This pattern was very consistent from day to day. I'm still thinking the shift is mostly due to mis-alignment of my AZ and EL axes. I have one of those little round bubble levels on top of the machine and it shows a degree or so of tilt as the machine rotates through 90 degrees.

I'm heading up to Minnesota for July 4th week, and will bring the machine along and try and do some testing there.

Jim
Title: Re: Mechanical Design
Post by: Gabriel on July 04, 2011, 05:22:21 PM
Hey Jim,

Here is a bug fix for the bug fix I just fixed. :) This one wouldn't have occurred until the winter months, so what you are using now should be OK for the moment. I also added a more robust calculation of the sun's declination which improves the output of the sun's position somewhat.

I had been dreading it, but I finally sat down and figured out how to make my Arduino talk to my computer through the USB port. This means that I have been able to do decent error checking of the Arduino algorithm's output for the thousands of possible date and time combinations.

I pasted the results below this post. It gives the maximum absolute error and average absolute error for each month. You can see that the output is OK-ish, but not great. It stays within a degree, but overall I would like it to be a lot better. This is likely part of the tracking error you're getting on your end.

There has been a new addition to the Arduino world in just the last few months. The chipKIT Uno32 is a 32-bit processor which means that it is way better at math than the 8-bit ATMEGA based Arduino. It also has double the outputs while still being the same price as the regular Arduino.

I have been waiting for something like this for a while now and have already bought one. Hopefully it should make my life a lot easier. It should also mean that the Open Source Sun Tracking / Heliostat project will be a lot more robust.

http://www.digilentinc.com/Products/Detail.cfm?NavPath=2,892,893&Prod=CHIPKIT-UNO32 (http://www.digilentinc.com/Products/Detail.cfm?NavPath=2,892,893&Prod=CHIPKIT-UNO32)

%Jan       max      ave
%alt     0.2856   0.1908
%az      0.2572   0.2305

%Feb       max      ave
%alt     0.7918   0.6667
%az      0.5776   0.5721

%March     max      ave
%alt     0.4520   0.4425
%az      0.5322   0.5216

%April     max      ave
%alt     0.4522   0.4354
%az      0.4988   0.4509

%May       max      ave
%alt     0.4025   0.3270
%az      0.3766   0.2809

%June      max      ave
%alt     0.2086   0.1395
%az      0.3187   0.2990

%July      max      ave
%alt     0.3421   0.2192
%az      0.3182   0.2900

%August    max      ave
%alt     0.5532   0.4332
%az      0.4630   0.3578

%Sept      max      ave
%alt     0.6199   0.4474
%az      0.6028   0.4324

%Oct      max      ave
%alt     0.6117   0.5467
%az      0.3871   0.3136

%Nov      max      ave
%alt     0.4214   0.6261
%az      0.2863   0.4616

%Dec      max      ave
%alt     0.2773   0.2208
%az      0.6777   0.6181
Title: Re: Mechanical Design
Post by: Jim McMillan on July 09, 2011, 11:29:00 PM
Hi Gabriel,
It's nice to hear you're still actively pursuing upgrades and improvements to the software and electronics.
I am on my way back to AZ from my vacation in MN and will get busy with my "mark 2" machine design when I get settled in. Hopefully this one will have a bit more mechanical accuracy and also will be more weather proof so I can leave it set up all the time.
Cheers,
Jim
Title: Re: Mechanical Design
Post by: Jim McMillan on August 14, 2011, 10:14:46 PM
Finally back to making parts for the new design. It's pretty similar to the first one, but I'm trying to tighten up the tolerances a bit. It will also be a little smaller. I was going to put the electronics inside the gearbox to make it a cleaner looking package, but then decided instead to shrink the gearbox and then mount the electronics in a separate, water-tight enclosure. That way I'm free to experiment with the electronics without having to worry if it will fit in the gearbox, and there is less concern over making the gearbox water-tight.
The pinion gears turned out much better this time. I can do a little write-up of the fabrication process if anyone is interested. Next trick is to try and do a better job of aligning the shaft holes in the housings so the shafts stay perpendicular when assembled. I think that was the biggest source of alignment error on the first one.
Jim

Gabriel, I tried uploading some pics, but it says "upload folder is full" or something like that. I ran into that before and had to go delete some of my old pic to make room for new ones. Is there any chance that upload allowance can be increased?
Title: Re: Mechanical Design
Post by: Gabriel on August 16, 2011, 12:29:44 PM
Hi Jim,

Awesome, I can't wait to see it up and running. It has been fairly quiet on my end lately as far heliostats are concerned. I have made some improvements, but just haven't had the time to post them. Maybe I'll hurry up and do it now before I run out of summer break.

If you wanted to write something to document what you did, that would be great. I could use the advice.  :) Theoretically, I could even give you your own username and password and you can post the documentation directly to the homepage of this site. It might be a little easier to post it there than here on the forums just because the Wordpress software is somewhat more flexible. It's up to you though. Mostly I am just curious to see how well that would work.

Also, I increased the upload limit to 50 megabytes, which is about 5 times what it was before. This forum is fairly small, so raising the limit isn't a big deal, but I may have to start recommending that people start using a separate file hosting site like imageshack.us if too many members start posting large files. Basically it just makes it really tedious to back everything up.

Take Care,
Gabriel
Title: Re: Mechanical Design
Post by: Jim McMillan on August 17, 2011, 12:17:08 AM
Cool. I'm not sure how I would go about posting directly on your site. You'd need to walk me through it I suppose. If you want to try it I'm game.

Anyhow, here are some pics of making the gears. I have a little Taig lathe and CNC mill that work great for this kind of stuff.
The key steps are as follows:
1. Figure out tooth pitch (determined by your worm screw selection) and number of teeth to give you're desired reduction ratio. From this you can calculate the diameter for the gear blank. Not super critical with this method as you'll see once you start cutting.
2. Prepare the blank. I turned them on the lathe to the diameter from step one and bored the inside for a close slip-fit on my 5/8 inch shafts.
3. "Pre-slash" the correct number of teeth around the perimeter of the blank. The "slashes" don't need to be any particular shape or size. The idea is that you need to start out with the right number of teeth so the tap has something to key into. You can skip this step but then the end result will be somewhat unpredictable as to the final number of teeth. More on this below.
4. Mount the blank in a free-spinning fixture of some sort. I used the headstock off my lathe and mounted it on my mill table.
5. Slowly bring a spinning tap up against the blank. Once the tap engages with the blank, the blank will start to spin. Continue advancing the tap into the blank until the teeth are of the desired depth. This is not super critical either as long as you have a way to adjust the shaft spacing in the final assembly.
6. Cross drill and tap for set-screws and you're done.

It's really almost simpler to do than to describe in words. Hopefully the pics will give you the idea. Probably the hardest part will be sizing and truing up the blanks and coming up with a holding fixture if you don't have access to machine tools, but I'm sure this can be overcome with some old fashioned Yankee ingenuity, if you'll pardon the expression :-)
A couple other things: The tap obviously has to match the screw you plan to use. I had a bunch of 1/2-10 ACME screws in my junk box so I bought a tap to match. Any old sawed-off bolt or threaded rod should work as long as you have a tap to match and can couple it up to your motor and provide side support. I selected my ratio of 36 to 1 just because it makes the math easy. I get ten degrees of mirror movement for each turn of the motor. Another thing on taps, I read somewhere that spiral taps work better than straight ones, so that's what I bought. I'm sure a common hardware store straight one could be used as well.
Next project is to finish the worm gears. I'll try and document that process as I go along.
Cheers,
Jim
Title: Re: Mechanical Design
Post by: Gabriel on August 17, 2011, 12:00:08 PM
Looks good so far. Are you making two of them? One of these days I really need to invest in some decent metal working tools. :)
Title: Re: Mechanical Design
Post by: Jim McMillan on August 20, 2011, 06:22:05 PM
Thanks Gabriel.
Yes, I figured I'd make two this time. I have enough confidence in the basic design that I figured I may as well dive right in. Besides most of the build time is spent setting up the tooling for each operation, so once it's set up it seems a shame to make only one part.
If you're thinking about small metalworking tools take a look at Taigtools.com. You can buy their mills with a "CNC Ready" option and install your own steppers and controller. That's what I did. I like my little Taig lathe too, but it's purely manual. I know of some folks who have converted them to CNC, and it looks like it would be pretty straight-forward. Cartertools.com is a Taig dealer and has a wonderful website. Check out all the user links. Some of them will blow your mind.
Sherline also makes a really nice line of small tools, though their mills are a little light for my kind of use. One of their CNC-ready lathes with the optional milling column makes a sweet portable CNC kit that could be carried in a suitcase or small trunk.
Then of course there are the Chinese imports...
Cheers,
Jim
Title: Re: Mechanical Design
Post by: Jim McMillan on September 05, 2011, 04:15:05 PM
Just a quick update on my number 2 machine build project:
I'm just about done with two of them.  Just need to add the limit switches, mount the machine to a base, and mount the mirror(s)... then of course the electronics...
I ran it last night connected to my Gecko 540 drive that runs one of my desktop CNC machines. Still tweaking on some minor binding and backlash issues (trying to find a happy medium between the two), but I think it's going to work out ok. This has been a real test of my amateur machining skills but I'm learning a lot, and I have a new-found admiration for folks who build precision mechanisms!
I tried to do a better job of documenting the build process this time, and am working on a build log with pics and comments which I will post when it's finished instead of trying to do it piecemeal in this forum. Stay tuned.
I have attached a couple pics of an almost finished machine.
Cheers!
Jim
Title: Re: Mechanical Design
Post by: Jim McMillan on September 12, 2011, 12:01:38 AM
Follow the link below for a short video of the thing in action. I thought it would be fun to see how fast I could make it go, and also to help "wear-in" the gears and bushings. I tried to make all the clearances real tight to minimize slop, so it needed a little limbering up. It was running off my Gecko 540 CNC controller in the video.
Cheers,
Jim

pic 002.avi (http://www.youtube.com/watch?v=-ehrcqhQOjk#)
Title: Re: Mechanical Design
Post by: iamtawon on October 25, 2011, 03:20:56 AM
Hi Jim how is it going with your 2nd heliostat, I have been reading this thread for a while and your machine look very clean and robust, so envy  :P
Title: Re: Mechanical Design
Post by: Gabriel on October 29, 2011, 08:38:59 AM
Hi iamtawon,

I attached a couple of pictures of Jim's heliostat to this post. He sent me his first one so that I could work out any possible bugs in the software.

It's been up and running for over a month now without any trouble at all. There hasn't been as much sun as I would like, but every time it does come out the reflected light is always in the same spot.  ;D

Gabriel
Title: Re: Mechanical Design
Post by: Jim McMillan on October 30, 2011, 05:47:05 PM
Hi Guys,
Sorry I haven't posted any updates for a while. I've been real busy with work and other projects. Still haven't got the other machine set up.
Thanks for the compliment iamtawon. I'm fairly pleased with how they came out given my amateur level of machining skills. I also learned a few tricks along the way that should help out on the next one. I still plan on posting a write-up of the build process when I get time.
Gabriel, thanks for posting the pics. It's nice to know it's still working fine! Mine is still just sitting on the bench. I bought a little water tight box for the electronics and another Arduino Uno, but still haven't decided on the stepper drivers.
Jim
Title: Re: Mechanical Design
Post by: solardude on August 28, 2015, 01:51:44 PM
I just found this website and have been playing around with a Arduino based solar tracking program on and off for about  a year now.

I have a motor setup that I was working on that is small and compact just like Jim's except it was using motors with a worm gear drive to hold position.

I'm just curious how stable Gabriel has the code working now with Jim's tiny motor setup?

I'm looking at building out a low cost commercial version of this to go along with some portable solar generator systems we build and sell all over the world.

Keep up the good work guys!
Title: Re: Mechanical Design
Post by: Gabriel on September 02, 2015, 07:35:38 AM
This project is years old now, and the machine itself hasn't been up and running for a long time. I do remember I had it working for several months though. There was a bit of a problem with drift, but I figured out that it was because of the worm gears slipping or something at the more extreme azimuth angles.

What worm gear drive are you using by the way?