RobTillaart / AS5600

Arduino library for AS5600 magnetic rotation meter
MIT License
114 stars 23 forks source link

Change DIR value after programming. #61

Closed vbenso closed 7 months ago

vbenso commented 8 months ago

Let's begin with, congrats for the nice work in the library.

Imagine the following scenario:

I program de AS5600 to give max output value at 10 degrees and min output value at 170 degress. It works fine, however, shouldn't it give me min output at 10 degreens and max output at 170 if I change the value of the direction pin?

What is the expected behaviour in this case? I've been looking for such information in the technical documents of AS5600, however there is little information about how the DIR pin affects the behaviour of an already programmed sensor.

Thanks for any advice.

RobTillaart commented 8 months ago

Thanks for your question, will dive into it later this evening.

RobTillaart commented 8 months ago

A quick first response

Changing the direction pin changes the direction of increase and from my head it works on the raw data. So 10 degrees become 350 and 170 becomes 190. It does not swap 10 and 170.

What is the underlying problem you try to solve?

vbenso commented 8 months ago

I'm trying to design a replacement for a potentiometer based angle sensor. In the specific model that I'm working in, this sensor can be mounted in its target machine in both polarities, it has 3 pins:

Wiring when used in place 1:
A- 5V
B- Output
C- GND

10 deg 0V
170 deg 5V
Wiring when used in place 2:
A- GND
B- Output
C- 5V

10 deg 5V
170 deg 0V

I'm using a low drop rectifier bridge in order to provide 5V to the AS56000, and I wanted the DIR pin to indicate to the IC in which way it is being mounted.

In order to keep the same behaviour as the original sensor that uses a potentiometer, I need the afore mentioned output curve. I'm wondering if the AS5600's output would follow this mechanism of inverting its output ramp according to the DIR state, in special after programming.

RobTillaart commented 8 months ago

@vbenso Any progress made?

If you mount in place 2 what are the angles you get if you dont change anything? (A simple mapping might then do the trick as you map a range of 160 degrees on another range of 160 degrees )

RobTillaart commented 7 months ago

As there is no answer I assume the problem is solved, so I close the issue.