¡Caminando hacia el éxito!

Aprende en Comunidad

Avalados por :

HCP IoT Showcase: Prueba de unidad con MQTT y Mosquitto en Raspberry Pi

  • Creado 01/03/2024
  • Modificado 01/03/2024
  • 10 Vistas
0
Cargando...
Hello everyone, again. This is the fifth blog post based on the following table.






HCP IoT Showcase using Sphero
Parte 1: Visión general
Parte 2: Control de Sphero usando Raspberry Pi y controlador Xbox 360
Parte 3: Configuración del laberinto (Hardware)
Parte 4: Prueba de unidad (Recopilación y envío de datos)
Parte 5: Prueba de unidad (MQTT)
Parte 6: Prueba de integración
Parte 7: Aplicación XS
Parte 8: UI

This blog explains the highlighted section in the overall architecture below.



In the previous blog, I introduced 2 unit tests in regard to gathering and sending data.

The remaining test is about MQTT broker which is for displaying real-time data in the dashboard.

MQTT broker does not directly communicate with HCP IoT Services here but it will play a role for supplementing HCP IoT Services from a displaying real-time data perspective.

So, technically, it is a separated data source for our dashboard and its purpose is different from HCP IoT Services in the architecture.

  • HCP IoT Services: Gathering and processing all data using HANA

  • MQTT Broker: Displaying real-time data without storing them in any databases


SAP Korea team used Mosquitto as our MQTT broker and we installed it on Raspberry Pi since we don’t need a public MQTT broker.

Let’s do the last unit test.

Prueba de unidad 3: MQTT


The first thing you need to do is installing Mosquitto on Raspberry Pi with WebSocket support.

Since blog de peter6960 (Peter van der Walt) explains the detailed steps in regard to the installation, I’ll not explain it here.

Please refer the “Installation Mosquitto with WebSocket Support” and “Enable WebSocket Support” sections in his blog.

However, I didn’t install mosquitto client and there are slight differences in editing mosquitto.conf file and loading it as below.
sudo apt-get install mosquitto mosquitto-clients

mosquitto.conf
sudo nano /etc/mosquitto/mosquitto.conf

I added 3 lines as below.
listener 1883
listener 9001
protocol websockets

Then I load config using following command.
mosquitto -c /etc/mosquitto/mosquitto.conf

The next thing is installing Chrome extension for subscribing and publishing topics.

I installed MQTTLens but if you have any favorite tools other than Chrome extension, you can also use them.





Once you launch MQTTLens, you can add a new connection
Pedro Pascal
Se unió el 07/03/2018
Pinterest
Telegram
Linkedin
Whatsapp

Sin respuestas

No hay respuestas para mostrar No hay respuestas para mostrar Se el primero en responder

contacto@primeinstitute.com

(+51) 1641 9379
(+57) 1489 6964

© 2024 Copyright. Todos los derechos reservados.

Desarrollado por Prime Institute

¡Hola! Soy Diana, asesora académica de Prime Institute, indícame en que curso estas interesado, saludos!
Hola ¿Puedo ayudarte?