The HobbyIoT DOG system is intended to implement a remote monitoring and control by using the very popular Raspberry Pi single board computer together with one or more simple web cameras and a 3G modem. A number of applications and scripts are installed within the standard Raspbian distribution to make the system reliably up and running.
In this article I will show you the technology used to remotely take a picture and transfer it back to the user.
The implementation includes a mobile or any other network device with a web browser. The OpenHAB system is running on the Local Pi device. It also runs a Mosquitto MQTT to be able to exchange topics and commands over it. The Remote Pi is running Mosquitto MQTT and Motion software for taking pictures, videos and other activities with the webcams. A small Python script called MQTT-Launcher is running in between and makes possible the MQTT commands to reach and control the Motion software. Both MQTT instances are running in Server mode and are connected in an MQTT Bridge chain.
When a picture has to be taken, pressing the "Take picture now" button the OpenHAB transmits an MQTT command over the MQTT Bridge from the Local Pi to the Remote Pi. The Python script there is subscribed for that topic and receiving the command over it executes a predefined script. The script itself contains an URL command (via CURL) to the Motion instance running there. It just says "Take picture now" as a first command and then "Send it back over the network" using simple SCP. In case of more webcams (Motion accepts up to 4 webcams) the MQTT topics have to be differentiated for each camera.
In my implementation I use 3 webcams to have one USB port of the Remote Pi spare for the 3G modem.
3G connection, remote access and more will be available here soon.
Information, scripts and schematics will be available soon on GitHub.
Check the Slack channel #HobbyIoT of the project for questions and discussions soon!
The OpenHAB website: https://www.openhab.org/
The Mosquitto MQTT: https://mosquitto.org/
Motion software: https://github.com/Motion-Project/motion
MQTT Launcher: https://github.com/jpmens/mqtt-launcher (requires PAHO MQTT: https://www.eclipse.org/paho/)