-->
Page 1 of 2

I2C guidance?

PostPosted: Fri Sep 23, 2016 2:04 am
by RyanC
So I have another question to ask of you fine gentlemen. I have a LSM303DLH accelerometer (here is one of several datasheets). I am trying to interface it with my esp, but it is so far not recognizing. Even if it was, I wouldn't know how to get the current bearing and other data off of it and into my sketch. I have it plugged in, pin D3 on nodemcu to sda, pin d4 to scl, but none of the sketches I've tried have had any effect. I've never worked with i2c before in any format, so this is all very new to me.

I would really appreciate any guidance anyone would be able to offer.
Thank you.

Re: I2C guidance?

PostPosted: Fri Sep 23, 2016 5:32 am
by trackerj
I would suggest you to start from here, with the I2C Bus Setup and scanning functions: viewtopic.php?f=40&t=11075

You can find there also the latest version of the I2C_scanner that will help you to proper devine your SDA/SCL pins and find your device.

Re: I2C guidance?

PostPosted: Sun Sep 25, 2016 1:51 am
by RyanC
Thanks, Tracker. I've since been able to find the address pins for my device (24 and 30). However, I have not had any luck at all getting it to talk to my magnetometer. There is only one example sketch I have found (the i2c RTC example), and I have not been able to make any headway on integrating it.

Can anyone help me to get an idea of how to structure the requests to garner the compass data and the accellerometer data? Right now I'm not sure when to start a request, when to end one, how many bytes to request, anything :/.
Thanks in advance.

Re: I2C guidance?

PostPosted: Sun Sep 25, 2016 2:19 am
by trackerj
Did you run the I2C_scanner program to see if you have a proper connection and response from your I2C device?

Can you also provide a link for device datasheet?