This variation on my Digital Setting Circles project was created by Craig Combes. He provided the following content so others could recreate his version. Thanks, Craig!

Many people use Dave’s serial DSC board with a serial to Bluetooth adapter and that can get quite pricey,  large and power hungry. So I adapted Dave’s design to skip the RS232 circuit and go straight to Bluetooth. In the process, I decided to change the PIC to a less expensive, and more recent chip: the 16F628A, which Dave had code for already. I made some minor tweaks to the code to eliminate some pull up resistors.

The new design uses a 5 volt regulator (to make sure the encoders are happy) and a 3.3 volt regulator to supply everything else (the Bluetooth module needs 3.3v). I used a MOSFET for polarity protection to reduce the input voltage requirement. I also replaced the oscillator module with a crystal to reduce cost and power consumption. The Bluetooth module is a surface mount device and the boards I created  have 11 pads to solder for this device. Most of the other components (not the PIC) are surface mount also, but there aren’t many of them and their are only a few pins maximum per component to solder, so it’s not difficult.

The Bluetooth module is the RN-42 from Roving Networks, which only uses 30ma when transmitting, 3ma when “sniffing” and 26ua when sleeping. I have it configured to communicate at 9600 baud. For more info on the RN-42, you can go here:

http://www.rovingnetworks.com/rn-42.php

D1 is the power on indicator LED. SW1 is the reset button for the RN-42 and the PIC. D2 is the status indicator light for the RN-42. D2 blinks until connected, then it stays on.

I do have boards made for this circuit and I will eventually make them available through FAR Circuits, like Dave’s original board. I am open to suggestions for improving the design/board. Just send me a note here.

Here is the schematic diagram (click to enlarge):

Bluetooth DSC Schematic

The parts list:

Part Description Mouser Part No. Price
R1 & R3 470 ohm resistor
R2 & R4 10k ohm resistor
R5 1.6k ohm resistor
C1 10uF 15V aluminum electrolytic capacitor
C2, C3, C6 0.1uF 10V (or greater) capacitor
C4, C5 33pF 10V (or greater) capacitor
D1, D2 LED
Q1 P-Channel MOSFET 863-NTR1P02T1G $0.36
U1 UA78L05 5v Voltage Regulator 595-UA78L05ACPK $0.48
U2 UA78M33 3.3v Voltage Regulator 595-UA78M33CDCYR $0.60
U3 Microchip PIC16F628A   Microcontroller 579-PIC16F628A-I/P $2.07
U4 Roving Networks RN-42 Bluetooth Module 765-RN-42 $19.95
SW1 Normally Open Pushbutton switch
J1 Dual RJ-11 jack
X1 Crystal ±20ppm 4MHZ Fundamental 815-ABL-4-B2 $0.39

Right-click here to download the .hex file for the PIC.

Here’s a picture of the completed board (click to enlarge):

Completed Bluetooth DSC board

21 thoughts on “Bluetooth Digital Setting Circles

  1. Can I use this with a high resolution encoder 48K CPR?

    Will the hardware be able to handle that frequency of clicks. For a push-to telescope, I guess the max rate will be 1/4 revolutions per second = 16K per second. Considering two encoders, that would be net 32K per second.

    Not only frequency, would the protocol support that man bits for reporting the current click-count?

    For the client software I don’t worry much, because I will be writing my own software. Just as long as the protocol allows it.

    Thanks,
    Harshad

    Reply
    • Heh! I screwed up my math. The max rate would be 1/4 rps = 12K per second. For two encoders that would be 24K per second.

      Would the PIC be able to handle that rate?

      Reply
    • Harshad, the max my circuit can handle 64K quadrature tics per revolution. If the gear ratio between the telescope axis and the encoder is 1:1, then that means that your encoder must not be more than 16K CPR (because 1 CPR = 4 quadrature tics). If the gear ratio is different than 1:1, adjust accordingly. The limit is due to the fact that the decoder box uses only 16 bits to store the current encoder position.

      That being said, there is little to be gained by exceeding 10-20K encoder tics per revolution. I usually recommend getting 1000 or 1024 CPR encoders (again, assuming 1:1 gear ratio). That gives you a resolution of about 0.1 degrees. Any additional encoder precision is wasted on mount errors, alignment errors, slippage, etc.

      I’ve never been able to make my decoder box miss counts when using ~ 4000 tics/rev (1000 CPR). I’m not sure what the upper limit is for not missing counts–you might be able to do as high as 10,000 counts/sec, but that’s probably stretching it.

      Dave

      Reply
        • Craig replaced the 16F84 with the 16F628, but he’s still clocking it at the same rate because the PIC code depends on a 4-MHz clock rate (for timing of the serial communications at 9600 baud). So, the max rate will be the same as before.

          Reply
  2. Hello Dave,

    i have a question about the use of the pic16f628:
    on the schematic adapted for the bluetooth communication it appears that you still connect rs232 (TX/RX) communication line to pins RA1 and RB0. But the pic16f628 have dedicated USART pins (RB1 and RB2). Is the schematic wrong or is it by purpose? Are
    the hex file (the bluetooth one and the normal one ) compatible with the two microcontrollers?
    Thank you!

    Reply
    • Joel, the schematic is correct. I did port the code over from the 16F84 to the F628, but didn’t change it to use the 628’s onboard UART. The only reason I ported it was because the 628 is cheaper than the 84. When Craig did the BT version, his code changes were done simply to eliminate some pullup resistors. I don’t think his hex code is compatible with the 84.

      Dave

      Reply
  3. Dave,

    Is this BT board and PIC available at Far Circuits?
    If not then would it require a PIC programmer since I do not see a ISP port on the board?

    Reply
    • Bradley, you might email Craig Combes directly (he’s the one who came up with this design) to see if he has any more boards/chips for this project. There’s a link above to his email address.

      Dave

      Reply
  4. Hi Dave, all

    I have finally finished my DSC based on this circuit but with a wifi-rs232 module (roving network RN-XV or RN-171 or equivalent) instead of the bluetooth.
    The “road” was a little bit tricky, but now it works. So i can connect to my dsc with an iphone/ipod touch and skysafari for example!!!
    Somethink to know, is that by default these wifi modules send to the local uart (wired) some messages which are creating troubles and prevent the good function!These messages are HELLO at the connection, and OPEN and CLOS each opening/closing of the ports (which is done by the iphone/ipod software,each query…)). So before doing anything it is mandatory to setup the module with null messages for that (quite simple: in command mode, send “set com close 0″ then “set com open 0″, then “set remote 0″ then save to the module!! it is well documented in their datasheet)

    Thank you for this nice circuit!!
    Joël

    Reply
  5. Dave,

    by the way, with skysafari, it doesn’t look to be possible to program the resolution in the encoder (skysafari do not send resolution setting queries). So i have to write it in “hard” so to speak in the encoder code. Can you tell me where they are located in the hex file, so that i can modify it easily with my own values?
    REgards
    Joël

    Reply
    • Joel, the easiest way to get the encoder resolutions into the box would be to use my testing program (EkBoxTester.exe). The resolutions are stored in EEPROM, so once they’ve been sent to the box once, they’ll remain in the box even when powered off (or until different resolutions are sent).

      Hope this helps –

      Dave

      Reply
  6. hi
    I was wondering what about the CTS & RTS on the rn-42
    do they need to be connected to something in order to transmit and receive data by Bluetooth
    and please I want to ask does it matte if am using a different PIC micro controller
    in my project am using PIC16f877A and I want to interface it to the rn-42 HID module does it have the same interface ?

    Reply
    • No, the CTS and RTS aren’t used.

      The PIC chip used in my interface doesn’t know about the RN-42 module at all. It’s simply transmitting serial data at TTL voltage levels (the same data/voltages that go into the MAX232 chip to be converted to RS-232 levels in the serial version of my board). The only thing that should be necessary is to make sure the RN-42 baud rate is set to the correct rate coming from the PIC (in the case of my circuit, 9600 baud).

      Reply
  7. Can anyone supply schematic to use the RN-171 with the DSC so i can connect to my iStuff?

    I bought a completed bluetooth dsc from Craig and it works great with my windows laptop, but won’t pair with my iPhone or iPad.. actually they don;t even see it.. anyways, i’d like to build one using the wifi module and need help.

    Reply
    • Unfortunately, Apple has locked down bluetooth in the iPhone and iPad, at least according to the Sky Safari FAQ (see questions 18 and 19). Only Apple-approved accessories will work.

      Regarding a wifi version, I’m not able to help you there–I have no experience with a wifi version or trying to construct one. Perhaps there is a serial-to-wifi converter of some sort you could employ.

      Dave

      Reply
  8. Joe,

    there is a small module by roving network (RN-XV) which is doing a serial to wifi convertion. (see my message of 26 may 2012 above. It is working almost ok with a board close the one of craig (replace the bluetooth by the RNXV, not pin to pin compatible, but wiring should do the job).
    Joël

    Reply
  9. Question … I would like to add encoders to an altaz mount (DM-4) and interface this to my Nexus-7 tablet which I just got. It has Bluetooth support. I installed Sky Safari Plus which I like.
    Can I just add this board and that’s it? Do I need anything else (besides the encoders)?

    This looks like a clean solution.

    Regards,
    Rob

    Reply
    • If Craig still has any of these boards, then that’s it–all you need is encoders. An alternative is to build my serial board and use a serial to bluetooth converter, as described here.

      Dave

      Reply

Leave a reply

required

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>