MT6835 Angle sensor 21bit

Hi, im creating this thread for the MT6835, since there are folks working on support for it, and because its awesome (not yet tested).

For folk who dont know it. It is the latest Magnetic Angle Sensor from MagnTek. It features a really interesting auto-calibration routine, which should help increase performance. This basic calibration routine works by mowing the motor/shaft in open-loop at a set speed, whereby the calibration is started until done.

Anyways, I’m wondering where the Z point is (cero point in ABZ encoder config.) if not set by the MCU. Will it just be some random place and if so, what does it matter if it is in a random place?

I’m thinking a XY machine use case here, like a PNP machine, where one will home the machine every time it start a job. In that case, if the sensor is mounted and calibrated (as part of the installation on the machine). Is SPI then actually needed if the ABZ interface is working properly ?

Edit: If needing to customize the ABZ resolution, then naturally the SPI interface is needed. So maybe while calibrating it would be nice to have SPI available, but other then that, should ABZ work independently?

Lets say the ABZ is pre-configured to a resolution when buying the sensor (the vendor programs the ABZ resolution).

1 Like

Regarding the TVS diode, recommended by MagnTek, I have found this small fellow:

https://www.mouser.dk/datasheet/2/80/AQW_G7049_ACPDQC3V3HT_HF_RevA-2933740.pdf

Its quite small, but actually significantly larger then other TVS diodes in the same range (3.3V working voltage - clamping voltage below 6V). Usually those are 0402 parts, like 0.6mm long, which is pretty hart to place by hand. Above footprint is 1.05mm long.

If you know any other TVS diode, with the same specs, but a bit larger eg. 0603 package, plz advice.

I think you got the answer already, but you can manually write the zero position. So you can do calibration, then move to endstop and write register over SPI to align the mechanical system and software.

For the TVS I don’t think you want 3.3V working voltage, because the chip is OK to 5.5V per datasheet. The clamp at 6V is probably a lot more important. https://www.mouser.com/ProductDetail/Nexperia/PESD3V3S1BSFYL?qs=pUKx8fyJudDCZ6XFlQWByg%3D%3D
This one matches similar specification but is 0603 which is easier than 0402 by a lot for hand work. I didn’t see any good matches on JLCPCB but this one caught my eye:
GBLC03CI | Yenji Elec | TVS | JLCPCB
I wonder why the application requires this. Obviously for circuit protection but I also wonder if they are using the capacitance from the diode for quick recovery or something.

Did you find anywhere to buy MT6835 outside of China?

MagnTek is located in China.

I ended up with this part for the tvs diode. It has a break down voltage at 4V and clamps to 6.5V which is absolutely max voltage on the MT6835. The footprint is 1.65mm

https://www.mouser.dk/datasheet/2/1057/PJSD03TS-AU_SERIES-1867703.pdf

The first one you linked to is 0.65mm, 0402 package.

oops, I always forget about 0603 metric vs imperial. nice find on your part!

1 Like

Hmm maybe 200 uA leakage is a bit High. (0.2 mA). @3.3V.

The 0402 TVS diode is overall better, just hard to place by hand.

It is equivalent to a 16.5K resistor, so it’s probably fine, but NASA would for sure use something less leaky

The MT6835 looks like a hot candidate to solve my AS5147 noise and precision problem which seems to make closed angle loop with steppers impossible. I see that the chip even has an internal calibration LUT! For calibration LUT I currently need a STM32L432KC with 64K RAM.
Is there a MT6835 breakout board available which fits on a NEMA17 mounting holes?

Yes, like @nikolaewich1988 has shown already, it works. Apparently there is a breakout board for sale, but I haven’t seen one explicitly for NEMA17 mounting holes.

@Juan-Antonio_Soren_E
actually, i printed it with a 3D printer :slight_smile:

1 Like

Would you share the design files, including the magnet holder? By the way, which magnet are you using? specs recommend 10mmx2.5mm. I only find that on Aliexpress again like the sensor board itself (which I ordered already).

Hey @husky ,

Where are you located (DM me?) - I could send you a MT6835 based sensor PCB to test if you want?

If you want to make some, I have a design here:

I’m sorry I did not document it yet, but it has been produced and I did a first test using SPI.
I don’t have a photo, but the size and shape is the same as this one: https://www.tindie.com/products/smallrobots/as5048a-encoder-board-for-robots-motor-control/
except it has a second JST port for the ABZ signals.

We are MagnTek’s distributor,we can sales MT6835 MR IC. If you need to buy ,you can send mail to me. E-mail:johnny.chang@jht-tech.com. we from Taiwan. our company name :Nimble technology co., LTD.

1 Like

here my first results with MT6835 (courtesy @runger !) on NEMA17 stepper with a 6mm magnet.
First graph shows the error table of calibration.cpp. The error range is within the specs for factory calibration, which say ±0.5 degrees.

And here the calibration LUT with the moving average filter:

Velocity mode in closed loop is working fine. Next step is to try the chip’s user calibration which should bring down the error to ±0.07 degrees.
The ultimate step of using the chip’s internal LUT for NLC - Non-Linearity Compensation Calibration - is out of reach for me currently as that would need a 21bit high precision optical encoder.
Peter

2 Likes

and here are the results of the chip’s user calibration method (pull pin Calibration Enable to Vdd and rotate 64 times - check PWM output pin duty cycle for success).
For clarity: I abuse the SimpleFOC calibration routine to get a sensor angle deviation from the ideal line, as I don’t have an external 21bit reference.
First the CalibratedSensor.cpp error array before moving average filter:


And the LUT after moving average filtering:

And indeed you see that the chip’s calibration feature really reduces the error a lot - compare to my last post. And that means that you could live without the software sensor calibration and have a good average accuracy. And you don’t need MCUs with >=64kB RAM.
Now comes the master question: For velocity mode the accuracy of the MT6835 seems good enough on a stepper motor - limiting factor is more the PWM resolution now. You can address that with high resolution timers (GHz clock!!) on bigger STM32 MCUs like STM32G474.
But how about high precision angle mode? What you really get from the sensor/motor combination is what you see on my first plot - the signal is jumping around ±0.2degrees in a small angle interval.
I am unsure if using a filter really helps here - we talk about low RPM converging to zero when the motor approaches the target angle.
Any thoughts about that?
Peter

2 Likes

if the signal fluctuates on ±0.2 degrees, so what is the point of 21 bit resolution?
the MA702 achieves the same, and it is 10 bit

Hey Geronimo,

MA702 is also a good sensor, and these things are not so easy to compare. MA702 gives its max RPM at 60000, and has a filter function with 1000Hz cutoff. MT6835 gives its max RPM at 120000, and has configurable bandwidth (though the datasheet doesn’t say exactly what it is).
So maybe the additional bits of the MT6835 give it some extra headroom to handle higher speeds while still giving you meaningful results.

Either sensor will benefit from linearity calibration, but the MT6835 has it built-in while for the MA702 you’d have to add it afterwards in software…

MT6835 has many options and functions, really. On the other hand its SPI protocol needs 24bit exchanges - while MA702 runs with 16bits - so you can read it 33% faster.

There are lots of details to consider when picking a sensor, and unfortunately they have not yet made the perfect one :smiley:

@husky thank you so much for your detailed and precise description, that is really cool!

Thanks runger, I was hoping for a higher resolution to achieve better position accuracy (as the best I could get with the MA702 is 0.3 degrees, the MA732 is unusable due to high latency). I don’t need the 120KRPM (this seems too fast even for the uController to handle the FOC at these speeds and close current loops). Right now I think the MA702 is the best one, and as you said, it is faster to read. Maybe I should try the AMS ones.

You are absolutely right, and I wonder what kind of system needs (and can manage to attain) such speeds. But it probably won’t use FOC!

I’ve had good experiences with the AMS sensors also…

I think partly the MagnTek sensors are also interesting because the performance is similar but they have a lower price :slight_smile:

I have no final conclusion what my measurements are telling us. I zoomed in a little bit into the signal as it is recorded during software calibration, means one motor mech rotation takes several seconds. You see a lot of ticks oscillating around zero. Each tick is the delta between sensor measurement and theoretical electrical angle as forced by the D/Q current settings.
Maybe the sensor works perfect (0.07deg error) and what we see is coming from improper motor control? I have lousy L298 drivers… Or is the PWM resolution much too low?
I think about how I could move the stepper on a really constant speed by attaching a DC motor to it to make the stepper just turning passively. That would show if PWM is the problem or some mechanical/magnetical effect. In another topic I was told that a stepper can’t suffer from cogging by principle…
Another option would be to buy another Nucleo board(grr… #3) with STM32G474 which has a HighRes timer running with GHz clock giving much higher PWM resolution.