Amazed from the power and the small dimensions of the LPC800 family of microcontroller , I tried to adapt a servo motor controller project and software found on the internet. The experiment was succesfull so I integrated it with all the necessary to implement a dual motor controller for astronomical applications. Thanks to the low cost of the microcontroller I prefer to use two LPC's, one for each motor.
The target is to control my small telescope motors with my android phone running SkySafary APP, an astronomical chart capable to drive telescopes via various standard commercial telescopes protocols. I added a RaspberryPi for the astronomical calculations with a python program. The raspberry serial port links to the dual servo controller which serial ports are daisy chained. Probably all the calculations could even be done in C under a third LPC controller ... but I love python and the raspberry is powerful and cheap too !
A bluetooth slave module is added for the communications between python program and the smartphone, one of the two LPC servo microcontrollers care about it. I tried some days to employ an usb-bleutooth dongle fot this purpouse but the Bluez stack of linux is not so simple as the slave module. Moreover the cost is about the same !!! I could also use WiFi connection, but this, if enabled, prevent the smartphone to access internet, while I want to still be able to use internet while observing.
Respect to the original servo project, which employs an 8bit AVR microcontroller, this one gains from the 32bits calulations which allows for faster execution. This leave the necessary resources to implement a position loop with ramp profile generator used in rapid positionings. The position loop counter is able to count up to +-16.000.000 pulses in 24/8 notation. This is enough for the overall travel of the telescope and allows for fine speed regulations necessary during sky tracking in AR axe.
This powerful LPC family unfortunately lacks of EErom onchip ... so it is not possible to save motor parameters like in AVr original project. This lacks can be "workarounded" by loading parametrs on startup from raspberry.
I have finally drawn the schematics a little bit better than ... by hand ! I'm not used to draw by cad so please be ... understanding :)
The python program side is still under developement and is targeted for a telescope with "german type" mount which require flip of the declination axe over the celestial meridian. For this you will need to be patient because I still lack of some mechanical parts to couple motors to the telescope, so I cannot extensively test the software.
2014-02-17: added firmware. I spent a little to translate some comments in english. To import it: In LPCxpresso File -> Import ->General - Existing project into workspace ->click on "Select source file" -> select the zipped file I provide -> select "MyTelescopeServo" in projects box -> Finish. Ctrl-B to try compile it. I compiled with V5.2.4.
In Main.c lines 62/63 comment only one line at a time to compile for Ra axe or Dec axe
2014-02-21: firmware update. The mode4 speed resolution was too low. Now the scaling factor for speed is 65535 while previusly it was 256. This allow for precise speed regulation needed for sky sidereal tracking. Moreover the position counter is now full 32bit and not only 24 .... In my telescope one complete Ra axe turn is 800*300*100 = 24.000.000 pulses !
Command reference added.