Build Option Rotary Encoder PDF

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

BUILD OPTION ROTARY ENCODER

© RB BROWN JULY 2015, ALL RIGHTS RESERVED

V100 22-10-2016

ROTARY ENCODER KEYES 040


The original myFocuser design uses two push buttons to provide a manual means of moving the
focuser IN and OUT, as well as resetting the focuser position to 0.

This addendum explores the use of the Keyes 040 Rotary Encoder to replace the push buttons with
the same or increased functionality.

The code provided here is for a FULL solution only, and schematics and layout have been provided
for DRV8825 and EasyDriver v44 solutions.

The Arduino code is designated with the “re” in the filename. Only use the “re” versions with the
Rotary Encoder build.

myFOCUSER ROTARY ENCODER (RE) SPECIFICATIONS


 Specify step rate of +1, +10 or +100 per rotary encoder click
 Able to reset the focuser position to 0 using the Push Button of the RE

PRECAUTIONS
 Never disconnect or connect the stepper motor when the Arduino or External Power is
ON. This can result in damage to the driver board
 The correct method is ensure everything is connected then connect the external power
12VDC
 Disconnect the external power 12VDC prior to disconnecting the USB cable

KEYES 040 ROTARY ENCODER


This is the only encoder that is supported at this time. It is highly likely that other encoders will not
work. The Keyes 040 RE is readily available on Ebay.

20 pulses per rotation


5V
COMPONENT LIST
5P Header post 0.25”
5P cable
Keyes 040 Rotary Encoder
Knob
Resistors (5pcs) 10KΩ ¼ watt
Ceramic Capacitors (20c) 100nf

CONNECTIONS
CLK to D9 via resistor/capacitor junction
DT to D10 via resistor/capacitor junction
SW D11 and 10K pullup resistor
+5V 5V
GND GND

SCHEMATIC
INTERACTION WITH WINDOWS APPLICATION OR ASCOM DRIVER
The Windows application and ASCOM driver should work correctly with the Rotary Encoder. Before
commands are sent to the controller to adjust the focuser position, the current position is requested
from the controller.

What this means is that if you move the focuser position using the RE, it is not immediately updated
into the ASCOM client or Windows application. However, using a GET focuser position command will
retrieve the current focuser position from the controller.

In determining a move of focuser position, the software always gets the current position from the
controller first, not from the application dialog box.

ROTARY ENCODER OPERATION


The following describes the operation of the RE

Turn left or right moves focuser IN or OUT


Push for 1s 1 beep on release, each click of RE = 1 focuser step, slow speed
Push for 2s 2 beeps on release, each click of RE = 10 focuser steps, medium speed
Push for 3s 3 beeps on release, each click of RE = 100 focuser steps, fast speed
Push for 4s+ 4 beeps on release, reset focuser position to 0

QUADRATURE.H and QUADRATURE.CPP FILES


These files are from a library written by Keith Neufeld. They have been modified. Only use these
modified files. The two files should be placed in the same directory as the Arduino source code (.ino
file) and the other file “eepromanything.h”

DEBOUNCE CIRCUITRY
The debounce circuitry is essential for
reliable operation of the encoder. The
circuit used 100nF capacitors and 10K
resistors (1/2 or 1/4W is fine). For the
prototype I used 220nF capacitors
which worked fine.

The PB switch on the encoder might


also benefit from a similar de-bounce
circuit. In practise I have only used a
10K pull-up, and this appears to work
without any issue (though I placed a
small 1ms delay in the reading of the RE
SW to handle any false triggers - do not
remove that code).
HARDWARE SUPPORTED
myFocuserPro
BOARD DRV8825 EASYDRIVER Rotary Encoder
BOARD DRV8825_HW203_RE

myFocuserPro2
BOARD DRV8825 EASYDRIVER Rotary Encoder
BOARD DRV8825_HW203_RE

ARDUINO FIRMWARE
All firmware versions that support the Rotary Encoder have RE in the filename
myFocuserPro
DRV8825_F_RE

myFocuserPro2
DRV8825_F_RE
DRV8825_HW203_F_OLED_RE
DRV8825_HW203_F_RE
DRV8825_HW203_F_RE_2004
BUILD PICTURES OF EASYDRIVER FULL BUILD WITH ROTARY ENCODER
OPTION
The following photos illustrate the EasyDriver v44 Full Option with Rotary Encoder build. Please note
that the board uses XH2.54 2P and 3P sockets. Off board components such as the driver board are
connected using 2P or 3P headers, this makes assembly and disassembly easier. Cost savings could
be made by direct soldering rather than using headers and sockets.

The EasyDriver board was purchased without the header pins soldered. Instead of soldering the
header pins, XH2.54 2P or 3P or 4P sockets were soldered. The following photo illustrates this. The
Easy driver board then connects to the main board using XH2.54 female-female cables.

The Keyes 040 Rotary Encoder pins were carefully


de-soldered and remounted the other way to
allow easy connection to a 4P header cable that
connects to 2-2P headers on the main board.

The LCD1602 I2C pins for VCC/GND/SDA/SCL were


straightened to allow easy connection to a 4P
header cable that connects to 2-2P headers on
the main board

You might also like