Author Topic: Cheap SMD components to detect magnetic field?  (Read 747 times)

0 Members and 1 Guest are viewing this topic.

Offline paulcaTopic starter

  • Super Contributor
  • ***
  • Posts: 4247
  • Country: gb
Cheap SMD components to detect magnetic field?
« on: August 30, 2024, 07:13:33 pm »
The thing I see in my head is...

Like a strip of LEDs.  A long flexible PCB.  Upon it, at intervals are magnetic field sensor ICs.  Rudimentary, just basic relative "strength".

Scanning this strip from end to end would allow you to detect a magnet's approximate position along that strip.

Do such "jelly bean" magnetic sensors exist?  Something as simple to chain into strips by the dozen without complex wiring.  Something you could "print" and "assemble" onto a meter long PCB with one sensor every half inch... without it costing more than £20 in parts.

(another idea on my fluid level inside a sealed vessel sensor).
"What could possibly go wrong?"
Current Open Projects:  STM32F411RE+ESP32+TFT for home IoT (NoT) projects.  Child's advent xmas countdown toy.  Digital audio routing board.
 

Offline exmadscientist

  • Frequent Contributor
  • **
  • Posts: 404
  • Country: us
  • Technically A Professional
Re: Cheap SMD components to detect magnetic field?
« Reply #1 on: August 30, 2024, 08:14:20 pm »
Seen these guys? They're not exactly what you're asking for (not quite that cheap, and you seem to want digital I2C/SPI style output rather than analog?) but they're worth looking at:

https://cototechnology.com/product/redrock-rr112-1g42-43-531-532-tmr-analog-magnetic-sensor/
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3831
  • Country: nl
Re: Cheap SMD components to detect magnetic field?
« Reply #2 on: August 30, 2024, 08:18:36 pm »
There are plenty of magnetic sensors around. They can be HALL sensors, or GMR, and maybe some other technologies too.

But as the sensor tends to be more expensive then a magnet (you don't need particularly strong magnets) it is usually turned around. One sensor is used and the magnets are embedded in a long strip. These strips cost about EUR 20 or so per meter, but the reading head is somewhere between EUR 60 and EUR250, depending on brand and (chinese) origin. Systems like these can have a quite high resolution. Somewhere around 10um or so.

https://duckduckgo.com/?hps=1&q=magnetic+encoder+strip&iax=images&ia=images

With cheaper sensors you can DIY a lower resolution system. With a few analog HALL or GMR sensors a uC and some experimentation to get the algorithms right.

What is the goal you want to reach? With more info somebody may know a better answer.
 
The following users thanked this post: electronx

Offline Xena E

  • Frequent Contributor
  • **
  • Posts: 438
  • Country: gb
Re: Cheap SMD components to detect magnetic field?
« Reply #3 on: August 31, 2024, 12:21:34 am »
(another idea on my fluid level inside a sealed vessel sensor).

Details if you can. What liquid, nature of vessel etc?
 

Offline paulcaTopic starter

  • Super Contributor
  • ***
  • Posts: 4247
  • Country: gb
Re: Cheap SMD components to detect magnetic field?
« Reply #4 on: August 31, 2024, 08:15:28 am »
(another idea on my fluid level inside a sealed vessel sensor).

Details if you can. What liquid, nature of vessel etc?

A beer keg.  Stainless steel about 1m high, 8 inches around.  So no active electronics inside the beer.  Well, no cables, Wifi and BT will make it out but I'd prefer the active portion of the device is outside.

It doesn't need to be 'that' accurate.  Pouring a pint takes about a fingers width out of the keg, but if the guage output was in % even and only accurate to 5% it would be fine.  I'm not looking to quantify anything in detail, just a basic "fuel gauge" type display.



The leading idea is still load cells, but I still come back to thinking of other ideas.

On the load cells.  I am dragging my feet it seems.  The reason is the project just sounds like a mechanical nightmare.  "Stick a load cell on each corner" isn't all there is to it.  I have a chest freezer with 6 kegs in it.  The free space amounts to 1cm around each keg.  So each load-cell plate needs to be an exact size and basically tile the entire floor of the fridge.  It's not "hard", but mechanics put me off projects sometimes.  I occasionly browse AliExpress and Amazon looking for "kids weigh scales" to see if I can find a bathroom scale that is small enough.  Then I consider buying any of them and gutting them for the sensors.  For example, there are wooden scales which can be shrunk down to fit with a jigsaw and a chisel.

The other concern with load cells is getting an understanding of just how far and how fast they will drift with a 20Kg keg sat on them 24/7 for months.
« Last Edit: August 31, 2024, 08:24:58 am by paulca »
"What could possibly go wrong?"
Current Open Projects:  STM32F411RE+ESP32+TFT for home IoT (NoT) projects.  Child's advent xmas countdown toy.  Digital audio routing board.
 

Offline Phil1977

  • Frequent Contributor
  • **
  • Posts: 715
  • Country: de
Re: Cheap SMD components to detect magnetic field?
« Reply #5 on: August 31, 2024, 09:08:14 am »
Did you ever consider a thermal measurement?

There are different possible setups, you could:
- Use the temperature variations that are unavoidable in any fridge. Measure how fast the wall of the keg follows the ambient temperature. Where it is full, the gradient will be lower than where it is empty.
- Connect a small heater to your temperature sensor. Build a type of thermal resistance sensor. Where the keg is full, the thermal resistance will be lower.

Maybe, if you are fit in image processing, you could even use a thermal imager to monitor the level of multiple kegs.
 

Offline SuzyC

  • Frequent Contributor
  • **
  • Posts: 812
Re: Cheap SMD components to detect magnetic field?
« Reply #6 on: August 31, 2024, 09:41:39 am »
Uhmmm....
1) Ultrasonic xmit/rec sensor on keg accurately measures distance to surface of liquid from keg top.
2) Hang them high.  Suspend keg by top cap to fixed shelf and measure pull on suspending cable.
3) (Sonar): Pinging by thump:  A small mechanical seismic thump anywhere on keg by a small solenoid with a rubber-covered tip piston will yield a precise different freq. tone depending on state of fill of keg.
4) Washing machine type fluid level meas.  A flexible air-filled plastic tube in liquid(tube opening held by weight in bottom of keg) creates air pressure inside tube dependent on liquid level in tube that is directly proportional to fill. Air-filled tube inserted into bottom of keg, 3-wire sensor PWM output sq. wave = water level. Also poly tube into hole on bottom of keg can be directly connected to a small air pressure sensor
« Last Edit: August 31, 2024, 10:03:34 am by SuzyC »
 

Offline tooki

  • Super Contributor
  • ***
  • Posts: 12577
  • Country: ch
Re: Cheap SMD components to detect magnetic field?
« Reply #7 on: August 31, 2024, 10:42:23 am »
4) Washing machine type fluid level meas.  A flexible air-filled plastic tube in liquid(tube opening held by weight in bottom of keg) creates air pressure inside tube dependent on liquid level in tube that is directly proportional to fill. Air-filled tube inserted into bottom of keg, 3-wire sensor PWM output sq. wave = water level. Also poly tube into hole on bottom of keg can be directly connected to a small air pressure sensor
Since kegs are dispensed by pressurizing them with CO2 (or N2 in the case of Guinness), using pressure to measure liquid level won’t work.
 

Offline tooki

  • Super Contributor
  • ***
  • Posts: 12577
  • Country: ch
Re: Cheap SMD components to detect magnetic field?
« Reply #8 on: August 31, 2024, 10:47:17 am »
(another idea on my fluid level inside a sealed vessel sensor).

Details if you can. What liquid, nature of vessel etc?

A beer keg.  Stainless steel about 1m high, 8 inches around.  So no active electronics inside the beer.  Well, no cables, Wifi and BT will make it out but I'd prefer the active portion of the device is outside.

It doesn't need to be 'that' accurate.  Pouring a pint takes about a fingers width out of the keg, but if the guage output was in % even and only accurate to 5% it would be fine.  I'm not looking to quantify anything in detail, just a basic "fuel gauge" type display.
Some commercial systems work by measuring the flow through the tubing. You just have to set the initial amount and then subtract from it as you serve.
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 10220
  • Country: nz
Re: Cheap SMD components to detect magnetic field?
« Reply #9 on: August 31, 2024, 12:22:11 pm »
I was just looking at cheap mag sensors last week for a work thing.
But I was focused on low current consumption and i wanted analog or logic output.
It sounds more like you'd prefer something you can daisy chain for simple wiring.

A found a nice analog one from COTO brand that looked perfect for my application and was cheapish in volume. Ordered some from digikey and tested them out in my application only to find they went from active to NRND 7 days after I ordered them  :palm:.
You can still get them though, if its for a one-off thing and you're ok with many analog channels down the pcb.
https://www.digikey.co.nz/en/products/detail/coto-technology/RR112-1G42-531/13543662

A better option is probably mag sensors with digital logic output as you have much cheaper options. Like down to around $0.17 in volume from digikey and even lower than that direct.
They also make them with open collector outputs, so you might be able to use different value pull up resistors that increase in value going down the strip.  Then hang them all on one analog line.  So as a magnet moves down the strip the voltage would increase. You'd get some oddness at the transitions as it wont be clean from one sensor to the next but it might be workable with a MCU and some logic.
 
The digital ones come in various sensitivities but here's one i was looking at that's open collector and cheap.
https://www.digikey.com/en/products/detail/texas-instruments/DRV5032AJDBZR/7732502
« Last Edit: August 31, 2024, 12:40:10 pm by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline tooki

  • Super Contributor
  • ***
  • Posts: 12577
  • Country: ch
Re: Cheap SMD components to detect magnetic field?
« Reply #10 on: August 31, 2024, 01:02:38 pm »
How would magnetic sensing even work, unless OP were to add an internal float mechanism to carry a magnet up and down? (To me that seems like something I’d want to avoid inside a keg.
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 10220
  • Country: nz
Re: Cheap SMD components to detect magnetic field?
« Reply #11 on: August 31, 2024, 01:05:20 pm »
How would magnetic sensing even work, unless OP were to add an internal float mechanism to carry a magnet up and down? (To me that seems like something I’d want to avoid inside a keg.

You'd definitely want to avoid a rare earth magnet anywhere near food/drink. Given that the protective outer shells are prone to cracking and the internals are pretty toxic.

But you might able to do something with an iron magnet that is 100% sealed within a food safe plastic puck.

But i agree that a magnet doesnt seem like the best solution.
« Last Edit: August 31, 2024, 01:08:14 pm by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 
The following users thanked this post: tooki

Offline paulcaTopic starter

  • Super Contributor
  • ***
  • Posts: 4247
  • Country: gb
Re: Cheap SMD components to detect magnetic field?
« Reply #12 on: August 31, 2024, 02:34:23 pm »
Good point on the toxicity of the magnet, however my idea was to just put it inside a sealed vile, probably a plastic one,  and drop it in.  The floating hydrometer I use in the fermentor is basically a "PET bottle blank" which hasn't been expanded into a mould yet.  It performs well at even 45PSI.

Sonar was suggested by someone else here previously.  I kind of pushed it to the back because... it sounds like it involves tricky calculus which I just don't do.

However.  I do have an ESP32 already coded to be an FFT style LED dancing spectrum "toy". 

Is it as simple as hooking it up to a keg while it's filling and tapping on the keg (in a consistent way and place) and watching the FFT?  Then, assuming there are "moving harmonics" I can see, write some averaging/windowing on the frequencies and produce an estimate level?

Is it likely to be that obvious on an FFT or is it going to involve something more involved?
"What could possibly go wrong?"
Current Open Projects:  STM32F411RE+ESP32+TFT for home IoT (NoT) projects.  Child's advent xmas countdown toy.  Digital audio routing board.
 

Offline paulcaTopic starter

  • Super Contributor
  • ***
  • Posts: 4247
  • Country: gb
Re: Cheap SMD components to detect magnetic field?
« Reply #13 on: August 31, 2024, 02:36:56 pm »
My other idea, which I could try, is to attach some "bathroom sink chain" onto the base of the floating hydrometer.

Just enough chain to touch the bottom.

The theory is, as the level in the keg drops, more chain will coil up on the bottom, putting less weight on one end of the hydrometer changing it's floating angle.

The downside is, it means having a Wifi device inside an SS keg.  It does work, but you tend to need a Wifi AP or a booster inside the fridge, like right ontop of the keg.
"What could possibly go wrong?"
Current Open Projects:  STM32F411RE+ESP32+TFT for home IoT (NoT) projects.  Child's advent xmas countdown toy.  Digital audio routing board.
 

Offline Xena E

  • Frequent Contributor
  • **
  • Posts: 438
  • Country: gb
Re: Cheap SMD components to detect magnetic field?
« Reply #14 on: August 31, 2024, 03:33:59 pm »
(another idea on my fluid level inside a sealed vessel sensor).

Details if you can. What liquid, nature of vessel etc?

A beer keg.  Stainless steel about 1m high, 8 inches around.


That must be the most unusually shaped beer keg ever devised!


 So no active electronics inside the beer.  Well, no cables, Wifi and BT will make it out but I'd prefer the active portion of the device is outside.


One suggestion I would make is to have an electrode with chemically inert insulation and measure capacitance inside the keg.

If the rule nothing inside the keg is to be adhered to weighing is the only real option. Suspended on luggage scale type load cell.

If the contents were not pressurised then resonance of the ullage space over the liquid could be used.
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3831
  • Country: nl
Re: Cheap SMD components to detect magnetic field?
« Reply #15 on: August 31, 2024, 04:01:20 pm »
Why is a weight scale problematic? Simplest is to just put it under the beer keg, like a weight scale used for persons, maybe with a bit bigger platform.
Another option is to put the loadcell on top and lift the beer keg a few mm from the ground.

Putting some kind of gadget inside a beer keg would be problematic in the first place. Aren't those things sealed to be able to pressurize them?
 

Offline paulcaTopic starter

  • Super Contributor
  • ***
  • Posts: 4247
  • Country: gb
Re: Cheap SMD components to detect magnetic field?
« Reply #16 on: August 31, 2024, 04:08:47 pm »
I was thinking about one of these:
https://www.ebay.co.uk/itm/142945286433

It's a platform scale with an LCD remote display.

The issue with almost any kind of scale like this, without modification, is that it's not designed for static operation.  They will, invariably have auto-power off and almost certainly with zero on power on.

I'm toying with the idea of buying one of them and hacking it.

As I mentioned above the main issue with scales is the mechanics.  The kegs are very tightly packed.  The ebay item was one I found out of hundreds that the platform is within the footprint of "a" keg.  22cm diameter.  Hieght wise I think they are maybe on 65cm.  In the photo below 2 are 19L kits the other 4 are 12L kegs.  4 beer 2 soda water.

2356789-0
"What could possibly go wrong?"
Current Open Projects:  STM32F411RE+ESP32+TFT for home IoT (NoT) projects.  Child's advent xmas countdown toy.  Digital audio routing board.
 

Offline tszaboo

  • Super Contributor
  • ***
  • Posts: 7909
  • Country: nl
  • Current job: ATEX product design
Re: Cheap SMD components to detect magnetic field?
« Reply #17 on: August 31, 2024, 04:13:46 pm »
Why is a weight scale problematic? Simplest is to just put it under the beer keg, like a weight scale used for persons, maybe with a bit bigger platform.
Another option is to put the loadcell on top and lift the beer keg a few mm from the ground.

Putting some kind of gadget inside a beer keg would be problematic in the first place. Aren't those things sealed to be able to pressurize them?
I was going to suggest this. Place it on a load cell, it doesn't even need to rest only on it. 3 bumps that the keg rests on, one of them is a load cell, it's plenty accurate. Once calibrated.
Anything going inside must be food grade, probably some grade of stainless steel, likely 316L. Custom parts from that are PITA to make yourself and expensive to outsource.
« Last Edit: August 31, 2024, 04:15:18 pm by tszaboo »
 

Offline Phil1977

  • Frequent Contributor
  • **
  • Posts: 715
  • Country: de
Re: Cheap SMD components to detect magnetic field?
« Reply #18 on: August 31, 2024, 04:35:37 pm »
Lots of reasons that speak for the thermal sensors. Cheap, easily addressable, no direct contact to the food, and you also know if the beer is cold...
 

Offline tooki

  • Super Contributor
  • ***
  • Posts: 12577
  • Country: ch
Re: Cheap SMD components to detect magnetic field?
« Reply #19 on: August 31, 2024, 05:17:56 pm »
Good point on the toxicity of the magnet, however my idea was to just put it inside a sealed vile, probably a plastic one,  and drop it in.  The floating hydrometer I use in the fermentor is basically a "PET bottle blank" which hasn't been expanded into a mould yet.  It performs well at even 45PSI.
So what would keep the magnet moving up and down along a single axis right next to your sensors? And in that case, why couldn't you just have another magnet on the outside that moves with it, like those aquarium scrubbers that have the scrubber on the inside and the handle on the outside, moved by magnets?
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 10220
  • Country: nz
Re: Cheap SMD components to detect magnetic field?
« Reply #20 on: August 31, 2024, 08:39:06 pm »
If you swap the magnet for any metal object that moves up and down with the liquid level and stays up against one side of the tank. (maybe held within a tube on the inside of the tank). Then you could use the LDC 3114 which is a 4-channel inductance-to-digital converter.  It's really intended for touch buttons, but you can put it into raw mode and use it for sensing any metal you want. I'm sure you could detect the different thickness of metal in front of one coil in a strip of coils. (case only vs case + floating metal object).

It's I2C chip, sadly the chip itself has fixed i2c address, but you could combine it with a 2nd chip that does I2C address multiplexing all on a single flex cable and get everything on one i2c bus. And you get 4 sense coils per chip.

Just be prepared for some development work because optimizing the coil size and coil frequency/capacitor. It can be a little tedious.  They do provide an excel file to calculate everything though.
And you also have to deal with drift in firmware if you put the chip into raw mode. (periodic baseline reset). It will do that itself if you dont use raw mode. but raw mode gives you much more freedom.
« Last Edit: August 31, 2024, 08:44:04 pm by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3831
  • Country: nl
Re: Cheap SMD components to detect magnetic field?
« Reply #21 on: September 03, 2024, 12:05:17 am »

It's a platform scale with an LCD remote display.

The issue with almost any kind of scale like this, without modification, is that it's not designed for static operation.  They will, invariably have auto-power off and almost certainly with zero on power on.

I'm toying with the idea of buying one of them and hacking it.

As I mentioned above the main issue with scales is the mechanics.  The kegs are very tightly packed.  The ebay item was one I found out of hundreds that the platform is within the footprint of "a" keg.  22cm diameter.  Hieght wise I think they are maybe on 65cm.  In the photo below 2 are 19L kits the other 4 are 12L kegs.  4 beer 2 soda water.


You can buy loose "beam type" load cells, separately, and indeed a lot of these stupid weigh scales turn themselves off. But this is an electronics forum, so buy a few big load cells, screw on some platforms yourself and then add an HX711 and an arduino and a display. HX711 is cheap and easy to interface with, but there are some gotcha's because it's a non standard serial protocol an you have to be a bit careful with synchronization.

Your beer kegs look a lot different from the kegs here in the Netherlands. The kegs we have, only have a hole big enough to let some beer out (around 4cm in diameter) and you can't really put anything in it.

Another option for you is to put some wooden beam over the whole square plastic container, and then suspend each keg on an S-type loadcell.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf