## 3 Energy Efficient MAC Protocol Design
### Scheduling Design  
Since multi-hop communication can save more energy than single hop communication within the human body, it is considered to be used for data transmission. Sensors send data to the coordinator via a multi-hop way. While for downlink data transmission, because the coordinator is not energy constrained, it sends data directly to the sensor nodes with large transmission power. In the swallowable BSN application, because the sensor nodes periodically send sensing data to the coordinator, a TDMA-based MAC scheme is adopted in this paper. Each node only transmits or receives data in the assigned time slot. This scheme can effectively eliminate or reduce collisions, idle listening and overhearing. The stability of the system can also be improved. For the rest of the time slot which does not belong to the sensor node, it will go into the sleep mode for saving energy. The entire scheduling is coordinated by the coordinator which is attached onto the outside of the human body. In our protocol, the control messages are exchanged between the coordinator and sensor nodes by direct link. The data messages are sent in the multi-hop way from the sensors to the coordinator. An example of the schedules in a BSN with three sensors is shown in Figure 4. In the beginning the coordinator broadcasts a beacon message to synchronize all the sensor nodes. After that, the coordinator broadcasts a message to announce the starting time slot for the following sections \"information exchange\", \"neighboring information upload\" and \"schedule assignment\". All the sensor nodes receive this broadcast information and use their own identification (ID) as the shift to calculate their own transmission time slots for information exchange, neighboring information uploading, and schedule assignment. In the information exchange section, each sensor broadcasts its own information including sensor ID and transmission power in its time slot. In the rest of the time it listens for others' information. In the upload section, the sensors send the collected information and their time slot requests to the coordinator in their own time slots. They go into the sleep status for saving energy when other nodes upload data to the coordinator. After the coordinator receives all this neighboring information, it calculates the routing and slot schedule pattern for each sensor. The time slot assignment is flexible. If a sensor device has a lot of data to send, then it would be given more data slots. If a sensor device has no data to send, then it would not be assigned data slots until next frame. In the schedule assignment section, the coordinator sends the schedules to the sensors. The sensor nodes only receive in their own slots and in the rest of the time they are in the sleep mode. The schedule includes transmit/receive time slot and transmit power for the specific sensor in the data slot section. After that, all sensor devices follow the received schedule to complete the communication. In Figure 4, an example of multi-hop data transmission from sensor 1 to the coordinator via sensor 2 and sensor 3 is shown. The whole process repeats in the next TDMA frame. The frame format is shown in Figure 4(a). Assume there are \(N\) sensor nodes in the network. The frame is bounded by the beacon. It is composed of mini control slots and data slots. The mini control slots include broadcast slot (slot 1), information exchange slots (slot 2 to slot _N_+1), neighboring informationupload slots (slot _N_+2 to slot 2_N_+1), and scheduling assignment slots (slot 2_N_+4 to slot 3_N_+3). There are two slots (slot 2_N_+2 and slot 2_N_+3) reserved for the coordinator to compute the schedules of sensor nodes. The control data is exchanged using one-hop communication between the coordinator and sensor nodes, which means the sensor nodes need to use a larger transmission power to send the control data to the coordinator, but for the sensing data transmission, the sensor nodes use little transmission power to send data to the coordinator in a multi-hop way.