Arduino Bluetooth Digital Setting Circles for Telescope

Edit: Google Code has gone, latest source code is here.

I decided to build an Arduino digital setting circle for my mount because it's really hard to buy Tangent Instruments boxes cheaply, and the Argo Navis (the Lexus of telescope digital setting circles) is quite expensive. Besides it seemed like a cool project.

I used an Arduino Uno, which cost $32 (Singapore dollars)

an Arduino Proto Shield ($5), as well as some headers ($2)

I got an RJ-45 jack from Sim Lim Tower and soldered it to the Proto Shield. Obviously four (4) digital pins from the Arduino are needed to read the two encoder channels. A lesson painfully learned: do not use pins 0 and 1 (the serial RX and TX pins) for anything else!

Jim's Mobile (JMI) has some good documentation on the pinout of the RJ-45 encoder connector. By maintaining compatibility with the JMI/Tangent Instruments encoder cable, I ensured that my Arduino DSC is compatible with all the telescope encoder setups out there.

I used Mike Fulbright's Arduino DSC source code, although his code didn't implement 4X quadrature decoding, only 2X which results in half the encoder resolution.

In order to get 4X quadrature, you need to hook interrupts to both channels of the encoder. Since there are two encoders (RA and DEC), you need four (4) interrupts - but the basic Atmega328p CPU on the Arduino only has two interrupts. To get my four interrupts, I used the PinChangeInt library, which provides multiple virtual interrupts.

A side-effect of this choice of library is that my code won't compile on the Digilent Max32 which is a 32-bit Arduino-compatible board. I had bought this board because I wanted to make a full GoTo controller and thought I needed more RAM (the Arduino Uno only has 2K of RAM and an 8-bit processor, the Max32 has 512K of RAM and a 32-bit processor).

I also soldered a $9.95 "linvor" Bluetooth serial adapter from ebay to the Arduino proto shield and (breaking my earlier rule) wired the Bluetooth RX to the Arduino TX pin, and the Bluetooth TX to the Arduino RX pin.

A good overview of how to use these cheap Bluetooth dongles with the Arduino is here. Note that it is necessary to disconnect the proto shield from the Arduino Uno board when uploading code to the board, since the programming circuit and the Bluetooth board fight each other for control of the Arduino's serial pins (pins 0 and 1).

I then powered the Arduino DSC from a 12V supply and connected it to the RA and DEC encoders on my mount. Actually I also put a DFRobot LCD Keypad Shield on it so I could eyeball the RA and DEC encoder readings. Although for the "production" version this is completely unnecessary because the encoder counts are polled by a PC. Pairing the "linvor" Bluetooth dongle with the PC is trivial and beyond the scope of this article, but suffice it to say that the Arduino DSC was accessible on COM4 on my PC. I was able to verify its operation using Putty (RealTerm didn't work and persistently disconnected the Bluetooth connection, avoid!)

I used Dave Ek's ASCOM driver for digital setting circles and Cartes du Ciel planetarium software.

Basically, you configure Cartes du Ciel (or any Windows planetarium software that supports ASCOM) to connect to the telescope, select the Dave Ek ASCOM driver, select COM4 (or whatever COM port the Arduino DSC gets assigned by the Bluetooth subsystem) and align.

After a successful alignment, when you move the telescope mount around and the encoders change readings, Cartes du Ciel will update its on-screen reticle to correctly reflect where the telescope is pointing. Cool!

This DSC should also work with SkySafari for Android which supports Tangent Instruments-type encoders over Bluetooth. I'll test this out when I get my hands on an Android 2.2 device.

The nice thing about this DSC (as compared to say Dave Ek's DSC circuit) is that the amount of soldering and PCB-etching required is close to nil: all you need is an RJ-45 jack, the Bluetooth dongle, an Arduino Uno, a Proto Shield, and the headers.

The Arduino Uno at about $25 USD is so darn cheap that it doesn't make sense to knock yourself out etching your own PCB and soldering tiny parts to it. This DSC does require some soldering - the RJ-45 jack, headers, and Bluetooth dongle - but that's quite minimal. And the total cost is well under $100, under $50 even. Most folks want $150 plus for their old Tangent Instruments boxes, so as long as you have a laptop already or Android device, you're golden. And I always have a laptop with my mount anyway, since I use the laptop for image capture and guiding.


Gary said...

Android 4 Galaxy Nexus arriving at our shores soon! :)

dgunnell said...

Have you posted your version of the Arduino code somewhere?



Miker said...

the source code was sent to me by Orly, who wrote this blog post and he gave permission to me to put it online somewhere. So here it is:

don't hesitate to contribute, I'm still assembling the hardware to begin this project so can't test if everything works at the moment.

Unknown said...

Just wanted to say thank you for this.. Built my own set for my Skywatcher 10in and they are working great with Sky Safari Plus.