Go Down

Topic: First Time arduino/microcontroller user working with the LSM303C mag sensor (Read 13862 times) previous topic - next topic

GettingAlong

Can't get to it tonight but I guess I'll throw this circuit together tomorrow based off the last picture I posted.

GettingAlong

Ok I built the circuit based off the last diagram I posted. I had an extra pair of eyes check it out to make sure I did not make any glaring mistakes. All things considered its a pretty simple circuit so I hope I got it right.

Before I plug this bad boy in and start testing to see how wrong my code is, you do feel certain, assuming I built the circuit correctly, the diagram we came to an agreement on will allow me to connect without any problems?

Peter_n

Yes.

You can use the usb plug to power it, that has a current limit.

GettingAlong

Once my code is "ready" all I have to do is hit the upload button in the IDE and let it run?

Peter_n

Yes, and you have to open the serial monitor to view the messages that are send with Serial.println().
But when you connect a I2C device, run the i2c_scanner first.
http://playground.arduino.cc/Main/I2cScanner
When the scanner finds the I2C address, the I2C-bus is working.

GettingAlong

So just copy those lines of code into mine before any of my project related stuff?

Peter_n

Yes, create a new sketch, copy the code into it, and upload. Open the serial monitor and see if the scanner finds the I2C device.

GettingAlong

Is this just a god, quick way to see if the device is connected and communicating correctly so you know the problem is in the code and not circuit related?

Peter_n

Yes, for 90%.

The chip could be half-fried, so it responds to it address, but is not working properly.
Also a 3.3V chip will work with 5V signals, but you don't know for how long.
But if the i2c_scanner finds the chip, the SDA and SCL are connected properly and the chip has power. In most cases that means that everything is okay.

GettingAlong

#39
Aug 11, 2014, 06:09 pm Last Edit: Aug 11, 2014, 06:17 pm by GettingAlong Reason: 1
....crap scanner came up with no I2C devices connected...

GettingAlong

#40
Aug 11, 2014, 09:15 pm Last Edit: Aug 11, 2014, 10:23 pm by GettingAlong Reason: 1
Not sure what the issue is because me and my dad, he is an electrical engineer so I figure he is capable of working through a circuit, found it to match up with the diagram completely. Any advice on where to start?

Peter_n

No, I'm sorry, I have checked that last schematic already.
You have to test everything one by one. Perhaps something is broken.

Do you have an other I2C chip that can be connected to the 3.3V side of the level shifter ? EEPROM, RTC, Sensors ? You can buy a lot on Ebay for a few dollars.

GettingAlong

Talking to someone else they suggested I add the pull-up resistors o the SDA/SCL to VDD connects because they might be in a floating state.

Peter_n

You can check the schematic: https://www.sparkfun.com/products/12009
The level shifter has 10k on all sides.

When I2C is not busy, you can measure the voltages. It should be a nice 3.3V for SDA and SCL at the low side and 5.0V for SDA and SCL at the high side.

Don't you have any other I2C device ? You have to fall back to something that will work for sure, and use that to advance.

GettingAlong

As the title says this is the first time I have ever done anything with arduino or I2c. I am on a bit of a time constraint to order any other test chips.

Go Up