Skip to content

Commit bf277a5

Browse files
committed
Added the installattion step for mqtt client library
1 parent db3f708 commit bf277a5

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

Diff for: README.md

+62
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,68 @@ The Push Button is powered using the ESP8266 3.3V, thus ESP8266 3.3V is connecte
8686
- Sinric Pro associates every Device with a DeviceID(let's call it *Light_ID*)
8787
2. Now update the *Light_ID*, your App key and App secret and the Wifi credentials in the code(`Arduino_code/main/main.ino`).
8888

89+
### For C server
90+
1. The C sever uses ***Paho MQTT C client*** library. The steps to install and build the library is written below:
91+
- Move to the folder where you want to install Paho MQTT C client library and let it be *$DEST_PATH* . Open the terminal.
92+
```cpp
93+
$ sudo apt-get install build-essential gcc make cmake cmake-gui cmake-curses-gui git doxygen graphviz libssl-dev
94+
$ git clone https://github.com/eclipse/paho.mqtt.c.git
95+
$ cd paho.mqtt.c
96+
$ cmake -Bbuild -H. -DPAHO_WITH_SSL=ON
97+
$ sudo cmake --build build/ --target install
98+
$ sudo ldconfig
99+
```
100+
2. Move to the folder containing C analyser code. In order to compile the code run the following command in the terminal.
101+
```cpp
102+
$ gcc -L${DEST_PATH}/paho.mqtt.c/build/output -o server analyser.c -lpaho-mqtt3c -lpthread
103+
```
104+
3. In order to run the server type the command.
105+
```cpp
106+
$ ./server
107+
```
108+
109+
### Install Mosquittto Broker
110+
1. Install the mosquitto package.
111+
```cpp
112+
$ sudo apt install -y mosquitto
113+
```
114+
2. The mosquitto package should now load on your server. Confirm the status of the mosquitto service (Ensure that the mosquittto package is loaded and active).
115+
```cpp
116+
$ sudo systemctl status mosquitto
117+
```
118+
3. Once running, you can manage the mosquitto services by executing the following commands.
119+
- Stop the mosquitto service:
120+
```cpp
121+
$ sudo systemctl stop mosquitto
122+
```
123+
- Start the mosquitto service:
124+
```cpp
125+
$ sudo systemctl start mosquitto
126+
```
127+
- Restart the mosquitto service:
128+
```cpp
129+
$ sudo systemctl restart mosquitto
130+
```
131+
4. By default, the mosquittto broker will not handle anonymous connections. The server compiled by analyser.c and the client written in the sketch doesn't use any authentication service. In order to make the mosquittto broker listen to anonymous clients, we need to tweak the configration file as shown below.
132+
```
133+
$ sudo nano /etc/mosquitto/conf.d/default.conf
134+
```
135+
Now add the following lines in the file :
136+
```
137+
listener 1883
138+
allow_anonymous true
139+
```
140+
5. Restart the mosquittto broker.
141+
142+
143+
### Install FastLED library.
144+
145+
1. Click here to download the [FastLED library ](https://github.com/FastLED/FastLED) from the offical github repository in .zip format.
146+
2. Open the Arduino IDE. Move to the *Sketch > Include Library > Add .ZIP library*.
147+
3. Enter the destination of the downloaded fastLED zip folder.
148+
4. Arduino wil add the library in the sketch.
149+
150+
89151
90152
## Working
91153
This section shows the workflow of the project.

0 commit comments

Comments
 (0)