## 3 System Architecture and Design
### Telematics Sensor Network
Figure 5: Procedure for T-Sensor node to synchronize its local software time tick to the received Sync_Req broadcast message. long as the processing latency is measured accurately, the _u32 Tick_ is updated and TAR and TACCR0 can be aligned correctly to the reference point. Let us briefly describe the hardware design of each kind of node. All kinds of nodes in the TSN are based on a MSP430 Micro-Controller Unit (MCU) and CC2420 IEEE 802.15.4 compliant transceiver and CC2590 RF front-end amplifier from Texas Instruments [34]. To detect vehicles the T-Sensor node is equipped with a HMC1041Z magneto-resistive (MR) sensor from Honeywell [35]. The reasons why we adopt such an MR sensor are as follows: firstly, an MR sensor has been used in the vehicle detection field and proven with inductance loops for many years [17, 20, 21, 29]. Unlike laser or PIR sensors, a MR sensor measuring perturbation of the Earth's ambient magnetic field (~6\(\sim\)+6 gauss for HMC1041Z) by a vehicle doesn't detect other objects such as humans, and it is not easily interfered by weather as explained in Section 2. Although a small amount of day to day change in the Earth's magnetic field and the temperature change can be sources of false detections [36], they can be overcome by a simple algorithm, baseline adaptation which is explained in Section 3.3. Secondly, since it's small-sized (1 mm \(\times\)1 mm \(\times\)4 mm for HMC1041Z) and can be operated in low voltage level (2\(\sim\)20 V for HMC1041Z) and low average current with the help of duty cycling, it makes possible to design a slim and small sized portable sensor node. To provide fault-tolerance to the failure of the wireless network after the start of the evaluation, the T-Sensor node has a back-up SD card on which to save undelivered packets. The T-Sink node is expendable for up to four sets of modules, each of which is responsible for a lane and consists of two communication modules connected via a Universal Asynchronous Receiver and Transmitter (UART). One communication module is for the upper tier network and the one is for the lower tier network. The T-BS-com is a gateway between the TSN and the T-Mon Host, and is attached with a back-up SD card in case the T-Mon Host fails. Before ending this sub-section, the overall operation of a T-Sensor node is described. In our pervious project, S3 [29], through downscaling measurement, we have already demonstrated the battery-life time is over two years against the maximum traffic (155,000 vehicles/day or 1.8 vehicles/second) with careful hardware and software design. In this pilot project, we leave the T-sensor node always on, and the overall operation procedure of a T-Sensor node is described in Figure 6. When a T-Sensor node turns on, it prepares its operation in '_Initialization_' by initializing several variables, the timer expiration period, the baseline (details in Section 3.3), and so on. The main routine consists of four tasks triggered by three event bits which are set in different interrupt service routines (ISRs). ADC event is set in an ADC ISR, which is executed by ADC conversion complete interrupt. Actually, a timer is set to expire every sampling period Ps in 'Initialization' phase, and the timer ISR starts ADC to sample the ambient magnetic field. Once ADC event is set, '_VehicleDetectionTask_' is executed to decide two major detection events (APPROACH or DEPARTURE), and the details are explained in Section 3.3. The other two events, Radio and UART events are set by CC2420 and an internal UART controller, respectively. '_NwRxProtocolTask_' is the main task for the network and application merged layer to process every received packet from the MAC layer. Depending on the destination address of the received packet, it takes the received packet and processes it in the application layer or just forwards the packet to a proper neighbor. If the destination of the packet is the current node and requires the response, it prepares the response packet and sends it to the requesting node.