1
\$\begingroup\$

I am trying to build a simple circuit to read from a pressure sensor using an Arduino Micro.

I looked at the datasheet and have a breadboard circuit which can be schematised as:

schematic

I know this isn't the best laid out schematic but I wanted to make sure every connection was explicitly drawn.

All grounds go to ground, reserved pins and IRQN are not connected, SDA and SCL go to the corresponding pins on the Arduino. R1 and R2 are meant to act as pull-up resistors. C1 is meant to be the decoupling capacitor.

This is the real circuit on the breadboard:

breadboard

Everything seems to connect where it I think it should and there aren't any obvious shorts.

If I run the Arduino I2C scanner I get:

--- Scan started ---
No I2C devices found
--- Scan finished ---

--- Scan started ---
Unknow error at address 0x52
Unknow error at address 0x7B
No I2C devices found
--- Scan finished ---

--- Scan started ---
No I2C devices found
--- Scan finished ---

...

There is no consistency in the error addresses and the scanner works separately with a different device. This implies that something about my circuit is wrong and, at least from the datasheet, I'm not sure what.

My best guess is that I've done the pull-up resistors or decoupling capacitor incorrectly (or there's some basic assumed background I don't have).

What am I missing here?

Misc. potentially useful info:

  • I did not solder the pressure sensor to the breakout board but trust the person who did so I don't think there's a connection issue with the actual sensor.
  • The true capacitance of the decoupling capacitor is closer to 110nF (measured using a multi-meter).
  • The true resistance of the resistors is around 9.8 kohms.

If I can provide any other information which would be of use, please let me know.

Edit - scope outputs:

Turns out we have quite an old scope with no way to get digital images out so here are some phone photos.

scope outputs

The clock timing seems different with the device attached. The voltage also doesn't seem to go fully high.

\$\endgroup\$
10
  • \$\begingroup\$ R. Mitchell - Hi, (a) Re: "The true resistance of the resistors is around 9.8 ohms." I guess you mean 9.8 kohms? Please edit the question to clarify. (b) Have you got an oscilloscope so that you can add scope traces of the I2C signals to the question? || Just as an aside, please see the main site rules in the tour & help center as they differ from typical forums (if you didn't already know). \$\endgroup\$
    – SamGibson
    Commented Aug 30 at 11:10
  • 1
    \$\begingroup\$ Yes it was kohms, sorry (now fixed). I do have access to a scope, I will try to get traces of the I2C signals. \$\endgroup\$ Commented Aug 30 at 11:22
  • 1
    \$\begingroup\$ How do you know that the sensor can be scanned for presence? What if it won't acknowledge a read to the chip, because it has not received any command to give you data, so it has none? I am just trying to say that the I2C scan performed by the Arduino cannot detect a chip, if the chip does not want to react on unsolicited reads, and some chips are like that. \$\endgroup\$
    – Justme
    Commented Aug 30 at 11:49
  • 1
    \$\begingroup\$ Larger breadboards isolate (split) their continuity rails. Check to make sure all your grounds and power connections are actually connected as expected. "at" me if this doesn't make sense and I'll turn it into an answer w/a picture. You don't have to accept it. It's just hard to describe in a "comment". \$\endgroup\$
    – st2000
    Commented Aug 30 at 12:56
  • \$\begingroup\$ @st2000 - Thanks for trying to help. FYI although comments don't show images inline, as you know, if you want to add image links in a comment, you can use this technique to add the images. Note that the draft answer (or question) must not be submitted. The draft answer (or question) is used only to upload the image & is then discarded. || That way, you don't write a "non-answer" with all the issues that can cause. || Of course if you do solve the problem accidentally in a comment, please do rewrite that in an answer, so the OP can accept it. TY \$\endgroup\$
    – SamGibson
    Commented Aug 30 at 13:13

3 Answers 3

1
\$\begingroup\$

I got the circuit working. My general advice for anyone with a similar issue/level of experience is to learn to use an oscilloscope and what your clock/data signals ought to look like.

Problem 1 - Pull-up resistor strength

Symptom: Slow rise times visible in the scope images above, highlighted by @SamGibson.

Cause: Pull-up resistors too weak.

Fix: Stronger pull-up resistors. Use the TI resource linked in @SamGibson's answer and/or use a scope to check the SDA/SCL signals.

Problem 2 - Inappropriate pull-up resistor wiring

Symptom: SDA/SCL idling at 5V when the sensor was disconnected which looked like a serious problem with the wiring.

Cause: The pull-ups were wired in such a way that they were only on the bus if the sensor was on the bus which caused the bus to behave differently when the sensor was connected. Likely wouldn't be a problem but generated a distracting symptom.

Fix: Wire the I2C bus so that the pull-up resistors always go to the correct power rail, even if the device is not connected to the bus.

Problem 3 - Broken power line

Symptoms: SDA/SCL would idle at ~2.6V then oscillate between 3.3V and 0V when transmitting. Voltage measured at the VDD input on the sensor was erratic or sitting around 2.6V, but fine at the edge of the PCB.

Cause: Broken power line on the PCB.

Fix: Soldered a piece of spare wire in to bridge the break in the line.

Problem 4 - Incorrect I2C address

Symptoms: Device NACK received by I2C master, but traces otherwise look correct.

Cause: The I2C address was incorrect so of course the device didn't acknowledge the transmission.

Fix: I checked the address which was being transmitted on the scope and realised it was wrong. I then checked the example code to confirm and set it to the correct address (the default used in the example was for a different sensor).

I can now read from my sensor. Trust nothing, check everything, change only one thing at a time. Thank you to everyone that responded!

\$\endgroup\$
3
  • 2
    \$\begingroup\$ A correction to your terminology: Your 10K pull-up resistors were too weak/too high a value. The lower value pull-up resistors are stronger/pulling up harder, with a higher current. \$\endgroup\$ Commented Sep 12 at 15:38
  • \$\begingroup\$ R. Mitchell - Thanks for coming back with the solutions to the various problems. I'm glad my answer helped a little towards that. Having multiple problems is often challenging. \$\endgroup\$
    – SamGibson
    Commented Sep 12 at 15:47
  • \$\begingroup\$ R. Mitchell - I've fixed the terminology reversal in the answer which was kindly highlighted by Peter Bennett above. I'll leave that comment so you can see the explanation, even though I've updated the answer. You can flag that comment (and mine) as "no longer needed" when you've read them, if you want to. \$\endgroup\$
    – SamGibson
    Commented Sep 12 at 16:03
0
\$\begingroup\$

Two problems are visible in the I2C scope traces:

But that won't be enough, as there's a strange problem:

  • The scope traces "without device connected" seem to show that the I2C bus pull-ups are going to 5 V, not to the correct & expected 3.3 V (the signals idle at 5 V). That's a big problem. You need to find out why.

    It seems that the "red rail" is connected to what should be the 3.3 V output of the Arduino Micro's onboard 3.3 V regulator, yet the scope traces "without device connected" show the scope is set to 5 V/div and the signal is 1 div.

    With the sensor connected, the signal voltage is lower (it's difficult to tell an accurate value - please investigate with the vertical scale expanded, instead of being only 1 division high). I can guess why that might be, but the situation seen "without device connected" needs sorting out first.

\$\endgroup\$
2
  • \$\begingroup\$ I swapped out the pull-ups (now using 2k2) and the traces look more square, they're also fully rising within one clock cycle now. I also figured out why the traces 'without' were going to 5V. My pull-ups were wired to the SDA/SCL pins on the breakout board. By disconnecting the pressure sensor board from the arduino, I'd removed them from the circuit so there was no anchor to 3.3V By disconnecting the device but including the pull-ups, the bus idles at 3.3V as I'd intended. \$\endgroup\$ Commented Sep 3 at 13:59
  • \$\begingroup\$ However, now with the device connected the signal seems to idle at 2.6V. I get one burst of activity which switches between 0V and 3.3V as expected, then the bus hangs at 2.6V. I'm trying to find out more and will update if/when I do. \$\endgroup\$ Commented Sep 3 at 14:29
0
\$\begingroup\$

The Arduino MICRO uses an ATMEGA32U4-XUMU. According to this schematic from the arduino.cc web site, it is running at VCC = 5 volts.

That said, the SDP32-125PA pressure gauge in the question is connected to the 3.3 volts regulated output of the Arduino MICRO.

So the SDP32-125PA is being driven with 0 to 5 volt signals while the SDP32-125PA is only being powered with 3.3 volts. Logic circuits should never be driven with voltages that exceed the supply voltage. This normally results in unexpected behavior. Including lockups.

Looking at the SDP32-125PA data sheet here, we see the typical supply voltage is 3.3 volts. However the maximum is 5.5 volts. This infers the SDP32-125PA can operate at 5.0 volts.

As the Atmel (AKA MicroChip) processor in the question is operating at 5.0 volts and is generating signals from 0 to 5.0 volts, it follows that the pressure sensor must also operate at 5.0 volts in order to be compatible.

Alternatively, an Arduino who's processor is operating at 3.3 volts can be used. Then the SDP32-125PA can also operate at 3.3 volts as it is now.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.