MPR121 12channel Unable to work completely

Issue #442 resolved
maike maker created an issue

The touch channels 8, 9, 10, and 11 are not responsive, and when touching channels 0, 1, 2, or 3, channels 8, 9, 10, and 11 are also triggered.Other channels are normal。

Comments (21)

  1. John Maloney repo owner

    I've been using the Touch library with the MPR121 on the MakerPort board and it has been working well.

    The MPR121 calibrates itself when it starts up. The calibration process takes less than one second. If you are touching any pins when during calibration, those pins may not respond to being touched later.

    You can force re-calibration by clicking the "stop" button in MicroBlocks, then re-starting the MicroBlocks program. Make sure you are not touching any pins or even the MPR121 itself when the programs starts.

    If re-calibrating does not fix the problem, then your MPR121 board may be defective. Do you have another one you can try?

  2. maike maker reporter

    Thank you for your reply.

    Despite my efforts to stay away from it during initialization, the fault still persists.

    I tested this module in the Arduino environment and it worked well.

    I only bought one for testing, and I will buy a few more for testing when I have the chance.

    I also noticed a strange phenomenon: in previous tests using the ESP32, when I connected the MPR121 module to the Pico2040, the Pico2040 failed to work and couldn't connect to the IDE. It's possible that this MPR121 is indeed faulty.

  3. John Maloney repo owner

    I tested this module in the Arduino environment and it worked well.

    This makes me think that the hardware is working correctly. Did you do that test with the same microcontroller board where the MPR121 does not work with MicroBlocks?

    Did you use this Arduino library:

    https://github.com/adafruit/Adafruit_MPR121/blob/master/Adafruit_MPR121.cpp

    What micrcontroller board(s) are you using to test?

    when I connected the MPR121 module to the Pico2040, the Pico2040 failed to work and couldn't connect to the IDE. It's possible that this MPR121 is indeed faulty

    A possible problem is that the MPR121 board lacks I2C pull-up resistors. That would explain why the Pico2040 would not work -- because it is waiting forever for the I2C SDA or SCL line to go high.

    Some microcontroller boards have built-in I2C pullup resistors, others do not. Most I2C extension boards include I2C pullup resistors but some do not. If neither the microcontroller board nor the extension board has pullup resistors then not only does I2C not work, but the low-level I2C code can hang.

    However, I see some resistors in the photo of your board so I'm guessing that it does have built-in pullup resistors.

    Another possible issue could be different voltage levels. Be sure to power the MPR121 from a 3.3v pin, not a 5v pin.

    There may also be a subtle bug in the MicroBlocks library that did not show up when testing with the MakerPort.

  4. John Maloney repo owner

    Thank you for doing those tests. This sounds more and more like a software bug.

    It's funny that I haven't seen this problem in my recent work with a new board called the MakerPort, which has a built-in MPR121. I'll study the Arduino library code to see I if I've missed something.

  5. John Maloney repo owner

    Here is a test script:

    touchTest.png

    You can download this image, then drop the .png file onto MicroBlocks to load the script.

    I want to see if it helps to add a short delay between reading the high and low bits from the MPR121 chip.

  6. maike maker reporter

    I see two identical numbers, and the last four channels are still unavailable.(by ESP32)

  7. John Maloney repo owner

    Thanks for doing that test. The numbers should be different if you are only touching one pin. I believe the low bits byte encodes pins 0-7 (as bits) and the low four bits of the high byte encodes pins 8-11.

    Since the Arduino program works, I think MicroBlocks must be doing something wrong. I will try to figure it out.

  8. maike maker reporter

    Thank you for your hard work. After testing, the new library has the same performance as before. Luckily, I found an internet friend who is willing to test this module with me. He has already placed an order, and we will provide you with the test results after receiving the goods in a few days.

  9. John Maloney repo owner

    Luckily, I found an internet friend who is willing to test this module with me. He has already placed an order, and we will provide you with the test results after receiving the goods in a few days.

    Great! It will be helpful to see if your friend gets same results with different hardware.

  10. John Maloney repo owner

    Glad that you got it working with the ESP8266 at least.

    You could try reducing the I2C clock speed to 100 kHz. Most I2C devices are happy with "i2c fast mode" of 400 kHz, but there are some that prefer a lower speed. You can find the block to change the I2C speed in the "sensorPrims" library in the System folder in the Other category.

    Switching the I2C to a lower speed will slow down interactions other I2C devices, especially OLED displays. Thus, if you need to use a lower I2C speed for your MPR121 it is a good idea to switch the speed to 100 kHz before interacting with the MPR121, then switch back to 400 kHz when it is finished. That will leave the I2C speed at 400 kHz for other devices that are happy at the higher speed.

    Of course, that doesn't matter if the MPR121 is the only I2C device you are using.

  11. maike maker reporter

    Thank you,i try reducing the I2C clock speed to 100 kHz.But this method doesn't seem to solve the bug。

  12. John Maloney repo owner

    Thanks for trying that. Sorry it didn't help.

    I just got a MPR121 breakout board from Adafruit. I'm about to go on vacation but in January I will see if I can reproduce the problem with that board.

    Has your friend gotten his board yet?

    It's interesting that your board works with the ESP8266. That may be a clue if we could figure out what it means!

  13. maike maker reporter

    My friend got the board and he also tested it, encountering the same problem as me.
    Wishing you a pleasant vacation
    Looking forward to you coming back to solve this problem

  14. maike maker reporter

    Thank you, John

    Thank you, José

    wow so happy

    I've tried it, it's very useful

    I made a numeric keyboard and will share it here once I have a demo done

  15. Log in to comment