# Is anyone here familiar with programming MLX90251 Linear Hall Effect Sensors?

Status
Not open for further replies.

#### Western

##### Member
I work on electronics out of dairy farms … and I have an issue with some milk meters.

Very basic concept (1st model) … donut shaped float with a magnet inside … slides on a stem with a reed switch at bottom and top.

When float reaches top (known quantity of milk) the dump valve opens … then cycle repeats.

For some reason these later models use an MLX90251 in place of a reed switch and I’m starting to see more and more with crook sensors.

Even though they are a very simple device … just a new base (with stem) on its own is over $600 … so replacing a couple of$5 parts still seems reasonable to me … and certainly to the dairy farmers as well.

I’ve researched in the past but came to a dead end … or at least a very expensive solution in buying a genuine programmer … and then trying to work out what to program into them.

Essentially they are a programmable resistor ... so I don't see why I can't cobble something together.

Device overview … https://www.melexis.com/en/product/MLX90251/Programmable-Linear-Hall-Effect-Sensor

Datasheet: https://www.melexis.com/-/media/files/documents/datasheets/mlx90251-datasheet-melexis.pdf

Thanks for any help.

#### dougy83

##### Well-Known Member
If you can measure the sensor output voltage (of a working sensor) for differing levels of liquid, it may be possible to replace the hall-effect sensors with a few reed switches and some resistors.

If you wanted to fix the mlx90251 probes, the hardware for programming the MLX90251 looks like it would be trivial, but you'd need to find the software documentation to find out how to send data to it. There's a calibration procedure listed in the datasheet you attached.

#### Pommie

##### Well-Known Member
It looks like a programmer could be cobbled together quiet easily but I can't find an explanation of how you read the internal EEPROM. If, as Dougy says, you can measure a working sensor then a non programmable hall sensor and a conditioning circuit could be used as a replacement.

Mike.

#### Western

##### Member
If you can measure the sensor output voltage (of a working sensor) for differing levels of liquid, it may be possible to replace the hall-effect sensors with a few reed switches and some resistors.
Yes, you are correct ... in fact while I was writing my original post I thought the same thing ... of creating a new pcb strip and mount some resistors and reed switches on it.

I already have the resistance values as the original version was just that ... some resistors and reed switches.

These new ones have additional electronics, with indicators to show when the 'switches' come on ... but they should still work the same.

If you wanted to fix the mlx90251 probes, the hardware for programming the MLX90251 looks like it would be trivial, but you'd need to find the software documentation to find out how to send data to it. There's a calibration procedure listed in the datasheet you attached.
Every time I do a batch of these, I go through the same mental process and get frustrated by not having an easy answer. I'm pretty sure that with a programmer (PTC-04) I could reverse engineer a programming system and build something myself ... but I need access to one first.

Maybe I'll suss out the farmer and see if he wants to invest in a programmer ... AUD \$2000

The other alternative is to find someone with a programmer ... send them some good ones to read ... and pay them to program a supply of them for me.

In reading all the info I can find ... I'm pretty sure they can still be read even if the Memlock is set ... that just stops the eprom from being rewritten.

Quote from datasheet ...

Note: EEPROM verification is done by reading the contents of the EEPROM and comparing it to the data written. It is possible to read the EEPROM contents regardless of the status of MEMLOCK.

#### Pommie

##### Well-Known Member
Have you found any description of how you read the EEPROM?

Mike.

#### Western

##### Member
It looks like a programmer could be cobbled together quiet easily but I can't find an explanation of how you read the internal EEPROM. .
Yeah ... these things only have 4 pins ... VDD, 2 x GND and Vout.

To read it, you need to up the Vdd from 5v to 9v ... then send a 'Read' command into the Vout.

Then it will spill its guts (I hope) and give up the contents of its eeprom ... the only problem is that it isn't digital ... it's voltage levels ... so you need some way of accurately reading that.

If I knew what the 'Read' command actually was ... I could maybe catch the output on my cro and interpret it ... there's only 24 bytes ... but I have no idea of how many levels and what means what.

Edit: 24 Bits ... not 24 Bytes

Last edited:

#### Pommie

##### Well-Known Member
It seems reading the EEPROM requires measuring the supply current, from datasheet,
The EEPROM contents can be read from the device. This procedure, known as a read back, is done by sending a read command and then measuring the supply current. To successfully read the EEPROM it must be possible to measure the supply current to the device. The Melexis PTC hardware and software tools contain built in functions for reading the EEPROM.
Mike.

#### Western

##### Member
It seems reading the EEPROM requires measuring the supply current, from datasheet,
Mike.
Whoops ... I pulled a clanger there. I did read that earlier ... but in my head somehow it changed. Not all that unusual for me.

I was still working through just how I could monitor the supply current in an accurate way.

#### dougy83

##### Well-Known Member
If I knew what the 'Read' command actually was ... I could maybe catch the output on my cro and interpret it ... there's only 24 bits ... but I have no idea of how many levels and what means what.
The 24 bits is just for the user serial number. There's the other programmable data detailed in table 7 of the datasheet. It still doesn't help you know what the read command is. You could just try every possible code until you get the right one, I guess (hopefully the code is short enough to be guessable quickly)
Yes, you are correct ... in fact while I was writing my original post I thought the same thing ... of creating a new pcb strip and mount some resistors and reed switches on it.
I already have the resistance values as the original version was just that ... some resistors and reed switches.
These new ones have additional electronics, with indicators to show when the 'switches' come on ... but they should still work the same.
The output of those MLX sensors is a voltage, so you'll have to characterise that first. Does the device work with the old resistor sensor?

Also, are you sure it's the MLX sensor breaking, and not some other more-easily-replaced part? (wishful thinking here)

#### Western

##### Member
The 24 bits is just for the user serial number.
Wow ... I'm going well today. I think I need to stop and read it all again and take some notes.

The output of those MLX sensors is a voltage, so you'll have to characterise that first.
That's the interesting part for me. I got used to measuring the old style ones while moving a magnet up the stem. The output resistance was always consistant depending on which reed switch was closed.

When I started seeing the new type, I eventually discovered that even unpowered ... between the output and ground ... it gave the same reading as the reed relay/resistor type when no switch was closed ...

... but even when powered up ... and still looking at resistance across the output ... I was getting the same value in ohms as the old type.

I've not actually looked for voltage across the output ... maybe I should ... but I had the (ohm) numbers in my head already ... and anything different jumped out at me straight away.

Does the device work with the old resistor sensor?

I haven't specifically tried ... but from the comments above, I would just about guarantee that it would.

Also, are you sure it's the MLX sensor breaking, and not some other more-easily-replaced part? (wishful thinking here)
Haha ... unfortunately yes.

I have made a good one out of 2 on a number of occasions already by swapping bits around.

Plus, it's really obvious when one is crook ... the resistance between 2 pins goes from its normal 155 ohms eg. ... to several mega ohms.

#### Skodra

##### New Member
Hello, did anyone figure it out, anything e.g. read command?
Sensors are expensive but programmer is even more expensive, this would be great for community.

#### Western

##### Member
Hi Skodra, I haven't worked it out or made any progress.

I only have the one customer who has been sending me these devices to fix ... maybe if there was more demand I would put in some more effort. I'm getting lazy in my old age ... or maybe more sensible.

Status
Not open for further replies.