Need help, Teensy 4.1 not reading analog input from as5600 hall sensor

Ram32

Member
Hello everyone, I'm new to teensy, but familiar with arduino and arduino IDE. For a side project I decided to give teensy a try. My first and major hurdle is I'm unable to read the analog input from the sensor(as5600). I'm attaching the pin data from datasheet for the sensor.

Link to the datasheet:
https://ams.com/documents/20143/36005/AS5600_DS000365_5-00.pdf/649ee61c-8f9a-20df-9e10-43173a3eb323.

I connected the VCC from sensor to the 5V pin(tried 3.3v as well) on the teensy, GND to GND, and trying to take analog out from the sensor through A0. I tried A3(input pin doesn't matter, just need the data) as input pin but in both scenarios I'm not getting any change in the input. I checked the signal with arduino mega and I see the change in values. I might be missing something simple but for the sake of life I'm unable to figure out what that is, why I'm not getting the reading. Any inputs or suggestions on how to get the analog reading from the sensor is much appreciated. Thanks.

I'm just using a example code from internet:

void setup()
{
Serial.begin(9600);
pinMode(A3, INPUT);
}

int val;

void loop()
{
Serial.println("123");
val = analogRead(A3);
Serial.print("analog A3 is: ");
Serial.println(val);
// delay(250);
}
 

Attachments

  • as56.jpg
    as56.jpg
    196.9 KB · Views: 56
First of all: do not connect the AS5600 sensor to the +5V ! The Teensy 4.1 is a 3V3 device and will get killed when the input voltages are higher than 3V3. When you power the sensor by 5V, the analog output will also near 5V.
So don't use the sensor's VDD5V supply input but connect Teensy's 3V3 output to the sensor's VDD3V supply input. Follow the instructions on the bottom of page 9 of the datsheet.
If you need more control of the chip, you can use this library.

Paul
 
I fear you are popping all the analog inputs one by one - 5V is typically instant death to any T4.0/T4.1 pin, or if unlucky the entire chip.
 
First of all: do not connect the AS5600 sensor to the +5V ! The Teensy 4.1 is a 3V3 device and will get killed when the input voltages are higher than 3V3. When you power the sensor by 5V, the analog output will also near 5V.
So don't use the sensor's VDD5V supply input but connect Teensy's 3V3 output to the sensor's VDD3V supply input. Follow the instructions on the bottom of page 9 of the datsheet.
If you need more control of the chip, you can use this library.

Paul
Thanks Paul, I got it working. I did follow the instructions and it worked. Thanks for pointing it out, I'm able to get the code working on teensy.
 
I fear you are popping all the analog inputs one by one - 5V is typically instant death to any T4.0/T4.1 pin, or if unlucky the entire chip.
Yeah I feared that I might kill the teensy, but luckily I didn't. It's working as expected.
 
Back
Top