Jump to content

Banner.jpg.b89429c566825f6ab32bcafbada449c9.jpg

Arduino Focus control and Cloud sensor


ncjunk

Recommended Posts

  • Replies 490
  • Created
  • Last Reply
I was just going to suggest exactly that. Try playing with the delay between steps.

i would say great minds think alike...although my Gran always said fools seldom differ...although she also used to say "Neil, some say hes the best others tell the truth"

And chris its your fault i have a load of bits sat in my garage to built a power unit (although i have added relays to your design so i can switch it all from the housr)

Link to comment
Share on other sites

heheheheeh, again...

I was considering relays per output when I added the focuser Arduino to the box. So many free I/O pins... :hello2:

But then, it would have to be built into the SGL sketch and Windows software because I can't open the same COM port from another application...

Link to comment
Share on other sites

Hi Neil,

Apologies for the delay, work's been a bit hectic lately.

A quick update for you...

I uninstalled the the old app and installed the beta version, then compiled and uploaded your new sketch, here's what happens;

When I first power on the board two leds light on the motor shield and the motor stays energised.

When I start the app and connect the motor stays energised, when I click the in or out button the four leds flash once very briefly and then they all go out - motor is no longer energised. At no point does the motor move and if I then press in or out again nothing happens at all.

Thanks for the continued help,

Ian

Link to comment
Share on other sites

I realise I'm probably doing this derriere-about-face, but I'm so sick of not being able to get outside that I've bought an Arduino to give my brain something to do.

Is there a good place to start as regards making it do stuff? Linux-centric for preference as I don't really do Windows if I can avoid it.

James

Link to comment
Share on other sites

You're in luck, the arduino IDE works in linux or windows or on a mac, so download whatever flavour floats your boat :hello2: You can get started on www.arduino.cc there is a full reference page, along with stuff about libraries and interfacing, of course if you get stuck there is also the arduino forums :)

Link to comment
Share on other sites

Thanks Reggie. The programming language looks rather C-like, which floats my boat.

I'm wittering off-topic, for which I apologise to the OP. My first encounter with computers was in the early/mid 80s with the ZX80 and so on. It's amazing comparing that to what is possible now from something that will easily fit on the palm of my hand. It's like one generation of apes working out that they could bang rocks together and the next building Salisbury cathedral. I regularly wonder how to explain to my children what the world was like (for my generation, at their age) when people didn't have computers at home, school or in the workplace. It's like trying to explain to children of my generation what it was like not to have cars, but it took four generations for horses-drawn vehicles to disappear. This has happened in one. Gob-smacking.

James

Link to comment
Share on other sites

have you tried running at faster speeds? if the delay is too long between steps it may cause some jerkiness at full step. obviously 1/4 or 1/8 stepping will be smoother even if you have the delay too long as its performing intermediate steps which will smooth the movement.

if you have the delay too short it will cause other problems but i'd have a play with that first.

mine is direct coupled and quite smooth whilst running but it jerks a little when it stops as it stops suddenly.

it makes a fair bit of noise (200 step non geared motor). the geared stepper i have is much smoother and a lot less noisy.

Hmmm, ok. I increased the speed and it does seem to run smoother, but still makes quite a whine when it operates. I had been feeding it a pulse every 4ms, but I've changed that to every 2ms and it seems happier. I also tried every 1.5ms and the result is similar, perhaps a little quieter still.

I tried pulses every 1ms and this seemed to produce a really loud whine like I was driving it too fast or something. So clearly there is a sweet spot to be found. I suspect it is probably in the vicinity of pulses every 1.5-2ms.

This is my first experience with stepper motors. Are they all this whiny? Presumably not since floppy drives don't make this sort of racket, but then again, scanners and printers do make this kind of whine when moving at speed.

I think I have the same ungeared motor as you Neil. Mercury Motor SM-42BYG011-25, 200 steps/rev.

Link to comment
Share on other sites

i would like to try and build my own focus control and stepper drive.

could you guys recommed what Arduino i should get ( total idiot to electronics)

i have the choice of:

Arduino UNO ATMEGA328P R3 Mainboard

Arduino MEGA 2560 R3 Board

Arduino MEGA ADK R3 for Android™ Board

would like to drive the focuser using a 3.5kg digital servo @ 6v or around there, but also maybe a stepper drive to swing my table dobson in AZ

Link to comment
Share on other sites

Hmmm, ok. I increased the speed and it does seem to run smoother, but still makes quite a whine when it operates. I had been feeding it a pulse every 4ms, but I've changed that to every 2ms and it seems happier. I also tried every 1.5ms and the result is similar, perhaps a little quieter still.

I tried pulses every 1ms and this seemed to produce a really loud whine like I was driving it too fast or something. So clearly there is a sweet spot to be found. I suspect it is probably in the vicinity of pulses every 1.5-2ms.

This is my first experience with stepper motors. Are they all this whiny? Presumably not since floppy drives don't make this sort of racket, but then again, scanners and printers do make this kind of whine when moving at speed.

I think I have the same ungeared motor as you Neil. Mercury Motor SM-42BYG011-25, 200 steps/rev.

even 1 ms might still be too slow. The speed setting in the SGL software is in microseconds, not milliseconds. On my focuser I canged the code to only wait 1 microsecond between steps:

delayMicroseconds(1);

Others have reported that this was too fast for their steppers. Try with 200 microseconds and experiment from there....

Link to comment
Share on other sites

You could just check the datasheet for your stepper motor and look out for the pps value (pulses per second!).

@tamiyaCowboy, the arduino uno would probably be just fine :hello2:

@JamesF, yeah, it's amazing how quickly things have progressed, I remember my dad building his first calculator (Sinclair!),

Link to comment
Share on other sites

thank you reggie

i have chosen the Uno version, being a newbie if i do anything remotely wrong the chip gets fried and the board lives.

Unlike the mega where the chip is surface mounted and would be a pain to replace.

my idea is have the unit power a focuser motor, and maybe Alt/Az movement of a dobson base. i also notice a GPS module can be added, maybe ascom goto ?

Link to comment
Share on other sites

even 1 ms might still be too slow. The speed setting in the SGL software is in microseconds, not milliseconds. On my focuser I canged the code to only wait 1 microsecond between steps:

delayMicroseconds(1);

Others have reported that this was too fast for their steppers. Try with 200 microseconds and experiment from there....

500 - 800 seems to work well with mine. I don´t think it liked the 1 microsecond delay)

James:- Thats no good, we need degrees of cloudy. Night time black, dusky black, whisker away from black, Cloudy with a hint of cloud, Clear but give it a moment I´m sure the cloud will roll in.

StarFlyer:- I´ll sort out another version for you to try. That used HalfStepper library but I will change it to stepper.h so that its the same as the one we have working.....I´ve got confused as to where we are...I´ll get back to you when I know what the heck I am meant to be doing!

Chris:- I am thinking of using the Arduino for the relay control and Cloudsensor and communicating over ethernet (leave it running all the time) with the Linux server I have....no idea how I´m going to start that yet...er..actually if thats going to work I better buy an ethernet shield!

Link to comment
Share on other sites

You could just check the datasheet for your stepper motor and look out for the pps value (pulses per second!).

Yes that would be ideal, except that the only datasheet that seems to be available is a schematic drawing of the physical size of the motor. There is nothing about pulses.

Sent from my iPad using Tapatalk

Link to comment
Share on other sites

even 1 ms might still be too slow. The speed setting in the SGL software is in microseconds, not milliseconds. On my focuser I canged the code to only wait 1 microsecond between steps:

delayMicroseconds(1);

Others have reported that this was too fast for their steppers. Try with 200 microseconds and experiment from there....

Yeah, I was using millisecond delays but switched to microseconds. I have been doing this:

Set HIGH

delay 1

Set LOW

delay 2

for each pulse. So delay2 would be where you do the 1microsec delay. What do you delay at delay1?

When I tried 500 microsecs for both delays, I got a loud whine and vibration but I think it moved. It didnt sound healthy though.

Sent from my iPad using Tapatalk

Link to comment
Share on other sites

500 - 800 seems to work well with mine. I don´t think it liked the 1 microsecond delay)

I'll give that a shot too. I've using the same delay at both points. 500 - 500 wasnt good. But 750-750 is ok. So maybe 500-800 will be ok too.

Sent from my iPad using Tapatalk

Link to comment
Share on other sites

in my sketch delay 1 is 1microsecond, delay 2 is what is set in the SGL software, default is 200 microseconds and that works for me.

with the EasyDriver the ON time is not the time that the stepper takes to make a (micro)step. it is just an input pulse that makes the driver chip make a step. According to the datasheet a few nanoseconds pulse is enough... But as mentioned before, others said that they needed longer ON pulses.

Link to comment
Share on other sites

Yeah, I was using millisecond delays but switched to microseconds. I have been doing this:

Set HIGH

delay 1

Set LOW

delay 2

for each pulse. So delay2 would be where you do the 1microsec delay. What do you delay at delay1?

When I tried 500 microsecs for both delays, I got a loud whine and vibration but I think it moved. It didnt sound healthy though.

Sent from my iPad using Tapatalk

i use the following-

digitalWrite(stepperPin, HIGH);

delayMicroseconds(SPEED);

digitalWrite(stepperPin, LOW);

delayMicroseconds(SPEED);

with speed set to 800. If you have the easydriver you need to check the current adjustment as well...the little pot on the board.

Chris the 1ms didnt work for me but i should really test at what point it fails rather than just say it dont work...you never know 2 might be fine :hello2:

Link to comment
Share on other sites

Tamiya, you won't be providing power to a motor from the arduino uno, not a chance :hello2: But of course you can use a suitable circuit to connect it to an uno so you can control it. Trying to use the the arduino to power anything bigger than a small hobby motor is asking for burnt traces!!

Link to comment
Share on other sites

I see there's a 1-wire library at least partly implemented for the Arduino. That could be interesting from a weather station point of view. I have quite a few 1-wire weather sensors (rain gauge, temperature, RH, solar intensity, wind direction and speed etc.).

James

Link to comment
Share on other sites

i use the following-

digitalWrite(stepperPin, HIGH);

delayMicroseconds(SPEED);

digitalWrite(stepperPin, LOW);

delayMicroseconds(SPEED);

with speed set to 800. If you have the easydriver you need to check the current adjustment as well...the little pot on the board.

Ok, so you're doing the same as me with symmetric timing. I found that 750 works. But see below.

Chris the 1ms didnt work for me but i should really test at what point it fails rather than just say it dont work...you never know 2 might be fine :hello2:

I tried the 1 micro sec delay between HIGH/LOW, and this worked for me, but only if I increase the total pulse length. So using 1/750 instead of 750x750 just made the motor whine and not actually move. When I changed to 1/1500 micros, the motor moved and the sound was ok-ish.

I experimented with the 1500 value to see what would also work. Basically anything below 1000 and the motor doesn't move. At 1000 it moves, but not properly. 1100 and things begin to operate normally, but it sounds very loud. Values from 1300 to 1500 sound alright, but 1400 is perhaps the quietest.

So it seems this motor likes to be driven at a particular frequency range. And the 1us delay works, but only if the overall pulse width hits the motor sweet spot. Maybe it also depends on the driver board. I use something similar to (but not) the EasyDriver. Mine came from CoolComponents in the UK. It's the only driver board they sell for steppers.

David

Link to comment
Share on other sites

Another question, I notice some of you, maybe just Chris actually, have a relay on your focuser boards, presumably to control the power to the motor so the Arduino can switch it on and off.

Do you think this is totally necessary? I'm thinking of adding a relay to my circuit for this, but not sure of the benefits. If I don't really need it, I will just go ahead and migrate my circuit from breadboard to PCB (strip board) and box it up.

What relay component did you use out of interest?

David

Link to comment
Share on other sites

Another question, I notice some of you, maybe just Chris actually, have a relay on your focuser boards, presumably to control the power to the motor so the Arduino can switch it on and off.

Do you think this is totally necessary? I'm thinking of adding a relay to my circuit for this, but not sure of the benefits. If I don't really need it, I will just go ahead and migrate my circuit from breadboard to PCB (strip board) and box it up.

What relay component did you use out of interest?

David

I read that the driver chip on the EasyDriver doesn't like it if the motor gets unplugged when the motor is energised. So what I did is to put the EasyDriver next to the stepper on the focuser to avoid accidental unplugging. Now I'm just running a long 4 core cable between Arduino and EasyDriver with the DIR and STEP lines, 12V and GND.

Then I noticed that both the motor and especially the EasyDriver get quite hot. I didn't want that constant heat source near my draw tube so I had to come up with some way of de-energising the stepper when it wasn't needed. I could have used the Enable pin on the EasyDriver but I had already prepared the 4 core wire and 4 pin RJ-10 sockets. So I decided to use a relay that cuts the 12V to the EasyDriver controlled by the Arduino. It currently switches off power 20 seconds after the last move.

If I were to do it again, I would instead use a 5th wire and use the Enable pin. The disadvantage of cutting power with a relay is, I believe, that the stepper jumps to the nearest full step when it is energised again without the Arduino knowing about it. When microstepping is used the step counter might be a few steps off each time power is switched off and on again.

The relay I used was salvaged from some old device, I don't have much info on it.... It has a 5V coil and max switching current is 1A.

Link to comment
Share on other sites

I read that the driver chip on the EasyDriver doesn't like it if the motor gets unplugged when the motor is energised. So what I did is to put the EasyDriver next to the stepper on the focuser to avoid accidental unplugging. Now I'm just running a long 4 core cable between Arduino and EasyDriver with the DIR and STEP lines, 12V and GND.

Then I noticed that both the motor and especially the EasyDriver get quite hot. I didn't want that constant heat source near my draw tube so I had to come up with some way of de-energising the stepper when it wasn't needed. I could have used the Enable pin on the EasyDriver but I had already prepared the 4 core wire and 4 pin RJ-10 sockets. So I decided to use a relay that cuts the 12V to the EasyDriver controlled by the Arduino. It currently switches off power 20 seconds after the last move.

If I were to do it again, I would instead use a 5th wire and use the Enable pin. The disadvantage of cutting power with a relay is, I believe, that the stepper jumps to the nearest full step when it is energised again without the Arduino knowing about it. When microstepping is used the step counter might be a few steps off each time power is switched off and on again.

The relay I used was salvaged from some old device, I don't have much info on it.... It has a 5V coil and max switching current is 1A.

Ah ok, yes I'm currently using the Enable pin on my driver board to control whether the motor gets energised, and for exactly the same reason - it gets too hot otherwise.

So, it sounds like I don't need a relay. I'm already solving the problem you used it for, which is good news for me. I don't want to have to tinker more with this circuit. Its already taken a ridiculous amount of time to get all the mechanical parts. So I'm looking forward to getting it boxed up and putting the focuser back on the scope.

Next I have the task of writing some control software for it. I'm a Mac user so the Windows solutions aren't good for me. I'm hoping to make an automatic focusing system a bit like FocusMax eventually. But in the meantime, I'll at least have an electric focuser!

David

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.