Magnetic sensor required

Colinpc

New Member
I am in need of a sensor that can be buried under a farm road next to the gate. I thought that a magetic sensor would be ideal. My theory is that a car travelling over the sensor would give a sufficient change to be able to be processed by a Picaxe and notify the owner of visitors.

There are a number of loop circuits on the WWW but I would like to use something that only requires minimal digging in hard gravel.

Any assistance would be much appreciated. Preference is for device readily available in Australia.

Fred
 

Dippy

Moderator
Thinking out loud....
A compass style sensor where a vehicle would alter Earth magnetic field and you measure the change?
A Hall sensor plus magnet (sensor, not switch) and, again you measure any changes?

I hope you have a sutiable supply of power if left long term?
 

MFB

Senior Member
I have been using an HMC5883L three-axis magnetometer for attitude measurement and found that it is also quite capable of detecting the movement of my metal office chair relative to the desk top. Would think a car passing nearby would produce even greater changes in output.

These low power I2C devices are available on breakout boards from a number of sources (including SparkFun) for about £10.
 

Janne

Senior Member
The traditional way of detecting the car would be to bury a few coils of wire to the ground, next to the gate. When the car stops over the coil, it changes the coil's inductance, which can then be detected for example with an oscillating circuit.
 

Dippy

Moderator
Yes, Janne, that would be the usual simple choice i.e. an 'upside down' metal detector.

But, read Post#1.
"There are a number of loop circuits on the WWW but I would like to use something that only requires minimal digging in hard gravel."

My assumption, therefore, was that the OP didn't want to use that method for practical reasons...?
 

techElder

Well-known member
Ramsey Electronics used to have one of those in their catalog, but I can't find it now. Guess they decided to remove it. Searching should find you a thousand ideas about that. Mostly it's an oscillator tank circuit that changes frequency when metal is near it.

You could probably adapt a cheap metal detector to do the same thing.
 

srnet

Senior Member
I am in need of a sensor that can be buried under a farm road next to the gate.
Why not mount the sensor, similar to those buried loops, on the gate post ?

What about some form of opto beam sensor mounted on the gate post, that could detect people and kangaroos also ?

The opto beam and reflector method is commonly seen in car parks in the UK.
 

Dippy

Moderator
Maybe he doesn't want to detect kangaroos? (or pterodactyls).
If vandals (and/or small boys with penknives) are kicking around then that could be a problem too?
 

Colinpc

New Member
Thanks for the input so far.

The reason I don't want sensors on the gate is that the gate is normally closed. I want warning when the vehicle first gets to the gate not waiting until it goes through. The magnetic sensor would be easier to install as it would be less digging in the hard gravel road.

The other requirement is low power as I only want to use a small inconspicuous solar panel.

The other thought I had was using a very high gain audio amp with the mic buried in the road to trigger but this would probably be triggered by roo's and stock. This could be done with a low power amp so the power required could be minimal.

For those thinking evil thoughts of why I need this, I am doing nothing illegal, I just want to know if someone visits while I am in the far corners! :)

Fred
 

SAborn

Senior Member
Perhaps a cheap ultrasonic reversing alarm that you would fit to the rear bumper of a car would do, but it would be triggered by stock so perhaps not.

Yes i think he might have more problems with flying pigs than pterodactyls triggering the sensor.
 

MFB

Senior Member
There really is nothing difficult about interfacing a magnetometer to a PICAXE, as I hope this link shows... http://www.picaxeforum.co.uk/showthread.php?18912-HMC5883L-magnetometer&highlight=MFB+magnetometer

For detecting large metal objects you need to position the sensor and have the PICAXE store the three 'normal' output levels from the local natural magnetic field. Then decide what you consider an anomaly (e.g. change in output when car is near) and have the PICAXE react to this new set of output levels.
 

Dippy

Moderator
Freddy, have you even looked at the Data Sheet for suggestion by MFB?
So, you will know how much current it takes?
You want less than that?

What size solar panel do you plan to use?
Will it need battery backup?
Then you can tell us the maximum power consumption we should be looking at.
Will you be using an RF link or a klaxon to notify you?

And to prevent a list of unwanted sensors/methods, tell us what you want to detect and what you want to ignore.
Then we can dispense with unsuitable suggestions.
In any event, unless someone here has done precisely what you want and happens to be viewing, you will probably end up having to prototype several varieties to determine the best.

Best to give us a full list of requirements now rather than drip-feed.
 

MFB

Senior Member
I certainly agreed with Dippy that more information is needed about your application but, for what its worth, the data sheet gives typical current draw as 100uA. Even this can be reduced further by keeping the sensor powered down for the majority of the time, only sampling a few times per second as they power-up really quickly.
 

techElder

Well-known member
My gosh ... it's a sensor to be buried in dirt/rock/mud/water to detect a 2-Ton chunk of metal moving very slowly over it. Surely this can be done without a single microprocessor.
 

srnet

Senior Member
My gosh ... it's a sensor to be buried in dirt/rock/mud/water to detect a 2-Ton chunk of metal moving very slowly over it. Surely this can be done without a single microprocessor.
Of course, magnetic mine.

Never done the tests, nere had the mines, but I bet you can hear them from quite a distance.
 

Colinpc

New Member
Thanks again especially MFB for the code ideas.

Sorry for the "drip feed". The sensor is the only part I am having a problem with so this is all I asked help for.

So here is the total project. Sensor to detect vehicles (only, pterodactyls are a bit rare in my area). The output of this will trigger a TX that draws no power until triggered. The RX then sounds a noise device. The RX can be in my vehicle or campsite. Range is ample and will run from battery bank. The Tx/sensor would run from a battery and draw current of up to say 20mA and be charged by ~3 - 5W panel. As I am only onsite on weekends, the sensor would be turned on only when on site.

The sensor would be buried in a suitably protected container under the middle of a gravel road. I invisage 10 -15cm deep with a thick pieace of perspex or similar over it to protect it from the weight of vehicles that wander across it. If this is too hard or insensitive, I would bury it next the road in softer soil.

The Picaxe side would be to read the sensor and trigger the TX.

HMC5883L magnetometer would appear to be what I need. It is available on a breakout board from a few suppliers in Australia for less than $20.

The Tx/Rx pair are adapted from an old commercial long range remote control system no longer avalable.

Fred
 

MFB

Senior Member
I’m sure you have fun playing with the magnetometer anyway. You can even detect a grasshopper’s heartbeat with one, provided you glue a tiny but strong magnet to its body. This was an Amateur Scientist project many years ago that demonstrate that this insect’s nervous system was too primitive to drive it’s heart when processing visual or audio information. Not too sure what would happen if the distraction was of too long a duration.
 

Colinpc

New Member
I have ordered the HMC5883L magnetometer and now waiting for delivery.

I am just a little worried about the difference in voltage of the magnetometer and the Picaxe. The Vmax for the magnetometer is 3.6V. If I connect the data pins to the Picaxe with 5V supply, will this damage the magnetometer? I plan to use a 3.3V reg on the magnetometer, should I use the same on the Picaxe? Will the Picaxe still program ok with this lower voltage or do I need to program at 5V but run it at 3.3V?

I would appreciate any help in interfacing the magnetometer.

Freddagg
 

Colinpc

New Member
Thanks, that is what I needed. At ~$20 for the Magnetometer, I did not want to blow it up. I will try with the 8M2.

I will run both on 3.3V

Fred
 

MFB

Senior Member
I agree, running both from the same supply would be best but also provide some protection by powering from a local 3.3 volt, low current (50mA) regulator.
 

peter howarth

New Member
2 infrared beams , spaced apart in height but diagonally spaced apart in height would be the go, so as to detect the height of the object passing, and in which direction the object is passing, whether it be a roo, a car, tractor etc, and just some logic programmed into the pic, but again use 2 infrared beams, probably the easiest and most reliable way, rather than a coil in the ground.. I wish I knew how traffic lights were triggered though, they use a coil in the ground somehow..
 

SAborn

Senior Member
I wish I knew how traffic lights were triggered though, they use a coil in the ground somehow..
All very simple, if you place a wire around in a loop and pass a current or a frequency through the wire, then place a metal object over the loop it will effect the flux of the loop, hence effecting the voltage or frequency, as a car is a large metal object then the effect is great, so in most cases they get away with a single wire loop.

Have you noticed if you move forward at the lights it can trigger a light change, this is often because you are not covering the loop enouh to trigger a reading, and when you move it is enough to be detected, i noticed when driving trucks the lights changed faster than in a small car, due to the area of the coil covered and the mass of metal reacting with the coil.

So next time you stop at the lights ensure you park over the coil and you will wait less time.

I see most coils here are 2 diamond shapes cut into the tarmac and would likely have a coil in each, but the more area of those coils you cover the better the detection......Bad luck if you ride a motor bike.
 

techElder

Well-known member
None of those problems here unless you are visiting a small town with a lot of antiques in it. Most lights can be triggered by a bicycle.

... Have you noticed if you move forward at the lights it can trigger a light change, this is often because you are not covering the loop enouh to trigger a reading, and when you move it is enough to be detected, i noticed when driving trucks the lights changed faster than in a small car, due to the area of the coil covered and the mass of metal reacting with the coil.

So next time you stop at the lights ensure you park over the coil and you will wait less time.

I see most coils here are 2 diamond shapes cut into the tarmac and would likely have a coil in each, but the more area of those coils you cover the better the detection......Bad luck if you ride a motor bike.
 

premelec

Senior Member
As a bicyclist I have been plagued by the lack of indication if a light change has been sensed... Here we have paint markings on the street where bikes are supposed to stand. A lot of areas are monitored and controlled by overhead TV cameras now. I haven't tried throwing a white cloth in the street to see if the light change occurs - but it's supposed to :) Anyhow the only mostly sure way is to go to the side and push the pedestrian button...

The magnetic sense loops break and are hard to replace... I know our traffic controls engineer and communicate with him often :) [when controls aren't working well]

BTW carbon fiber bike frames don't actuate the magnetic sense loops... [I've got steel..]
 
Last edited:

Colinpc

New Member
I have finally made up my board to test the device. My power supply to the Picaxe and magnetometer is 3.3v. I tried to program the Picaxe but could not do so (simply clearing memory to show connection ok). I think it may be that the 3.3v supply is too low for the RS232.

I am looking for info from those who have used Picaxe 8M2 and HMC5883L as to how they where used electronically. I can use 5v for Picaxe and 3.3v for HMC5883L but I am worried about the voltage levels on the data/clock pins damaging the HMC5883L.

Fred
 

MFB

Senior Member
I have run both the 8M2 and HMC5883L at 3 volts (single cell LiPo with low-drop regulator) without problems. Although this must have been near the lower limit of RS-232 operation. You may have to add a non-inverting buffer on the serout from the 8M2. A fast rail-to-rail opamp powered from a 9 volt supply would do it.
 

Colinpc

New Member
I have finally got the project working on stripboard. I used 5v for the 8M2 and 3.3 for the magnetometer with FET level shift. The sensor can detect a paperclip at 30mm. Should be able to detect a car at some metres.

One interesting command I came across is "@ptr". This variable points to a memory location and allows access to the data in the location rather than the location itself. I have used this to setup a storage area that can be accessed via @ptr. Read the manual for a clearer explanation!!

In the code sample, a word is read into W0 and this is to be saved in a 5 location store. The next value is read then stored etc. I then add the values and get an average.

Code:
@ptr = 18              'initialise to start of storage area

w0 contains value so store it in location pointed to by @ptr then increment the ptr
.
.
@bptrinc = b0						'save it in the store and increment ptr
@bptrinc = b1

if bptr = 28 then 
	 bptr =18						'end of store, goto start
endif

get another value and loop back
 
Last edited:

marzan

Senior Member
All very simple, if you place a wire around in a loop and pass a current or a frequency through the wire, then place a metal object over the loop it will effect the flux of the loop, hence effecting the voltage or frequency, as a car is a large metal object then the effect is great, so in most cases they get away with a single wire loop.

Have you noticed if you move forward at the lights it can trigger a light change, this is often because you are not covering the loop enouh to trigger a reading, and when you move it is enough to be detected, i noticed when driving trucks the lights changed faster than in a small car, due to the area of the coil covered and the mass of metal reacting with the coil.

So next time you stop at the lights ensure you park over the coil and you will wait less time.

I see most coils here are 2 diamond shapes cut into the tarmac and would likely have a coil in each, but the more area of those coils you cover the better the detection......Bad luck if you ride a motor bike.
I think that for the last 5 years in our part of the world they have been using fibre optic, that is why the 45 degree corners so as not to bend the cable too much.
 

SAborn

Senior Member
Yes i would like to know how fiber optic is used while set into the pavement???

Also do the sums on the corner angles and your 45 degree corner theory dont stack up, true it uses 2x45 corners but then what degree is the third corner (the one at the each very end) its like saying a diamond shape is made from 45 degree angles..... its not.
 

marzan

Senior Member
detects motion so i`m told. vehicle braking as they approach the intersection . Apparently more reliable.
 

marzan

Senior Member
PDF]



SPZ Fiber Optic Traffic Sensors


scsembeddedtech.com/pdffiles/measpec/SPZ.pdf

Sensor Line SPZ traffic sensor is a fiber optic load sensor designed for permanent in the road installation. When a load is applied to the sensor, it experiences a decrease of optical transmittance. An opto-electronic interface detects these changes and transforms them into signals for traffic data processing.
 
Last edited:
Top