-5
\$\begingroup\$

I have an acceleration sensor connected to an I2C of a microcontroller as shown in the figure below

enter image description here

I would like to display the output of the sensor to an oscilloscope for troubleshooting. I have connected one of my scope probe's ground clip to the ground, and the probe tip to the SDA pin and the other probe to SCL pin. However, I get a weird looking graph (it is mostly a square wave signal even when I shake the accelerometer sensor). I suspect I am connecting the scope wrong or I do not know how to interpret the output. What is the correct way to display the output of an I2C connected device to an oscilloscope?

\$\endgroup\$

closed as unclear what you're asking by brhans, Brian Carlton, Voltage Spike, clabacchio Jul 19 '17 at 7:37

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    \$\begingroup\$ Are we supposed to understand what `weird looking graph" is meaning? \$\endgroup\$ – Eugene Sh. Jul 18 '17 at 15:53
  • \$\begingroup\$ @EugeneSh thanks for your comment! I updated my question to state that I get a square wave type of output \$\endgroup\$ – Dillion Ecmark Jul 18 '17 at 16:01
  • 1
    \$\begingroup\$ The sensor is measuring something, then sending digital information to the uC. Digital = string of ones and zeros = square wave. \$\endgroup\$ – Jack B Jul 18 '17 at 16:07
  • \$\begingroup\$ @JohnP if you want to decode the digital output, you'll need to look at the bits going by on the bus, use the datasheet to find out what they mean and decode them by hand, with excel or another computer program. (Some more advanced scopes will decode the digital for you and dump it in a text file) \$\endgroup\$ – Voltage Spike Jul 18 '17 at 17:55
2
\$\begingroup\$

Recognize that I2C "SDA" and "SCL" signals are digital, swinging between zero volts and Vdd. enter image description here

The top trace (blue) is SDA while the bottom trace (red) is SCL. In this case, Vdd is +5v. If you have a two-channel oscilloscope, one probe can monitor SDA, while the other probe monitors SCL.
It is difficult to interpret data on the SDA signal, it is binary-coded in 8-bit segments, plus one "ACK" bit. This example shows a five-byte transaction. Most-significant bit is transmitted first.

\$\endgroup\$
0
\$\begingroup\$

I suspect I am connecting the scope wrong or I do not know how to interpret the output.

It is actually the latter! The I2C interface is a digital interface: of course the signals will be square wave types!

Have a look online about what the I2C interface is and understand how the sensor outputs its readings. You say that you get square wave signals even if you shake the accelerometer... but this is totally normal: The sensor probably stores its measurements to registers and the micro-controller should read the contents of these registers to be able to understand what the sensor has measured.

What do you expect to see with an oscilloscope? You should analyze the I2C protocol in order to understand what the sensor sends to the micro-controller.

\$\endgroup\$

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