Jump to content

Banner.jpg.b89429c566825f6ab32bcafbada449c9.jpg

Arduino help needed for barn door tracker control


Recommended Posts

Ok, i have a fairly accurate stepper motor driven barn door tracker. consisting of a NEMA17 stepper motor, a tb6600 driver and a variable pulse generator. I wish to replace the pulse generator with an Arduino uno but i need some guidance and pointers to a schematic and a sketch that works for this setup and only needing to change the speed in the code .

the previous post for the finished project here..

thanks in advance

Edited by Legion Of Andromeda
Link to comment
Share on other sites

Is there something about the code I posted over in the other thread that troubles you?  If your driver accepts a simple pulse stream (which it does) that code will work perfectly. One numeric value in one line of code, which I made clear in the comments, is all that’s needed to adjust the speed to suit your needs. The numerical value doesn’t have to be a whole number either as decimal fractions work just fine. Frankly I find it odd you would start another thread when your answer has already been provided, and ALL the programming done from a working example. Is there something I’m missing here?

Link to comment
Share on other sites

10 hours ago, theropod said:

Is there something about the code I posted over in the other thread that troubles you?  If your driver accepts a simple pulse stream (which it does) that code will work perfectly. One numeric value in one line of code, which I made clear in the comments, is all that’s needed to adjust the speed to suit your needs. The numerical value doesn’t have to be a whole number either as decimal fractions work just fine. Frankly I find it odd you would start another thread when your answer has already been provided, and ALL the programming done from a working example. Is there something I’m missing here?

This current post is very different and more specific to my needs and my way of doing research is to collate various sources, including your own, which will all differ in terms of schematics, level of detail, alternative hardware, external links etc ..from which i will form an informed plan with confidence. Most of which has so far referred to the UNO with sketches varying in functionality ...whereas you did say your sketch was intended for the NANO which is probably not an issue, but the concept of using millis is certainly worth investigation.... I have the UNO and 6 sketches including your own but i'm still waiting for the connectors.... early days...the only thing i have done so far is to play with the pin13 LED...I'l let you know how i get on though.

Link to comment
Share on other sites

After checking the specs for an Uno the sketch will work exactly the same as if running on a Nano. The onboard LED is tied to D13 for both Arduinos. Try loading my sketch on to your Uno, hook it up to your drive and see what happens. You can load new sketches on an Arduino thousands of times, so if you don’t like the way it works it’s simple enough to ditch it.

The use of the millis function provides much more precise timing than using the delay function. When the delay function is called the Arduino comes to a complete halt. Nothing happens at all until the designated end of the delay. With millis the Arduino only has to keep track of how much time has elapsed. Only folding in a Real Time Clock would increase the accuracy of these timed events, and maybe incorporating an encoder to use interrupt events as precise feedback. Both of this things would add a great deal of complexity to the software/hardware, and with complexity comes headaches. Not that these things can’t be done, indeed I’ve dreamed of just such a barn door tracker. What I have now works flawlessly, and consistently.

I think someone ought to make these commercially available, and include the features I cite above. If someone could come up with a way to mount these things on any good tripod, be accurate over 10 minutes and have a really good built-in polar scope I’m sure they would sell. Heck, kits would be great for families!

  • Thanks 1
Link to comment
Share on other sites

On 13/06/2020 at 00:12, theropod said:

 all that’s needed to adjust the speed to suit your needs. The numerical value doesn’t have to be a whole number either as decimal fractions work just fine.

Interesting code, thanks.

A barn door is on my list, waiting for a roundtuit (I have the unos and nanos!)

Thinks - how much more code would be needed to vary that number as a function of elapsed time (ie. as the angle increases) to take care of the tangent error of a linear screw ? (to avoid having to bend it into an arc)

 

Link to comment
Share on other sites

9 hours ago, Corncrake said:

Interesting code, thanks.

A barn door is on my list, waiting for a roundtuit (I have the unos and nanos!)

Thinks - how much more code would be needed to vary that number as a function of elapsed time (ie. as the angle increases) to take care of the tangent error of a linear screw ? (to avoid having to bend it into an arc)
 

Link to comment
Share on other sites

It might be easier to incorporate an incline sensor than to attempt to vary the step speed based on time. The 3 axis gyro chips on breakout boards would probably work in such an application. It should be relatively easy to detect the rate of increase in the angle and force the step pulses to match an ideal. This would, of course, require a big jump in the complexity of the code, but should be doable. I would think such an approach would require a good deal of fine tuning and altering the code several times. I feel a simple encoder would be easier to fold into the design, and give constant precise results. I don’t think one would need a high value encoder to make this work either.

  • Like 1
Link to comment
Share on other sites

20 hours ago, theropod said:

After checking the specs for an Uno the sketch will work exactly the same as if running on a Nano. The onboard LED is tied to D13 for both Arduinos. Try loading my sketch on to your Uno, hook it up to your drive and see what happens. You can load new sketches on an Arduino thousands of times, so if you don’t like the way it works it’s simple enough to ditch it.

The use of the millis function provides much more precise timing than using the delay function. When the delay function is called the Arduino comes to a complete halt. Nothing happens at all until the designated end of the delay. With millis the Arduino only has to keep track of how much time has elapsed. Only folding in a Real Time Clock would increase the accuracy of these timed events, and maybe incorporating an encoder to use interrupt events as precise feedback. Both of this things would add a great deal of complexity to the software/hardware, and with complexity comes headaches. Not that these things can’t be done, indeed I’ve dreamed of just such a barn door tracker. What I have now works flawlessly, and consistently.

I think someone ought to make these commercially available, and include the features I cite above. If someone could come up with a way to mount these things on any good tripod, be accurate over 10 minutes and have a really good built-in polar scope I’m sure they would sell. Heck, kits would be great for families!

ok, I disassembled the old circuit with the variable / manual pulse controller and reassembled with my UNO connected to dir/2 and pul/3 pins and their grounds of course, but no ena? as per most of the sketches and the simplest one not only moved in the right direction but i easily changed the delays from 1000 to 1180 to get the rpm needed for round stars, in this case 0.97 rpm. Apart form your sketch bearing no resemblance to the others, and assuming 13 is pul, i couldn't see any reference to a dir pin. The tb6600 microstep driver has ena, dir and pul

Link to comment
Share on other sites

8 hours ago, sloz1664 said:

I will base my barn door tracker on this arduino design Barn Door Tracker

Steve

thats an interesting approach to overcoming the tangent error of a straight rod, as long as your coding reflects the maths involved with a rod moving at an increased rate of accelleration to keep the door rotating at a constant rate. The easy driver is nice and compact but i prefer the TB6600 for quick and sturdy connections... adding a reverse switch would be handy for me

Link to comment
Share on other sites

Most stepper motor drivers can be set to direction without the need to use up a processor output pin. If the driver needs to see positive voltage on a direction pin it’s easy enough to supply it via a DIP switch. The same is true if it expects to see ground. My Easy Driver defaults to one direction without input, and reversing the motor leads controls direction. I still provide that direction pin 5v positive from the Arduino. My design is manual reversing, but adding one output pin and enabling the function in the Arduino sketch is super easy. See my post about my home made alt/az mount. Steppers are super easy.

ETA: link to alt/az project.

 

Edited by theropod
Added content
Link to comment
Share on other sites

54 minutes ago, theropod said:

Most stepper motor drivers can be set to direction without the need to use up a processor output pin. If the driver needs to see positive voltage on a direction pin it’s easy enough to supply it via a DIP switch. The same is true if it expects to see ground. My Easy Driver defaults to one direction without input, and reversing the motor leads controls direction. I still provide that direction pin 5v positive from the Arduino. My design is manual reversing, but adding one output pin and enabling the function in the Arduino sketch is super easy. See my post about my home made alt/az mount. Steppers are super easy.

ETA: link to alt/az project.

 

how does this and the sketch you provided earlier apply to my aforementioned setup?. I assumed you had a nema17 hooked up to a Tb6600 (optimised for current and resolution) and an UNO?, plus, your sketch makes no mention of pul, dir and ena which is why i haven't touched it yet. I now have it all running perfectly and quietly in a smaller box than before on a very basic code.

Edited by Legion Of Andromeda
Link to comment
Share on other sites

Prior to installing the Arduino, i took a couple of single, unstacked test shots last night using my old D7000 with a 50mm lens, one at 2 mins , the other at 3 mins. Now i have rewired it for the Arduino i can house the electronics in a far smaller box and after that i need to figure out some kind of alt sub-base rather than tilting the top part of my mount

 

_RBC2848a.jpg

_RBC2847a.jpg

IMG_20200609_185403.jpg

  • Like 1
Link to comment
Share on other sites

1 hour ago, Legion Of Andromeda said:

how does this and the sketch you provided earlier apply to my aforementioned setup?. I assumed you had a nema17 hooked up to a Tb6600 (optimised for current and resolution) and an UNO?, plus, your sketch makes no mention of pul, dir and ena which is why i haven't touched it yet. I now have it all running perfectly and quietly in a smaller box than before on a very basic code.

How? Because the step pulse is all you need, and no I’m not using your driver, and I’ve made it VERY clear I’m using a NANO. I have also made it clear that your Uno and a Nano function exactly the same pin for pin.

All your driver needs from the Arduino (Uno, Nano, whatever) is a stream of pulses. You can set the direction, and enable, via the 5v pin regulated output pin on the Arduino through simple DIP switches, or push buttons, that have nothing at all to do with programming. This leaves those output pins free for other chores, or keeps the code super simple.

I was asked to post my code. I did. I explained how those signals for direction and enable are provided externally to the Arduino. I just don’t think you understand what you’re looking at, and I’m not able to explain this well.

95% of the time your barn door will be turning one direction, so to why complicate the code with crap that has no effect on the barn door? Turning the drive motor backwards by hand doesn’t take very long as I can spin mine back to the start position in under 2 minutes. No big deal for every 3 hours of run time. If you set up a simple momentary push button switch even reverse direction could be done if you wanted it. Those signals DO NOT have to come from the Arduino!!

I’ve repeatedly mentioned my using Easy Drivers, but your driver works almost exactly the same way. All the Arduino needs to do is pulse the step signal to the driver, and you control the direction and enable via switches. If you’re looking for someone to match your equipment part for part AND write code just for your situation I don’t know what to tell you.

Never mind. I must be failing in spades to make, what to me is a simple matter, clear. If what you have is working, good enough. I really don’t know what more you expect. I was merely trying to help. I’ve spent my last drop of energy on this matter. Good luck with your efforts.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 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.