Connecting HCM375B-232-68N with arduino

Hello Guys,
I have a 3D digital compass model"HCM375B-232-68N", I have used it with it's Rion software. Now my second step is to connect this compass with arduino, for first few tries I attempted to obtain the data values shown on it's software on arduino serial monitor through rx/tx pins. I got some of values but they were not what I wanted.
Please can anyone guide me how can I connect the compass with arduino so that i could obtain it's movement values on serial monitor of arduino.
Below attached:
https://youtu.be/I0Tq7U8Stro?si=YYLQDtRFbor89HQN (connection of compass with vga , then i took single wires splitted in two other wires one connected with rx of vga and one connected with rx of arduino)

  1. http://rionsystem.com/en/static/upload/file/20220302/1646220938575346.pdf (data sheet of the compass)
  2. My first Try of the code when the compass was simultaneously transmitting values towards the vga board to it's software and arduino was receiving some hex values of the compass.
    HCM375B-232-68-N output received on RX of arduino:
    Received Hex: 0x49
    Received Hex: 0xFFFFFF9F
    Received Hex: 0xFFFFFFCE
    Received Hex: 0xFFFFFFFC
    Received Hex: 0xFFFFFFBA
    Received Hex: 0x0
    Received Hex: 0xFFFFFFC9
    Received Hex: 0xFFFFFFFE
    Received Hex: 0xFFFFFFEE
    Received Hex: 0xFFFFFFFC
    Received Hex: 0xFFFFFFFE
    Received Hex: 0xFFFFFF9A
    Received Hex: 0xFFFFFFBE
    Received Hex: 0xFFFFFFFA
    Received Hex: 0x2A
    Received Hex: 0xFFFFFFFA
    Received Hex: 0xFFFFFFFA
    Received Hex: 0x62
    Received Hex: 0xFFFFFFFE
    Received Hex: 0xFFFFFF96
    Received Hex: 0x0
    Received Hex: 0xFFFFFFC9
    Received Hex: 0xFFFFFFFE
    Received Hex: 0xFFFFFFEE
    Received Hex: 0xFFFFFFFC
    Received Hex: 0xFFFFFFFE
    Received Hex: 0xFFFFFF9A
    Received Hex: 0xFFFFFFBE
    Received Hex: 0xFFFFFFFA
    Received Hex: 0x2A
    Received Hex: 0xFFFFFFFA
    Received Hex: 0xFFFFFFFA
    Received Hex: 0x62
    Received Hex: 0xFFFFFFFE
    Received Hex: 0xFFFFFF96
    Received Hex: 0x0
    Received Hex: 0xFFFFFFC9
    Received Hex: 0xFFFFFFFE
    Received Hex: 0xFFFFFFEE
    Received Hex: 0xFFFFFFFC
    Received Hex: 0xFFFFFFFE
    Received Hex: 0xFFFFFF9A
    Received Hex: 0xFFFFFFBE
    Received Hex: 0xFFFFFFFA
    Received Hex: 0x2A
    Received Hex: 0xFFFFFFFA
    Received Hex: 0xFFFFFFFA
    Received Hex: 0x3E
    Received Hex: 0xFFFFFFFE
    Received Hex: 0x72
    Received Hex: 0x0
    Received Hex: 0xFFFFFFC9
    Received Hex: 0xFFFFFFFE
    Received Hex: 0xFFFFFFEE
    Received Hex: 0xFFFFFFFC
    Received Hex: 0xFFFFFFFE
    Received Hex: 0xFFFFFF9E
    Received Hex: 0xFFFFFFBE
    Received Hex: 0xFFFFFFFA
    Received Hex: 0x2A
    Received Hex: 0xFFFFFFFA
    Received Hex: 0xFFFFFFFA
    Received Hex: 0x3E
    Output values on Rion software:
    TX: 68 04 00 04 08
    RX: 68 0E 00 84 00 00 20 10 01 30 01 01 02 00 F7
    TX: 68 04 00 04 08
    RX: 68 0E 00 84 00 00 20 10 01 30 01 01 01 00 F6
    TX: 68 04 00 04 08
    RX: 68 0E 00 84 00 00 20 10 01 30 01 01 02 00 F7
    TX: 68 04 00 04 08
    RX: 68 0E 00 84 00 00 20 10 01 30 01 01 02 00 F7
    TX: 68 04 00 04 08
    RX: 68 00
    TX: 68 04 00 04 08
    RX: 68 0E 00 84 00 00 20 10 01 30 01 01 04 00 F9
    TX: 68 04 00 04 08
    RX: 68 0E 00 84 00 00 20 10 01 30 01 01 02 00 F7
    TX: 68 04 00 04 08
    RX: 68 0E 00 84 00 00 20 10 01 30 01 01 02 00 F7
    TX: 68 04 00 04 08
    RX: 68 0E 00 84 00 00 20 10 01 30 01 01 03 00 F8
    TX: 68 04 00 04 08
    RX: 68 0E 00 84 00 00 19 10 01 31 01 01 05 00 F4
    TX: 68 04 00 04 08
    RX: 68 0E 00 84 00 00 19 10 01 31 01 01 08 00 F7
    TX: 68 04 00 04 08
    RX: 68 0E 00 84 00 00 19 10 01 31 01 01 18 00 07
    TX: 68 04 00 04 08
    RX: 68 0E 00 84 00 00 20 10 01 30 01 01 42 00 37
    TX: 68 04 00 04 08
    RX: 68 0E 00 84 00 00 19 10 01 31 01 01 92 00 81
    TX: 68 04 00 04 08
    RX: 68 0E 00 84 00 00 19 10 01 31 01 02 85 00 75
    TX: 68 04 00 04 08
    RX: 68 0E 00 84 00 00 19 10 01 31 01 04 27 00 19
    TX: 68 04 00 04 08
    RX: 68 0E 00 84 00 00 20 10 01 30 01 05 92 00 8B
    TX: 68 04 00 04 08
    RX: 68 0E 00 84 00 00 20 10 01 30 01 06 99 00 93
    TX: 68 04 00 04 08
    RX: 68 0E 00 84 00 00 20 10 01 30 01 08 37 00 33
    TX: 68 04 00 04 08
    RX: 68 0E 00 84 00 00 20 10 01 30 01 09 41 00 3E
    TX: 68 04 00 04 08
    RX: 68 0E 00 84 00 00 20 10 01 30 01 10 12 00 16
    TX: 68 04 00 04 08
    RX: 68 0E 00 84 00 00 20 10 01 30 01 10 25 00 29
    TX: 68 04 00 04 08
    RX: 68 0E 00 84 00 00 20 10 01 30 01 09 85 00 82
    TX: 68 04 00 04 08
    RX: 68 0E 00 84 00 00 20 10 01 30 01 09 47 00 44
    TX: 68 04 00 04 08
    RX: 68 0E 00 84 00 00 20 10 01 30 01 09 09 00 06
    TX: 68 04 00 04 08
    RX: 68 0E 00 84 00 00 20 10 01 30 01 08 37 00 33
    TX: 68 04 00 04 08
    RX: 68 0E 00 84 00 00 20 10 01 30 01 07 13 00 0E
    TX: 68 04 00 04 08
    RX: 68 0E 00 84 00 00 20 10 01 30 01 05 90 00 89
    TX: 68 04 00 04 08
    RX: 68 00
    TX: 68 04 00 04 08
    RX: 68 0E 00 84 00 00 20 10 01 30 01 04 23 00 1B
    TX: 68 04 00 04 08
    RX: 68 0E 00 84 00 00 20 10 01 30 01 03 22 00 19
    TX: 68 04 00 04 08
    Arduino code:
void setup() {
  Serial.begin(9600);
}

void loop() {
  if (Serial.available() > 0) {
    char incomingByte = Serial.read();
    Serial.print("Received Hex: 0x");
    Serial.println(incomingByte, HEX); // Print the hexadecimal representation
   // Serial.println();
  }
}

have a read of how-to-get-the-best-out-of-this-forum
in particular

  1. what arduino are you using?
  2. how have you connected it to the compass?
1 Like

First you will need a RS232-TTL converter

I hope you did not connect the compass directly to your arduino especially if it's a 3.3V type Arduino

1 Like

@jim-p Thankyou for guiding I am using arduino uno(SMD version).
Can I use HW-044(https://www.seeedstudio.com/RS232-to-TTL-Converter-Module-p-1684.html) as I have it right now, otherwise I will purchase the other one which you have mentioned.
Can you please guide that should I use the 5v supply to HCM375 compass either from arduino uno(which I am using) or from the rs232 ?

The converter you have is OK
I need to look at the data sheet for the cpmpass to see how to connect the two.

1 Like

the HW-044 RS232-TTL shield should work OK with the UNO
I would suggest you use AltSoftSerial library which works OK on a UNO at 9600 baud

try this simple program

// AltSoftSerial transmit/Receive Test
//
// from https://github.com/PaulStoffregen/AltSoftSerial/blob/master/examples/ReceiveTest/ReceiveTest.ino
//
// Transmit data with Serial1 and try to receive
// it with AltSoftSerial.  You must connect a wire
// from Serial1 TX to AltSoftSerial RX.

#include <AltSoftSerial.h>

AltSoftSerial altser;
const int mybaud = 9600;

// Board            Serial1 TX   AltSoftSerial RX
// -----            ----------   ----------------
// UNO                   9              8
// Teensy 3.x            1              20
// Teensy 2.0            8 (D3)         10 (C7)
// Teensy++ 2.0          3 (D3)          4 (D4)
// Arduino Leonardo      1              13
// Arduino Mega         18              48

// Serial1 on AVR @ 16 MHz minimum baud is 245
// Serial1 on Teensy 3.2 @ 96 MHz minimum baud is 733

void setup() {
  delay(200);
  Serial.begin(115200);
  while (!Serial) ;  // wait for Arduino Serial Monitor
  altser.begin(mybaud);   // to AltSoftSerial RX
  Serial.println("AltSoftSerial transmit/ Receive Test");
  Serial.println("on a UNO connect pins 8 and 9 for a loopback test");
  Serial.println("characters entered on serial monitor keyboard are echoed back via serial to the display");

}

void loop() {
  // transmit a test byte on Serial 1
  if (Serial.available() > 0) {
    altser.write(Serial.read());
  }
  // attempt to receive it by AltSoftSerial
  if (altser.available() > 0) {
    Serial.write(altser.read());
  }
}

to check it works connect UNO pins 8 and 9 together to give a loopback test
characters entered on serial monitor keyboard are echoed back via serial to the display

to connect the RS232module
connect UNO pin 8 Rx to RS232 RX
connect UNO pin 9 Tx to RS232 TX
connect UNO 5V and GND to the RS232 module

does the HCM375 compass have a 9pin D-type connector which can plug into the RS232-TTL module

1 Like

which arduino do you have?

Connect like this:

Compass     Converter DB9
TXD     -->  pin 3
RXD     <--  pin 2

Converter     Arduino
RX       -->     RX 
TX       <--     TX

VCC      <--     ???
GND      <->     GND

@jim-p @horace
Thankyou I have read that document which you mentioned.

  1. I am using arduino uno (smd version , attaching the image along)
  2. I had used rx,tx pins of compass and arduino but it did'nt work because as everyone mentioned we need to use RS232 and probably send a command in hexadecimal to start operating the compass.
  3. No, HCM375 does'nt come with a 9 pin D-type connector , however I used one to connect it and make it work on it's own software, which worked perfectly fine. (also attaching the pin configuration of compass)
    image

    image

@jim-p
I have smd arduino attached image in my other comment.
Secondly, I have also attached the datasheet of the compass in my first post.

@jim-p
I connected all pins in the way you mentioned, however this only worked when I simultaneously used compass's 'Rion' software along with the arduino. But it didnot worked when I separately used only arduino and compass with the connections mentioned above.

@horace
Thankyou for loopback test code.
I have tried and obtained the output shown below. I tried to enter few characters on serial monitor they were sent but never displayed. Is my output shown correct ?
connections are
RS232(vcc-5v)arduino
RS232(gnd-gnd)arduino
RS232(RX-8)arduino
RS232(TX-9)arduino

did you try connecting pins 8 and 9 of the UNO to do a loopback test? did t work OK?

when the RS232-TTL module is connected to the UNO try connecting pins 2 and 3 of the D-type connector - this should form a loopback test to check the RS232-TTL module is working

@horace Can you please make connections more clear.
like what's the sequence of connecting all pins.
RS232(vcc-5v)arduino
RS232(gnd-gnd)arduino
RS232(RX-8)arduino
RS232(TX-9)arduino
and use 2,3 pins of D-type to connect with which pins ?

First you should only have the Uno and compass connected, nothing else should be connected to RXD, TXD
Second what software are you using on the Uno to communicate with the compass?

connect D-type pins 2 and 3 together - the transmitted signal is fed back to the receiver to form a loopback
characters entered on the serial monitor are transmitted over RS232 and received back to be displayed

@jim-p
I should connect uno and compass only with 5v and GND right ?
Secondly I am not using and software to communicate with compass however as @horace and you mentioned I will need to use rs232 module for communication.

@horace
Please check the connections below and inform my mistake.

try swopping pins 8 and 9 on the UNO
marking can be ambiguous - does Tx mean transmit out of device or transmit into device

Connect as I show in post #8 using the HW-044 converter, Vcc is 5V.
Only connect the Uno and compass, nothing else.
What software are you using on the UNO?