Skip to content

Kelvin-Weksa/Mqtt_protobuf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MQTT + PROTOCOL BUFFERS + ESP8266 + LINUX DOCKER

starting from a fresh debian/ubuntu/raspbian container

begin by installing these packages as :

apt update

apt upgrade

apt install git cmake make g++ autoconf automake libtool curl unzip python  python-dev python-pip  python3 python3-dev python3-pip mosquitto mosquitto-dev libmosquittopp-dev arduino

install protocol buffers from source

git clone https://github.com/protocolbuffers/protobuf.git
// 
cd protobuf
git submodule update --init --recursive
./autogen.sh
 
./configure --prefix=/usr
make
make check
make install
ldconfig # refresh shared library cache.

then within python install:

pip install python3-protobuf protobuf paho-mqtt
pip3 install python3-protobuf protobuf paho-mqtt

Now pull the Mqtt_Protobuf demo and build

cd /
git clone https://github.com/Kelvin-Weksa/Mqtt_Protobuf.git
cd Mqtt_Protobuf
git submodule init
git submodule update
mkdir build #the build folder MUST be named 'build'
cd build/
cmake ..
make
from the witin build/ folder open terminal and access the C++ app as
./cpp/cpp broker_ip subscribe_to publish_to
from the witin build/ folder open terminal and access the python3 app as
python3 ../python/paho_mqtt.py broker_ip subscribe_to publish_to
from the witin build/ folder open terminal and compile the esp8266 app as
./../arduino-cli compile --fqbn esp8266:esp8266:generic  ../Mqtt_Protobuf_Sketch/
from the witin build/ folder open terminal and upload/monitor the esp8266 app as
./../arduino-cli upload -p /dev/ttyUSB0 --fqbn esp8266:esp8266:generic ../Mqtt_Protobuf_Sketch/ && stty -F /dev/ttyUSB0 raw 115200 && cat /dev/ttyUSB0
of course assuming the esp8266 is located at: /dev/ttyUSB0
change as appropriate see arduino-cli
how to run the docker so as to have access to host network and chosen usb devices
docker run -it --device=/dev/ttyUSB0 --device=/dev/ttyACM0 --net=host kelvinwekesa/debian-mosquitto:final
the folder structure is as follows
  • build: this is where the built application and generated files are located it MUST be named "build"

  • cpp: c++ program to subscribe and publish messages

  • examples: collection of working code snippets not related to our project

  • fmt: 3rd party libraly, unmodified

  • messages: CMakefile to build protobuf and generate c++ code

  • messages_embedded: CMakefile to build protobuf and generate arduino code

  • Mqtt_Protobuf_Sketch: Arduono code to subscribe and publish messages

  • MQTT_Publish: example code from recomended starter projec, unmodified

  • MQTT_Subscribe: example code from recomended starter project, unmodified

  • nanopb: 3rd party library, unmodified

  • protobuf_examples: example protobuf tutorial, not related to our project

  • python: Python script to subscribe and publish messages

-...

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published