Jump to content

Stargazers Lounge Uses Cookies

Like most websites, SGL uses cookies in order to deliver a secure, personalised service, to provide social media functions and to analyse our traffic. Continued use of SGL indicates your acceptance of our cookie policy.

sgl_imaging_challenge_banner_lunar_landings.thumb.jpg.b50378d0845690d8a03305a49923eb40.jpg

tekkydave

Arduino Ascom focuser Mark2

Recommended Posts

9 minutes ago, Mick J said:

Great Stuff indeed Carsten,  just wish I understood half of it. 

Just read these few 30+ pages here ;-)

Carsten

  • Like 1

Share this post


Link to post
Share on other sites

Hi Carsten

Have received the BT HC-05 module have managed to pair with it on my Android phone and can see the control App you sent but as yet only get a blank screen when I try to "Connect". Do you know the Baud used for communication? Do I need to set this on my phone?

Do you have a link to the Arduino sketch you loaded into you system as I may have the wrong one.

Thanks Ken

Share this post


Link to post
Share on other sites

After pressing Connect you should See A list of devices including your BT module. You choose then the module. 

I am not 100% sure my APP will work with the original sketch but i guess so. You have to have the same baud rate at the arduino and the BT module. 

Right now an including this week i cant check because i have no acces to my PC.

Carsten

 

Share this post


Link to post
Share on other sites
On 2/1/2016 at 14:53, calli said:

After pressing Connect you should See A list of devices including your BT module. You choose then the module. 

I am not 100% sure my APP will work with the original sketch but i guess so. You have to have the same baud rate at the arduino and the BT module. 

Right now an including this week i cant check because i have no acces to my PC.

Carsten

 

Hi Carsten

Thanks for the recommendation I now have a working system. I used a Nano micro-controller,  an EasyDriver stepper motor board and an HC-05 BlueTooth module for the communication with my phone. I used MIT App Inventor to produce the App and Arduino to wright the sketch for the controller. I modified the sketch to communicate with HC-05 using a second serial port so as to use the default TX/RT (pin 0 and 1) to download the code.

Thanks ken

BlueTooth Box small.jpg

Share this post


Link to post
Share on other sites

Hi all,

I finally got round to building the focuser and I am pleased to say it works wonderfully. The hardest part was getting it attached to my SkyWatcher 150PDS.  I did not want to drill any holes into it or glue anything so I just made life more difficulty for myself!  In the end I got a 3mm thick sheet of black acrylic so it was reasonably strong and cut a shape that allowed it to attach to the two big screws at the bottom of the focus assembly. I then used a heat gun to put a bend in to it so it would hold the new focuser with enough tension to turn the focus knob.  The next issue I had was that the belt kept slipping and I didn't want to take off the Skywatcher focus knob so I got some heat shrinking rubber tube and cut it so it would just cover the knob and heated it so it just wraps it self around the knob but the belt still kept slipping. In the end I purchased some grip tape and put that over the heat shrink tubing and now it works well with no slippage!!

I can now happily control it using BYEOS which is my primary imaging tool.  The one question I do have is that there is a 7 step backlash in each direction so I manually compensate for it but I would like to go for a autofocus solution such a Sequence Generator Pro so my ask is... Is there any pointers on how I can update the arduino code or the ASCOM driver to add this in so I can enter a backlash value to auto compensate when I change focus direction?  I'm not that great with programming but have written using VB/VBscript and Powershell for work.  Any pointer on where to start would be really appreciated. I was thinking along the lines of holding the last direction in a variable and for each move command, it compares the held value with the new direction command and if there is a change, it adds 7 to the move value?

Finally a massive thankyou to all those who have contributed to the thread and especially to tekkydave for all the hard work and effort he has put into this project and kindly shared with the rest of us.

Regards

IMG_6151.JPG

IMG_6152.JPG

  • Like 2

Share this post


Link to post
Share on other sites

Hi all

 

Loving all these focusers.

Building one of these myself.

I have it all set up on the bread board and have tested the motor with small sketches and all is well.

I have th SGL group sketch of source forge ready but still waiting on sgl yahoo group so i can get the libraries.

all has been smooth untill i went to yahoo and have had a night mare joining. got in via mail rather than the join group button as its broken.

Evrything still greyed out at the moment so ill have a look tomorrow.

Still to do is stick it all on a stripboard and mout motor to scope.

2 more will be made once ive sussed it all out

  • Like 1

Share this post


Link to post
Share on other sites
17 hours ago, Domain105 said:

Hi all,

I finally got round to building the focuser and I am pleased to say it works wonderfully. The hardest part was getting it attached to my SkyWatcher 150PDS.  I did not want to drill any holes into it or glue anything so I just made life more difficulty for myself!  In the end I got a 3mm thick sheet of black acrylic so it was reasonably strong and cut a shape that allowed it to attach to the two big screws at the bottom of the focus assembly. I then used a heat gun to put a bend in to it so it would hold the new focuser with enough tension to turn the focus knob.  The next issue I had was that the belt kept slipping and I didn't want to take off the Skywatcher focus knob so I got some heat shrinking rubber tube and cut it so it would just cover the knob and heated it so it just wraps it self around the knob but the belt still kept slipping. In the end I purchased some grip tape and put that over the heat shrink tubing and now it works well with no slippage!!

I can now happily control it using BYEOS which is my primary imaging tool.  The one question I do have is that there is a 7 step backlash in each direction so I manually compensate for it but I would like to go for a autofocus solution such a Sequence Generator Pro so my ask is... Is there any pointers on how I can update the arduino code or the ASCOM driver to add this in so I can enter a backlash value to auto compensate when I change focus direction?  I'm not that great with programming but have written using VB/VBscript and Powershell for work.  Any pointer on where to start would be really appreciated. I was thinking along the lines of holding the last direction in a variable and for each move command, it compares the held value with the new direction command and if there is a change, it adds 7 to the move value?

Finally a massive thankyou to all those who have contributed to the thread and especially to tekkydave for all the hard work and effort he has put into this project and kindly shared with the rest of us.

Regards

IMG_6151.JPG

IMG_6152.JPG

The ascom driver acts mainly as an interface between the client (eg ByeOS) and the hardware/controller (eg arduino). If the client doesnt have the facility to do the backlash comp then the best place is to add it is the arduino sketch. Simplest is to set up a variable with how many steps to take then at the point where the target position is reached just step that many steps in the opposite direction. Hope that helps.

Share this post


Link to post
Share on other sites

Hi,

Thanks for the pointer. I'm glad you suggest the arduino code rather than the ASCOM driver as I feel more confident with Arduino code. I'll give it a try and see how it works out!

Thanks again for the prompt reply

Regards

Share this post


Link to post
Share on other sites

Hi all,

I've managed to modify the arduino code so the focuser compensates for motor backlash when changing direction. For me, there was a 7 step backlash in both directions so I modified the code in the following way...

1. On each T command to move to a new target position, the code checks to see what the direction of travel is.

2. If there is a change in direction, it adds the backlash ASCOM steps to the movement

3. Finally is stores the current direction in a variable (not the EEPROM) so next time the T command is issued it knows what the last direction of travel was.

The modified bits of the code are:


 

// User-configurable values
#define BACK_LASH                       4                 // Blacklash value - Extra ASCOM movement steps to take when changing direction

//Global variables
int           lastdir = 0;                                 // The direction of thr last move command 0 = clockwise     1 = anticlockwise
int           currentdir;                                  // The current direction of travel        0 = clockwise     1 = anticlockwise



  if (targetPosition > currentPosition) {
          Serial.print("Higher");
          currentdir = 0;
        }
        else
        {
          Serial.print("Lower");
          currentdir = 1;
        }


        if (lastdir != currentdir)                                        //Check to see if the new command has changed direction
        {
          if (currentdir != 1)                                            //If current direction is Clockwise
          {
            for (int blc = 0; blc < BACK_LASH; blc++)                     //Move Clockwise the number of ASCOM steps define in BACK_LAST
            {
              for (int ic = 0; ic < MOTOR_STEPS_PER_DRIVER_STEP; ic++)
              {
                clockwise();
              }
            }
          }

          if (currentdir != 0)                                            //If current direction is Anti Clockwise
          {
            for (int blac = 0; blac < BACK_LASH; blac++)                  //Move AntiClockwise the number of ASCOM steps define in BACK_LAST
            {
              for (int iac = 0; iac < MOTOR_STEPS_PER_DRIVER_STEP; iac++)
              {
                anticlockwise();
              }
            }
          }
        }

        lastdir = currentdir;                                            // Save the current direction as the last direction moved ready for next command

I've attached the full Arduino code file too. I think I set the backlash value in the file to 4 but you can change it to what ever suits your needs. It seems to work perfectly for me so I'm hoping it can help others too.  Thanks to tekkydave for his pointer on how to do this.

Regards
 

 

 

AAF2.2.ino

Edited by Domain105
Wrong file added
  • Like 3

Share this post


Link to post
Share on other sites

Great! I just printed some gears. That will introduce more backlash.

Carsten

Share this post


Link to post
Share on other sites
4 hours ago, Domain105 said:

Hi all,

I've managed to modify the arduino code so the focuser compensates for motor backlash when changing direction. For me, there was a 7 step backlash in both directions so I modified the code in the following way...

1. On each T command to move to a new target position, the code checks to see what the direction of travel is.

2. If there is a change in direction, it adds the backlash ASCOM steps to the movement

3. Finally is stores the current direction in a variable (not the EEPROM) so next time the T command is issued it knows what the last direction of travel was.

The modified bits of the code are:


 


// User-configurable values
#define BACK_LASH                       4                 // Blacklash value - Extra ASCOM movement steps to take when changing direction

//Global variables
int           lastdir = 0;                                 // The direction of thr last move command 0 = clockwise     1 = anticlockwise
int           currentdir;                                  // The current direction of travel        0 = clockwise     1 = anticlockwise



  if (targetPosition > currentPosition) {
          Serial.print("Higher");
          currentdir = 0;
        }
        else
        {
          Serial.print("Lower");
          currentdir = 1;
        }


        if (lastdir != currentdir)                                        //Check to see if the new command has changed direction
        {
          if (currentdir != 1)                                            //If current direction is Clockwise
          {
            for (int blc = 0; blc < BACK_LASH; blc++)                     //Move Clockwise the number of ASCOM steps define in BACK_LAST
            {
              for (int ic = 0; ic < MOTOR_STEPS_PER_DRIVER_STEP; ic++)
              {
                clockwise();
              }
            }
          }

          if (currentdir != 0)                                            //If current direction is Anti Clockwise
          {
            for (int blac = 0; blac < BACK_LASH; blac++)                  //Move AntiClockwise the number of ASCOM steps define in BACK_LAST
            {
              for (int iac = 0; iac < MOTOR_STEPS_PER_DRIVER_STEP; iac++)
              {
                anticlockwise();
              }
            }
          }
        }

        lastdir = currentdir;                                            // Save the current direction as the last direction moved ready for next command

I've attached the full Arduino code file too. I think I set the backlash value in the file to 4 but you can change it to what ever suits your needs. It seems to work perfectly for me so I'm hoping it can help others too.  Thanks to tekkydave for his pointer on how to do this.

Regards
 

 

 

AAF2.2.ino

Thanks for sharing :smiley:

Share this post


Link to post
Share on other sites

So!

I switched over to gears. Heringbone gears, wich don't introduce axial forces and have a smooth run because eve at low teeth numbers they have a good contact face. Also they are quite easy to print as the little angle from print layer to printlayer tends to hide little imperfections from the filament or printer, as tradeoff the print is harder to clean. Normally I don't care much for color as long it is black, but my heavy modified velemann broke down during print and for my NEO I had only limited amounts of black filament, so.... Well at least you notice the end of the scope at night quite easy, kids don't touch the gears! ;-)

Cheers,
Carsten

Focusser_Gears.jpg

  • Like 2

Share this post


Link to post
Share on other sites
1 hour ago, calli said:

So!

I switched over to gears. Heringbone gears, wich don't introduce axial forces and have a smooth run because eve at low teeth numbers they have a good contact face. Also they are quite easy to print as the little angle from print layer to printlayer tends to hide little imperfections from the filament or printer, as tradeoff the print is harder to clean. Normally I don't care much for color as long it is black, but my heavy modified velemann broke down during print and for my NEO I had only limited amounts of black filament, so.... Well at least you notice the end of the scope at night quite easy, kids don't touch the gears! ;-)

Cheers,
Carsten

Focusser_Gears.jpg

Thats a nice print calli. One question - when you tighten the central optical section (cant remember the correct name for it) down on your printed part does the tube section still turn. I tried a similar method to mount my focuser and it wont tighten even if the print is only 2mm thick. The tube section that the diagonal fits in is still loose and flopping about.

Share this post


Link to post
Share on other sites
17 minutes ago, tekkydave said:

Thats a nice print calli. One question - when you tighten the central optical section (cant remember the correct name for it) down on your printed part does the tube section still turn. I tried a similar method to mount my focuser and it wont tighten even if the print is only 2mm thick. The tube section that the diagonal fits in is still loose and flopping about.

Thanks,

the central part is tight (its one part, maybe you have a loose grip ring?) and the main plate holds good. Will see if it works out in real life.

Carsten

Share this post


Link to post
Share on other sites
12 minutes ago, calli said:

Thanks,

the central part is tight (its one part, maybe you have a loose grip ring?) and the main plate holds good. Will see if it works out in real life.

Carsten

That explains it. Mine has a separate ring which tightens the tube against the end of the threaded part on the OTA. I'll have to come up with a more fiendish design I think.

Share this post


Link to post
Share on other sites
On 20.8.2014 at 19:17, orly_andico said:

i did a different approach - because I don't know how to program in Windows, i re-implemented the Lacey / Moonlite protocol -

http://orlygoingthirty.blogspot.sg/2014/04/arduino-based-motor-focuser-controller.html

works fine for me...

I might be interested in having a INDI driver for this fine project. I know orly_andico did it the way to implement the moonlight protocol. I am not sure if I want to go this way. So far I am happy with daves code and my inclusions for my dew heater. So there are two(?) options: Make a Indi plugin(?)/driver for the AAFM2 or hack the arduino code to be moonlite compatible.

Opinions?

Cheers,
Carsten

 

Share this post


Link to post
Share on other sites

I read through this post, and looked on SourceForge at the comprehensive write-up. It looked straighforward to follow the instructions and I figured even I could get this working ;-) Needless to say I was mistaken :-(  I have the basic hardware cabled correctly as a test system on the bench, Software installed OK, communications work fine. I'm using the option for NEMA17-PG5 + UNO + L293D Shield (my UNO is R3 though). I'm using v2.19_L293D_F 18022016 which compiled and uploaded without a hitch, and either the Windows App or the ASCOM test program will connect to the motor no problem and commands appear to reach the controller and results are returned (position etc.,).

However... It seems stuck at 10000 position, if I give a command to move to, say 9000, it will rotate to 9500 then back again to 10000 (?!). Sometimes the motor runs very fast for a second then crawls along at a snails pace. I don't know if it's the code (I haven't changed anything other than the settings required - MotorPort, and settings for FullStep mode - const int stepsPerRevolution = 1028). I;ve gone through all the settings tabs to make sure they make sense. So is it my hardware? (I don't have the other options connected like temp probe, LCD screen, button switches etc., just what you see in the image below).

IMG_0716_zpsfgzvkvso.jpg

ChrisH

Edit: went through the code line by line, found the 'special note' in Main Loop about disabling the code for buttons if none are attached. Did that and can now control direction and movement correctly (using ASCOM driver and SGPro). Movement is woefully slow though, even with a speed setting of '3'. This is full step (1028), have not tried half-step.

Edit 2: 'Dropped' the speed from 3 down to 2 and now the motor turns much faster...?

Edit 3: OK, found that the data for speed is 'ambitious' by default - speed 1=1, speed 2=10, speed 3=200 (!). So 10 is near optimal for speed. Also, if the gearbox is really 5:1 then the number of steps per revolution is not 1028 (step angle 0.35deg), I think that was rounded up from 0.347deg as it's actually 1036 steps per revolution (this motor here anyway). Other than that the basic thing appears to be working now...

Edited by ChrisLX200

Share this post


Link to post
Share on other sites

Good work. Are you using my sf sketch or a modified version? I'm a bit nervous that these 2 projects are becoming confused. Maybe the latest bluetooth aspects should be in a different topic to avoid confusing other readers.

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, tekkydave said:

Good work. Are you using my sf sketch or a modified version? I'm a bit nervous that these 2 projects are becoming confused. Maybe the latest bluetooth aspects should be in a different topic to avoid confusing other readers.

Yes, I feel a bit guilty with my modifications. However: Just using bluetooth will be completely transparent and works with the 100% original sketch and Ascom Drivers.

I think the motor in the image is a bipolar (4 wires) one but the ones used here are more the unipolar ones (5 wires) and I think bipolar ones will probably not work with the original sketch. I had the problem the other way around not getting the 5V motor to work with AStepper Library.

Carsten

  • Like 2

Share this post


Link to post
Share on other sites

Don't feel guilty. I want people to use and experiment with my code and build on it. I was just concerned that anyone reading this in the future might get confused about which bits were part of my original SF project and which were your wonderful improvements. I remember looking at the SGL focuser project when I first started looking at building a focuser and how confused the project had become. I never managed to work it out so built my own. I don't mind if you want to carry on posting in this topic :grin:

 

  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, tekkydave said:

Good work. Are you using my sf sketch or a modified version? I'm a bit nervous that these 2 projects are becoming confused. Maybe the latest bluetooth aspects should be in a different topic to avoid confusing other readers.

This is all your stuff Dave ;-) downloaded from your SourceForge page. Although I have been experimenting with other stuff too.

I would really like to add the backlash compensation feature because autofocus is not going to be accurate without it, and I don't know if it's possible to use AccelStepper library to potentially increase max speed. Also I need it to remember position from one session (power down/up) to the next. None of these mods fall within my current knowledge of Arduino programming so I'm on a crash learning course.. :-)

I should add here for the benefit of others (with my engineering hat on!) you really _have_ to arrange for some sort of slip-clutch mechanism if attaching this motor to a Rack and Pinion focuser. The focuser will be history if the motor tries to drive it past either end (a hard stop).

 

ChrisH

  • Like 1

Share this post


Link to post
Share on other sites
52 minutes ago, tekkydave said:

Don't feel guilty. I want people to use and experiment with my code and build on it. I was just concerned that anyone reading this in the future might get confused about which bits were part of my original SF project and which were your wonderful improvements. I remember looking at the SGL focuser project when I first started looking at building a focuser and how confused the project had become. I never managed to work it out so built my own. I don't mind if you want to carry on posting in this topic :grin:

 

I think you're right Dave, it does get very confusing (speaking as someone entirely new to mucking around with Arduinos and coding for them!). I had to filter the posts to find those relevant to your project, that doesn't mean I don't want to add mods - I do - but would prefer to look in a separate thread for those I think. However, all the info provided is gratefully accepted ;-)

ChrisH

  • Like 1

Share this post


Link to post
Share on other sites

Just for clarity then, the last release on my Sourceforge page at  https://sourceforge.net/projects/arduinoascomfocuser was V2.4.0 on 19th April 2015. I haven't made any changes since then.

At the moment I'm not planning to enhance it further but obviously anything added by others here is all welcome. My SF project has been downloaded 4,157 times and I know at least 25 SGLers have built one which is amazing really. I never though anyone would be interested :D

 

Share this post


Link to post
Share on other sites

I'm sorry Dave - confession time... I'm NOT using your program, I;ve got my sources confused and the one I'm actually using is that of Robert Brown! So I'm posting in the wrong thread myself I guess... ;-(
There are so many different versions/projects  - which is really a good thing, but confusing! I did start out playing with the 28BYJ-48 motor plus NANO, but then looked for a more powerful motor with suitable driver board - that led me to using a NEMA17-PG5 + L293D Shield. Somewhere along this path I obviously swapped projects and authors!

ChrisH

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.