Arduino Forum

Community => Exhibition / Gallery => Topic started by: wattevah on Jun 08, 2014, 12:50 pm

Title: [ASTROPHOTO] Autoguiding using an old webcam and an arduino
Post by: wattevah on Jun 08, 2014, 12:50 pm
Hi everyone,

Just a quick post here to share a little project I finished this week:

Autoguiding using a webcam an an arduino

So if you know a bit about astrophotography you know about the need to have accurate star tracking. This is often achieved with a seperate camera tracking a "guide-star". As I'm a student and thus have little money, I took a shortcut and built a DIY autoguiding system. I finally got around writing the ASCOM driver for it, so I thought I should share this. As I'm too lazy to maintain a personal website, I'm posting all the info here, who knows, might be helpful to someone  :)

The results are suprisingly good. I was able to achieve 5 minute exposures at 300mm (450mm equivalent for full size sensors) without any trails. I think I'll even go towards 10 minutes next time.  8)

The setup:


Some pics (click for full size) :
(http://i.imgur.com/eMFcNFOs.jpg) (http://imgur.com/eMFcNFO) (http://i.imgur.com/PQoN7E4s.jpg) (http://imgur.com/PQoN7E4) (http://i.imgur.com/6GRkwRas.jpg) (http://imgur.com/6GRkwRa)


Attached are the .ino code running on the arduino, and the .exe is the installation file for the ASCOM drivers. The C# source code is included, you'll need a tool like MS Visual Studio (express is free) to compile the code.

EDIT: Added the *raw* source code for the ASCOM driver and the STL file for the 3d printed part.

Cheers !
Luca
Title: Re: [ASTROPHOTO] Autoguiding using an old webcam and an arduino
Post by: robtillaart on Jun 08, 2014, 08:25 pm
Hi  Wattevah
Thanks for sharing!

can you share also the source of the ascom driver?

(many people don't like to click on an .exe file)
Title: Re: [ASTROPHOTO] Autoguiding using an old webcam and an arduino
Post by: wattevah on Jun 08, 2014, 10:19 pm
You're right about the exe. I added the raw source code. In that case you'll need the create an ASCOM project from scratch and add it manually ! Otherwise just install the .exe and click "install source code".

Luca
Title: Re: [ASTROPHOTO] Autoguiding using an old webcam and an arduino
Post by: robtillaart on Jun 08, 2014, 11:12 pm
Thanks!  appreciated
Title: Re: [ASTROPHOTO] Autoguiding using an old webcam and an arduino
Post by: dtokez on Jun 09, 2014, 03:49 pm
amazing! looks like epic work, have you got any images to share to show the results?
Title: Re: [ASTROPHOTO] Autoguiding using an old webcam and an arduino
Post by: wattevah on Jun 10, 2014, 09:02 am
Here's a picture of the veil nebula I did the first night I tested the mount:
(http://i.imgur.com/zRBrMVcs.jpg) (http://imgur.com/zRBrMVc)

Canon 1100D, EF 70-300mm lens, f5.6, 4x300s, IS0800. It was just to test the tracking of my mount. More frames and even longer exposures would have given a better result. The lens wasn't focused properly: you can see that the stars in the lower right of the picture are oval even though the stars on the top left are perfectly round. I'll have to double check that next time, hope it is not a lens defect.

I did not have time to shoot more. Hopefully we'll have clear skies this week-end, but I wouldn't count on it. Plus the moon is up.


Luca
Title: Re: [ASTROPHOTO] Autoguiding using an old webcam and an arduino
Post by: vendinleciel on Sep 11, 2014, 08:55 am
Congratulations for your work

I am new on this forum; i am amateur in astronomy and i live in the north of france.
Arduino is very interseting to make small dyi projects.
Your application for small astronmical mount tracking is very intersting so i should want to realize it with my canon 550d on my eq1.
Can you give me more information aabout the system: wiring between stepper motor and driver controler, and with arduino pins and webcam (schematix picture if possible) and how start  and stop the system.
I try to animate a small group but in north of france the sky is often cloudy!

Have a good day
Title: Re: [ASTROPHOTO] Autoguiding using an old webcam and an arduino
Post by: orly_andico on Oct 14, 2014, 02:02 pm
This is very nice work, I am no good at ASCOM drivers so I am re-using the ASCOM driver posted here.

However when using OpenPHD2 2.1.3a I was getting errors "ascom driver failed checking slewing" every time a guide pulse is sent to the mount?!?!? and I have to click the OK button on the error box that pops up.

Apparently a fix was added in OpenPHD 2.3.0 which allows PHD2 to ignore this type of error.  When I upgraded to 2.3.1 the error still pops up but I now can guide.  My challenge now is getting PEC working.
Title: Re: [ASTROPHOTO] Autoguiding using an old webcam and an arduino
Post by: wattevah on Oct 25, 2014, 11:47 am
Can you give me more information aabout the system: wiring between stepper motor and driver controler, and with arduino pins and webcam (schematix picture if possible) and how start  and stop the system.
Salut ! Je ne suis pas chez moi en ce moment, je ne peux donc pas te donner exactement la schématique du montage. Cependant, tout se trouve sur le net ainsi que dans mon code. Pour les branchements moteur-stepper driver tu peux regarder ici. (http://www.pololu.com/product/1182) La webcam est une webcam standard qui se branche via USB. Nimporte laquelle devrait faire l'affaire, a condition qu'elle permette de bien voir les étoiles (éventuellement changer l'objectif, comme je l'ai fait). Le reste du controle se fait avec OpenPHD, il y a des tutoriels sur le net ! Hésite pas si tu as des questions, j'essairai de répondre !

However when using OpenPHD2 2.1.3a I was getting errors "ascom driver failed checking slewing" every time a guide pulse is sent to the mount?!?!? and I have to click the OK button on the error box that pops up.
This is possibly due to my lazyness, I only implemented the PulseGuide functions in the driver. If openPHD tries to slew the mount, it will fail because it will not respond. Do no try to slew the mount within openPHD. FYI I'm using openPHD 2.2.2g.

Apparently a fix was added in OpenPHD 2.3.0 which allows PHD2 to ignore this type of error.  When I upgraded to 2.3.1 the error still pops up but I now can guide.  My challenge now is getting PEC working.
Good luck ! Don't hesitate to ask me stuff if you have any questions !
Title: Re: [ASTROPHOTO] Autoguiding using an old webcam and an arduino
Post by: plgiorgi on Mar 23, 2015, 03:16 pm
Hi Luca, I'd like to try a solution very close to your project. I'd like to use an EyeToy Silver (PS2, Namtai CMOS VGA resolution). Do you utilized an EyeToy as well? It seems to me that you mounted an standard 50mm lens in front of the webcam. How well your set up performed during autoguiding? I suppose your EyeToy was modded by removing the original lens group, right?
Gigi

https://sites.google.com/site/gigimysite/home/astro (https://sites.google.com/site/gigimysite/home/astro)
Title: Re: [ASTROPHOTO] Autoguiding using an old webcam and an arduino
Post by: wattevah on Apr 23, 2015, 10:36 pm
Hi Gigi,

Yes, I also used a PS2 eyetoy camera, black version though  ;)  I removed the PCB from the housing and made a custom 3d printed housing designed to work with a 50 mm lens, for three reasons:
- The focal length of the original plastic lens is way too short (wide angle)
- The aperture is very low, it would have been difficult to get any stars
- The optical quality is poor.

I used an old 50mm f1.4 yashica lens (which BTW is extremely sharp!) instead, and it works well. The autoguiding part works very well, however the mount I used is crappy, so that's the area where currently I can improve the most.

Good luck!
Title: Re: [ASTROPHOTO] Autoguiding using an old webcam and an arduino
Post by: plgiorgi on Apr 23, 2015, 10:59 pm
Thanks Luca for your response! I also removed the PS2 lens and made a simple adapter for my Nikon lenses (see here (https://picasaweb.google.com/110161483001058852427/ATMDIYAstronomyEyeToyMod?authuser=0&feat=directlink)). The idea is to use a 400mm Sigma to take astrophotos and a 200mm as guiding scope (here (https://picasaweb.google.com/110161483001058852427/AdjustableGuideTelescope?authuser=0&feat=directlink)) not tested yet. My doubt is that 200mm for guiding is too much ... you use a 50mm  :o
Gigi
Title: Re: [ASTROPHOTO] Autoguiding using an old webcam and an arduino
Post by: vendinleciel on Apr 30, 2015, 10:03 pm

Bonjour

J'ai réaliser le montage, mais ma monture n'est pas exactement la même que celle que tu utilises; de plus mon moteur pas à pas est un 200 pas.

Dans ta formule:
//Fixed track rate
// 1 day = 86'400'000 ms
// 1 day = 1 big wheel turn = 100 small screw turns
// 1 screw turn = 864'000 ms
// 1 screw turn = 1 motor turn = 400 steps * 16 (microstepping)
// 1 motor step = 135 ms
// Timer1 OCR : 1000ms = 15625 units
// 15.625*135 = 2109.375 = 2109 (value for 1.0x sidereal rate)

à quoi correspond: Timer1 OCR : 1000ms = 15625 units et dans mon cas y a t il quelque chose à changer?
à part mettre 200 à la place de 400 et modifier le calcul avec la valeur induite par mon big wheel turn?

Bonne soirée
Title: Re: [ASTROPHOTO] Autoguiding using an old webcam and an arduino
Post by: wattevah on May 20, 2015, 02:22 am
My doubt is that 200mm for guiding is too much ... you use a 50mm  :o
Nice setup you have there. Yes, 200mm is going too much if you have a 400mm lens on the main camera. I think a lense somewhere between 50-100mm should do the trick. Use the brightest lens available.

Bonjour

J'ai réaliser le montage, mais ma monture n'est pas exactement la même que celle que tu utilises; de plus mon moteur pas à pas est un 200 pas.

Dans ta formule:
//Fixed track rate
// 1 day = 86'400'000 ms
// 1 day = 1 big wheel turn = 100 small screw turns
// 1 screw turn = 864'000 ms
// 1 screw turn = 1 motor turn = 400 steps * 16 (microstepping)
// 1 motor step = 135 ms
// Timer1 OCR : 1000ms = 15625 units
// 15.625*135 = 2109.375 = 2109 (value for 1.0x sidereal rate)

à quoi correspond: Timer1 OCR : 1000ms = 15625 units et dans mon cas y a t il quelque chose à changer?
à part mettre 200 à la place de 400 et modifier le calcul avec la valeur induite par mon big wheel turn?

Bonne soirée
Hello.

Tous d'abord, il y a une petite erreur dans mon texte. Une rotation complete de la terre prend 23h56m04s et non 24h comme écrit. Partons donc avec comme objectif un "tour de monture" en 23h56m04s. Supposons que la grand roue (je ne connais pas le nom exact  :) ) a 100 rainures. Il faut donc 100 tours de petite vis pour tourner de 360 degrés. Regle de trois, on trouve qu'il faut faire un tour de petit vis toutes les 86164/100 = 861.64s. Ton moteur a 200 pas par tour. Il te faut encore savoir si tu fais du full-step, half-step ou microstepping comme moi (je divise un pas par 16...). Je vais supposer que tu fais tu half-stepping ici. Tu as donc 200*2 pas par tour. Il faut donc faire un pas tous les 861.64/400 = 2.15 secondes.

Pour créer le signal qui steppe ton moteur, tu utilises un compteur qui va de 0 à 65535 (16 bits) en 8388.608 millisecondes. (Voir ici pour details, prescaler = 1024: http://playground.arduino.cc/code/timer1).

Si tu veux attendre 2.15 secondes, il faut donc configure le timer compare match register à une valeur correspondant à 2150ms. Celle ci est (regle de trois...) : (2150/8388)*65535 = 16797.8 = 16798.

Tu peux donc definir trackRate = 16798. trackEast doit etre plus grand (=ralentir le mouvement), trackWest doit être plus petit (=accelerer).

J'espère avoir été a peu près clair. De toute manière tu peux définir une valeur puis regarder si ça marche, et changer au besoin.

A+
Title: Re: [ASTROPHOTO] Autoguiding using an old webcam and an arduino
Post by: tksandy on Jun 10, 2015, 07:47 am
I'm in the early phases of designing and building my own mount (powered by stepper motors) and this is a huge help!

I'm pretty new to this all though, and have a few questions:

I'm planning on 2-axis guiding (both RA and DEC). How can this be changed to work with a dual-axis guiding system? I can probably figure out how to tweak the arduino code myself, but will the ASCOM driver still work? How would I need to change that?

Also, out of curiosity since I'll need to be buying my own, which pololu stepper driver did you use?

Thanks!
Title: Re: [ASTROPHOTO] Autoguiding using an old webcam and an arduino
Post by: wattevah on Jun 25, 2015, 01:35 am
will the ASCOM driver still work? How would I need to change that?
In the ASCOM driver, you have to change line 640, add the north and south direction to the PulseGuide method.  See the manual (http://www.ascom-standards.org/Help/Platform/html/M_ASCOM_DeviceInterface_ITelescopeV3_PulseGuide.htm).

In the arduino code you'll have to add the entire DEC axis control code, but you can basically copy what I did for the RA axis.

Sorry I really skipped a lot of stuff and went for the essential part for my project  :)


Regarding the polulu stepper driver, I think I have the 2amps version that can do 16x microstepping




Title: Re: [ASTROPHOTO] Autoguiding using an old webcam and an arduino
Post by: Kasty on Oct 06, 2015, 09:51 pm
What are your PHD2 settings? Im trying to connect a normal webcam but the screen is always black, and also the mount, i am also using an EQ1 but dont know what so select, i actualy havent found any tutorial about the PHD guiding :(
And also, your webcam, can you do a long exposure for guiding or is the lens powerful enough to colect enough light so the sensor of the camera catches it?

Thank you, awsome idea and great work :)
Title: Re: [ASTROPHOTO] Autoguiding using an old webcam and an arduino
Post by: Forrest_Erickson2002 on Dec 12, 2015, 11:12 pm
Trying to compiler your C# code.
Using Microsoft Visual Studio. 
I got over 60 errors.
I added the Platform 6 Developer Component  dlls for Platform6
I am down to four errors.
I get the following errors messages:

Code: [Select]
Error 1 The type or namespace name 'SetupDialogForm' could not be found (are you missing a using directive or an assembly reference?) c:\users\vrx\documents\visual studio 2013\Projects\arduinoMount\arduinoMount\Driver.cs 122 20 arduinoMount

Error 2 The type or namespace name 'SetupDialogForm' could not be found (are you missing a using directive or an assembly reference?) c:\users\vrx\documents\visual studio 2013\Projects\arduinoMount\arduinoMount\Driver.cs 122 44 arduinoMount

Error 3 'ASCOM.ArduinoMount.Telescope.AxisRates(ASCOM.DeviceInterface.TelescopeAxes)' is a 'method' but is used like a 'type' c:\users\vrx\documents\visual studio 2013\Projects\arduinoMount\arduinoMount\Driver.cs 346 24 arduinoMount

Error 4 'ASCOM.ArduinoMount.Telescope.TrackingRates' is a 'property' but is used like a 'type' c:\users\vrx\documents\visual studio 2013\Projects\arduinoMount\arduinoMount\Driver.cs 890 52 arduinoMount



No idea what to do next.
Title: Re: [ASTROPHOTO] Autoguiding using an old webcam and an arduino
Post by: Forrest_Erickson2002 on Dec 14, 2015, 03:18 am
Regarding, "Im trying to connect a normal webcam but the screen is always black,"

I had the same problem.  You have to select the camera with the camera icon lower left. Then you have to press the looping icon which, if I remember correctly, is the third from the left. It looks like a looping horizontal arrow. Then you start getting video from the web cam.
Title: Re: [ASTROPHOTO] Autoguiding using an old webcam and an arduino
Post by: amjorge on Apr 03, 2018, 02:41 am
Nice work and thanks for sharing.

I was working on a single drive axis Arduino controlled for EQ1. But no ST4 interface.

A very cheap 28byj stepper with interface and Arduino Uno.

Sideral day of 23h56m04.1s must be consider instead of a solar day of 24h00m00s. This must be done because at the same time Earth do a complete rotation we advance almost one degree (1/365.25) around the Sun orbit.

Well, a lot of calculation could be implemented If you consider the Earth's eliptic orbit and even VSOP 87 theory for planetary position to know the real sideral day length but It appears to be ok.
Title: Re: [ASTROPHOTO] Autoguiding using an old webcam and an arduino
Post by: amjorge on Apr 03, 2018, 02:50 am
In time: How do autoguider works with one axis only?!
Title: Re: [ASTROPHOTO] Autoguiding using an old webcam and an arduino
Post by: austinstephens on Apr 24, 2018, 12:02 am
Hello,
I am getting an error "ASCOM driver failed checking isPulseGuiding" when running PHD 2. I have an Arduino UNO connected to a Big Easy Driver to a NEMA 17 Stepper motor that is attached to the RA worm gear shaft.
I'm sure I missed something here. Any help is, very much, appreciated.
Title: Re: [ASTROPHOTO] Autoguiding using an old webcam and an arduino
Post by: skymattisky on Jun 10, 2018, 01:06 pm
Hey,

I wanted to do this as a project for university and this post actually helped me a lot.

In my case, I expanded the code for RA and DEC tracking using the EasyDriver and two NEMA 17 1.8 deg motors. I also implemented the slewing feedback to get rid of the error message. Heres the github link: https://github.com/mattisky/Arduino_Ascom_Project (https://github.com/mattisky/Arduino_Ascom_Project) .I'm glad if this might help somebody and if you have questions go ahead.

Matti
Title: Re: [ASTROPHOTO] Autoguiding using an old webcam and an arduino
Post by: BarbarossaRexA on Jan 06, 2019, 02:00 pm
Hey,

I wanted to do this as a project for university and this post actually helped me a lot.

In my case, I expanded the code for RA and DEC tracking using the EasyDriver and two NEMA 17 1.8 deg motors. I also implemented the slewing feedback to get rid of the error message. Heres the github link: https://github.com/mattisky/Arduino_Ascom_Project (https://github.com/mattisky/Arduino_Ascom_Project) .I'm glad if this might help somebody and if you have questions go ahead.

Matti
Hey there!

How do I compile this .cs-file correctly?

When I do it, I get a bunch of errors calling out missing references to ASCOM.

Greetings!
Title: Re: [ASTROPHOTO] Autoguiding using an old webcam and an arduino
Post by: Bojan on Feb 14, 2019, 12:59 am
Very interesting project!
Did you consider interfacing CCD chip (TC237 in particular) to Arduino, so the sketch can guide the mount via ST-4 interface (OnSTEP, for example), completely stand-alone?

Some time ago I did something similar (it was for another application, with one of Philips processors), there was also very primitive "star" detection (assumed round illuminated shape, treshold was at 50% level from CCD chip), it sort of worked..)