Monday, February 22, 2016

Communication with Pi via MQTT using Arduino

Experiment: Communication with Pi via MQTT using Arduino 


1. Installed all the required packages: SPI, PubSubClient
2. Tested the example program 
It connects to an MQTT server then:
  - publishes "hello world" to the topic "outTopic" every two seconds
  - subscribes to the topic "inTopic", printing out any messages
    it receives. NB - it assumes the received payloads are strings not binary
  - If the first character of the topic "inTopic" is an 1, switch ON the ESP Led,
    else switch it off.
3.Tried communicating with pi by using it as the server.
4. Read the messages in from the topic "outTopic" using mosquitto.


Code: https://github.com/jyothi-lanka/IoT/blob/master/mqtt/mqtt_esp8266.ino


Video:





Whom I helped:

Helped my classmates( Hema, Prashant, Sandeep) in
1. Trying to install packages.
2. Working on the Arduino programming to connect to the MQTT server.
3. Solving the issues during the connection.


Who helped me:

Prashant helped me in connecting to the Pi using the Arduino programming and also using mosquitto.


References:http://m2mio.tumblr.com/post/30048662088/a-simple-example-arduino-mqtt-m2mio


No comments:

Post a Comment