IOT Notes
IOT Notes
Part 1: What
1. What is cloud hosting?
2. What is Raspberry Pi?
3. What is ESP32?
4. What is wifi?
5. What is Modbus?
6. What is HTTP?
7. What is MQTT?
8. What is WebSocket?
Part 2: Software
1. Install Arduino IDE 2.1.0
2.3. Tekan OK
2.4. Buka Boards Manager
2.5. Cari esp32 dan install esp32 by Espressif Systems
2.6. Pilih Tools >> Board >> esp32 >> ESP32 Dev Module
Part 3: ESP32
Response
Slave address 1 byte
Function code 1 byte 0x03
Byte count 1 bytes 2xN
Coils status 2 x N bytes
Frame checking 2 bytes
N=quantity of register
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.php index.html index.htm;
server_name _;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
}
Ctrl+x > y > Enter
allow_anonymous false
password_file /etc/mosquitto/passwd
listener 1883
Ctrl+x > y > Enter
[{"id":"305bea2cacc8acae","type":"function","z":"f220633f093e40be","name":"","func":
"var url = \"http://shahrulnizam.com/iot/umt-data.php\";\nmsg.url = url + \"?mode=\" +
JSON.stringify(msg.payload);\nreturn msg;\
n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":380,"y":880,"wires":
[["5338dcc22ef52ee6"]]},{"id":"5338dcc22ef52ee6","type":"http
request","z":"f220633f093e40be","name":"","method":"GET","ret":"txt","paytoqs":false,
"url":"","persist":false,"insecureHTTPParser":false,"authType":"","senderr":false,"header
s":[],"x":550,"y":880,"wires":[["aced39179dd4a616"]]},
{"id":"aced39179dd4a616","type":"websocket
out","z":"f220633f093e40be","name":"","server":"bad8dd43d21cb19e","client":"","x":7
20,"y":880,"wires":[]},{"id":"2a518a804b7675f9","type":"websocket
in","z":"f220633f093e40be","name":"","server":"bad8dd43d21cb19e","client":"","x":22
0,"y":940,"wires":[["fee6e9871d2e9c1c"]]},{"id":"f82bf448387f6307","type":"mqtt
in","z":"f220633f093e40be","name":"umt/in","topic":"umt/in","qos":"2","datatype":"au
to-
detect","broker":"fc9b69ada63eebbb","nl":false,"rap":true,"rh":0,"inputs":0,"x":230,"y":
880,"wires":[["305bea2cacc8acae"]]},{"id":"708428613be30f1a","type":"mqtt
out","z":"f220633f093e40be","name":"umt/id","topic":"","qos":"2","retain":"","respTopi
c":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"fc9b69ada63eebb
b","x":710,"y":940,"wires":[]},
{"id":"fee6e9871d2e9c1c","type":"function","z":"f220633f093e40be","name":"","func":"
if (msg.payload != \"\") {\n var p = JSON.parse(msg.payload);\n msg.topic = 'umt/' +
p.id;\n return msg;\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":
[],"x":460,"y":940,"wires":[["708428613be30f1a"]]},
{"id":"bad8dd43d21cb19e","type":"websocket-listener","path":"/
umt","wholemsg":"false"},{"id":"fc9b69ada63eebbb","type":"mqtt-
broker","name":"","broker":"localhost","port":"1883","clientid":"","autoConnect":true,"
usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","
birthQos":"0","birthPayload":"","birthMsg":
{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":
{},"willTopic":"","willQos":"0","willPayload":"","willMsg":
{},"userProps":"","sessionExpiry":""}]