how to achieve multiple tasks for stepper control / barndoor tracker

Hi there,

I have constructed a barndoor for tracking stars using an arduino UNO clone and a tb6600 driver. It works fine but the thing is, I always have to upload one program for the stepper to go in one direction and one for the opposite direction (to bring the barndoor back into default position). I would like to be able to do at least three tasks with the stepper without having to connect to the board and upload the respective program each time for each task: 1. On/Off button 2. stepper going in one direction 3. stepper going in the other direction. Perhaps a fourth one for different speed.

from what I have read you can only upload one sketch to the board but still use different parts of the sketch for different tasks. So my question is: can I do this via buttons that are connected to the board (and different pins) and if so, how? I.e. which kind of buttons / cables / pins, preferably at the least costs possible. I believe I can do the programming, so my question is probably only hardware related. I guess there would also be the need of first turning off all other buttons before turning on a specific button. Maybe there are buttons that allow to do this in one go, i.e. pressing one button means turning off all other buttons?

Cheers
step1

The usual way is to have several functions in the program which are called when different things need to happen.

Have a look at how the code is organised in Planning and Implementing a Program

...R

Hi Robin2,

thank you, that will certainly be useful for programming in case needed. However, first I need to know the hardware (buttons or button boards) that I can use to achieve the different tasks via user "input". Maybe there are also ready to use units with buttons, I have no idea. As I mentioned, cheapest way would be preferred.

Cheers
step1

A simple Switch.
Anything you might have laying around.

If( switch == high)
run forward
Else
Run reverse

This is not actually code but shows how simple it is

Read HOW TO USE THIS FORUM
It is a sticky post at the top of every forum
#7 code tages
Post your code.
We can walk you through it.

Buttons are cheap. Just get one at your local hardware shop. All they have to do is make and break an electrical contact, just about any button will do just fine. Find one that you like.

ok thanks guys, sounds simple :slight_smile: just googled a little, how about a TTP224 (has 4 buttons), I suppose that item would do the job?

step1

They work great as touch buttons. Not as on/off switches, nor as long touch buttons.

I don't like capacitive switches.
Too sensitive and easier to bump in the dark.

But there is no reason that they would not work. Just personal preference.

hmm. looks like it can be programmed so that the the signal is used to set a permanent value (until another button is pressed), guy in this video explains:

dave-in-nj:
I don't like capacitive switches.
Too sensitive and easier to bump in the dark.

But there is no reason that they would not work. Just personal preference.

yep, I guess I will try both types of switches to find out which are more convenient to use. The touch switch would have the advantage of the least vibrations (which are unwanted in my apparatus).

step1:
hmm. looks like it can be programmed so that the the signal is used to set a permanent value (until another button is pressed), guy in this video explains:

That's routine. Press button once, do one thing. Press it again, stop doing that thing (or do something else). Those touch sensors make that easy as you don't have to worry about button bounce.

Do look up the finite state machine programming technique. This is one of many many examples. Only some of the simplest projects that I've built do not use a state machine of sorts. More complex projects tend to have many independent and/or nested state machines in the same sketch.

ok, will do. I think I have sufficient info now to get things working as I imagine them to. Thanks all for your help. Will go ordering some switches now :smiley: ..

Cya

when using an SLR type camera
hold a large black cover over the lens, do not touch.
have the camera shutter open. let the camera vibrate with the movement of the internal shutter.
remove the light blocking cover.
time the exposure, move the cover back over and then close the shutter.
we went from blobs to getting nebula after we did that.

the motor start should be before you open the shutter and you should close before you stop the tracking.
so the type of switch should not matter. and if you want totally vibration free, use wireless.
you can get wireless for very cheap.

========

we tested the SLR
put it on the table facing straight up.
put a cover over the lens to protect it. Then put a water bowl on the lens.
used a cable release and when we triggered the shutter, the water moved and created ripples.
once we knew that using the light blocking until after the lens was open and then again before closing it made the nebula clouds come out fantastic.

Hi Dave,

I'm using a Sony SLT-A58, the camera itself doesn't cause any problems especially because I use a remote and the selftimer. The barndoor though is pretty susceptible to vibrations, especially because I didn't cut off much of the rod. So any vibration I cause to the apparatus can last for quite some time, don't know exactly for how long as I've only used the barndoor a couple of times and under bad weather conditions (windy up to 25 km/h, not completely clear sky). But I noticed and also could see in the live-view that when I touched the apparatus or a gust of wind came by the rod would swing and that's not so good :smiley: But when I wait enough time (and it's not so windy) it stops swinging. Reducing that time by using touch switches instead of button switches is therefore helpful. The stepper does not seem to cause noticable vibrations as I use microstepping and rubber damping.

I have ordered the ttp224 and some cables, will see how it works out.

Cheers

You can also use a cable and move the switches from the base.

.
As for the vibration
You could try long coil springs.
Very weak springs might work wonders.
We had to walk softly and deliberately to eliminate thathat source

true, it's a mobile apparatus though (on a tripod) and where possible I try to mount everthing on the lower branch of the barndoor. Cables in the dark can betimes cause some trouble with feet, escpecially when you are a little clumsy like me :smiley:

Loose cables? That's what duct tape is for.

Only you know your setup
But a 12 inch cable to hold switches should be easy to work with.
As you get pictures and try to get better resolution a lot of things will reveal themselves.
Also an LED in the switch box would offer a very faint glow to help find it

yeah, LEDs are helpful, the two arduino LEDs shine constantly. perhaps I should put some LEDs near the polar scope as well since I have at least three times mistaken it for the tripod handle :smiley: ... and that's not so good because I would have to disassemble almost the complete apparatus to be able to realign it with the axis of the hinge.

my setup looks like this (see attachment)