Getting the position from two between hall sensors?

I'm working on an improved version of a DIY MIDI controller that is based on a DJ-style crossfader. For the updated version I plan on using a contactless approach using the main rails/PCB from a commercial crossfader.

rf_dirty_fader

You can make out the two hall sensors next to the black vertical bits, and in the middle of the fader bit is a neodymium magnet.

Now, I've done stuff with hall sensors and Arduino/Teensy stuff before, but I've never done anything where I'll be taking two sets of values to get a single position.

I've not gotten the fader yet to test, but I would imagine that each will be significantly more accurate in its own "half", with there being a bit in the middle where they taper off.

Is is there a name of this type of sensor and/or an algorithm that is meant to combine and produce an accurate representation of where the fader is based on readings from both hall sensors?

You need to supply the link to a data sheet for the Hall sensors, so we know as much as you do about them.

I've not received the PCB yet, so can't confirm by looking at the part number on the hall sensors, but I did find the patent document (and a service manual for the Mixer that it typically goes in) and it does reference an Allegro A3515 as an example of the type of hall sensor that would work well with this.

Datasheet:
A3515-6-Datasheet.pdf (1.7 MB)

Incidentally, these are the best/clearest pics I could find of the PCB. Not nearly clear enough to read the part numbers however.


You do realise these are a discontinued line..??
There would be replacements though.

Ratiometric means they sit at 1/2 supply while under no influence of the magnet.
As a N pole approaches they slowly move towards one rail supply and opposite is opposite.

Magnet I imagine would need to be rather strong if the distance to the sensor is over a certain limit.
You don't say anything about the magnet so just assuming bar magnet.
So N would be one direction, south the other.
Feed into analog input and take mid-point to low for one side and mid-point to high on the other.
Could possible map the output to get some usable numbers or convert what you have.

Given they are rail level dependant, might pay to feed them with a stable 5v for any expected output.

1 Like

Probably wouldn't be a first choice to design something from scratch, but I do believe that is what's in the part/PCB I've ordered as the company still sells parts for older-generation mixers.

The main reason I've done this approach, rather than rolling something completely from scratch, is the mechanical-side of this is what's trickiest to get right (feel, stability, weight, etc...), so that is sorted in a commercial product. I also imagine the hall sensor and built-in magnet are spec'd appropriate to each other.

When it does arrive I'll do some testing, it's mainly what to do with the maths of computing the absolute position from both sensors. I'm glad I found the patent document as that may give some insight as to what they are doing further down the processing chain. However, since I'm using it without the rest of the mixer/circuit, I'm going from the hall sensors directly to an Arduino (possible an i2c ADC first, to get as much resolution as possible).

The HED output voltage is proportional to the applied magnetic field. That comes from a bar magnet by the look of the mechanics, so the field at the sensor will vary as the inverse-square of the distance. If I have the maths correct this can still give a reasonably linear result but some correction may be needed near the extremes of travel, so you may need to use either a lookup table or some computation to give a more linear response. You need of course to take the difference between the HED outputs, which could be done either with a differential amp (not as easy as it sounds) or by sampling them separately and diffing in software (but then the ADCs need to be matched). Sounds a fun project.

1 Like

Thanks, that's useful to know.

My plan at the moment is to use an ADS1115 as I've used it in projects before, as it will give be better-than-stock resolution towards that. I'm curious how well taking a straight difference will be as at the far ranges for each side (as in, when the magnet is close to one sensor, but quite far from the other), I would think the noise potentially introduced by the "far" one would just deteriorate the resolution/accuracy of the "close" one.

The word is "potentially". Try it and see. More likely to be other magnetic fields (e.g. from mains wiring) introducing noise. You need to use both signals to optimise linearity.

1 Like

It is the inverse cube for a magnet. The fields fall off very rapidly.

1 Like

Hmm... so it does! Every day a learning day.

Doesn't change the principle though but makes it more important to use the difference to optimise linearity. If the sensors are at +/- A a quick mathematica plot looks reasonably linear over +/- A/2, but then starts to go very non linear. The series expansion is

6x + 20x^3 + 42x^5 + O(x^6)

where x is the magnet deflection divided by A. (There's a multiplying constant as well which doesn't matter.) For x = 0.5 this gives 6.8125 which is significantly greater than the "linear" value of 3. So maybe the thing to do is difference the Hall sensor outputs then have either a lookup table or a formula to linearise the result.

True. But the region when no hall sensor is picking up anything is likely to give you a big hole in a dead section at the centre.

The best way to do this would be to forget magnets and replace the middle whit a white card, then have a TOF sensor at one end. I have made a single ended version of the same thing with an 8mm stainless steel rod and a linear bearing.

Well it would be worth a bit more analysis. There is an excellent magnetic field calculator at:

where you can define the shape of the magnet and material and it will calculate the field at any point in space.
image

So this shows the field 20mm axially away from an N42 (material) neodymium magnet 12 x 4mm (a common size and quite cheap), and gives a value of 45.7 gauss. The A3515 has a sensitivity of 5mV/gauss so one should get a sensed voltage of over 200mV for that. OK, probably need some gain in the diff amp but sounds doable.

1 Like

Then there are radial magnets....

Ok, finally received the fader and after zooming in with my phone to take some pics, it looks like it's an Allegro A1324:

The wiring of it looks pretty straight forward in the datasheet:

On the bottom of the board there are two caps:

I've no idea what the values are as I don't really work with SMT packages too much, but I'm guessing the values are appropriate to the bypass cap called for. It does seem odd that it's two separate caps also bridging with the output pin:

It's a bit hard to see without snipping the pins, but it looks like the top trace connects to the middle pin.

Then all of the pins come to a 4-pin breakout:

I'm assuming these would represent VCC, GND, and VOUT1 / VOUT2, but it's hard for me to tell from the pic which is which. It also looks like the output pins from the hall sensors only get there from being bridged across C2/C4 and C1/C3 respectively. I would assume pin3 of the output is either GND or VCC as it clearly goes to both sides. Holding it up to the light there's a couple traces on the other side and/or connecting to some of the output pins:

Or is supposed to, but the soldering looks highly suspect!

Hehe, with the bent and un-snipped pins, it is definitely on the casual side of a production PCB.

Interesting setup. Is this considered a successful product, or is it something nobody wanted to buy?

You could read the 2 Hall sensor outputs into A/D inputs on an Arduino, and maybe they'll give you numbers that are unique for every point along the track, and not a big zone in the middle with no change. Even if the output is highly nonlinear, you could get more of a true position reading if you figured out a mathematical function, or maybe just a lookup table.

This is the crossfader component from a larger DJ mixer. The company itself (Rane) is quite big and this was, at one point, a flagship fader from them. They have a more recent gen version of the fader, but it has a microcontroller and more stuff on it, and I figured it would be harder to hack around.

Having a quick look at the picture on the product page, it does appear to also/still use the A324, but in the different form factor.

Yeah, that's what I'm thinking. Hopefully it's not too non-linear, but the datasheet does have some graphs and such which I'm sure I could use to build a LUT.

When decoupling a supply it is normal to have two capacitors, a large one to handle low frequency interference and a small ceramic one to handle high frequency interference.

The thing is that surface mount capacitors do not have a value printed on them so you can't tell the value. However it is clear from your photograph that the two are different. I suspect the right hand one is the small ceramic capacitor. The left one could also be ceramic but it has an unusual look to it if it is.

1 Like

Already done in another thread.