4 hall sensor with TLA2518 converter

Hi everyone,

I am working on my master's thesis using an Arduino Uno, but I am experiencing some difficulties as I am not very experienced with it. Specifically, I have four Hall sensors connected to a TLA2518 converter (SPI), which is in turn connected to the Arduino Uno using the following pins:

  • SCL pin 13
  • SDI pin 12
  • SDO pin 11
  • CS pin 10

I have also connected VD to V5 and GND to GND.

I am facing an issue where the readings on the serial monitor are always displaying as zeros when i use a magnet.

I am not sure if my code is correct, or if there is somethong wrong.

#include <SPI.h>
#define CS 10

void setup() {
  // Initialize SPI communication
  SPI.begin();

  // Set the CS pin as an output
  pinMode(CS, OUTPUT);

  // Start serial communication
  Serial.begin(9600);
}

void loop() {
  // Select the first sensor
  digitalWrite(CS, LOW);

  // Send a command to read from the TLA2518
  SPI.transfer(0b00001111);

  // Read the data from the TLA2518
  int msb = SPI.transfer(0x00);
  int lsb = SPI.transfer(0x00);
  int data = (msb << 8) | lsb;

  // Deselect the TLA2518 converter
  digitalWrite(CS, HIGH);

  // Print the data to the serial monitor
  Serial.println("Sensor 1: " + String(data));

  // Select the second sensor
  digitalWrite(CS, LOW);

  // Send a command to read from the TLA2518
  SPI.transfer(0b00011111);

  // Read the data from the TLA2518
  msb = SPI.transfer(0x00);
  lsb = SPI.transfer(0x00);
  data = (msb << 8) | lsb;

  // Deselect the TLA2518 converter
  digitalWrite(CS, HIGH);

  // Print the data to the serial monitor
  Serial.println("Sensor 2: " + String(data));

  // Select the third sensor
  digitalWrite(CS, LOW);

  // Send a command to read from the TLA2518
  SPI.transfer(0b00101111);

  // Read the data from the TLA2518
  msb = SPI.transfer(0x00);
  lsb = SPI.transfer(0x00);
  data = (msb << 8) | lsb;

  // Deselect the TLA2518 converter
  digitalWrite(CS, HIGH);

  // Print the data to the serial monitor
  Serial.println("Sensor 3: " + String(data));

  // Select the fourth sensor
  digitalWrite(CS, LOW);

  // Send a command to read from the TLA2518
  SPI.transfer(0b00111111);

  // Read the data from the TLA2518
  msb = SPI.transfer(0x00);
  lsb = SPI.transfer(0x00);
  data = (msb << 8) | lsb;

  // Deselect the TLA2518 converter
  digitalWrite(CS, HIGH);

  // Print the data to the serial monitor
  Serial.println("Sensor 4: " + String(data));

  // Wait for a moment before sending another command
  delay(1000);
}

there are link for Converter and hallsensor :

Converter TLA2518 :

Hallsensor:
https://www.mouser.de/datasheet/2/187/HWSC_S_A0012826248_1-3073340.pdf

The question is: why am I not getting any reaction from my sensor at serialmonitor ?

Question:

Why do use an ADC to read a hal sensor ?

Did you write the source code?

A quick look at the data sheet suggests that you first have to configure the inputs, then initiate a conversion, then wait for the conversion to complete, then get the data.

A Google search for "Arduino TLA2518" gave this library GitHub - dlyckelid/IOExpander-TLA2518
I don't know if it's any good, but should give you some ideas.

this device output is from 1V to 4V, (w/o trigger).

1 Like

I don't have any source code for my project. I attempted to use a TLA2518 library, but there were always errors in the something and decided not to use it.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.