Author Topic: heliostat doesn't move  (Read 250 times)

luiklodwig

  • New Member
  • *
  • Posts: 12
    • View Profile
heliostat doesn't move
« on: December 07, 2017, 08:47:28 AM »
Hi,

I build an gear worm based heliostat with a 25cm mirror, and I would love to get it to work with the open sun harvester programme, but as I dont live in the us, i did not order the shield yet...

Right now I'm trying to get it to work with an arduino mega 2560, 2 0.4A Nema 17 Steppers, 2x Easy Drivers, DS1307 Clock, Joystick and 2 Limit switches. I did not attach the manual switches, buttons and the pot yet..

When I start the programme and power the motors on, they shake for a second but then nothing happens.. This happens in Heliostat and Sun tracking mode. I got the motors to move using a test programme which doesn't use a stepper library.I am not sure if this might have something to do with the stepper settings in the programme or if i am missing something else... When I open the serial monitor I either get "Resetting..." or it asks me for altitude and azimuth and when I enter something, it is always out of the limits (and nothing happens)

Any help would be really appreciated ! Thank you :)


Gabriel

  • Administrator
  • Hero Member
  • *****
  • Posts: 656
    • View Profile
Re: heliostat doesn't move
« Reply #1 on: December 07, 2017, 03:09:55 PM »
Hi luiklodwig,

It sounds like it should work. What code did you use to test the stepper motors? When you first reset the Arduino it should start moving the Azimuth stepper motor. You say that the motors "shake for a second". Do they stay powered on in that you can't easily move them by hand, or do they just turn right back off again.

It might be this setting "enableHIGHorLOW". I think by default it should be OK, but maybe it was changed at some point?

Let me know how it goes.

Thanks!
Gabriel


luiklodwig

  • New Member
  • *
  • Posts: 12
    • View Profile
Re: heliostat doesn't move
« Reply #2 on: December 07, 2017, 04:10:57 PM »
Gabriel! Thanks for the reply and for the great work you have been doing.

Actually (i tried it again) the azimuth "shakes" for a second, then the alt motor starts moving but doesn't stop even if it hits the limit switch

I am using V098 of the program and testet them  (and the gear ratio) using this:

void setup()
{
  Serial.begin(9600);
  pinMode(6,OUTPUT); // Enable
  pinMode(2,OUTPUT); // Step
  pinMode(3,OUTPUT); // Dir
  digitalWrite(6,LOW); // Set Enable low
}

void loop()
{
  for (int y = 0; y < 55; y++) {
    digitalWrite(6,LOW); // Set Enable low
    digitalWrite(3,HIGH); // Set Dir high
    Serial.println("Loop 200 steps (1 rev)");
    for(int x = 0; x < 1600; x++) // Loop 200 times
    {
      digitalWrite(2,HIGH); // Output high
      delay(1); // Wait
      digitalWrite(2,LOW); // Output low
      delay(1); // Wait
    }
    Serial.println("Pause");
    delay(1);
   
  }

 
  delay(5000);
 
 
 
}

Edit: Is it possible that all this comes from my eventual miswiring of the limit switches? I attached them to one pin (8 ) using a 10k resistor between 5V and PIN, the other two wires go to  GND
« Last Edit: December 08, 2017, 05:46:30 PM by luiklodwig »

Gabriel

  • Administrator
  • Hero Member
  • *****
  • Posts: 656
    • View Profile
Re: heliostat doesn't move
« Reply #3 on: December 09, 2017, 08:08:51 AM »
Hi luiklodwig,

I am a bit puzzled about this one. It's been awhile since I've looked at the program's code, but from what you sent it looks like you have the right idea.

You can rule out the limit switches by disconnecting them. In that case the azimuth motor should just keep turning for a very long time before it reverses direction and then switches to the altitude.

When a stepper motor just "shakes" sometimes it means that the program is set to try and turn it too fast.

It may also be that it is too under powered to turn. There is a potentiometer on most driver boards where you can increase the current to the stepper motor.

You might also try switching driver boards and see if that fixes it. It could be that the azimuth board is bad. Just make sure you don't rewire the boards when they are plugged in as that will probably ruin them.

Once you get the motors moving, then see if you can get the limit switches working.

You probably already have seen this link, but here is a diagram of the circuit if you want to clarify how to wire the limit switches.
http://www.cerebralmeltdown.com/wp-content/uploads//2012/07/SunTrackerCircuit3_bb.pdf

Hope that helps!
Gabriel

luiklodwig

  • New Member
  • *
  • Posts: 12
    • View Profile
Re: heliostat doesn't move
« Reply #4 on: December 10, 2017, 11:21:37 AM »
Gabriel,

Thanks for the drawing! that really helped. I don't really know what I did, but after I turned the axis of the az motor it started moving, and thanks to the diagram, the limit switches work too!


Now all I need is sun! :)


luiklodwig

  • New Member
  • *
  • Posts: 12
    • View Profile
Re: heliostat doesn't move
« Reply #5 on: January 22, 2018, 01:48:42 PM »
Hi everybody,

Because I wanted to have everything clean and nice, I decided It might be a good idea to put the arduino in a case with the buttons installed in a clean front panel and put all the 12 wires from the arduino control to the heliostat machine together in a single 12 core cable of 5 meters length. I did it and I'm happy with how tidy everything looks now, but unfortunately I'm having a little bit of troubles with the heliostat now. Sometimes it seems that (especially the alt motor) stops before hitting its limit switch but everything behaves as if it was hit, sometimes it just moves as if it was already sitting on the switch when I turned it on; sometimes the machine starts moving after reset, sometimes it doesn't...

I use 2 different input lines for alt and az limitswitches and each has it's own ground wire...i'm not sure what kind of resistors I'm using right now, but maybe I should use different ones now that I have the 5m of cable?

any ideas would be appreciated :)

edit: ok so I recon that adding more resistance is not going to help against this noise or whatever is happening inside of my cable... in another forum on a similar issue someone suggested to read the switch twice to make sure it was actually really triggered, maybe I'll try this then...If I find the right place to do that :D
« Last Edit: January 22, 2018, 03:03:21 PM by luiklodwig »

luiklodwig

  • New Member
  • *
  • Posts: 12
    • View Profile
Re: heliostat doesn't move
« Reply #6 on: January 23, 2018, 02:11:16 PM »
well, for someone who might have a similar problem:

It actually helped to "ask" the switch twice if it was hit

I changed the reset section in the "Functions" Tab of the programm.

Code: [Select]
//This code resets the machine on the limit switches
void findLimits(int altOrAz, int motorDirection, float limitAngle){
  if (altOrAz==1){
    searchForLimit(limitAngle, altitudeDirPin, altitudeStepPin, altResetSpeed, altLimitPin, altitudeMax, motorDirection );
  }
  if (altOrAz==2){
    searchForLimit(limitAngle, azimuthDirPin, azimuthStepPin, azResetSpeed, azLimitPin, azimuthMax, motorDirection );
  }
}
void searchForLimit(float limitAngle, int DirPin, int stepPin, int ResetSpeed, int LimitPin, long maxResetSteps, int motorDirection){
  long x;
  int whichDir;
  if (motorDirection!=0){//A motorDirection of 0 will skip the reset 
  if (abs(limitAngle) != limitAngle){whichDir = 1;}else{whichDir = -1;}
  if (motorDirection*whichDir != 1){digitalWrite(DirPin, LOW);}else{digitalWrite(DirPin, HIGH);}
    float MotorDelay = ( 1000000 * ( 60 / (steps * ResetSpeed) ) ) / 2;
    while(x<maxResetSteps){
     digitalWrite(stepPin, HIGH);
     delayInMicroseconds(MotorDelay);         
     digitalWrite(stepPin, LOW);
     delayInMicroseconds(MotorDelay);
     //////changes
     if (digitalRead(LimitPin)==HIGH){
       delay (5);
       if (digitalRead(LimitPin)==HIGH){
       x=maxResetSteps;}
     }
     x+=1;
   }
  }
}