Pages: 1 2 3 [4]   Go Down
Author Topic: First Time arduino/microcontroller user working with the LSM303C mag sensor  (Read 1560 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Also I have a another copy of the sensor I am using because eventually I want to be using them at the same time. Should I try and switch that out to see what happens?
Logged

Offline Offline
Edison Member
*
Karma: 35
Posts: 1079
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think it is safe to do so.
Use the usb connector to power the Arduino, and run the i2c scanner.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If this fails what do you think might be the issue? It would have to be nearly impossible to have two bad sensors unless the circuit is causing them the malfunction.

« Last Edit: August 12, 2014, 02:27:48 pm by GettingAlong » Logged

Offline Offline
Edison Member
*
Karma: 35
Posts: 1079
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm sorry, but I don't know.
When I develop something, I try a few things to get some 'feeling' with it. So I buy often different things that do the same. When one thing is not working, I put it aside, and try something else with different hardware and software.

You do have a multimeter ? To measure that the level shifter has no 5V signals on the 3.3V side ?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I believe I have one laying around, if not I can run and pick one up. Sadly I am a student who had this project forced on him so I am basically having to learn to run before I learn to walk.

Also the I2C scanner sketch seems to be locked up because it got passed the first print statement and has not done anything else. Something tells me it shouldn't take 15 mins for this code to execute at least one full pass through. Added a few print statements and it starts the first iteration of the for loop but only makes 1 iteration and hangs.

This is where it hangs:

error = Wire.endTransmission();
« Last Edit: August 12, 2014, 03:27:01 pm by GettingAlong » Logged

Offline Offline
Edison Member
*
Karma: 35
Posts: 1079
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

When the i2c_scanner locks up, the SDA and SCL are shortcut to each other, or one of them is shortcut to ground.
Remove everything and run the i2c_scanner again. After that, connect the level shifter, run it again, and so on.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So what you think is I have a short somewhere in my circuit?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

When I disconnect everything it runs fine, when I reconnect it hangs.


Hmmm for my SDA/SCL I have both plugged into the + rail on my breadboard. At the far end is where the LV of the level shifter is connected. The + rail is what I have everything plugged into that is related VDD.

Right after the SDA/SCL to VDD connections I connected wires to 2 horizontal rails and from there connected to the rail of the corresponding channel in the level shifter. I did that for both SDA and SCL. Each are seperate from each other so I don't think there are any shorts there.
Logged

Offline Offline
Edison Member
*
Karma: 35
Posts: 1079
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't understand, can you make a photo of it ?
You should not connect SDA and SCL to the + rail of course.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah I get you a couple photos of the circuit I built. The SDA and SCL have to be tied to VDD_IO (through a resistor) according to the data sheet. VDD_IO and VDD are both connected to the + rail since that was the easiest.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK here is a picture(bad) I drew of my circuit on the breadboard. I only mapped out SCL/SDA for now since that is what is in question.



* breadboard_circuit.png (1257.37 KB, 1337x1042 - viewed 10 times.)
Logged

Offline Offline
Edison Member
*
Karma: 35
Posts: 1079
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm sorry, but the drawing is confusing.
According to that drawing the chip VDD_IO is not connected, and SDA and SCL are connected to each other and both to 3.3V.

Do you have a multimeter ?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Oh wow that is totally wrong i apologize! I made SDA and SCL not connected to each other and VDD_IO is connected to 3.3V rail.
I now have a multimeter.


* breadboard_circuit.png (1255.88 KB, 1337x1042 - viewed 8 times.)
« Last Edit: August 12, 2014, 07:57:43 pm by GettingAlong » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

First off I'd like to thank you for all this help you've given me. Without it I'd probably still be staring at an empty breadboard.smiley-grin

Now I guess it is on to a little more interesting part of getting my code to work. But first like I said in the other thread you have any idea why the scanner would return device found at both 0x1D and 0x1E when 1E is the only device ?

Nevermind, it was just the accelerometer.
« Last Edit: August 14, 2014, 01:31:50 pm by GettingAlong » Logged

Pages: 1 2 3 [4]   Go Up
Jump to: