Multiple Sensors Hardware Question...

I’m using MPR121 capacitive touch sensors (https://www.sparkfun.com/products/9695) You can connect 4 to one Arduino, via a breadboard.

But I’m having problems with my setup - I am testing with two sensors at the moment, and am looking for some advice. Setup is

PWR > Breadboard > 3.3v
GND > Breadboard > GND
SDA > Breadboard > Digital 20
SCL > Breadboard > Digital 21

One of the chips is unmodified, and the other is modified, I’ve cut the ADD pin from the ground on the back of the chip, as desired on SparkFun -

There a four jumpers on the bottom of the board, all of which are set (closed) by default. An address jumper ties the ADD pin to ground, meaning the default I2C address of the chip will be 0x5A. If you need to change the address of the chip (by shorting ADD to a different pin), make sure you open the jumper first. Jumpers also connect SDA, SCL and the interrupt pin to 10k pull-up resistors. If you don’t require the pull-up resistors you can open the jumpers by cutting the trace connecting them.

So the first chip is unmodified and the second’s ADD is going to 3.3v on the chip.

I attached a photo of the setup, which is probably very confusing and may not explain anything! The code I’m running in Arduino works fine when either chip is connected on it’s own, but with two connected, it just can’t read anything… screenshot attached.

Does anyone know if I need a resistor on the board???

Thanks in advance for your time and thoughts :slight_smile:

Have you run an I2C scanner to see if both report aboard the I2C bus?

Hey,

Yes, sorry, I forgot to mention... I did run I2C scanner and I get

I2C Scanner
Scanning...

:~

If the sensors each have pull-up resistors on the I2C lines, the line may be being pulled up too strongly for the devices to pull down to signal each other.

So I've tried it with 2.2k resistors between GND and SDA, and GND and SDL. Still got nothing.

Do you think it's a hardware or Arduino problem?

J.

Try running the scanner with only one unit connected at a time. Note the addresses if they come up. It is hard to tell by the picture how everything is wired. Can you do a schematic? And to post code (necessary to get informed assistance), copy the sketch and insert between code tags (# button above).

Hi jonnyb

So I've tried it with 2.2k resistors between GND and SDA, and GND and SDL. Still got nothing.

Try connecting the resistors from SDA and SCL to +3.3V instead of GND.

Regards

Ray

Thanks GroundFungus,

Here is the code I’m working with (attached as it was too long to paste), also attached is a rough picture of the schematic I’m working from. IRQ is on 4 different buses, each going to a separate digital pin.

I’ll try that now with the two different sensors…

J.

multipleTouchSensorsTest.zip (4.94 KB)

Hi Ray,

Thanks for your response. Have tried that with the 2.2k resistors but still nothing with my sketch.

I2C scanner also gets nothing....

Do you have any level converters between the 3.3V I2C devices and the 5V Arduino?

No, but they as the chip is connected to the 3.3v on the Arduino I should be okay? That was one of my initial thoughts.

Here’s a photo of my setup. Perhaps I’m doing something really silly on the board…

GroundFungus,

I tried both chips separately via the board with my own sketch, and nothing comes in.

I've also tried with I2C scanner and have got nothing...

I think it must be a problem with my setup on the breadboard...?

I don't believe that is enough, jonny.

See this tutorial at Sparkfun:

https://learn.sparkfun.com/tutorials/using-the-logic-level-converter

EDIT: more info here ... http://forum.arduino.cc/index.php/topic,116345.0.html

You can buy ready made level converter breakout boards from other suppliers, too. Or you could build you own circuit.

EDIT: but looking at the product page, Sparkfun do have a hookup diagram that does not level convert SCL and SDA!

Usually breadboards have the HORIZONTAL (in your picture) rows connected. Check to see for sure the orientation of the connected rows. I don't think that the vertical (again in the photo) are connected.

Hey Ray,

Woah how’d you find that, thought I’d looked everywhere :~ Thanks!

Okay, so a level converter makes sense, and it was something I considered early on. But, when I was working with only one chip connected to the arduino (via 3.3v), it worked fine. Does this not mean that it has the capability to work without level converter? Or… is that only because there was only one, and with more, level conversion is required?

I’ve attached a photo incase I’m doing anything obviously wrong. I’m a newbie to the hardware side of things…

Thanks guys!

Groundfungus,

:astonished: I'm going to rearrange that now...

Check first!

Groundfungus,

:astonished: I'm going to rearrange now....

Yes...

That has fixed it. It's reading both sensors now and getting the correct data.

That was an incredible oversight on my part, sorry for wasting everyone's time!

Thanks so much guys.

hello,

I’m curious: what exactly did you do wrong? did you buy the bi directional logic converter and hooked them to the 3.3 volts or what was the mistake?

Best
mar