Code Monkey home page Code Monkey logo

enc2btn's Introduction

Encoder to button adapter

This little board is designed to convert the CW and CCW encoder rotation into an active low "press button" events. The main use for this adapter are DIY joystick/cockpit systems with no dedicated rotary encoder inputs. With this board the encoder can be connected to ordinary active low button inputs.

alt text

The outputs of the encoder are filtered, debounced and work on PinChange interrupts basis, thus delivering a reliable operation, even with cheaper types of encoders.
The number of steps is buffered and "clicked out" in a constant period pulses to avoid missing steps due to button debounce routines. A quick turn of a 30 step rotary encoder will be definitely too fast for typical button input with 20-50ms debounce time. The default press on and release time of a one button press event is set to about 30ms in firmware.

Two types of encoders are implemented: half step and full step. Setting is done via a jumper. How to determine the encoder type: one step should generate one button press event. If it takes two steps to make one click, or one step generates two clicks, simply change the encoder type setting to the opposite one.

Programming the ATTINY25 chip:

use any ISP AVR programmer, like USBasp or AVR MKII.
First, set the fuses to

  • Low = 0xE2
  • High = 0xDD
  • Ext = 0xFF

then upload the Enc2Btn.hex file found in firmware/hex directory.

Compatible encoder models (11mm):

  • ALPS EC11 series
  • BOURNS PEC11L-4xxxF series
  • various no name 11mm rotary encoders

Operation:

  1. Connect the power lines: GND and VCC (3-5V DC).
  2. Connect the INC and DEC outputs to any active low button inputs in your joystick/controller board.
  3. If encoder has a built in button, attach the BTN out to another button input.

Depending on the encoder type and it's internal construction it may happen the INC and DEC outputs will work backwards, CW rotation will generate pulses on DEC and vice versa. No big deal, as you can swap the button inputs freely.

Construction:

Boards can be ordered directly from OSH Park:

Order from OSH Park

alt text alt text

Passive components are in 0603 size. The ATTINY25SU chip is in SOIC8 Wide package.

alt text

alt text

alt text

alt text

Credits:

The encoder subroutines are heavily inspired by the work of Ben Buxton http://www.buxtronix.net/2011/10/rotary-encoders-done-properly.html

Encoder to button converter


(c) 08/09.2016 by Piotr Zapart www.hexeguitar.com

License: Creative Commons - Attribution - ShareAlike 3.0 http://creativecommons.org/licenses/by-sa/3.0/

enc2btn's People

Contributors

hexeguitar avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.