MQTT using Raspberry Pi and Amazon AWS IoT

MQTT(Message Queue Telemetry Transport) is a Publish/Subscribe based messaging protocol on top of the TCP/IP protocol. Amazon AWS IoT is a great platform that enables you to connect devices to AWS Services using MQTT protocol. Here, we are going to show Raspberry Pi communicating with another Raspberry Pi through Amazon AWS IoT.

We are using Amazon AWS IoT Python SDK and MQTT protocol to Publish/Subscribe event. The Publish/Subscribe messaging pattern requires a MQTT broker. The MQTT broker is responsible for distributing messages to interested clients based on the topic of a message. Here, Raspberry pi used as a MQTT Client and Amazon AWS IoT used as a MQTT Broker.

In this program, first Raspberry Pi device is Subscribing to Button Event of second Raspberry Pi device and vice versa. Raspberry pi will toggle the light when Button Event received from another Raspberry Pi. So when we press button on first device, it will send Publish request of button event. This event will be received by second device which will toggle light. We will need to generate end point on Amazon AWS IoT which will also provide us private key and certificate required for a particular device secure authentication.

Post a Comment