Magic Lantern Forum

Developing Magic Lantern => Feature Requests => Topic started by: calypsob on September 24, 2016, 11:23:35 PM

Title: USB output commands
Post by: calypsob on September 24, 2016, 11:23:35 PM
Can magic lantern allow for usb output commands?  I know a few people that could assist me with the coding end but I want to check if its possible first.  I want to send dithering commands to an equatorial mount between exposures, this would be a benefit for dslr astrophotography.  It would only benefit a niche audience so probably nightly build material. 

Below is a link to the lacerta mgen autoguider.  It is a camera with an interface which communicates with the guide camera and sends commands to the dslr, intervalometer commands.  It also sends st4 commands to the equatorial mount which allow it to dither, move several pixels in each direction between exposures.  This allows you to calibrate out noise between exposures when doing a median stack in post processing.  http://www.teleskop-express.de/shop/product_info.php/language/en/info/p4173_Lacerta-MGEN-Stand-Alone-Autoguider-for-astrophotography.html
I want to avoid using a lacerta mgen, or a laptop to dither, I dont want a guide camera at all because my eq mount does not need autoguiding in its current configuration, I just want my dlsr, lens and the ability to dither during an intervalometer run.


here is an adapter which converts usb to st4  http://www.highpointscientific.com/zwo-usb-to-st4-adapter-usbst4?utm_source=google&utm_medium=cse&utm_term=ZWO-USBST4&gclid=CJb8t-_1qM8CFdgBgQodLWAMeQ

If I could tell magic lantern to send out dither commands, then all I would need is a usb cable.  some mounts use usb instead of an st4 port so either way the stock canon usb cable works.  CAn we send these simple st4 commands?  This would be huge  for astrophotography.  I did not go into detail on this process because I dont want to spend to much time explaining if ML cannot send usb commands.  Anyone with some experience please let me know and I will start contacting some coders.  Thank you

Title: Re: USB output commands
Post by: calypsob on September 24, 2016, 11:26:44 PM
I need to explain the work flow here briefly

Camera>Bulb mode

ML Intervalometer>Exposure time

>Delay between exposure, the option to shoot like crazy or wait a certain time>During this time a dither command would be sent to dither several pixels either north, south, east, or west

>after the delay the next exposure begins. 
Title: Re: USB output commands
Post by: a1ex on September 24, 2016, 11:56:33 PM
It's possible to talk to another device via PTP. There is some proof of concept code around, including a remote control app, but I'm not sure how easy is to create a generic USB driver or adapt some custom protocol (didn't really look into it).

Maqs has a proof of concept about talking to an Arduino from ML via USB, if this would help.
Title: Re: USB output commands
Post by: ItsMeLenny on September 25, 2016, 04:47:45 AM
I can't remember who made this, I think a marcus someone, and there used to be a video somewhere on youtube.
But using arduino and a usb shield, plus a module or script for magic lantern, they were able to control an LED (on and off) from a magic lantern menu, in addition to being able to control it with a button on an arduino which would control the on off in the menu on magic lantern, so the two were always synced up.
Title: Re: USB output commands
Post by: SpcCb on September 25, 2016, 05:06:04 AM
Hello calypsob,

You're not the only one who thought to do that, ML direct to ST4 for dithering ;) It's nice to see someone else !
I'm agree with a1ex, it's possible to send simple orders via PTP through the camera USB. Not quite easy by the way (I loose some neurons with the ptp.h !), especially if you want to drive an USB to ST4 interface. It looks like to transform the camera USB into an USB OTG (?), with a 5V power line from the camera (not safe IMHO), etc.
And it's not possible to drive the ST4 interface of your mount directly from the USB, you will need to use a pair of relays or optocouplers (solid state relays or eq.) between the USB and the ST4 because of the electronic level differences and because it's not safe too.
So in both cases you will need some electronic between the camera and the mount, and/or the camera and the USB-ST4 interface. :/

Another application will be to drive robot-focusers or EF lens from ML, by pointing a star in LV mode, with a real time FWHM algorithm... ^.^' <3 But it's an offtopic dream. :)