GithubHelp home page GithubHelp logo

adafruit_mpr121's Introduction

Adafruit MPR121 Library Build Status

Tested and works great with the Adafruit MPR121

Check out the links above for our tutorials and wiring diagrams. These sensors use I2C to communicate, 2+ pins are required to interface

Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!

Written by Limor Fried/Ladyada (Adafruit Industries). MIT license, all text above must be included in any redistribution

adafruit_mpr121's People

Contributors

andydoro avatar arduino12 avatar auberj avatar deanm1278 avatar evaherrada avatar fritsjan avatar hoffmannjan avatar ladyada avatar njh avatar r89m avatar siddacious avatar tdicola avatar thijstriemstra avatar toddtreece avatar tyeth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adafruit_mpr121's Issues

Arduino Micro - Program stops

Hi!
I'm using an Arduino Micro and the MPR121test Code provided in examples. I can upload the code and it starts running. But it stops saying "Adafruit MPR121 Capacitive Touch sensor test". It doesn't continue with the program saying MPR121 found.
I connected the SCL to Digital 3 and SDA to Digital 2. Also I connected 3.3V to VIN and GND to GND.

Thank you so much for helping!

  • Arduino board: Arduino Micro

  • Arduino IDE version (found in Arduino -> About Arduino menu): 2.1.0

MPR121 weak touch detection

Hello,

I am having problems with the touch sensitivity of the MPR121.
Even when I set the threshold value very low cap.setThreshholds(2, 1); the detection of the touch button is very weak.
When I touch it directly on the PCB, it works okay, but as soon as I add anything on top of the PCB, the touch won't be recognized anymore. Even with a 1.5mm thick piece of acrylic it won't detect the touch anymore. With other touch sensors (like the TTP223) I can easily place a 6mm sheet of acrylic on top of the sensor and the touch will still be detected.

First I thought the touch area was too small, but I tested it with circular touch areas with various sizes (from 8mm all the way up to 25mm) and the touch detection is pretty much the same with all of them.

Is there a way to further increase the sensitivity? Or is it normal, that the MPR121 only works directly on the PCB? But in which usecase would you touch directly on the PCB instead of a surface above it?

MPR121 library can work for Arduino Due, if...

  • Arduino board: Arduino Due (ATSAM3X8E)

  • Arduino IDE version: v1.8.7, but I mostly use Eclipse and Sloeber 4.3.1 plugin.

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too): Arduino Due did not work with the Adafruit MPR121 library and it also states that on your project page. Just open the libraries example (MPR121test) and download to the Due and it outputs that the MPR121 is not found

I was able to track down why the Due does not work. The Wire library does not handle the I2C restart bit correctly on the due even though there was a parameter added endTransmission() to specifically handle that. The ATSAM3x8e I2C peripheral will automatically generate the Write Cmd containing the internal address followed by the restart when the Read Cmd address size is non-zero. The MPR121 library was always using address length of 0 and then performing the Write Cmd manually and then the Read Cmd. Because of that, the Write Cmd still generated a STOP bit on the Due. The datasheet for the MPR121 does not like seeing that STOP bit and it then returns 0's for the Read Cmds because it tosses the internal address away after seeing the STOP. It only accepts the RepeatStart between the Write and Read transmissions.

I do not know if the following change breaks other Arduinos, but it did fix the Arduino Due. If other Arduinos would properly handle the endTransmission() SendStop parameter, they likely would still work. I just don't have any to try. The fix is to remove the Write and replace requestFrom() with one of the overloaded functions that handle the internal address.

here's the change:
@@ -176,10 +176,7 @@

  • @returns the 8 bit value that was read.
    ****************************************************************************************/
    uint8_t Adafruit_MPR121::readRegister8(uint8_t reg) {
  • Wire.beginTransmission(_i2caddr);
  • Wire.write(reg);
  • Wire.endTransmission(false);
  • Wire.requestFrom(_i2caddr, 1);
  • Wire.requestFrom(_i2caddr, 1, reg, 1, 0);
    if (Wire.available() < 1)
    return 0;
    return (Wire.read());

FR: add feature to support MPR121 IRQ pin

MPR121 chip has a nice IRQ pin that is triggered when a button is pressed.
It would be nice to extend the library to support IRQ pin firing an interrupt.

This feature might be a benefit in terms of performance.

call of overloaded 'write(int)' is ambiguous

Environment
Arduino board: Feather nRF52832
Arduino IDE version: 1.8.10

Issue
Does not compile for the Feather nRF52832 due to error call of overloaded 'write(int)' is ambiguous

Solution
Changing line 244 in Adafruit_MPR121.cpp from
_wire->write(0x00); // clear this register to set stop modus
to
_wire->write((byte)0x00); // clear this register to set stop modus

solves this issue.

Thanks!

Support for Adafruit Feather Huzzah ESP8266

kindly add support to the Adafruit Feather Huzzah ESP8266 with this library. Current the example code gives the following message on the serial port

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v60000318
~ld

ESP32 Sleep mode interrupt

now my project using Esp32 and mpr121.
when esp32 going sleep, the mpr121's IRQ pin will be the key to interrupt esp to wakeup.
but i found a problem is the sensitivity of mpr121 wont adjusted while esp32 going sleep.
when esp32 working, the mpr121 sensitive is good enough and work well. but esp32 sleeping, the mpr121 quite hard to interrupt esp32 to wakeup.

ESP8266 not working?

Hi Lady Ada.
I am wonder why ESP8266 is tagged as not working , well , since it use I2C which is super simple ?
I am porting this code to Lua firmware , hope that it will be done soon.
BR

MPR121 library does not work with Arduino Due although all the libraries are up to date

  • Arduino board: Arduino Due

  • Arduino IDE version (found in Arduino -> About Arduino menu): arduino 1.8.13

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too):
    I have all the libraries up to date but when I tried to run MPRtest, it says "MPR121 not found, check wiring?".
    I made sure about the port (using programming port).
    My arduino Due is fine with other programs that does not have MPR 121 part.
    MPR 121's ground is connected to Arduino Due ground.
    MPR 121's Vin is connected to Arduino Due 5V.
    MPR 121's SDA is connected to Arduino Due SDA1.
    MPR 121's SCL is connected to Arduino Due SCL1.
    (I also tried Due's 20 and 21 pins for SDA and SCL)
    I did not have pull-up resistors initially. But because it did not work, I tried pull-up resistors of 4.7k ohm but the result was the same.
    My library versions are up-to-date:
    arduino MPR121: ver 1.1.0
    arduino busio: ver 1.7.1

I saw this old post (#21) and thought it is resolved but it is not.

bad defaults

Hi,
I noticed that you changed the default "base value" behavior of the chip that prevents the base value to fall too fast when an input is touched.
The consequence is that, when touched, an input can't be touched for a few seconds (the difference between "base" and "filtered" is too small) .
Those settings can be easily reverted (after reading a few pdfs), but I'm not sure they're good defaults.

Anyway, thx for your circuits, they work well...and specially thx for your (very) clear site.

Olivier (from Paris)

setThresholds does not work as expected

  • Arduino board: UNO Rev 3
  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.7
  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too): Add something like this as last line in setup()
  cap.setThresholds(0xFF, 0x00);

The MPR121 requires being in STOP mode to write to registers.
mpr121_reg_write
This is being done in the constructor, but not else where. So calling setThresholds() has no effect.

Compatibility with ATSAMD21

I'm aware that the Readme of this library states it doesn't work with ATSAMD21 cores, however I find myself in a use-case scenario where that would be precisely the ideal setup. Is there something intrinsic with the chip that impedes it functioning together with these processors, or could anything be done to fix the library and add compatibility for ATSAMD21 cores? (Specifically an Arduino MKR1000)

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.