Compass module that doesn't use I2C

As part of the project research for my wearable computer idea, I'm looking for some kind of compass that doesn't use I2C.

What I want it to do:
I want to be able to tell if I'm facing north, south, east, or west.

Why I can't use I2C:
It's already being used for an OLED.

If anyone knows some kind of module that works like this, let me know. Thanks.

That's not necessarily a good reason.
I2C is a bus; as long as the devices have different addresses, all should be good (if a tiny bit slower)

Is it? I'm new to I2C, so I assumed it was like SPI where you couldn't use multiple devices at once.

Again, no.

You can use multiple SPI devices on the same set of pins, you just need to disable all but one of the devices.

Or Google "Suunto SK8" - I have a couple and I recommend them.

That sounds like a pain.

Either way, how would I find the OLED's address?

With an I2C scanner, or look at the datasheet.

Why do you say that?

Okay. I'm using the U8GLIB library for the OLED.

And I say that using multiple SPI devices at once would be a pain because it sounds like you would have to switch one on, read the data, switch it off, switch the next one on, read the data, switch it off, etc.

You'd pass the enable pin number to the controlling SPI object, and the rest would mostly be down to the library.
To you the user, it is virtually invisible.

Nope, its the exact opposite, its easy.

If you call a function that reads\writes data to a SPI SD card, the library automatically takes care of the device selection.

If you then call a function that reads\writes data to a SPI Radio device, the library automatically takes care of the device selection.

If you then call a function that reads\writes data to a SPI TFT display device, the library automatically takes care of the device selection.

If you then call a function that reads\writes data to a touch screen on a display device, the library automatically takes care of the device selection.

Bizzare.

Not at all. This sort of thing is going on all the time in the device you're using to post here.

That would appear to be your concept of how SPI works.

1 Like

So basically I need to find the I2C address of each device, and then make sure they don't match?

Then what? How do I write to both devices?

I'm using the U8GLIB library for the OLED, and I found a piece of code that uses MechaQMC5883 and Wire for the libraries on a compass.

I don't have a clue how these Chromebooks work other than "badly".

As long as they have different I2C addresses you dont need to do anything, the libraries take care of selecting the appropriate device.

This seems too easy. I'll try once I get both sensors.

Even your iPhone does this.

Try opening your mind a little, rather than coming back with the smart-arse answers.

Exactly like I²C. :+1:

Not really exactly, because the enabling / disabling on SPI is explicit, using a separate, non-bus pin, whereas with I2C, the address transmitted on the bus performs the enable

So what is the advantage of using SPI instead of I2C? Faster? Because it uses a lot more pins...