Displaying data from RHF1S001 in node-red


rhf1s001The RisingHF’s Temperature and humidity LoRaWAN sensor node RHF1S001 is aimed at outdoor application with it’s IP64 protection level. And thanks to it’s high performance internal antenna and LoRa technology used, the sensor could operate in extremely hard environment or ultra-long range application. In addition to all above, the ultra-low sleep current help it to work in a long life, 5 years (uplink every 2 minutes) or even 10 (uplink every 5 minutes) years.

Here is sample code to displaying data to dashboard node-red, Raw data taken from MQTT convert to JSON Object.

Screenshot from 2018-07-03 07-53-19

[{"id":"4e63f2ca.376b64","type":"mqtt in","z":"b6605d08.a927b","name":"","topic":"thrf/#","qos":"2","broker":"ce3645f8.a18d78","x":70,"y":2920,"wires":[["9c30a7cc.16ac38"]]},{"id":"a4fb0e04.52f6b","type":"function","z":"b6605d08.a927b","name":"decode temp","func":"var obj = msg.payload;\nvar data = obj.data;\n\nvar temp1 = data.toString().substr(2, 2);\nvar temp2 = data.toString().substr(4, 2);\nvar temp = temp2 + temp1;\n// var tmp = \"0x\" + temp; \n\nfunction hexToDec(hex) {\n return hex.toLowerCase().split('').reduce( (result, ch) =>\n result * 16 + '0123456789abcdefgh'.indexOf(ch), 0);\n}\n\nvar value = hexToDec(temp);\n\nvar t = ((175 * value)/65536) - 46.85;\n\nmsg.payload = t.toFixed(2);\n// return msg;\n// msg.payload = obj.data;\nreturn msg;","outputs":1,"noerr":0,"x":430,"y":2980,"wires":[["db7f0faf.eec008"]]},{"id":"de0b9d41.21bd3","type":"function","z":"b6605d08.a927b","name":"data","func":"var obj = msg.payload;\nmsg.payload = obj.data;\nreturn msg;","outputs":1,"noerr":0,"x":410,"y":2920,"wires":[["88553271.5b5678"]]},{"id":"88553271.5b5678","type":"debug","z":"b6605d08.a927b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":590,"y":2920,"wires":[]},{"id":"9c30a7cc.16ac38","type":"json","z":"b6605d08.a927b","name":"","property":"payload","action":"obj","pretty":true,"x":210,"y":2920,"wires":[["de0b9d41.21bd3","a4fb0e04.52f6b","3ef4e4a1.49fcac","cbbcecc.d9fbc9"]]},{"id":"3ef4e4a1.49fcac","type":"function","z":"b6605d08.a927b","name":"decode hum","func":"var obj = msg.payload;\nvar data = obj.data;\n\n\nvar humidity = data.toString().substr(6, 2);\n// var hum = \"0x\" + humidity; \n\nfunction hexToDec(hex) {\n return hex.toLowerCase().split('').reduce( (result, ch) =>\n result * 16 + '0123456789abcdefgh'.indexOf(ch), 0);\n}\n\nvar value = hexToDec(humidity);\n\n\nvar RH = (((125 * value)/256) -6);\n\nmsg.payload = RH.toFixed(2);\n\n// return msg;\n// msg.payload = obj.data;\nreturn msg;","outputs":1,"noerr":0,"x":430,"y":3040,"wires":[["3dd9c892.32f9b8"]]},{"id":"cbbcecc.d9fbc9","type":"function","z":"b6605d08.a927b","name":"decode batt","func":"var obj = msg.payload;\nvar data = obj.data;\nvar batt = data.toString().substr(16, 2);\n\nfunction hexToDec(hex) {\n return hex.toLowerCase().split('').reduce( (result, ch) =>\n result * 16 + '0123456789abcdefgh'.indexOf(ch), 0);\n}\n\n\n\nmsg.payload = (hexToDec(batt) + 150) * 0.01;\n\n// msg.payload = RH.toFixed(2);\n\n// return msg;\n// msg.payload = obj.data;\nreturn msg;","outputs":1,"noerr":0,"x":430,"y":3100,"wires":[["c70731a.a7ba85"]]},{"id":"3dd9c892.32f9b8","type":"ui_chart","z":"b6605d08.a927b","name":"","group":"44b692c4.bec04c","order":0,"width":0,"height":0,"label":"hum rhf","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":640,"y":3040,"wires":[[],[]]},{"id":"c70731a.a7ba85","type":"ui_chart","z":"b6605d08.a927b","name":"","group":"44b692c4.bec04c","order":0,"width":0,"height":0,"label":"batt rhf","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":640,"y":3100,"wires":[[],[]]},{"id":"db7f0faf.eec008","type":"ui_chart","z":"b6605d08.a927b","name":"","group":"44b692c4.bec04c","order":0,"width":0,"height":0,"label":"temperture rhf","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":660,"y":2980,"wires":[[],[]]},{"id":"ce3645f8.a18d78","type":"mqtt-broker","z":"","name":"loralocal","broker":"00.00.00.00","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"44b692c4.bec04c","type":"ui_group","z":"","name":"RHF","tab":"b031aecd.a463f","order":1,"disp":true,"width":"6","collapse":false},{"id":"b031aecd.a463f","type":"ui_tab","z":"","name":"GATEWAY","icon":"desktop_mac","order":2}]

Datasheet sensor

http://www.risinghf.com/#/product-details?product_id=1&lang=en

Advertisements

lora mini dev and ttn


lora_mini_devKali ini nyobain lora module buatan dragino namanya lora mini dev, uniknya dari module ini adalah sudah jadi satu antara RF dan mikro kontrollernya, untuk programmingnya sendiri cukup mudah karena sudah ada usb nya jadi tinggal colok aja mikro usb bawaannya terus bisa diprogram menggunakan arduino ide.

Reviewnya menyusul ya ini tadi baru  test OTAA ke thethingsnetwork si lancar jaya cuman awalnya sempat bingung untuk pin mapping lmicnya, soalnya nyari nyari didokumentasinya ngga nemu.

Beruntung banget pas lagi browsing nemu, nah dibawah ini adalah pinout mappingnya karena kalau pinout ini salah dijamin lora mini dev ini ngga akan bekerja di lmic

 const lmic_pinmap lmic_pins = {
 .nss = 10,
 .rxtx = LMIC_UNUSED_PIN,
 .rst = 9,
 .dio = {2, 6, 7},
};

Silahkan yang pingin nyoba nyoba ini modul bisa pake lmic standard tinggal nanti menyesuaikan lmicnya seperti diatas.

kalau mau liat2 codingannya ke github saya disini tinggal ganti lmicnya seperti diatas

Happy Coding ..

Salam ngoprek …

Moisture Sensor and nodemcu v.1


Terlampir project yang sedang saya kerjakan dengan menggunakan nodemcu, kali ini project saya adalah menghubungkan moisture sensor yang biasa digunakan untuk mengukur kelembapan tanah dihubungkan dengan nodemcu v.1 idenya sih mau buat penyiram bunga otomatis.

 

Diatas adalah contoh pembacaan dari serial monitor dan web server dari node mcu, ternyata asyik juga main dengan nodemcu ini, apalagi sudah support arduino IDE jadi kita bisa pakai library2 dari arduino juga.

Kalau ingin mencoba silahkan sedot kode dibawah

https://github.com/susiloharjo/Moisturesensor-with-esp8266

Semoga bermanfaat, dan Happy coding

Membaca output serial com port arduino via ttyUSB lewat web


Pertama tama pastikan code arduino sudah benar dan Wiring sensor (saya menggunakan sensor suhu) sudah benar apabila bingung silahkan ikuti cara dibawah ini (saya menggunakan arduino nano v3 clone)

Gambar didapat dari sini

Arduino_Sensor_interface

Arduino sketch + php code download disini sesuaikan portnya saya menggunakan ttyUSB1, dan upload file php nya yang didalam folder arduino ke directory file server anda, kalau saya karena menggunakan lampp saya copy ke /opt/lampp/htdocs

Saya menggunakan ubuntu 14.04 pastikan permission dialout sudah ditambahkan apabila belum berikan akses ke ttyUSB1

sudo usermod -a -G dialout www-data

sudo usermod -a -G dialout useranda

dan apabila masih error juga berikan full Access ke ttyUSB1

chmod 777 /dev/ttyUSB1 –> sesuaikan dengan port anda.

Selection_046

sampai sini sudah selesai tinggal dimodifikas untuk tampilan agar menjadi lebih baik dan satu lagi kekurangannya harus selalu direfresh mungkin bisa dikembangkan dengan JSON dan membaca data tersebut agar bisa realtime

Done, Happy Coding, Good Luck

pemasangan sensor ultrasonik di tank


Jadi ceritanya aku dari tanggal 1 february kemaren dah magang di PT. Medco E & P Indonesia lokasi di Sangasanga-Kalimantan Timur, hari pertama masuk sudah dapat pengalaman asyik banget, kebetulan pas dengan backgroundku teknik elektro khususnya instrumentasi, jadi pas masuk hari pertama ternyata ada proyek pemasangan sensor ultrasonik merk flowline untuk mengetahui jumlah material didalam tangk (maaf ga bisa nyebutin apa dan dimana karena rahasia 🙂 ), jadi garis besarnya adalah memasang sensor ultrasonic di tank.

sensor yang digunakan adalah merk flowline gambarnya kira2 seperti ini

nah alat seperti ini dipasang diatas tank kira-kira terpasang seperti ini (bukan gambar sebenarya)

Continue reading pemasangan sensor ultrasonik di tank