Main Content

Remote Control and Photo Surveillance Over MQTT

Today I would like to talk about how to make a remote control and monitoring system that can be used, for example, to control garage doors, lighting, heating, pressure control, temperature and many other parameters. But the main feature of this system is that you can remotely receive photos from a remote object. Before you begin the story, a short preface.Once I wanted to make a photo surveillance system using a compatible Arduino M0-SD board, a VC0706 camera and a 3G/GPRS/GSM/GPS shield for Arduino. The Arduino M0-SD compatible board was chosen from the conditions that it is very easy to program (just like the Arduino UNO), the operating voltage is 3.3V - this is very convenient for working with the VC0706 camera, a large amount of ROM and RAM, several ports the UART, a separate virtual port of the USB, but the main advantage is the presence of a micro SD connector directly on the board (It is very convenient to store large amounts of data, such as images).
3G/GPRS/GSM/GPS shield for Arduino is very convenient for use with a compatible Arduino M0-SD board. There are several libraries on the Internet, as well as many examples for working with this shield. The data transfer rate (3G) is much higher than that of conventional GPRS shields (especially convenient for transmitting images). Availability of GPS module is an additional advantage.
I chose a low-cost tariff from a cellular operator for data (photos) transmission over the Internet. But the question arose: how to transfer data? MMS? FTP? How to get a notification about the receipt of data (photo)? As a result, I came to the decision to send data (photos) to e-mail and view letters through the application installed on a mobile phone. It turned out to be very convenient! :-) The finished project can be viewed at this link.

There is also a similar project for Arduino UNO by reference.

Then I decided to expand the functionality of my device. For example, add the ability to control LEDs (although in reality the possibilities are much wider). E-mail for this is not very suitable. SMS option is expensive and uncomfortable. And then I learned about the MQTT. I will not describe what he is. Let me just say: This is a really cool thing! :-) With the help of MQTT, you can exchange not only messages, but also binary files (images). In the application for the phone, you can easily create your own interface.

I looked for examples of implementation of the MQTT protocol for my 3G/GPRS/GSM/GPS shield (SIM5320) and, unfortunately, did not find the implementation I needed. But that didn’t leave me alone. I decided to independently implement the necessary functionality. As a result, I managed to create a device that is controlled (indicated by three LEDs) over MQTT from an application installed on a mobile phone, and also sends a photo to the phone on command from the phone. (I will tell you a secret that I havent seen any examples of sending images through the MQTT broker before and did it for the first time. And when I managed to transfer the first picture I was immensely happy! :-) ) And so, I propose to go straight to the first step - a list of necessary components.”

Link to article