Git Product home page Git Product logo

anabuttons's Introduction

WARNING!

This project is deprecated in favour of BMux that is more efficient in code and have more features. This repo will be keep here only for reference and educational purposes.

Analog Buttons for Arduino (AnaButtons)

Manage up to six buttons over just one analog pin, that's my goal.

This library will allow you to have from 1 to 6 buttons over a single analog pin in your Arduino projects; all you need is the push buttons (obviously) a few resistors with a peculiar relationship you will see later and a few capacitors.

How it works?

By reading the analog value every time and averaging the difference over time, to know if the variation drift towards zero (aka it's stable to read) and then compare the actual value against the predefined ranges to emit a status and using a timer to avoid repeated emits.

Just follow the instructions in the INSTALL.txt file and start the Arduino IDE, then go to examples and search for the AnaButtons then the only example to check how it works.

What about the circuit to make it works?

Find 5 resistors that are half of each other and add one more for the highest value, with that you will be in ball park values of what is programed in the library.

For example I have tested with this series of resistors (others combinations are possible):

  • 10k, 4.7k, 2.2k, 1k, 470 + 10k
  • 3.3k, 1.2k, 680, 330, 150 + 3.3k
  • 2,2k, 1k, 510, 220, 100 + 2,2k

The ranges programed has computed a variation of about 20% of tolerance on the resistors and that's allow for some room, for example in the previous example on the last series I can change the 510 by a 470 ohms resistor and it still works.

You have to take into account that for smooth work of the library you have to put a capacitor of about 10 to 100 nF in parallel with each push button to avoid noise.

About the schematics I can offer this files made with Fritzing:

  • Whole Fritzing file: sketch.fzz (the PCB view is an autorouted one, not ready for production)
  • Arduino wiring diagram: sketch_bb.png
  • Schematic diagram: sketch_esquema.png

What if I only need 4 and no six buttons?

Just wire the buttons you need, the others will be included in the code but as they are not wired they will never trigger any action (see the below note).

Keep in mind that for stability issues you must always keep the lower and higher ones (marked SW1 and SW6 in the diagrams)

Note: If you have a flash space problem the I will recommend that you modify the library to only manage the buttons you need and this will save you a few bits of flash space.

Author & contributors

The only author is Pavel Milanes CO7WT, reachable at [email protected]

Until now I have no contributions.

Where to download the latest version?

Always download the latest version from the github repository

If you need to give thanks...

Please take a look at the Donations and Funding file to keep me sharing my work with you.

anabuttons's People

Contributors

stdevpavelmc avatar

Watchers

 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.