Bluetooth Digital Setting Circles

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

  • #1 written by Harshad
    about 1 year ago

    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

    • #2 written by Harshad
      about 1 year ago

      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?

    • #3 written by Dave
      about 1 year ago

      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

      • #4 written by Harshad
        about 1 year ago

        Thanks Dave!

        Craig seems to have changed the PIC. Will that or any other change affect the max rate it can support?

        I would like to go for a low frequency encoder too, but I found a good deal on eBay, which tempted me:
        http://bit.ly/bYEoGB

        • #5 written by Dave
          about 1 year ago

          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.

  • #6 written by KITTU
    about 1 year ago

    HI..

    CAN YOU SEND THE SOURCE CODE REFERENCE
    I AM WORKING WITH SAME MODULE BUT MY CONTROLLER IS DIFFERENT

    THANK YOU

  • #7 written by Joel
    about 6 months ago

    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!

    • #8 written by Dave
      about 6 months ago

      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

  • #9 written by Bradley Roseberry
    about 5 months ago

    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?

    • #10 written by Dave
      about 5 months ago

      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

No trackbacks yet.