Hi,
I would like to learn about using multiple magnetometers. It seems to me, and I could misunderstanding this, that the A0 and A1 pins on the MLX90393 can be used to individually address the magnetometers. For example, I'd like to use a Feather, attach 3 or 4 magnetometers to it (somehow) and then be able to read from them individually in software. I've used a 32u4 Datalogger along with one magnetometer, using a modified version of the sample code, so now I'd like to extend that. Is there some doc or sample code around that I've missed that provides some guidance on how to do that?
I've seen that the MLX90393 is out of stock. Is it being replaced with the other model that I've seen on the website? It's fine, just wondering what direction it's going in at this point.
Thanks for any guidance you can provide.
Ron
Multiple Magnetometers MLX90393
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- dastels
- Posts: 15608
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Multiple Magnetometers MLX90393
Wiring A0 and/or A1 to 3.3v (or shorting/jumpering the A0/A1 pads on the bottom of the board) will select one of 4 addresses (1 indicates a jumpered/3.3v address pin)
A1 A0 address
0 0 0x0C
0 1 0x0D
1 0 0x0E
1 1 0x0F
In the code, you create an object for each address you're using, and specify the address for each in the constructor call (for Circuitpython) or the begin_I2C call (in C++).
Dave
A1 A0 address
0 0 0x0C
0 1 0x0D
1 0 0x0E
1 1 0x0F
In the code, you create an object for each address you're using, and specify the address for each in the constructor call (for Circuitpython) or the begin_I2C call (in C++).
Dave
- RonGee
- Posts: 12
- Joined: Wed Aug 25, 2021 1:13 pm
Re: Multiple Magnetometers MLX90393
Thanks, Dave.
So, if I'm understanding this, you can have up to 4 MLX90393 attached to a Feather, or I guess, any microcontroller. Is that right? Is there any way to extend that, do you think? I'm just wondering if there might be a way to electrically have 4 magnetometers attached to a pin on a Feather and use the addressing along with that pin's identifier to create a larger group, ie, if you have a set of pins like that, you could have 4 MLX's attached to each one. Of course, at this point, I'm just making that up; no idea whether a Feather can do something like that. :-) Is there some limit as to how many sensors a Feather can "handle", just in general? What if I wanted to something create an array of 20 sensors, maybe not magnetometers, but in general? If you want to point me towards some reading to do, I'm happy to do that.
Shorting the pins to establish the address, I get. Yay me. :-)
If I've got 4 of them, for example, I'm going to have 4 SDA and 4 SCL wires. Would I just bring all 4 to the SDA and SCL pins on the Feather? And then use the software to address them, and for example, tell one at a time to read the magnetic field?
I can power the magnetometers either from the Feather, I would imagine, or from a separate 3.3V supply. Just have to see what the draw from each MLX90393 is and then see if a Feather can handle that.
RIght now, I've got a 32u4 datalogger. Would a different Feather give me more capabilities?
As to the software, I think I better do more reading before I ask any more questions there. :-)
Thanks again. I learn a little bit more each day.
Ron
So, if I'm understanding this, you can have up to 4 MLX90393 attached to a Feather, or I guess, any microcontroller. Is that right? Is there any way to extend that, do you think? I'm just wondering if there might be a way to electrically have 4 magnetometers attached to a pin on a Feather and use the addressing along with that pin's identifier to create a larger group, ie, if you have a set of pins like that, you could have 4 MLX's attached to each one. Of course, at this point, I'm just making that up; no idea whether a Feather can do something like that. :-) Is there some limit as to how many sensors a Feather can "handle", just in general? What if I wanted to something create an array of 20 sensors, maybe not magnetometers, but in general? If you want to point me towards some reading to do, I'm happy to do that.
Shorting the pins to establish the address, I get. Yay me. :-)
If I've got 4 of them, for example, I'm going to have 4 SDA and 4 SCL wires. Would I just bring all 4 to the SDA and SCL pins on the Feather? And then use the software to address them, and for example, tell one at a time to read the magnetic field?
I can power the magnetometers either from the Feather, I would imagine, or from a separate 3.3V supply. Just have to see what the draw from each MLX90393 is and then see if a Feather can handle that.
RIght now, I've got a 32u4 datalogger. Would a different Feather give me more capabilities?
As to the software, I think I better do more reading before I ask any more questions there. :-)
Thanks again. I learn a little bit more each day.
Ron
- dastels
- Posts: 15608
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Multiple Magnetometers MLX90393
You are correct. Using I2C multiplexers https://www.adafruit.com/product/2717 you could add more... up to 32 in this case. (4 addresses, a multiplexer for each, each multiplexer supports 8 connected devices).
Though, sometimes all you need is something simple and limited.
Dave
Yes. I2C is a bus, you can have many devices connected as long as they have different addresses. As mentioned above, using multiplexers can extend that further.If I've got 4 of them, for example, I'm going to have 4 SDA and 4 SCL wires. Would I just bring all 4 to the SDA and SCL pins on the Feather? And then use the software to address them, and for example, tell one at a time to read the magnetic field?
Yes, each MCU has different features. The 32u4 is rather ancient, and very limited. Compare it's feature with, say, a Feather M4 Express or ESP32-S2.RIght now, I've got a 32u4 datalogger. Would a different Feather give me more capabilities?
Though, sometimes all you need is something simple and limited.
Dave
- RonGee
- Posts: 12
- Joined: Wed Aug 25, 2021 1:13 pm
Re: Multiple Magnetometers MLX90393
Thanks again, Dave. Much appreciated.
I'll have to check out the multiplexor.
Ron
I'll have to check out the multiplexor.
Ron
Please be positive and constructive with your questions and comments.