General Arduino

Arduino + BMM150 magnetometer. SPI Connection fails

userHead pcapdess 2023-03-20 00:31:25 319 Views3 Replies

Hello all,

 

I am trying to make my BMM150 work on Arduino UNO using SPI communication. 

 

I followed the instruction for documentation here: https://wiki.dfrobot.com/SKU_SEN0419_Fermion_BMM150_Triple_Axis_Magnetometer_Sensor_Breakout#target_0

There is no step by step tutorial for dummies like me, so I may have missed something.

 

As far as I know, the chip don't allow 5V level, so I needed a level converter between Arduino and BMM150 magnetometer. I took this TXB0104 https://www.sparkfun.com/products/11771.

 

 

The wiring is the following

 

Arduino                                                                      TXB0104                                     BM150

* GND -------------------------------------------------------  GND                GND  -------------------   GND* 5V ----------------------------------------------------------  VCCB           VCCA   -------------------   VCC* DIGITAL13 (SCK) -----------------------------------  B4                      A4   -------------------   SCK* DIGITAL12 (MISO) ---------------------------------  B3                      A3   -------------------   SDI* DIGITAL11 (MOSI) ---------------------------------  B2                      A2   -------------------   SDO* DIGITAL10 (CS custom) ------------------------  B1                       A1   -------------------  CS                                                                                                                                      PS --→ GND

I also joined a schematic:

 

According to the same tutorial page I install the DFRobot_BMM150_library on arduino IDE and launched the getAllState example. 

It fails saying bmm150 init failed, Please try again!

 

It is easy to see that the program fails at the very beginning of the code:


void setup() 
{
 
 Serial.begin(115200);
 Serial.print("BMM150_CS=");Serial.println(BMM150_CS);  // print to check CS pin is set to 10. It actually print 10
 while(!Serial)
 {Serial.print("wait");}

 while(bmm150.begin()){  
   Serial.println("bmm150 init failed, Please try again!");
   delay(1000);
 } Serial.println("bmm150 init success!");

 

 

I looks so simple that I am a bit confused and blocked.

I have any idea or see an error in my wiring please tell me.

 

Pierre

 

 

2023-11-02 22:17:37

What are you seeing in the serial monitor? Garbage values or nothing at all?

userHeadPic lia.ifat
2023-11-02 05:19:49

Hi ! 

I'm using this sensor with my raspi 3 and i get this error message : “please check connect r” after running both demo_get_all_state.py and astro_compass.py. I take a look at the python code and i didn't understand the cause of this error message.

I know you didn't used a raspi, but maybe you could still help me if your problem is solved?

(PS : “Pierre” sounds french, maybe a compatriot by any chance ?)

userHeadPic shadelub
2023-03-20 01:29:12

Hum table rendering with caracters failed… I will try to write it again.

 

Arduino                                                                      TXB0104                                     BM150

 

* GND -------------------------------------------------------  GND                GND  -------------------   GND

 

* 5V ----------------------------------------------------------  VCCB           VCCA   -------------------   VCC

 

* DIGITAL13 (SCK) -----------------------------------  B4                      A4   -------------------   SCK

 

* DIGITAL12 (MISO) ---------------------------------  B3                      A3   -------------------   SDI

 

* DIGITAL11 (MOSI) ---------------------------------  B2                      A2   -------------------   SDO

 

* DIGITAL10 (CS custom) ------------------------  B1                       A1   -------------------  CS                        

                                                                                                                                      PS  --→ GND

userHeadPic pcapdess