Weird compass data on UART

Frequent questions asked online, offline, in forums are answered here
Post Reply
BenC
Posts: 1
Joined: Thu Sep 26, 2019 10:18 am

Weird compass data on UART

Post by BenC »

Hello,
I bought marvelmind system recently and I try to get compass data on Arduino. I obtain weird data, higher than 65000 but it will be 12 bits so under 4096, right?
I use a modified version of hedgehog_sample_uart_v3 to get compass data and I have also the same issue with hedgehog_sample_uart_imu_raw_v1 that I have been finding on forum.
Thanks in advance
Attachments
compass_data_uart.rar
(1.33 KiB) Downloaded 130 times
hedgehog_sample_uart_imu_raw_v1.rar
(2.1 KiB) Downloaded 145 times

smoker77
Posts: 322
Joined: Sat Feb 06, 2016 4:03 pm

Re: Weird compass data on UART

Post by smoker77 »

Hello,

It looks like negative values.
Compass values are signed 16 bit represented in two's complement code.
https://en.wikipedia.org/wiki/Two%27s_complement

Value -1 is represented as 65535 and so on.
Generally, if "V" is received 16-bit value and high bit of this value is 1, you should treat the result as (V-2^16)

hunteril
Posts: 5
Joined: Thu Jun 25, 2020 9:11 pm

Re: Weird compass data on UART

Post by hunteril »

Hello
could you please specify the pin connection between arduino and marvelmind modem ?

smoker77
Posts: 322
Joined: Sat Feb 06, 2016 4:03 pm

Re: Weird compass data on UART

Post by smoker77 »

Hello,

You should connect USART2_TX pin of modem to UART RX pin (digital pin 0) on Arduino and modem's ground pin to Arduino's GND.
Modem's pinout is shown in section 8.3 of the manual:
https://marvelmind.com/pics/marvelmind_ ... manual.pdf

hunteril
Posts: 5
Joined: Thu Jun 25, 2020 9:11 pm

Re: Weird compass data on UART

Post by hunteril »

Hello smoker77,
again thanks for your reply.

I tried both ways: connecting the arduino to modem and then to mobile beacon.

No compass information is available

any advice please ?

smoker77
Posts: 322
Joined: Sat Feb 06, 2016 4:03 pm

Re: Weird compass data on UART

Post by smoker77 »

Hello,

Please check presence of IMU in your beacon as I described in the topic:
https://marvelmind.com/forum/viewtopic. ... 178#p40178

Post Reply