I would like to design a system using Raspberry Pi that sends the sensor's data to server continuously and receive commands from server.

Will MQTT suit my needs ?

Is there any way to do so if I use Java on my Pi?


By continuously I mean that streams like video are continuous and other text based data is sent twice every minute.

The sensors are:

Humidity sensor - http://www.amazon.in/DHT11-Temperature-Humidity-Sensor-Module/dp/B01HI9G9ZU?tag=googinhydr18418-21&tag=googinkenshoo-21&ascsubtag=710c9d6b-87d0-41e2-b3e0-06a1045769f3

A 5MP camera (Webcam connected to USB of the Pi.)

LDR(Light and Dark) - Sensor

The server is based on a cloud hosting location.

  • 1
    Thank you ;) I'd also like to know if you have choosen a specific cloud hosted server, important for the MQTT approach
    – Goufalite
    Commented May 16, 2017 at 16:59
  • 1
    @Goufalite no i simply have a cloud server machine at google cloud nothing fancy a simple cloud server with 4GB memory and 2 cores of compute power. Commented May 16, 2017 at 17:03

2 Answers 2


Ok here goes

  • Install MQTT on your Raspberry Pi

Look if it is already running on your Rpi linux flavor or install it

  • Expose your MQTT port

Look at which port MQTT is installed and open this port using port forwarding with your broadband modem

  • Connect your cloud server to your local MQTT

  • Test your sensors

I don't know how the temperature sensor will be connected, my best guess would be with an Arduino. If it is the case, you can connect it to MQTT with a shield. If not, please edit your question to tell us how your sensors will be connected to your system.

  • Monitor your camera

Raspberry Pi has a library called motion which allows to control the camera, its behaviour on detection,...

Unless motion has already a MQTT interface, your best move is to output movements as pictures and then use a homemade service which uses inotify to wait for a new file and act (MQTT /camera/motion yes)

If you need more advice, please edit your question with other elements.


By continuously I mean that streams like video are continuous

If you are considering continuous video streaming from Pi then LIVE555 Streaming Media is a may serve your purpose. Live555 will provide following:

  • Source distribution for standards based RTP/RTCP/RTSP/SIP multimedia streaming
  • Suitable for embedded and/or low-cost streaming application

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.