# Smart Warehouse Management System: Architecture, Real-Time Implementation and Prototype Design
## 6 Design and Development of the Prototype
### Protocol Stack  
The Internet Protocol Suite is the backbone of any IoT-based system. It is the bridge that connects all the modules together and exchanges data in between them. For any particular device or system, the protocol is chosen as per the requirements and needs, so that it can work efficiently in the given circumstances. Different protocols are available including wireless and wired [48]. Wired protocols such as SPI, I2C, and UART are useful in the absence of a wireless network or the Internet; nonetheless, these restrict the area of application as they have a limited wire length. A longer wire length is susceptible to transmission loss, as well as low transmission rates. Hence, wireless transmission protocols are vital to a fully automated smart warehouse management system [49]. As for the wireless networking protocols, there are different protocols working on different layers of the Internet Protocol Suite. These include HTTP, MQTT, SMTP, DHCP, etc., for the application layer, TCP, UDP, DCCP, etc., for the transport layer, and MAC (WiFi), ZigBee, OSPF etc., for the link layer. Conventionally, the client-server model using HTTP/s is used as the application layer protocol as it is easily configurable on many devices and gives good results. However, we replaced it with MQTT, which has provided promising results in real-time environments, as proven by the comparison at the end.  
MQTT is a lightweight wireless networking protocol, with a small overhead. The greatest advantage it provides is the fast, real-time data transfer, which is vital in the case of a large warehouse and inventory. A typical architecture for the implementation of the MQTT protocol is shown in Figure 9. It is based on a broker, subscriber, and publisher model.  
To configure the broker, an open-source broker can be installed on any operating system. A large number of subscribers and publishers can connect to it using IP addresses. Publishers are the sender module, and subscribers are the receiver module. Publishers publish data (strings, integers, bits, etc.) to any \"topic\", that acts as an address to publish and retrieve the data. Subscribers subscribe to the topic from which they want to receive data. There can be many topics for a single broker, with a large number of subscribers and publishers. Subscribers can also be publishers and vice versa. The small overhead size makes it possible for data to be transmitted in real time, making MQTT the perfect option for real-time data transfer and acquisition, which is vital for any real-time smart warehouse management system [50]. As mentioned earlier, any device with an operating system can be configured as a broker; in this case, the Raspberry Pi was used due to its portability and availability for an operating system, and the Eclipse Mosquito broker was configured on it. The connection was secured using publisher authentication. The ESP scanners were connected to the Raspberry Pi wirelessly and published the IDs on the specific configured topics. A single Raspberry Pi with the broker installed on it can connect to many publishers and subscribers, hence covering a large area of the inventory. The IDs were retrieved at the backend using JavaScript, which acted as a subscriber. The block diagram of the prototype design is shown in Figure 10, and the overall working system is shown in Figure 11.  
Figure 9: MQTT architecture for the Internet of Things.  
Figure 11: Block diagram of the working system.  
Figure 10: Block diagram of the prototype.