Tuesday 20 April 2010

Scope control update

Interrupts on the mbed didn't go so well - it's easy enough to get them to run a function, but some timing issues arose and I gave up on that for now. Instead I'm relying on the fact that the Autostar continuously polls for data using the same sequence of bytes - 0x02 0x11 0x02 (which correspond to length 0x02, address 0x11 aka #506 cable and command number 0x02). So, whenever I need to speak to the Autostar I can regain sync by reading data from the Autostar until the last 24 bits read form the value 0x021102 - at which point I'm back in sync and ready to go :) It's a bit of a hack, but it works and is good enough for me. Anyway, with that sorted I was in the position where I could type commands into a terminal to send to the mbed, which would then send them to the scope - but that gets a little tedious. So, this is what I'm using as of now:


It's nice and simple to use, the direction buttons at the top left move the scope at the slew rate selected below. Information about the Autostar system is shown along the top. I'm not sure how much functionality I'm going to implement on the mbed itself, but I definitely don't want it to sit there as a dumb translator between the PC & Autostar - that just seems wasteful, but it doesn't hurt to have control from the PC in addition to whatever I do on the mbed.

I even came up with a crazy scheme which might solve the problems with my mounts tracking - stick my webcam in front of the scopes finder and implement something which would watch for movement and move to compensate and keep things in the same positions in the finder. But that would probably be pretty difficult to get working properly and not 100% exact anyway.

Still, I think it's cool to be able to press a button on the PC and have the scope move around, especially considering how long it took me to get it to work :)

Code for the PC app is at http://github.com/paulburton/autostarcontrol It's built with WebKit/Gtk+ and currently very basic. I'll make the mbed code available at some point soon too.

Thursday 15 April 2010

It... speaks!!!

Following up on the mbed scope-controlling idea:


I just got this to work after many hours of coffee fueled hacking :) The mbed can now speak the Autostars kinda-i2c-but-kinda-not language, and in the pic there has asked the Autostar to report the scopes product name and firmware date.

Next I need to look into how interrupts work on the mbed, as currently as soon as the mbed leaves the scope alone to do anything else (such as writing to the LCD) it will lose sync with the clock signal the Autostar outputs and communicating won't work anymore.

Then I need to look at the commands for moving the scope and reporting its position, and eventually write the locations of some interesting targets onto the microSD card that you can see there in the top right and hook up some buttons to select one and slew the scope to the correct position :)

I'm definitely a fan of the mbed - it feels much more powerful than the arduino I was using previously, there's a lot of example code and libraries for doing things like the LCD output and SD card read/write, and it's nice to be using a proper C++ compiler. The compiler's web based and seems to fail to save at times, though that could be the fault of the dodgy net connection I'm on at the moment... Still, I've developed a game where I try to guess how many attempts it will take to save the code so it's all good fun :P

Also, it's the day before I go to the star party - so I'm not sure if this counts as a success in my planned timing. It does technically work, even if it doesn't do anything useful yet :)