# Mangoh Yellow - Magnetometer Not Connected?

**URL:** <https://mangoh.discourse.group/t/mangoh-yellow-magnetometer-not-connected/3135>\
**Category:** mangOH Yellow\
**Created:** [December 9, 2019, 7:28pm UTC](https://mangoh.discourse.group/t/mangoh-yellow-magnetometer-not-connected/3135 "2019-12-09T19:28:22Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![nrcrast](https://avatars.discourse-cdn.com/v4/letter/n/ea666f/32.png) [@nrcrast](https://mangoh.discourse.group/u/nrcrast)\
**Post date:** [December 9, 2019, 7:28pm UTC](https://mangoh.discourse.group/t/mangoh-yellow-magnetometer-not-connected/3135/1 "2019-12-09T19:28:23Z")

</div>

Hi guys,

I’m having some issues getting data from the built in magnetometer on the MangOH yellow. According to the sample app, the sys interface implemented by the kernel module should be here:

/sys/bus/i2c/devices/6-0010/iio:device1/

However, this directory does not exist. Any ideas why this would be? The accelerometer/gyroscope directory exists and that’s working fine.

-Nick

---

<div class="post-metadata">

**Author:** ![dfrey](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/dfrey/32/303_2.png) [@dfrey](https://mangoh.discourse.group/u/dfrey)\
**Post date:** [December 9, 2019, 11:39pm UTC](https://mangoh.discourse.group/t/mangoh-yellow-magnetometer-not-connected/3135/2 "2019-12-09T23:39:19Z")

</div>

In some earlier development versions of mangoH Yellow, the magnetometer was connected to the same i2c bus as the accelerometer. In the final version the magnetometer was placed on an i2c bus that downstream of the bmi160 accelerometer. The bmi160 can simultaneously act as an i2c slave to the WP module and an i2c master to the magnetometer. I think this theoretically offloads some work from the WP’s CPU and allows for accelerometer and magnetometer readings that are nicely correlated, but this requires some additional driver work that hasn’t been done yet.

[This is the latest version of the upstream driver for the bmi160](https://github.com/torvalds/linux/blob/master/drivers/iio/imu/bmi160/bmi160_core.c) and if you search around you can find some references to the magnetometer, but it’s not implemented. I would like to implement this, but I’m not sure if/when I will have time.

---

<div class="post-metadata">

**Author:** ![nrcrast](https://avatars.discourse-cdn.com/v4/letter/n/ea666f/32.png) [@nrcrast](https://mangoh.discourse.group/u/nrcrast)\
**Post date:** [December 10, 2019, 1:30am UTC](https://mangoh.discourse.group/t/mangoh-yellow-magnetometer-not-connected/3135/3 "2019-12-10T01:30:46Z")

</div>

Thanks for the response!

I must have missed that in the schematic. I have decided to just talk to the BMI160/BMM150 from userland I2C for now, and I’ve got it working.

One other question for you, if you don’t mind. I can make another thread for this one, but I’m trying to figure out how to read from ADC0 on the IOT Expansion header, but not exactly sure how. I did some digging and didn’t find any sort of /sys kernel interface for that kind of stuff. Any guidance there?

-Nick

---

<div class="post-metadata">

**Author:** ![asyal](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/asyal/32/78_2.png) [@asyal](https://mangoh.discourse.group/u/asyal)\
**Post date:** [December 10, 2019, 5:00am UTC](https://mangoh.discourse.group/t/mangoh-yellow-magnetometer-not-connected/3135/4 "2019-12-10T05:00:47Z")

</div>

You can see the code for ADC reading here. It was done for mangoh red but will apply for yellow as well:

> **[mangOH/mangOH](https://github.com/mangOH/mangOH/tree/master/samples/tutorials/mangOH_Red/adc/NoiseSensor)**
>
> Primary mangOH git repository. Contribute to mangOH/mangOH development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![asyal](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/asyal/32/78_2.png) [@asyal](https://mangoh.discourse.group/u/asyal)\
**Post date:** [December 10, 2019, 5:01am UTC](https://mangoh.discourse.group/t/mangoh-yellow-magnetometer-not-connected/3135/5 "2019-12-10T05:01:49Z")

</div>

For the magnetometer, can you let us know your use case? If there is a widepsread use case, then we can put the right resources on it.

---

<div class="post-metadata">

**Author:** ![nrcrast](https://avatars.discourse-cdn.com/v4/letter/n/ea666f/32.png) [@nrcrast](https://mangoh.discourse.group/u/nrcrast)\
**Post date:** [December 11, 2019, 6:48pm UTC](https://mangoh.discourse.group/t/mangoh-yellow-magnetometer-not-connected/3135/6 "2019-12-11T18:48:18Z")

</div>

I am the Lead Embedded engineer for [Atmosphere IoT](https://atmosphereiot.com/) and we are currently working on adding support for the MangOH yellow into our platform, which is a drag-and-drop IDE/Cloud Solution. Just trying to make sure all the sensors and various peripherals work.

Feel free to send me a PM if you’d like to talk more!

Just getting around to trying the ADC, I’ll let you know how that goes.

Another question: Userland SPI support. I see the IoT header has a few SPI pins on it. Can I get to those? I don’t see any spidev devices.

Thanks for the help,  
Nick

---

<div class="post-metadata">

**Author:** ![nrcrast](https://avatars.discourse-cdn.com/v4/letter/n/ea666f/32.png) [@nrcrast](https://mangoh.discourse.group/u/nrcrast)\
**Post date:** [December 11, 2019, 7:07pm UTC](https://mangoh.discourse.group/t/mangoh-yellow-magnetometer-not-connected/3135/7 "2019-12-11T19:07:45Z")

</div>

Also is there hardware PWM support on anything except for the Buzzer? Ideally some pins on the IoT expansion header.

---

<div class="post-metadata">

**Author:** ![asyal](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/asyal/32/78_2.png) [@asyal](https://mangoh.discourse.group/u/asyal)\
**Post date:** [December 12, 2019, 4:30am UTC](https://mangoh.discourse.group/t/mangoh-yellow-magnetometer-not-connected/3135/8 "2019-12-12T04:30:57Z")

</div>

> [@nrcrast](#):
>
> I am the Lead Embedded engineer for [Atmosphere IoT](https://atmosphereiot.com/) and we are currently working on adding support for the MangOH yellow into our platform, which is a drag-and-drop IDE/Cloud Solution. Just trying to make sure all the sensors and various peripherals work.

For spidev automatically showing up, we will update firmware to make that happen.

---

<div class="post-metadata">

**Author:** ![asyal](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/asyal/32/78_2.png) [@asyal](https://mangoh.discourse.group/u/asyal)\
**Post date:** [December 12, 2019, 4:46am UTC](https://mangoh.discourse.group/t/mangoh-yellow-magnetometer-not-connected/3135/9 "2019-12-12T04:46:49Z")

</div>

There is no hardware PWM as it is not supported on the module. I will send you a PM for further discussions.

---

<div class="post-metadata">

**Author:** ![nrcrast](https://avatars.discourse-cdn.com/v4/letter/n/ea666f/32.png) [@nrcrast](https://mangoh.discourse.group/u/nrcrast)\
**Post date:** [December 12, 2019, 12:06pm UTC](https://mangoh.discourse.group/t/mangoh-yellow-magnetometer-not-connected/3135/10 "2019-12-12T12:06:50Z")

</div>

Cool thanks for the help! This is a nifty little board for sure.

Nick

---

<div class="post-metadata">

**Author:** ![epastor](https://avatars.discourse-cdn.com/v4/letter/e/91b2a8/32.png) [@epastor](https://mangoh.discourse.group/u/epastor)\
**Post date:** [March 10, 2021, 11:02pm UTC](https://mangoh.discourse.group/t/mangoh-yellow-magnetometer-not-connected/3135/11 "2021-03-10T23:02:26Z")

</div>

> [@nrcrast](#):
>
> BMI160

Hello,  
Just come across this post.  
We are quite interested in using that magnetometer in order to compensate for the heading of a vehicle.  
Would you mind sharing some insight on who did you manage that?  
Thanks a lot in advance.  
-Enric
