[ASTROPHOTO] Autoguiding using an old webcam and an arduino

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 :slight_smile:

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:

  • Arduino nano
  • Polulu stepper driver
  • Wantai stepper motor 0.9° 1.7A
  • Old Eyetoy webcam (playstation 2 game) fitted in a 3D printed case accepting Canon EF lenses
  • Cheap orion eq-1 mount with DIY plate for mounting a DSLR with zoom lens
  • Laptop with PHD guiding 2.2.2

Some pics (click for full size) :

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

arduinoAscomMount.ino (3.07 KB)

ArduinoMountASCOMdriver.exe (474 KB)

Driver.cs (34.4 KB)

guide-cam.STL (873 KB)

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)

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

Thanks! appreciated

amazing! looks like epic work, have you got any images to share to show the results?

Here's a picture of the veil nebula I did the first night I tested the mount:

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

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

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.

vendinleciel: 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. 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 !

orly_andico: 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.

orly_andico: 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 !

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

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!

Thanks Luca for your response! I also removed the PS2 lens and made a simple adapter for my Nikon lenses (see here). The idea is to use a 400mm Sigma to take astrophotos and a 200mm as guiding scope (here) not tested yet. My doubt is that 200mm for guiding is too much ... you use a 50mm :o Gigi

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

GigiG: 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.

vendinleciel: 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+

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!

tksandy: 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.

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

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 :)

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:

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.

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.

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.