You can easily wire this breakout to any microcontroller, we'll be using an Arduino. For another kind of microcontroller, just make sure it has I2C, then port the code - its pretty simple stuff!

  • Connect Vin to the power supply, 3-5V is fine. Use the same voltage that the microcontroller logic is based off of. For most Arduinos, that is 5V
  • Connect GND to common power/data ground
  • Connect the SCL pin to the I2C clock SCL pin on your Arduino. On an UNO & '328 based Arduino, this is also known as A5, on a Mega it is also known as digital 21 and on a Leonardo/Micro, digital 3
  • Connect the SDA pin to the I2C data SDA pin on your Arduino. On an UNO & '328 based Arduino, this is also known as A4, on a Mega it is also known as digital 20 and on a Leonardo/Micro, digital 2

The MPRLS has a default I2C address of 0x18 and cannot be changed!

Install Arduino Libraries

Lets begin by installing all the libraries we need. Open up the library manager in Arduino IDE

Search for and install the latest version of the Adafruit MPRLS library

Basic Example

Start by opening up the Adafruit MPRLS -> simpletest under the Adafruit MPRLS library:

And upload it to your board!

Open up the serial console to see the readings. You can blow into the port or cover it with your finger to change the readings

If you'd like to add hardware reset and EOC pin support, you can change these lines and update your wiring to include the wires you've selected - you can use any 2 digital pins

// You dont *need* a reset and EOC pin for most uses, so we set to -1 and don't connect
#define RESET_PIN  -1  // set to any GPIO pin # to hard-reset on begin()
#define EOC_PIN    -1  // set to any GPIO pin to read end-of-conversion by pin
Adafruit_MPRLS mpr = Adafruit_MPRLS(RESET_PIN, EOC_PIN);

This guide was first published on Sep 26, 2018. It was last updated on Mar 19, 2024.

This page (Arduino Test) was last updated on Mar 08, 2024.

Text editor powered by tinymce.