## 3 System Design and Implementation
### Deployment of Sensor Nodes in WSN  
The deployment of sensor nodes in a WSN is mainly for setting up a wireless network environment for ECG data transmission between the BSL and PNL. In this module, a compact, light-weight and small ECG sensor node as shown in Figure 2(a) is implanted in a body-worn ECG device, namely the wearable health shirt shown in Figure 3(a). This wearable health shirt with an ECG chest belt and ECG sensor node is able to obtain the ECG vital signs from the human's body. This shirt can be easily applied to a person's chest. The patients will not feel uncomfortably as it is just like wearing a normal shirt with no restrictions on their daily activities. A tiny base station node, known as the wireless dongle [9] and shown in Figure 2(b) is modified to be attached to a smart phone as shown in Figure 3(b) to receive the ECG vital signs from the wearable health shirt. The wireless dongle is connected to the smart phone through a customized sensor node-to-mobile phone RS-232 serial communication interface. Both the ECG sensor node and the base station node have a serial port interface that provides bidirectional communication at 15,200 Kbps which allows them to connect to the ECG module internally. These sensor nodes are specially designed for ubiquitous healthcare applications. The size of the mote is small -4 \(\times\) 4 \(\times\) 0.2 cm. These sensor nodes are featured with a Texas Instruments MSP430F1611 ultra low power microcontroller, equipped with an internal voltage and ECG sensor together with a CC2420 RF transceiver. The specifications of the sensor nodes are listed in Table 2. A sensor node attached to the ECG module is connected to a rechargeable battery to allow for the continuous ECG data transmission and monitoring. The wireless dongle is modified to be attached to the mobile device according to one of ubiquitous healthcare's basic concepts, flexibility, where monitoring process can be done anytime without any obstacles, especially with regard to the the  
Figure 3: Deployment of sensor nodes in WSN: (**a**) Wearable health shirt embedded with ECG devices; (**b**) Wireless dongle on smart phone device. Figure 2: Sensor nodes: (**a**) Sensor node on ECG module; (**b**) Wireless dongle on smart phone. battery exhaustion problem. This modified node attached to the smart phone is different from the other sensor modules which normally have a battery power supply module attached. It utilizes the power supply directly from the battery of the mobile phone. The user does not need to worry about battery usage at the base station as long as the mobile phone is functioning. The ECG data obtained by the sensor node from the wearable smart shirt is translated into sensory data and then transmitted by the sensor nodes over the network to the wireless dongle, the base station node at the smart phone. The sensor nodes are built on top of the TinyOS's embedded C based programming platform. Figure 4 shows the packet format of the sensory data in the implementation. This packet format has the same encoding as that of the HDLC protocol. Data is organized into frames and sent across WSN to its destination. The packet format contains a flag field to identify the beginning and end of a packet frame, a protocol byte, followed by 10-byte of TinyOS command message, 26-byte of ECG payload and a 2-byte CRC. A TinyOS command message consists of length, frame control field, data link sequence number, destination identifier, message type and a group identifier. For ECG data, 20 bytes are allocated for 10 data with 2 bytes each. \begin{table}
\begin{tabular}{l l} \hline \hline
**Components** & **Descriptions** \\ \hline Microcontroller & MSP430F1611 \\ \hline \multirow{4}{*}{RF Transceiver CC2420} & Sensitivity:12 bits \\  & Transceiver rate:250 Kbps \\  & Rx current:18.8 mA \\  & Tx current:17.4 mA \\ \hline RF range & \(\simeq\)100 m \\ \hline Size (cm) & 4 \(\times\) 4 \(\times\) 0.2 \\ \hline Power & 2.5 V–4.0 V \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Specifications of the sensor node.