- From justmaster on 09-04-2015 at 01:51:47
Please Tax, help me with my thesis, i need this excellent project...
Inductive Loop Detector works by detecting an inductance change in wire loop (coil) that is buried in road. It does that by measuring the frequency of the internal oscillator which powers the mentioned coil. When a metallic object moves over the coil it changes its inductance and that in turn changes the oscillator frequency which is measured by the microcontroller. It is used for vehicle access control at door and barrier controls, for monitoring the occupancy and for vehicle counting in parking garages, for traffic light installations and traffic controllers, for direction and speed detection of vehicle traffic (if dual channel version is used), in car-wash plants, etc.
Two versions of this device were made: v2.0 and v2.1. Version v2.0 had TPS5405 SMPS buck converter IC but that turned out to be a bad choice because of it's low maximum input voltage and dynamic switching frequency change (special feature of TPS5405) which interfered with our loop oscillator in some cases. Therefore, here is a better version v2.1 that uses LM2596 IC.
Pinout of electronics (note: this is actually for version 2.0 but pinout is the same for this version 2.1)
Main component of this device is Colpitts oscillator which consists of just one transistor and few passive components. Frequency of oscillation is determined by number of coil windings - inductance and capacitors in oscillator circuit - capacitance, which can be changed with DIP switches. Wire loop (coil) is isolated from sensor electronics with 1:1 ratio isolation transformer. Transformer that I used in this project is from an old ADSL modem but rewound to 1:1 ratio. Transformer is not really critical, but RM5 core is your best choice. Note: You can build this oscillator without a transformer too! Common frequency range used for these detectors is from 30 kHz to 150 kHz.
Oscillator is connected to PIC16F877A microcontroller's RA4/T0CKI input via NPN transistor. Microcontroller is measuring the frequency of oscillations and determines whether the detection has occurred or not. There is a LED bargraph display that is used to show and set current detection sensitivity level and it also displays current level of detection as metalic objects approach the coil.
MCU PIC16F877A (entire schematics can be downloaded by clicking on the red download button bellow)
Electronics are powered by LM2596 SMPS step-down (buck) converter IC. It has a maximum input voltage of 40V DC which is perfect in case our electronics are powered from alternating ~24V because after rectifying we end up with 34V DC. LM2596 can provide 2A of current which is actually an overkill for this sensor, but I went for it since it is extra cheap and easy to order from eBay.
Voltage regulator LM2596
As this project is all about measuring the frequency (30-150 kHz) we need to choose the best method of measurement for this application. We can choose from two methods of measurement: frequency measuring (direct method) by using "gate time" or period measurement where we count pulses and work with that value.
The only suitable method for this application is actually the "period measurement". Impulses from oscillator are connected to RA4/T0CKI input pin of microcontroller, and on every overflow of TIMER0 counter I simply read the value of counter TIMER1. TIMER1 is configured as a free counter and its value is incremented with every internal clock pulse (Fosc/4). TIMER0 is configured and prescaled so that during normal operation of sensor electronics TIMER1 must never overflow over it's maximum value (65535). Value of TIMER1 is manually cleared to zero on every TIMER0 counter overflow, so it starts counting from 0 every time.
After powering up the device, oscillator starts to oscillate and microcontroller performs a startup measurement which is reported on yellow LED by blinking in 10kHz steps. Initial setup of TIMER0 is: prescaler=1:2, reloader=0. Reloader is a preset initial value which is loaded into TIMER0 after each overflow in order to speed it up. Prescaler tells us that the value of TIMER0 will increase by 1 on each 2 pulses that arrive from the oscillator. This means that overflow of TIMER0 will occur after 512 pulses which in turn means that by using MCU Fosc=12 (actually 12/4 MHz) and at loop oscillator frequency of 30 kHz TIMER0 will always overflow when value of TIMER1 increases to 51200. If we calculate the resolution at these values we can see that it is 0.58 Hz which is excellent. Under these same conditions but at loop oscillator frequency of 140 kHz value that TIMER1 value would be 10971 and resolution would be 12.76 Hz which is pretty bad.
It would be best if we could somehow fix value of TIMER1 counter to around 53000 at any given loop oscillator frequency. This can actually be done by prescaling the TIMER0 and preloading it with some initial values. This means that after microcontroller starts and performs initial measurement, it can figure out the best values for TIMER0 prescaller and reloader so that TIMER1 gets around 53000 where it will have best resolution and in turn have best sensitivity. Value for TIMER1 has been chosen to 53000 because during normal operation no metallic object can increase it that much so that it causes an overflow. In case it does overflow, the microcontroller will re-adjust TIMER0 prescaler and reloader values so it gets back to around 53000.
By using this method we ensure that device has the best sensitivity at any loop oscillator frequency.
After the initial calibration is finished, sensor remembers current value of TIMER1 and uses it as baseline value to compare with any following measurement. If frequency change that crosses selected threshold is detected, the sensor goes into "detect" state. Later when frequency changes back to the baseline value the sensor goes back to "idle" state.
During normal operation sensor constantly re-adjusts the baseline frequency value because it tends to drift with temperature changes of electronics and the wire loop itself.
There are 10 DIP switches to configure the operation of sensor electronics. When the switch is in left-hand position it means that it is turned "off", right-hand position means that switch is turned "on".
Sensor should be reset after making any DIP switch changes!
|DIP 1||Signal Filtering (B)|
|DIP 2||Signal Filtering (A)|
|DIP 3||Presence Selection (B)|
|DIP 4||Presence Selection (A)|
|DIP 5||ASB (on, off)|
|DIP 6||Relay Pulse Duration (on = 500 ms, off = 100 ms)|
|DIP 7||Relay Pulse Type (on = on loop leave, off = on loop enter)|
|DIP 8||Relay Type (on = presence, off = pulse)|
|DIP 9||Frequency Selection (B)|
|DIP 0||Frequency Selection (A)|
There are 2 DIP switches for selecting 4 filtering stages: DIP 1 i DIP 2. Filtering stages are described in detail in PDF user manual.
If this option (DIP 3 and DIP 4) is selected to infinity, the "detect" state will remain as long as there is a vehicle above the loop. One possible problem of using this option is that in "detect" state sensor electronics do not track and compensate for frequency drift. In extreme situations this can either cause false detect when vehicle finally leaves the loop (in this case device must be reset manually), or somewhat slower response time of further detections until device completes positive frequency drift compensation.
ASB - automatic sensitivity booster
DIP 5 - This option increases sensor sensitivity to maximum upon detection. This is usually used to detect trucks and vehicles with trailers if sensor is not already configured to maximum sensitivity. If sensor is already configured to maximum sensitivity, this option is ignored.
Relay Pulse Duration
DIP 6 - This option selects the duration of relay pulse in case Relay Pulse Mode is selected. When the DIP switch is at "on" position the pulse lasts ~ 500 ms, if the switch is at "off" position the pulse lasts ~ 100 ms.
Relay Pulse Type
DIP 7 - In case Relay Pulse Mode is selected; this option defines whether the pulse will occur when vehicle approaches the loop or leaves the loop. When DIP switch is at “on” position then the pulse will occur when vehicle leaves the loop, otherwise the pulse occurs when vehicle arrives on the loop.
DIP 8 - This option selects Relay Mode. If the switch is at "off" position then relay will be activated for as long as there is a detection. Otherwise relay will just send out the pulse which is defined by DIP 6 and DIP 7.
Frequency of loop oscillator is primarily defined by the wire loop geometry and the number of windings. In order to slightly change the frequency of the loop oscillator there are two DIP switches DIP 0 and DIP 9.
Loop oscillator frequency is displayed on yellow status LED after the device is reset. LED will blink in steps of 10 kHz. Example: if LED blinks 7 times it means that the frequency of loop is from 70 kHz to 79 kHz.
Sensor should be reset after making any frequency adjustments!
All working parameters of the sensor can be fine-tuned by using supplied PC application.
PC configuration UART (TTL!) port
Explanation of parameters
Sensitivity - "Osjetljivost"
When metallic object approaches the loop it changes its inductance which in turn changes the oscillator frequency. Oscillator frequency is internally represented by number that has range of 1 to 255. Smaller metallic objects (for example bicycles) make smaller changes to this number while larger objects (such as cars) make bigger changes. Sensitivity has two thresholds: detection threshold which represents the number that the object must change inside the MCU in order to declare detection, and un-detection threshold which represents the number that is required in order for it to remain in "detect" state. Un-detection threshold is always smaller than the detection threshold and is usually 1/2 or 1/3 of the detection threshold.
Programmed values for each sensitivity level remain in sensor's internal EEPROM memory and can be selected with the Sensitivity Button while device is operating.
Signal Filtering - "Filtriranje"
Filtering is very important part of sensors internal operation. There are 4 filtering levels that can be selected and fine-tuned using this PC configurator app. Parameters that define filtering levels are:
Note: Number used for negative drift compensation can also be used for positive drift compensation. Parameter used for positive drift compensation should be equal to or smaller than the number used for negative drift compensation.
There are 4 levels of filtering that can be programmed into the sensor and later selected by the appropriate DIP switches.
PPC (permanent presence canceller) - Presence Selection
Values for Presence Selection can also be fine-tuned. Detailed instructions about this can be found in PDF user manual.
Note: All files required to build this device (schematics and PIC firmware) are available by clicking on the red download button bellow.
Video of sensor in use (this is video of version v2.0)
Testing on the desk
Photos of sensor (note: this is PCB version v2.0)
Device in idle state showing current sensitivity level (maximum)
Device in "detect" state
Bottom PCB side where MCU is located
Close-up of top PCB side
Gas discharge tubes and 1:1 isolation transformer
Soldering top side
DIY stencil from a fizzy drink can
Close-up of bottom PCB side with MCU and 12.000 MHz crystal
[ Source: Trax ]
Author (sent by): Trax
Download counter: 1,120
Rate: (3.01, votes 960)
Lokalna verzija ove stranice: Induktivna petlja za detekciju vozila v2.1
We will continue discussion via E-mail. Regards!
Please Tax, help me with my thesis, i need this excellent project...
Hi tax, and send you mail, please help me, I know that's your job, you have no obligation.
Hopefully you can help me I really need that information is vital for me. thank you
It is trax at elektronika dot ba. Or click on the author name bellow the article (above this
comment you are reading).
Hi, which is you emails
Hi @justmaster, make me an offer to my e-mail and I might consider :-)
Hello, how much money it costs the code, I need really urgent for my thesis and not to do.
Thank you very much for your cooperation.
Yes it would work, but this doesn't actually detect magnets that well. It detects metal.
Perhaps you should consider using an RFID reader and put a TAG on your dog's collar? That would
I'm interested in using this to detect a dog wearing a magnet on his collar to open a pet flap.
The loop around the flap would be 50cm in diameter. Would this work & if so could I
purchase a complete PCB?
Intersira me cijena ovog proizvoda detektor vozila.
bug pojacalo telephone transmitter amplifier tv phone ir senzor detector prekidac predajnik sms antena telefon audio atmel light mhz alarm detektor pic fm radio gsm prijemnik battery switch sensor bubica