pigsfoot
Posts: 22
Joined: Sun Feb 14, 2016 11:42 am

Magnetometer Project

Mon May 20, 2019 2:49 pm

Hi,

I'm trying to come up with a RPI based platform that can use a Magnetometer to detect vehicle presence.

The idea is to be able to calibrate the Magnetometer so that it only detects a magnetic field of X, X being the magnetic field of a small vehicle so it doesn't report on things like bikes, push chairs etc. Once detected i want to it run scripts etc.

I have had a look around and there seems to be several Magnetometer hats, the PI Sense being one but I'm not sure if these can be configured to detect a min magnetic field.

Any suggestions would be appreciated.

Thanks.

Frollo
Posts: 24
Joined: Thu Aug 27, 2015 8:44 pm

Re: Magnetometer Project

Mon May 20, 2019 9:39 pm

Hello'

Magnetometers aren't design to detect cars. Commonly they are used as compas, as for the HMC5883L.

In industries we detect cars or trucks with magnetic loops, it's a very reliable technology you can adjust.
You've got two parts : one relay adjustable, and one specific wire as for sensor (one twisted pair shielded), that you get 1 inch max under the ground.
The budget is between 150 to 200€.

example of relay :
https://www.amazon.fr/dp/B076VN4Y1Q/?sm ... PlfAu1TYQQ

with sensor :
https://www.amazon.fr/dp/B005NH6DSS/?sm ... ucwgs472oA

Frollo
Posts: 24
Joined: Thu Aug 27, 2015 8:44 pm

Re: Magnetometer Project

Mon May 20, 2019 9:42 pm

Maybe it would be possible to build one ? It's nothing more than an Ampere loop with an ampli-op i think... :?

Andyroo
Posts: 2998
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: Magnetometer Project

Mon May 20, 2019 10:58 pm

Have you seen this guide?

If you Google DIY vehicle detector wire you should come up with a few ideas that are easier to read...
Need Pi spray - these things are breeding in my house...

pigsfoot
Posts: 22
Joined: Sun Feb 14, 2016 11:42 am

Re: Magnetometer Project

Tue May 21, 2019 8:46 am

Hi all,

Thanks for the replies and feedback.

I do understand that magnetometer are not necessarily designed to detect cars, but thats doesn't mean they wont and to be fair thats half the fun, making something do what it wasn't initially intended to do :-). Using something like a magnetometer also allows for a much smaller install, i.e. small box on a wall.

This isn't my application but if you had a long drive, you could build a RPI magnetometer, power it with a battery, connect it to your WiFi and every time a vehicle comes up / onto your drive, be it family or delivery you could send a command to another device that rings a bell, not the best use of this solution but you get the idea.

To make this work, consider that a magnetometer is just a sensor that detect the Earths magnetic field and being able to detect a car ( or anything else thats metal ) is actually very straight forward. If i cant find a sensor that has a variable sensitivity I'll just built the sensitivity into the code.

Th easiest way to see this work, and presuming you have a smart phone ( majority of smart phones use a magnetometer for the compass and to detect magnetic North ). Install a magnetometer app, when installed stand still ( away from anything metal ) and watch the reading, it will be anywhere around 20 - 60 uT, now walk toward something metal like radiator and you will see the readings will go bonkers. So if you have a base line ( e.g 40 uT ) and you know what type of reading you would get if a small car were to pass ( e.g 200 uT ) you just code in something that says if a uT reading is > 200 add 1 to a file and thats how you detect and report on things.

Nothing is impossible, you just need to do a bit of head scratching. :lol:

User avatar
bensimmo
Posts: 3977
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: Magnetometer Project

Tue May 21, 2019 9:38 am

The coding is easy, you can have a play with a fake SenseHAT using SenseEmu, built in to RaspberryPi Desktop.

Once you have the code, look for a nice sensor and just plug it in (find a module that does the hardwork for you)

You could even write in on your phone using something like Pydroid3, for a proof of concept.

Return to “Automation, sensing and robotics”