Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Gabriel

Pages: [1] 2 3 ... 42
Hi luiklodwig,

Those openmv microcontrollers look really cool! This isn't something I've tried before, so I'm not sure what's the best way to do this, but I think you might have to see if anyone has any example code for finding how "bright" the individual pixels are and then moving the motors according to that pixel's location in relation to the center. It's just a thought, but overall you're probably going to have to rely on whatever someone else has already started if you don't want to spend your whole life coding. :)

I think that you could get by without much math really if you can find a library to get you started.

Let us know how it goes.


Sun Tracking / Heliostat Program Discussion Board / Re: heliostat
« on: September 23, 2016, 05:06:52 AM »
I'm not sure why it's not showing up. Sometimes you have to click the file in the folder directly. I guess I could have just posted the code in the first place though. :)

The code basically just turns the sun and target's altitude and azimuth into a vector, calculates the half way point between them, and then turns the resulting vector back into altitude and azimuth measurements.

Code: [Select]
//This code calculates the angles for the heliostat (returnaltaz = 1 will return alt, 2 returns az)
void FindHeliostatAltAndAz(float SunsAltitude, float SunsAzimuth, float targetalt, float targetaz, float &machinealt, float &machineaz){

  float x,y,z,z1,z2,x1,x2,y1,y2,hyp,dist;
  z1 = sin(to_rad(SunsAltitude));
  hyp = cos(to_rad(SunsAltitude));
  x1 = hyp*cos(to_rad(SunsAzimuth*-1));
  y1 = hyp*sin(to_rad(SunsAzimuth*-1));

  z2 = sin(to_rad(targetalt));
  hyp = cos(to_rad(targetalt));
  x2 = hyp*cos(to_rad(targetaz*-1));
  y2 = hyp*sin(to_rad(targetaz*-1)); 
  if ((dist>-0.0001) && (dist <0.0001)){



Hi Boerekos,

I remember you posted a while back. :) Things have been a bit quiet on my end as I haven't had a lot of spare time recently, but have had the chance recently to work on some things.

I have been working on a design that can be printed with a 3D printer. It seems to be going alright, but I still have a ways to go. Plastic is OK for prototyping and playing around, but once I get the design down I think I'll try to make it out of metal. There is actually a place near me that has a laser cutter that I might try getting parts made at.

1) I have played around with a GPS as someone requested the feature for one of their projects. They basically bought me a GPS and I figured out the code. The fact that they keep track of time is definitely an advantage. It's not actually that hard to add as there is example code, but I haven't done anything official yet.

2) Like you mentioned, I'm not aware of an electronic compass that is especially accurate, probably more so with the cheap ones. I actually align mine the same way.

3) I haven't done much for wind protection aside from having a mode where it parks horizontal. There is no automation there. It would be worth adding, but I wonder what it would take to build one that is sturdy enough to hold up to very high winds.

I have built (attempted mostly) heliostats where I was able to focus the reflected light by angling the mirrors. I think I've pretty much decided that it is less work, and possibly even less money, to just rip a hole in the wall and put in a bigger window than it is to try and build a single heliostat that has mirrors that are adjustable. 

I think I'm going to focus on smaller sized heliostats for that reason. :)

Sun Tracking / Heliostat Program Discussion Board / Re: heliostat
« on: August 23, 2016, 05:11:51 PM »
Hi Marie,

I'm not sure if I understand what you are asking, but I don't think the calculations are really posted anywhere on the site. They are in the program though, so you might be able to work them out from the programming syntax.

If you go to the "Functions" tab in the Arduino IDE and then find the "FindHeliostatAltAndAz" function, you will find where the calculations are for calculating the heliostat coordinates. It basically inputs the sun's altitude and azimuth and the desired target altitude and azimuth and outputs the altitude and azimuth direction for the heliostat.

Is that what you are looking for?

Hi Reptile,

Yes you should be able to load the sketch without the shield no problem. There Arduino really has no way to know the difference if it is attached or not. Are you having trouble uploading?


Heliostat Projects / Re: stagged spiral heliostat field arrays
« on: May 15, 2016, 05:48:37 PM »
Hi Jim,

I remember someone sent me an article on this a good while back, but it never had the math with it. It seems like it should be published somewhere, but I don't know where. It might be on one of those research sites where you have to pay for the article or something similar.

It would definitely be nice to have the math on hand though.

This is an old program they I had started working on which (among other things) lets you generate an array of heliostats and calculates how much energy they will collect based on real world solar radiation data. I actually wanted to do what you mentioned with this program, but never really needed it for my purposes so it never got done.

This program could sort of be used to check if one array is more efficient then the other, but the problem with it is that it doesn't take into account when one heliostat shades another.

Generating the "sunflower" shape might not be that bad, but checking to see if it is actually better than other shapes is no easy task. It would be worth doing though I think. Maybe someone out there already knows of something that would help with this?

Take Care and welcome to the forums!

Hi Emmpunkt,

I will definitely have to put synchronized motion up a lot higher on the list based on what you have mentioned.

I am used to dealing with small machines which only take less than a minute to move into position, but I know the larger ones can take much longer to do it.

Finding time to actually work on these things has been a big challenge lately, but I think that you should be able to hack the program pretty easily to do what you want.

We can cheat a little bit and reuse the joystick control code which already kind of synchronizes the motors. There won't be any acceleration, and the motors won't necessarily reach the end of their individual movements at the same time, but they won't be taking turns either.

If you open up the program and look at the very top of the functions tab, you will see what code to replace.

Replace this...
Code: [Select]

  if (AccelYesOrNo==1){//This code runs during normal operation
  moveMotorWithAccel(azsteps, azimuthStepPin, azimuthDirPin, azSpeed, azAccel);
  moveMotorWithAccel(altsteps, altitudeStepPin, altitudeDirPin, altSpeed, altAccel);

with this...

Code: [Select]

  if (AccelYesOrNo==1){//This code runs during normal operation
    if (digitalRead(WindProtectionSwitch)==HIGH){
      joystickMoveMotors( altsteps, altitudeStepPin, altitudeDirPin, altManualSpeed, azsteps, azimuthStepPin, azimuthDirPin, azManualSpeed  );
      moveMotorWithAccel(azsteps, azimuthStepPin, azimuthDirPin, azSpeed, azAccel);
      moveMotorWithAccel(altsteps, altitudeStepPin, altitudeDirPin, altSpeed, altAccel);

Note that I haven't actually tested this code, so let me know if you have any issues.

Hopefully it will tie you over until I have time to do some real work on the program. Maybe not this year, but hopefully the next. :)


Hello again,

Sorry about the delayed reply. I meant to look into this over the weekend, but I ended up spending the weekend putting together a 3D printer kit actually. I sort of lost track of time ha ha.

After looking into it I am now remembering that I never really got that far into the PC side of the program. I'm thinking that it might be better to just start the whole thing from scratch. Technically, I do have some code at this link,, but there is so much there that it is hard to pull out only what you need.

The above is also in Visual C#, but I think it would be easier to start over in Processing because it is a whole lot easier to use.

It looks like I don't have much in the way of example code, but this link should get you started.
It's a little confusing at first, but once you get some example code up and running it's not too bad.

Hope that helps and sorry again about the delayed reply.



That definitely looks cool! I would be interesting in finding out about how accurately the chip is able to position the machine.

It has been awhile since I have tried to program for the XBees, but I remember that it was fairly easy to do. Honestly, it is pretty much plug and play if you have the Series 1 XBees I think.

If you are at all familiar with sending and receiving commands through the Serial Monitor, then, well, that's all you are really doing.

The code I use to control machines through the heliostat is this.

Code: [Select]

//This function returns a float number typed into the serial monitor
  float getFloatFromSerialMonitor(){
  //char inData[20];
  float f=0;   
  int x=0; 
  while (x<1){ 
  String str;   
  // when characters arrive over the serial port...
  if (Serial.available()) {
    // wait a bit for the entire message to arrive
    int i=0;
    // read all the available characters
    while (Serial.available() > 0) {
     char  inByte =;
    f = atof(inData);
    memset(inData, 0, sizeof(inData)); 
  if (digitalRead(manualModeOnOffPin)==LOW){x=2;}
  }//END WHILE X<1 
   return f;
void ManualControlThroughSerial(){
  float newAlt,newAz, newTargetAlt, newTargetAz;
  //if ((digitalRead(PinToMoveAltInPositiveDir)!=HIGH)&&(digitalRead(PinToMoveAltInNegativeDir)!=HIGH)
   int machineNumberInput;
   if (numberOfMachines>1){
   Serial.println("Manual Mode Active:");
   Serial.println("Type Machine Number:");   
   machineNumberInput = (int)getFloatFromSerialMonitor(); 
   if (float(pgm_read_float(&MachineSettings[machineNumber][1]))==1 || digitalRead(HeliostatToSun)==HIGH){//MANUAL CONTROL OF SUN TRACKER
   Serial.println("Machine's Current Altitude:");   
   Serial.println("Machine's Current Azimuth:");     
   Serial.println("Input Altitude:");
   newAlt = getFloatFromSerialMonitor();
   Serial.println("Input Azimuth:");   
   newAz = getFloatFromSerialMonitor();

   Serial.println("Begin Move? Yes=1, No=0");
   int yesOrNo = getFloatFromSerialMonitor();
   if (yesOrNo==1){SunsAltitude=newAlt; SunsAzimuth=newAz;}
   else{//Manual Control Of Heliostat Targets
   Serial.println("Target's Current Alt:");   
   Serial.println("Target's Current Az:");     
   Serial.println("Input Target's New Alt:");
   newTargetAlt = getFloatFromSerialMonitor();
   Serial.println("Input Target's New Az:");   
   newTargetAz = getFloatFromSerialMonitor();
   Serial.println("Begin Move? Yes=1, No=0");
   int yesOrNo = getFloatFromSerialMonitor();
   if (yesOrNo==1){MachineTargetAlt[machineNumberInput] = newTargetAlt; MachineTargetAz[machineNumberInput] = newTargetAz; targetsUsed = targetsUsed+1;}

The interesting function is the getFloatFromSerialMonitor.

That would be the Arduino part of the program, but you would also basically need another program on the device that actually controls the heliostats that sends the Serial data. I may have some example code somewhere, but I don't know if it is in a language that would be useful to you.

I think that should at least get you started though.


Hi Soufiane,

I think what you are looking for is the stuff near the top at this link. Correct?

Take Care,

Hi Ole,

I don't remember off the top of my head exactly how much power the system uses, but the driver board puts the stepper motors to sleep when they aren't moving, so they won't consume anything in that case. It's probably on the forum here somewhere, but I used a kilowatt meter to measure the power used over a period of time, and I think it worked out to be less than a dollars worth of electricity for the entire year.

Take Care,

Heliostat Projects / Re: DIY Worm Gear Based Heliostat Design
« on: January 24, 2016, 06:17:49 AM »
Hi Abhijit,

I don't have a pdf for this heliostat, but if you go to the first post you will see that there is a Sketchup file that you can download. Sketchup is a free (for individuals) CAD program that you can download and view or modify the design file. I have sort of abandoned this design and am trying to build more out of metal this time around, but it would definitely be cool to see someone finish it.

Hope that helps,

Hi soufiane,

I don't think I had much in the way of references for this program aside from the ones shared in the first post. The programming behind it is all relatively basic math stuff, so it was all basically done from scratch.

Is that what you are looking for?


Hi jrpixley,

Sorry about the delayed reply. I have had a very busy week.

It looks like you have the right idea so far.

Basically this code...

     digitalWrite(stepPin, HIGH);
     digitalWrite(stepPin, LOW);

Just tells a motor to move one step towards the limit switch, so you need to replace it with the motor shield code that moves a stepper motor one step. The tricky-ish part though is that you need to specify which motor need to do the moving. So you could so something like this...

if (stepPin == azimuthStepPin){ //code to move azimuth motor one step
if (stepPin == altitudeStepPin){ //code to move altitude motor one step

I don't know if you have modified the motor code that is already present, but if not I think this should work without any other modifications.

Let me know if you need more clarifications.

My busy week isn't finished yet so I don't have much time for this post Ha ha

Pages: [1] 2 3 ... 42