Jump to content

Banner.jpg.b89429c566825f6ab32bcafbada449c9.jpg

Christmas (arrrrrh!) Project - part II (the focuser comes!)


Stargazer33

Recommended Posts

It looks like the UNO will take 12V but a power tank can put out 13.5 or more and I am not sure the voltage regulator on the UNO will cope. I know that I experiment with a "big" Arduino when I am developing (I have the Duemilanove) but switch to a "small" production Arduino for deploying the project ( I use the Mini Pro). The small ones don't have voltage regulators so I am in the mindset that says "only feed 5V to the Arduino". Luckily, it gets that from the USB connection. I would not be tempted to share motor power and arduino power, it's a recipe for hard to diagnose problems. 

It should be possible to use a rotary switch as an input to the arduino for single steps while also providing fast-forward and fast-rewind buttons. I haven't seen a "sketch" that does that but there could well be one out there.

When I was playing around with an Arduino and stepper motor driver boards I used a 9v battery (pp3) as it was within the correct range for both.
Link to comment
Share on other sites

  • 3 weeks later...
  • Replies 74
  • Created
  • Last Reply

I've just tested my MOM switches with 12v LED illumination on the bench power supply set to 5v (my supply voltage to the motor) and I get a lovely red glow. I am going to make up some black on clear Dymo labels with 'SF, SB, FF, FB, 10' on them for the five button tops. With the warm red glow showing through it should be easy to identify the correct button in the dark.

I'm going to start drilling the case during my breaks to fit the switches. I haven't quite worked out the placement yet but I think it is going to be like the dots on the 5 side of a die.

Link to comment
Share on other sites

Just finished fitting the buttons to my handset for controlling the focuser.

post-21511-0-32484800-1387288675_thumb.j

Not quite in the configuration that I initially thought of but I needed to give myself enough room in the bottom half of the box in case I wanted to use the UNO instead of the NANO.

I need to wire up all the buttons and fit the power cable, signal cable to the motor and the arduino & motor control PCBs.

Next is making up the motor box in which I am going to have a plug/socket connection for the signal/power cable so that I leave as little as possible connected to the tube for when I have to carry everything inside.

Link to comment
Share on other sites

  • 4 weeks later...

Things are moving along a bit now with the focuser after a false start over the Christmas holiday - there were lots of bits (mainly connectors) that I had neglected to source.

My current problem is: there doesn't seem to be a connection point on the motor controller board for the ground wire! The circuit diagram shows the ground going to pin 8 of the IC but from what I can see pin 8 doesn't have a connection pad/pin for me to attach a wire.  :icon_scratch:

Link to comment
Share on other sites

  • 2 weeks later...

Well the focuser is fully assembled now but as predicted it doesn't work at all! :undecided:

I have tried to upload Gina's script...

// This Arduino example demonstrates bidirectional operation of a
// 28BYJ-48, which is readily available on eBay, using a ULN2003
// interface board to drive the stepper. The 28BYJ-48 motor is a 4-
// phase, 8-beat motor, geared down by a factor of 68. One bipolar
// winding is on motor pins 1 & 3 and the other on motor pins 2 & 4.
// Refer to the manufacturer's documentation of  Changzhou Fulling
// Motor Co., Ltd., among others.  The step angle is 5.625/64 and the
// operating Frequency is 100pps. Current draw is 92mA.
////////////////////////////////////////////////
//declare variables for the motor pins
int motorPin1 = 2; // Blue   - 28BYJ48 pin 1
int motorPin2 = 3; // Pink   - 28BYJ48 pin 2
int motorPin3 = 4; // Yellow - 28BYJ48 pin 3
int motorPin4 = 5; // Orange - 28BYJ48 pin 4
                        // Red    - 28BYJ48 pin 5 (VCC)
int motorPin1a = 6; // Blue   - 28BYJ48 pin 1
int motorPin2a = 7; // Pink   - 28BYJ48 pin 2
int motorPin3a = 8; // Yellow - 28BYJ48 pin 3
int motorPin4a = 9; // Orange - 28BYJ48 pin 4
////////////////////////////
int motorSpeed = 1200;  //variable to set stepper speed
int count = 0;          // count of steps made
int countsperrev = 512; // number of steps per full revolution
int lookup[8] = {B01000, B01100, B00100, B00110, B00010, B00011, B00001, B01001};
//////////////////////////////////
int wfPin = 10;  // Widefield focuser select switch
int controlPin = 0;  //  Input control line pin
boolean wf; // Widefield focuser true/false
int focusCount = 0;  // focus count for WF
// int focusCount_b = 0;  // focus count for scope
// int focusCountPrev_a = 0;
// int focusCountPrev_b = 0;
int val = 0;  //  value of control input voltage
int opCode = 0;  //  corresponding operation code
int stepSize = 5;  // how many motor steps correspond to one focussing step
boolean busy = false;  // used to provide single action buttons - wait for "up" before continuing
//////////////////////////////////////////////////////////////////////////////
void setup() {
  //declare the motor pins as outputs
  pinMode(motorPin1, OUTPUT);
  pinMode(motorPin2, OUTPUT);
  pinMode(motorPin3, OUTPUT);
  pinMode(motorPin4, OUTPUT);
  Serial.begin(9600);
}
//////////////////////////////////////////////////////////////////////////////
//set pins to ULN2003 high in sequence from 1 to 4
//delay "motorSpeed" between each pin setting (to determine speed)
void moveBackward()
{
  for (int s = 0; s < stepSize; s++) {
    for(int i = 0; i < 8; i++)
    {
      setOutput(i);
      delayMicroseconds(motorSpeed);
    }
  }
  focusCount--;
  Serial.println(focusCount);
}
///////////////////////////
void moveForward()
{
  for (int s = 0; s < stepSize; s++) {
    for(int i = 7; i >= 0; i--)
    {
      setOutput(i);
      delayMicroseconds(motorSpeed);
    }
  }
  focusCount++;
  Serial.println(focusCount);
}
////////////////////////
void setOutput(int out)
{
  digitalWrite(motorPin1, bitRead(lookup[out], 0));
  digitalWrite(motorPin2, bitRead(lookup[out], 1));
  digitalWrite(motorPin3, bitRead(lookup[out], 2));
  digitalWrite(motorPin4, bitRead(lookup[out], 3));
}
///////////////////////
void moveB10() {
if (busy == false) {  // do it once then wait for button release
    for (int i = 9; i >= 0; i--) {
    moveBackward(); }
    busy = true; }
}
////////////////////////////
void moveB1() {
  if (busy == false) {
    moveBackward();
    busy = true; }
}
//////////////////////////
void moveF1() {
  if (busy == false) {
    moveForward();
    busy = true; }
}
///////////////////////
void loop() {
  wf = (digitalRead(wfPin) == LOW);
  val = analogRead(controlPin);
// Break points 102, 307, 512, 717 and 922
  if (val < 102) {  //  allow for small variations in control line voltage by separating into bands
    opCode = 0;
  } else if (val < 307) {
    opCode = 1;
  } else if (val < 512) {
    opCode = 2;
  } else if (val < 717) {
    opCode = 3;
  } else if (val < 922) {
    opCode = 4;
  } else {
    opCode = 5;
  }
//
  switch(opCode) {
    case 0 : busy = false; delay(100); break;  // clear busy flag and wait for button state to settle (switch bounce)
    case 1 : moveBackward(); break;
    case 2 : moveB10(); break;
    case 3 : moveB1(); break;
    case 4 : moveF1(); break;
    case 5 : moveForward(); break;
  }
}

... but I get this error message at the end of the upload process. The script compiles okay.

post-21511-0-56091800-1390162203_thumb.j

And I have no idea what that means! :huh:

I am also very unsure as to what pins I should connect my wires to. I have connected the Blue, Pink Yellow and Orange wires from the stepper motor to pins: D2, D3, D4 and D5 which I think are the variables declared in the first part of Gina's script. I connected the red, power, wire from the stepper to the +5v output on the nano.

I have also connected the 5 wires from the push buttons as follows:

Fast Back      = pin A1

Back 10         = pin A2

Slow Back      = pin A3

Slow Forward = pin A4

Fast Forward = pin A5.

I took this from the last part of the script under switch(opCode) {

The blue power LED is on and the 'L' LED is flashing at the normal rate, but it just doesn't work.

I know Gina's script has the option for two motors but I thought that part of the programme just wouldn't be activated as there is no switch to change to a second motor and it would stay in the default state of motor 1.

Any help would be gratefully appreciated. :grin:

Link to comment
Share on other sites

... but I get this error message at the end of the upload process. The script compiles okay.

attachicon.gifNano Upload Error.jpg

And I have no idea what that means! :huh:

This means that the sketch has not been uploaded to your Arduino. Make sure you selected the correct Arduino model in the Tools -> Board menu (if I remember correctly).

Then try uploading the sketch again.

Link to comment
Share on other sites

Oh, also check that the COM port is set correctly under Tools -> COM port.

Also, as far as I can tell from that sketch the 5 buttons use a single input pin and resistors with various values between them. So it looks like you wired the switches wrong.

Link to comment
Share on other sites

The upload fault was that I wasn't selecting the correct COM port, so thanks again for that Chris.

After rewiring my hand controller I've found that it still isn't working!

I uploaded a basic sketch from the driver board manufacturer which should rotate the motor one full turn backwards and then one full turn forwards, however all that happens is the motor vibrates it way across the desk! All four indicator LEDs on the driver board are lit and stay lit so I can only assume that the coils are all being energised at the same time and 'locking' the motor in position. I have no idea why this is happening. I have two motors and driver boards and it is happening with both. I have also tried the motor from one set and the driver board from the other with the same result. I'm out of ideas!

Link to comment
Share on other sites

Assuming the motors are connected to the board correctly, it could be that there's not enough power getting through. Have you had the manufacturer's sketch working before?

On the subject of hand controllers (and just to add to the confusion!), I reckon a small IR remote is a good choice. Sparkfun do a suitable one here, and then you'd just need a TSOP38238 IR sensor and adapt your sketch to suit.

Link to comment
Share on other sites

Unfortunately I haven't had the motors working at all yet. I believe Gina had a problem with here fast forward/backward due to low power but I believe it still worked with the slow rotations.

Jason has suggested in another post that it may be the motorspeed value so I'm going to give that a try.

If the motor speed thing doesn't work I will try powering the motor differently. Thanks for the suggestion.

I was thinking about remote control in the very early days of design, but as I am struggling with this as it is, I think that is one straw too many!

Link to comment
Share on other sites

Yes, try running the motor slowly at first.  Slow it right down to a step or two a second so that you can see the LEDs blink in order.  This will check that you have the sketch working propperly.  Check that the LEDs blink in order 1234 or 4321 and not out of sequence.  I think it very unlikely that you have the connections wrong or the code in the wrong order but when things don't work you need to check.  With the LEDs blinking slowly you should be able to hear the motor ticking gently. 

Running that slowly you may not be able to see the motor turning so reduce the step delay to speed things up.  You should begin to see the motor rotating.  Continue to reduce the step delay and you should see the speed increasing.  Eventually, the speed will be too much for the motor and it will stop and just vibrate.  It would seem that this is what you are getting.

I recommend getting the basics things working first - then add refinements or extra special controls.  Take it in easy steps, otherwise you won't know what's working and what isn't.

Hope that helps and good luck :)  It's often the simplest things that cause the most problems :D

Link to comment
Share on other sites

Thanks Gina! Yesterday I made up a simple pin to pin loom to try the motor/driver board in a basic configuration. I won't be able to try that until tomorrow night.

I did try reducing the motor speed as Jason suggested and I seem to be getting LEDs 1&3 lighting and then 2&4. One pair (I can't remember which) seems to be a lot dimmer than the other.  :icon_scratch:

I will run through what you have suggested and hopefully narrow down the problem. As I am the simplest of things in this equation, the problem is bound to be me!  :grin:

 I will check my signal/power lead from the hand controller to the motor housing. I bought this ready made up RJ12 to RJ12 and I thought it was straight through (1-6, 2-5, 3-4, 4-3, 5-2, 6-1), but I should check and make sure that it isn't a cross-over lead (1-1, 2-2, 3-3, 4-4, 5-5, 6-6).

Link to comment
Share on other sites

Definitely something wrong there.  With single stepping you should get just one LED on at a time and in 1-2-3-4-1-2-3-4 sequence or 4-3-2-1-4-3-2-1 sequence.  With micro-stepping you have one on or two adjacent ones eg. for 2:1 micro-stepping you get 1-12-2-23-3-34-4-41-1-12-2-23-3-34-4 or the reverse.

Link to comment
Share on other sites

Managed to do a quick test before we went out last night with my power supply hooked up to the Nano, my test loom (4 wire - motor control board to Nano), motor control board and stepper motor. I loaded the simple test sketch that rotates the motor 360 deg one way and then reverses it and it  worked fine. I now at least know that the Nano, test sketch, motor control board and stepper motor are all okay. I have a starting point.

So tonight I am going to hook up my hand control box to the motor box using the RJ12 lead and see if it still works. If not then there is definitely a problem with my wiring. If that works or if I can sort out the problem there, then I can try and see why the buttons aren't working. Again I suspect the problem lies with me/my work!  :icon_clown:

Link to comment
Share on other sites

post-21511-0-85979900-1391035276.jpg

Finally! It's working. All along it was a simple schoolboy error in the wiring; and when I find the simple schoolboy that did the wiring, he will be for the high jump! :grin:

A simple process of elimination narrowed down a number of wiring errors that as they were corrected lead to the focuser working as Gina had originally designed.

When I get some time I will take some pictures and hopefully will post a parts list in case anyone else would like to make one themselves.

In the meantime thanks to everyone who helped get this project finished and especially Gina for her original concept and help & guidance.

All I need now is for this blinking rain to stop! :clouds2:

Link to comment
Share on other sites

Aaaah! :BangHead:

Everything was working just as it should. I took the hand controller to work to tidy up the cabling and to secure the boards down. When I bought the controller home and plugged it into the power supply and motor to make sure it was working properly I had three of the buttons - 'Fast Forward', 'Fast Back' and 'Slow Forward' running continuously forward (fast forward). The '10 Back' button is running slow back (1 step backwards per press) and the 'Slow Back' button is running 10 back (10 steps backward per press)!

I have checked all the soldering and everything looks okay. I have loaded the test sketch again to rotate the motor 1 full turn forwards and then 1 full turn backwards continuously and that works okay, so the Nano, motor and motor control board are working correctly. Looks like a frustrating weekend lays ahead trying to figure out what has gone wrong!

Link to comment
Share on other sites

Hi Chris,

No, the wires weren't changed after I got it working. I just shortened each one in turn to tidy them up. You're on the right track though.

What I found this morning running through the resistor board was another schoolboy error (must stop employing these schoolboys to wire up my projects! :smiley:). Having shortened the power feed to the resistor board I bridged the first resistor with solder, effectively removing it from the circuit and giving me low values for all the signals from the buttons.

I've just tested it again and it's working as it should. :grin:

Now, with current weather patterns I should be able to get outside and get first light with it around July! :shocked:

Link to comment
Share on other sites

Well, as I said in an earlier post, here is a full breakdown of my version of Gina's Arduino controlled focussing.

First off is the parts list.

Motor Box:

Hand Controller Box:

Accessories:

post-21511-0-17655700-1391372455_thumb.jpost-21511-0-41193900-1391372464_thumb.jpost-21511-0-68437500-1391372486_thumb.jpost-21511-0-65802800-1391372498_thumb.jpost-21511-0-83082700-1391372513_thumb.jpost-21511-0-73944200-1391372521_thumb.jpost-21511-0-66131700-1391372537_thumb.jpost-21511-0-54546300-1391372544_thumb.jpost-21511-0-28662300-1391372566_thumb.jpost-21511-0-26096200-1391372573_thumb.jpost-21511-0-14732400-1391372577_thumb.j

You Tube video of my focuser in action!

I have a supply voltage of 12.5v coming from my power supply box. This is dropped to 9v by the DC/DC converter in order to supply the Nano with the optimum voltage. This 9v also supplies the power for the 12v LEDs in the push buttons - it means they are not too bright.

On my resistor board I have replaced the 1K2 resistor on Gina's circuit diagram with a 570R resistor as suggested by Gina. This works fine. I also used Gina's last script here. It's the one posted on 06 March 2013 at 06:48 PM.

You will see in the video that when I press the Slow Forward (SF) and Slow Backwards (SB) buttons on the hand controller nothing happens during the first press. This is due to the slack in the gears. If I was moving from Fast Forward (FF) to Slow Forward (SF) there wouldn't be that dead press.

If you have any questions about my build then please don't hesitate to ask. I will try to answer as best I can.

My power distribution box seen in the photos and video can be found on this earlier post.

Link to comment
Share on other sites

  • 2 years later...
On 02/02/2014 at 20:53, Stargazer33 said:

Well, as I said in an earlier post, here is a full breakdown of my version of Gina's Arduino controlled focussing.

First off is the parts list.

Motor Box:

Hand Controller Box:

Accessories:

Hand Controller Wiring.jpgButton Wiring.jpgNano - DC-DC Converter Wiring.jpgHand Controller - Size.jpgHand Controller Sockets.jpgDedication.jpgConfiguration.jpgClose-up Handcontroller - Motor.jpgMotor on Scope - Belt Side.jpgMotor on Scope - Bracket Side.jpgWhole Set-up Including Scope.jpg

You Tube video of my focuser in action!

I have a supply voltage of 12.5v coming from my power supply box. This is dropped to 9v by the DC/DC converter in order to supply the Nano with the optimum voltage. This 9v also supplies the power for the 12v LEDs in the push buttons - it means they are not too bright.

On my resistor board I have replaced the 1K2 resistor on Gina's circuit diagram with a 570R resistor as suggested by Gina. This works fine. I also used Gina's last script here. It's the one posted on 06 March 2013 at 06:48 PM.

You will see in the video that when I press the Slow Forward (SF) and Slow Backwards (SB) buttons on the hand controller nothing happens during the first press. This is due to the slack in the gears. If I was moving from Fast Forward (FF) to Slow Forward (SF) there wouldn't be that dead press.

If you have any questions about my build then please don't hesitate to ask. I will try to answer as best I can.

My power distribution box seen in the photos and video can be found on this earlier post.

Hi Brian - love the work & would love to make this myself.

 

I know its an old post, but would you be able to:

 

Tell me where (or share a link) to the screw on mini din connector on the handset? Cant seem to find one.

 

Did you amend Gina's sketch at all & if so, would you mind sharing?

 

Thanks.

Link to comment
Share on other sites

Hi, yes, a very old post! :icon_eek:

 

Easy one first. No I didn't modify Gina's script at all (I'm not that clever!) I used it exactly as it was written. There was an awful lot of plagierism on this project!

The other question is not so easy to answer. I used to work for a company that repaired/serviced/manufactured communications equipment for pilots and groundcrew (commercial, civil & military). The mini din socket/plug are from one of the headsets that we used to work on. I think they may have been the connectors for the overhead cable from a Bose X headset.

I have just looked through my old spares tin and I found one half (the socket) but not the other. Otherwise I would have sent the pair to you.  The pin buckets are so small I think I melted the first connector trying to solder the wires on. That's why I only have one half left.

Sorry I couldn't help more, but if you have any other questions please don't hesitate to ask.

Regards, Bryan

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.