You are on page 1of 6

Copyright IFAC Control Systems Design, IFAC

~
Bratislava, Slovak Republic, 2003

Publications
www.elsevier.comllocate/ifac

MICROCONTROLLER BASED DATALOGGER


FOR TRAFFIC INFORMATION COLLECTION
IN PARKING AREAS

Luciano Spinello 1 , Luca Spaghetti 1 ,


Francesco Martinelli 1 , Valentino Di Salvo2

1 Dipartimento di Informatica Sistemi e Produzione


Universitd di Roma Tor Veryata
1-00133 Rome, Italy
e-mail: lucianospinello~universitor.i t,
lucaspaghetti~fastwebnet.it,
martinelli~disp.uniroma2.it

2 Traffic Engineer
e-mail: valentinoambrogio.disalvo~fastwebnet.it

Abstract: In this paper an automatic device to collect data regarding open


parking areas is described. It is based on a loop vehicle detector and a datalogger
where collected data are recorded for subsequent processing operations on a
standard PC. The device is controlled through a commercial microcontroller
unit. The circuit scheme and firmware design are discussed in detail in the
paper. Experimental results are provided in the paper together with a discussion
of related realizations available in the technical literature. Copyright 2003 IFA C

Keywords: Traffic Data Collection, Microprocessor control, Data logging,


Sensors.

1. INTRODUCTION However, the requirements specified for this device


are very restrictive:
For statistical purposes. parking companies regu-
it should be easy to place it in a standard car
larly collect data regarding the occupancy state
parking slot;
of public parking areas. Each park slot should be
it should have an autonomy of 7 days (night
monitored on a basis of 24h per day. This kind of
and day) using a common battery;
study is usually realized by a manual procedure,
it should be sufficiently robust to environ-
which is very expensive and subject to many er-
ment disturbances;
rors.
it should be realized with commercial and low
For this reason, it is of interest to design and cost components.
realize a device to be placed in each park slot to
At present, such a kind of device is not available
be monitored, performing the human work in a
on the market. A large part of traffic data col-
more precise and efficient way.
lection devices have been realized to perform flow
measurements, especially in a situation of heavy
) This work has been partially supported by ASI and traffic conditions. It would be very hard to adapt
MIUR (cofin: MATRICS).

443
these devices to our purposes. because the require- results. finall~'. in Section 5. wc sketch some con-
ments are completely different, If a traffic data cluding remarks.
collection device accidentally skips the passage
of a few vehides. the relative error committed is
usuall:. negligible: in fact this kind of devices is 2. HARD\\ARE DESIG:\'
used on highways where the t~'pical traffic flow
ranges in the order of 2500 and more vehides per 2.1 A sensor s'uT1'ey.
hour. On the contrar~. the error could be dramatic
if the requested park slot device skips a vehide The first step to realize the requested device is the
which takes bus~' the park slot for several days. selection of a sensor or a proper combination of
In addition. a parking measurement device is a sensors with high reliability. acceptable costs and
finite state machine. unlike a flow traffic counter. 10\\' energy consumption. The following sensors
since operations performed depend on the park have been considered: inductive/capacitive prox-
slot state (free or bus~'). imity switches, photoelectric sensors, microwave
sensors. vibration based monitoriug sensors. ultra-
A problem similar to the one addressed in this
sonic proximity switches. loop vehicle detectors.
paper. even if in a domain completely differ-
Videocameras have not been cousidered mainl~'
ent. is considPfed in Luharuka and Krishnamurti
for privacy violation rea."ons.
(2002). The objecti\'(~ in Luharuka and Krishna-
murti (2002) is the realization of a portable data- For different reasons. the loop vehicle detector
logger for physiological sensing. The requirements hac; appeared as the most promising sensor. It
of this device arc an autonorn~' of 12h and an is characteri7,ed by mediulIl energy consumption
high reliability. The projected device comprises a (G5mA), an optimal sensing range and an ad-
commercial GSR (galvanic skin response) sensor justable sensibility, This kind of seusor is com-
which is able to provide output data like heart mouly used iu automatic switched gate parking
rate. temperature and blood pressure. An on- areas to detect the presence of vehicles which
board datalogger containing a great amount of approach to an exit gate. The sensor is small
eeprom guarantees the recording of 7-20 l\IB data for dimension and weight but the loop requires
corresponding to 12 hours logging report. Such a surface of about 1 m 2 .
data can be downloaded on a PC at the end of a
recording session.
2.2 Model concept
lany similarities can be observed between the de-
vice described in this paper and tlH' one presented
A long time has been spent to understand which
in Luharuka and Krishnamurti (2002). They are
sensors and which components should have been
based on the same control unit famil.v micro-
considered and in which ,,,ay t hey should have
processor (l\lPU l\licrochip PICIGXXXX). a yC'rv
been disposed into the parking slot. At t he end of
high qualitv and low cost component: the~' both
these invest igations. the Inductive modf'l has been
use a battery as unique power supplv. with yolt-
selected. which is ba..c;ed on a loop vchide detector
ages conversions where needed.
sensor. located in a parking slot as illustrated in
It would be reallv appealing (and it is actu- figuf<' 1.
all,' considered as a fut ure deyelopmC'nt of our
project) the possibility of realizing po\\'er indepen-
(knt measurement devices connected to a central
data collection svst<-'m. like the traffic information
collPct ion s~'stem realized by Koito iJl(!ust ries and
desnil)('d in :\latsuda (1999), In the system de-
snibed in :\latsuda (Em9). detectors arc pO\\'('red
by slnall solar cells and communicate detected
data to a central device through free-space optical
transmission links. Vehicle detectors arc based on
ultrasonic sensors. This system \\'as installed in
Februarv 1999 along the national route 2-1G to ('01-
kct traffic information regarding vehides running
east and \\'est between TokYO and ShiZlloka. In this
area a commC'rcial power supplv is not ayailable. Fig. 1. Sensor placement in a park slot (inductiw
model)
TIH' paper is organized as follo\\'s: in Section 2
\\'e discuss the hard\\'are design. in Section J \\'e Data arc recorded in a HoboEwnt Datalogger pro-
describe the control algorithm and its implC'lllC'n- duced by the OnSet Computers. The O\'C'rall de-
ration. in Section -1 \\'e present sOllle experimental vice is controlled b~' a :\IPU :\lic!'Ochip PICIGF8-1.

444
which operates as a two state finite machine, one freq uency variation in a digital signal. By properly
state corresponding to Empty parking and the tuning some adjustable parameters, it is possible
other corresponding to Busy parking. Energy is to have precise measurements, ignoring frequency
given by a unique commercial 12V battery. variations caused by environment disturbances.
The FGl Detector would require a 24V power
The control device, sensor and datalogger units,
supply but it correctl~' works using a 12V battery.
are located inside a rigid box placed near the side-
walk, while the loop of the vehicle detector has to Two different outputs. corresponding to two dif-
be located in the middle of the parking slot under ferent electra-mechanical relays, give respectively
a special PVC covering. The vehicle detector sen- the signal of busy Loop and of Loop in exit transi-
sor is always on during the overall measurement tion.
session. The control algorithm works according to
Different parameters can be set to obtain the
the following logic: when a vehicle enters a park
desired behavior: the vehicle loop detector sen-
slot, its presence is immediately detected but the
sitivity, the circuit frequency oscillation and the
entrance event is registered in the datalogger only
operation principles of the output relays.
if the vehicle stays in the park slot for at least 20
s, as explained below. The vehicle loop detector sensitivit~' is a reall~'
important parameter to be selected. The precision
of the measurements depends on its good tuning
2. S The FG 1 detector and it has been set only after a large campaign
of experiments. The circuit frequency oscillation
In this subsection we provide a detailed descrip- characterizes the velocity of the sensor of detect-
tion of the sensor used in the realized device, the ing a state transition. For parking purposes a low
FGl vehicle loop detector produced by FAAC (see setting of this parameter is acceptable and allows
Fig. 2). It is commonly used for gate automation to save energy. The operation principles of the
systems and produced for this kind of applica- output relays can be set in two wa~'s. In the first
tions. operation way, if the loop is busy, the correspond-
ing relays is closed, while it would remain open
in the second operation way. The other rela~' (the
one corresponding to the exit transition output)
stays closed for 300 ms after the vehicle has left
the park slot.

2.4 Data recording

Dat a )>fovidcd b~' the sensor are stowd in a stand


alone (i.e. non-integrated) datalogger, which is
an autonomous device designed to record a large
qualltit~ of data and to transfer them on a stan-
dard PC throughout thE' serial port.
The datalogger used in our dE'vice is the HoboEl'c7It
produced by OnSet Computers. This datalogger is
produced for environmental data collection. it has
beeu used for l'xample as a component in a rain
gauge. It is not commonly used in automation
devices. but it is appealing for its functionalit\.
lo\\' cost. and robustness. especially \\'it h respect
to environment agents. It is able to record up to
..kat ~2
800U ewnts. comprising date and time in t he fol-
_ 2 2Jv"" IOC)
lowing format: dd/mmh'~'. hh/mm/ss. To record
an event. it is necessary to shorten a cont act
Fig. 2. DE'tector FG 1 bet\veE'n t\\'O metal \\'ires coming out the rigid box
containing the device. The Hoboevent is a com-
The operat ion of thE' FG 1 DE'tE'ctor is basE'd on pletel~' autonomous device \\'orking \\'ith a proper
a Hart le~' t~'pe HF-circuit. \\'hE'rE' the oscillator CR 2032-lithium batter~. for a time of 1 ~'ear of
inductor is the loop. When a metallic body (likE' activit~. It is possible to set some parameters of
a car) is over the loop. the inductancE' and con- the HoboevE'nt through a special soft\\'are pack-
sequentl~' the circuit natural oscillation frequency age provided b~' the producer. Onl' of t he most
are changed. A PLL discriminator transforms this important parameters is the option ignore cl'cnt,

445
through which it is possible to have the Hoboevent connected to the relay contact of the Hoboevent.
ignore events for a given amount of time after the Actuall~. to prevent an excessive load to the PlC
contact shortening. This parameter has been used controller, t.his output pin is connected to the ba'ie
in our project. as explained below. pin of a BJT ~P:'\ which is used as an electronic
switch.
Since the selected datalogger uses an electro-
;2.5 Circuit design
mechanical rela.v. the option ignore e1'ent of this
unit has been set to 1-2 s to prevent the reg-
All the described components have been assem-
istration of fictitious events due the bouncing
bled as in the circuit represented in Fig. 3.
phenomenon existing in this type of rela~"s. In
fact. when the cont.act of the relay is closed. the
relay shutter, which shorts the two output wires
of the dat.alogger. could oscillate and generat.e
a sequence of fictitious events. It is particularly
important to t.ake care of this undesirable phe-
nomenon as t he component gets older and older.
Two leds are placed on the control card. They give
a fast representation of the controller state: if the
green led is 011. t.he park slot is free while, if the
red led is on, the park slot is busy. Finally, if the
Fig. 3. The circuit scheme green led is blinking the device is in the decisional
waiting loop.
Both the FGl detector and the micro-controller
circuit PlC IGF84 are powered b~' a 12V battery.
through a proper voltage conversion. The voltage
3. FIR.!\IWARE DESIGN
conversion is performed through an integrated
transformer L!\I7805, which realizes a linear con-
version voltage from a maximum of 30V t.o 5V sta- The operation of t.he PIC16F84 control device fol-
bilized. The two electrolytic condensers connected lows thE' behavior of a two state Mealy aut.omaton
with ground are suggested bv the producer (Texas (see Fig. 5).
Instrument.s) t.o st.abilize t.he output and to reduce
the overshoot phenomenon.

Pin Diagrams

8
PDIP. sOle

RA2- -RA1
Vel1lclePresence(tI~1!
RAJ- -RAO
1P k'ngS!a te=1j
RMlfOCKI- - - - OSC11CLKIN
MCLR-
Vss-
RBOMH-
RB1-
RB2-
RBJ-
-
-Voo

-RB6
-RB5
-RB4
OSC2iCLKOUT

......... R87

u
Fig. S. :"Iealv automaton

The oj)('ration of the automaton f('pn'sented in


Fig. -I. Pin diagram Fig. S is depicted in Table 1. "'here 5(t) represents
t he state of the automaton at time t and can
Tlw t\VO outputs of the FGl deteC'tor are con- aSSUllle two values: BU8:tj Car Park. short Iv Busy
n('ct('d to the inputs of tlw PlC. The PlC r('quires and Empty Car ParI.:. shortlY Empty. The input of
a -I:"IHz quartz oscillator. considering t hat it is the automaton at time t is denoted as \ 'ehic/(,P-
equipped with a prescaler. it actualh" works at rese7l(('(t). shortl~" FPresence(t). while the out-
l:-IHz. The t\VO condensers connected with Illass put of the automaton is the PnrkingState. shortlY
complf'te the oscillating circuit. The PlC is ob- P5tate.
viousl~' connected to the ground and to the 5V
\'Presellce(l) = ] \,Presellce(t) = 0
power suppl~. The :"ICRL pin ,,"orks as a reset
Bus.,-: PSlate= J El1lpt~.PSI ale =(J
pin: when the voltage is high on this pin. the PlC Bus.,': PState=] Empl.'. PSlalc =0
starts to execute the finnware loaded in its flash Table 1.
memorv. One of tlw output of the PlC should be

446
The most important module of the firmware is the
state selector, represented in the flmv diagram of
...,--
Fig. 6.

Y..

Fig. 6. State selector

Fig. 8. Flow diagram for the state of busy parking

if the vehicle remains for at last 20s,


then an event is registered in thp datalog-
ger:
the Occupancy State is set to 1 (Busy
State):
else no event is registered in the datalog-
ger.
Busy State When the vehicle is leaving the park
slot:
the Occupancy State is 1 (Busy State):
the loop detects the absence of metallic
masses (i.e. Relays 1 is closed):
the loop detects an outgoing metallic mass
(i.e. Relays 2 is closed for 300ms):
an event is registered in the datalogger:
the Occupanc~' State is set to 0 (ElIlpt~
State).
Yes
t The part of the algorithm regarding the detection
-( of loop in exit transition (\vhich uses Rela~'s 2
output) has bCf~n developed to avoid improper
operations of the sensor.
Fig. 7. Flow diagram for the state of empty
parking Since the realized device should operate 24h pcr
da~' for about one week. it is of interest to contain
Such a kind of control paradigm. based on a ~deal~' as much as possible powpr consumption. To do
automaton. is necpssar~' since the datalogger is not this. tlw control circuit remains activp onl~.. for
ablp of detecting the type of tlw pyent but onl~' short time periods: 20s when a whide is pntering
rpcords t hp closurp of its rplay. t he park slot and only for the time t he \"Chide
The control algorithms implpmented in thp firm- req uirl:'s to fr('(' thl:' park slot. For t hl:' remaining
warp are represpnted in the fto\\' diagrams of timl:'. the PlC is maintainl:'d in standby. in 10'"
Figures 7 and 8 for the Empt~ and for thp Busy power consumption modp. wherl:' the needl:'d cur-
states. rpspectiYel~. Tlw idea of the procpdure is rent is 1000 timl:'S smallpr (from 2mA to 211 A).
as follows:
Empty State \Yhen a vehicle is entpring the
park slot: S.l The jiT7T1u'are programming language
the Occupanc~' Statp is 0 (Empty State):
the loop detects a metallic mass (i.e. Rl:'ia~'s The PlC is programmed through a RISC (Re-
1 is closed): duced Instruction Set Computer) assembler lan-
the controller starts a 20s waiting period: guage specific of the :-'licfOchip.

447
It comprises 35 I-byte instructions (called op. In figure 10 it is possible to distinguish the interval
operation) which are executed by the processor of times where the parking slot has been busy.
in one or two clock c~-cles. Since the processor which are the black rectangles. At the base of
\vorks at 1 l\IHz, the execution of each instruction each rectangle it is possible to read the starting
requires 1 or 2 /is. This is a negligible speed and the ending times of each parking event. For
if compared to the clock frequenc~' of modern convenience. a text box provides a list of all
processors, however it is completely sufficient to data collected. The realized software can manage
ensure the real time application we are interested more windows at the same time, allowing a fast
in. comparison of data collected. and it is equipped
with zoom and pan capabilities.
The PlC also comprises Ram and eeprom which
makes it suitable in many application domains.
All processor famil~' IGFXXX may be programmed
b~' cheap serial port programmers and the assem-
bler may be compiled using software available on
the ~Iicrochip website. The firmware (compiled
assembler) is then uploaded through a free soft-
ware in the PlC flash memory.

4. RESULTS OF THE PROTOTYPE


TESTING
.'=JE.3 1::. ::: ~: ;': ::;::~~ ~;.:::.:~: ~~.':::~;~ ~:~:
<

r-:
.'

l.lIo; .J
.~
~::::::: ~; ;;;:::~ ~: :::;:: ~~::::~ ::::;~:
The Sos.T.A. device (represented in Fig. 9) is
characterized by a valuable precision in data de-
tection. The large quantity of experiments showed Fig. 10. The visualization window
that the device is able to recognize a parking event
even if only half of the vehicle covers the parking
slot area. If the sensor is located in the middle of 5. CONCLUSIONS
the park slot, erroneous or improper vehicle posi-
tions can be over-passed. In a real urban scenario, In this paper a microcontroller based datalogger
where vehides are positioned quite randomly with for parking data collection has been described.
respect to the parking slots, the Sos.T.A. device A loop vehicle detector has been selected as the
correctly detected all the parking events, apart most suitable sensor for this application. The de-
from a negligible number of errors mainly due to scri bed device satisfies all the specified require-
misplacements of the loop sensor or to battery ments, naIIlel~' the robustness, the low costs and
exhaustion. the installation simplicitv. As a future work. it is
of interest to integrate t he prod uet and to develop
a solar cell powered s~'stcm connected to a data
collection network.

REFERE:'\CES
R. Luharuka ami S. KrishmlInurti. A microcon-
troller based datalogger for physiological sens-
ing. In IEEE instrumentation and mea811TPTnerlf
technolo(j!l conferere. Anchorage. Alaska. :\Iav
2002.
Fig. 9. The realized dnice :\1. ~Iatsuda. Traffic information collection
To rpduce the detection error as much as possible. systems jJO\\'ered bv solar cells. In 1999
it is extremel~' important to select a proper value IEEE/IEEJ/JS.H International Confcrence on
for the sensitivit~ of the loop sensor: a proper Intelligent Transportation S,l/stems. pages 870
sett ing allows to exact Iv discriminate between 873. 1999.
park slot bus\' and empty and. in addition. to
rej('ct disturbances like lllotor-c~'('les standing or
passing through t he parking area.
Data can be anal~'zed through a processing data
soft\\'are dewloped in Borland CPP Builder on
\\'in9xj:\T jXP platforms.

448

You might also like