GithubHelp home page GithubHelp logo

mpr121's Introduction

Bare Conductive

Bare Conductive MPR121 Arduino Library

A fairly feature complete library for the Resurgent Semiconductor MPR121QR2. This is a popular capacitive touch sense IC featuring:

  • 12 electrodes/capacitance sensing inputs in which 8 are multifunctional for LED driving and GPIO
  • Integrated independent autocalibration for each electrode input
  • Autoconfiguration of charge current and charge time for each electrode input
  • Separate touch and release trip thresholds for each electrode, providing hysteresis and electrode independence
  • I2C interface, with IRQ Interrupt output to advise electrode status changes

This library was originally developed to support the Bare Conductive Touch Board. However, it should work fine (with adaptations) for any Arduino connected to an MPR121.

Library includes support for:

  • capacitive touch sensing
  • proximity mode for virtual 13th electrode
  • readback of filtered capacitance measurements
  • full GPIO including PWM write

Still to be implemented:

  • full support for autocalibration / autoconfig
  • callback attachment for interrupt pin

Requirements

  • requires Wire.h library, which is part of the Arduino core (so you don't need to download anything) but you do need to include it in your .ino file
  • it is the user's responsibility to include <wire.h> and call its begin() method
  • before you use any of the MPR121 methods, you need to call its MPR121.begin() method, normally in setup()
  • the default MPR121 I2C address for this library is 0x5C, which is used if you call MPR121.begin()
  • if you want to specify a different address you can, with MPR121.begin(yourAddress)

Typical use example:

// 0x5A for a lot of boards out there
// 0x5C for the Touch Board

#define MPR121addr 0x5A

#include <Wire.h>
#include <MPR121.h>

void setup(){
	MPR121.begin(MPR121addr);
}

void loop(){
	// your code goes here
}

Install

  • Arduino's instructions for installing libraries are available here

Examples

  • SimpleTouch - simple capacitive touch sense sketch with output via serial
  • DataStream - serial data stream of capacitance data from MPR121
  • GPIOinverter - MPR121 GPIO inverter - reads one pin and outputs the inverse on another
  • LEDfade - simple MPR121 LED fader

mpr121's People

Contributors

honnet avatar loosepascal avatar peter-krige avatar stefandz avatar

Stargazers

 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.