Android Question Hello, I want to make a program that plays sound or shows a picture when the mobile phone is close to the metal

hossein.ash

New Member
Hello, I want to make a program that plays sound or shows a picture when the mobile phone is close to the metal
 

Cableguy

Expert
Licensed User
Longtime User
I don't think that a phone can be used as a metal detector
It can, but not a very accurate or sensible one.
You can use the magnetic field sensor (most smartphones have one). It will have a noticeable change in the magnetic field detected when near either ferromagnetic material, as well as live mains wires.
 
Upvote 0

BlueVision

Active Member
Licensed User
Longtime User
If I am allowed to interrupt...
There is no way to use a sensor in a standard mobile phone to detect metal. It is clear, that a magnetized metal has an influence to the magnetic sensors of your phone. But all this influence is a kind of white noise, except for strong magnetic materials. This influence you can see with a good compass app.
I made some experiments with that while developing my compass app, using also the magnetic field sensors of the phone.

So in general, it reacts to a magnitized metal (a knife), other metal has no influence (the titanium of my watch). If you want to try it, you can find my compass app here.
After installation simply lay your phone flat on a table made of wood or glass. The blue arrow should point to the north. Use a scissor, knife or something like that and put it around the phone. You will see a reaction. Put a nonmagnetic metal near the phone -> no reaction.
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
All metal detection devices work under the same principle: a magnetic field will be influenced in the presence of ferro-magnectic metals, such as steel or iron.
Some metals do not have ferro-magnetic characteristics and therefore cannot be detected in that way.
I stand by first post. A metal detector can be created using a smartphone and its on-board sensors, just not an accurate or sensible one.
Just to add, some fugged phones come equipped with thermal cameras and those can also be used to "detect" metals by their thermal signatures
 
Upvote 0

BlueVision

Active Member
Licensed User
Longtime User
Cableguy is right.
Another point.
It is a little bit dangerous if you want to detect a powerline within a wall by that principle. Many metals are not magnetic (aluminium, copper, brass, silver, gold).
So when it comes to a copperline or a line of aluminium, you may or may not detect it as long there is electricity in the line. An electric field creates an magnetic field. But when powering of the line, there is no magnetic field in a copper- or aluminium based powerline. Ergo you are not able to detect this kind of metal. The good thing is, if there is power in the line, there is a magnetic field. If you can measure it, it can give you a warning. Be very careful with that kind of detection. I for myself would never trust such an indication of a standard mobile phone.
 
Upvote 0

GJREDITOR

Member
Maybe this will help you a little
Whether it helps the OP or not, it did help me . I changed the formula for micro Tesla and the results aligned with popular sensor test apps.
changed formula for micro Tesla:
'Formula from https://jshelter.org/sensor-magnet/
    Dim microtesla As Float = Power(Values(0),2)+ Power(Values(2),2)+ Power(Values(1),2)
    microtesla = Sqrt(microtesla)
    lblValueMicroTesla.Text= microtesla& " ?T"
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…