5$ DIY radiation shield


I made some fun project for weather monitoring for measuring temperature, humidity, pressure using BME 680, lora modul and my first sensor like this

And after a couple days i realize the sensor measuring temperature is too high maybe because sensor measuring inside the box, after googling and looking other solution and my idea is making radiation shield and i end up with DIY radiation shield using some cheap plastic plates.

I bought 2$ for 8 plastic plates but i only use 6 because my sensor is small, and i also buy some spacer for mounting the plates its 2$ for 20 spacer i’m using 1 inches spacer, and 1$ for other material like cable ties and also spray paint

And this is it my cheap radiation shield 🙂 and i’m happy for the result

Happy Coding

Salam ngoprek

Simple ABP for STM32L0 Discovery kit LoRa running on Arduino IDE


This is some sketch for B-L072Z-LRWAN1 a.k.a STM32L0 Discovery kit LoRa, Sigfox, low-power wireless from ST, This Discovery kit features the all-in-one CMWX1ZZABZ-091 open module by Murata.

This is some sample arduoino sketch you can open my github here

Happy Coding

Salam ngoprek

(Solved) LoPy not detected in visual windows studio code


Iseng iseng install windows di virtual box untuk install modul modul sensor yang jalan dengan aplikasi windows dan ternyata berhasil dengan baik, nah kebetulan pagi ini nyoba njalanin LoPy di virtual eh ternyata ngga mau kebaca di visual studio code.

Setelah browsing browsing begini caranya pastikan com port sudah terbaca kalau di saya COM4, saya menggunakan aplikasi bawaan LoPy yaitu pymakr yang mana aplikasi ini bentuknya ektension di visual studio code, kemudian masuk ke global setting di PyMakr dan non aktifkan “auto_connect” dengan cara memberikan perintah false yang sebelumnya true, kemudian simpan dan LoPy sudah bisa terbaca.

Demikian catatan dari saya.

Happy Coding …

Salam Ngoprek …

Screenshot from 2019-05-23 07-47-02

Parsing data from mqtt ttn


Postingan kali ini adalah lanjutan dari postingan saya sebelumnya disini , nah pada postingan saya kali ini akan membahas bagaimana cara memparsing data json yang kita dapat dari ttn kemudian menampilkannya ke dalam dashboard, sehingga hasilnya seperti dibawah ini

[{"id":"1f1f6ed1.81cf91","type":"mqtt in","z":"7609c47a.c51b3c","name":"","topic":"+/devices/+/up","qos":"2","broker":"7833904b.af11d","x":220,"y":200,"wires":[["d839d790.4b77c8"]]},{"id":"d839d790.4b77c8","type":"json","z":"7609c47a.c51b3c","name":"","property":"payload","action":"obj","pretty":true,"x":470,"y":200,"wires":[["e2efc94c.1de158","47698174.a787f","9db17467.71c868","b38807c2.074058","6cc7cd06.b7c634"]]},{"id":"e2efc94c.1de158","type":"function","z":"7609c47a.c51b3c","name":"battery","func":"var obj = msg.payload;\nmsg.payload = obj.payload_fields.analog_in_3;\nreturn msg;","outputs":1,"noerr":0,"x":720,"y":180,"wires":[["9ea82fec.53c49"]]},{"id":"47698174.a787f","type":"function","z":"7609c47a.c51b3c","name":"temperature","func":"var obj = msg.payload;\nmsg.payload = obj.payload_fields.temperature_1;\nreturn msg;","outputs":1,"noerr":0,"x":710,"y":240,"wires":[["491b941b.7cb80c"]]},{"id":"9db17467.71c868","type":"function","z":"7609c47a.c51b3c","name":"humidity","func":"var obj = msg.payload;\nmsg.payload = obj.payload_fields.relative_humidity_2;\nreturn msg;","outputs":1,"noerr":0,"x":700,"y":300,"wires":[["754ca03c.46161"]]},{"id":"491b941b.7cb80c","type":"ui_chart","z":"7609c47a.c51b3c","name":"","group":"7fb7eee3.fc934","order":1,"width":0,"height":0,"label":"Temperature","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":930,"y":240,"wires":[[],[]]},{"id":"9ea82fec.53c49","type":"ui_gauge","z":"7609c47a.c51b3c","name":"","group":"d98f26c6.56b8b8","order":1,"width":0,"height":0,"gtype":"gage","title":"Battery","label":"units","format":"{{value}}","min":0,"max":10,"colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":920,"y":180,"wires":[]},{"id":"754ca03c.46161","type":"ui_chart","z":"7609c47a.c51b3c","name":"","group":"7fb7eee3.fc934","order":2,"width":0,"height":0,"label":"Humidity","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":920,"y":300,"wires":[[],[]]},{"id":"b38807c2.074058","type":"function","z":"7609c47a.c51b3c","name":"rssi","func":"var obj = msg.payload;\nmsg.payload = obj.metadata.gateways[0].rssi;\nreturn msg;","outputs":1,"noerr":0,"x":690,"y":360,"wires":[["9e68c3c6.729e5"]]},{"id":"9e68c3c6.729e5","type":"ui_chart","z":"7609c47a.c51b3c","name":"","group":"9a2e91ee.5594a","order":2,"width":0,"height":0,"label":"RSSI","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":910,"y":360,"wires":[[],[]]},{"id":"6cc7cd06.b7c634","type":"function","z":"7609c47a.c51b3c","name":"rssi","func":"var obj = msg.payload;\nmsg.payload = obj.metadata.gateways[0].snr;\nreturn msg;","outputs":1,"noerr":0,"x":690,"y":420,"wires":[["c2e09073.55f99"]]},{"id":"c2e09073.55f99","type":"ui_chart","z":"7609c47a.c51b3c","name":"","group":"9a2e91ee.5594a","order":3,"width":0,"height":0,"label":"SNR","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":910,"y":420,"wires":[[],[]]},{"id":"7833904b.af11d","type":"mqtt-broker","z":"","name":"application_name","broker":"asia-se.thethings.network","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"7fb7eee3.fc934","type":"ui_group","z":"","name":"Chart","tab":"5d83a158.d5268","order":2,"disp":true,"width":"6","collapse":false},{"id":"d98f26c6.56b8b8","type":"ui_group","z":"","name":"Gauge","tab":"5d83a158.d5268","order":1,"disp":true,"width":"6","collapse":false},{"id":"9a2e91ee.5594a","type":"ui_group","z":"","name":"Others","tab":"5d83a158.d5268","order":3,"disp":true,"width":"6","collapse":false},{"id":"5d83a158.d5268","type":"ui_tab","z":"","name":"Home","icon":"timeline"}]

TTN payload format for Rising HF RHF1S001


function Decoder(bytes, port) {
var obj = new Object();

//temp
var tempEncoded=(bytes[2]<<8)|(bytes[1]);
var tempDecoded=(tempEncoded*175.72/65536)-46.85;
obj.temp=tempDecoded.toFixed(2);

//humidity
var humEncoded=(bytes[3]);
var humDecoded=(humEncoded*125/256)-6;
obj.hum=humDecoded.toFixed(2);

//period
var periodEncoded=(bytes[5]<<8)|(bytes[4]);
var periodDecoded=(periodEncoded*2);
obj.period=periodDecoded+" sec";

//battery
var batteryEncoded=(bytes[8]);
var batteryDecoded=(batteryEncoded+150)*0.01;
obj.battery=batteryDecoded.toFixed(2);


return obj;
}

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 …

Memasang Password di node-red


node-redAda yang belum tau node-red? yang suka main main dengan raspberry pi atau iot pasti familiar dengan node-red, ya node-red adalah suatu aplikasi dengan banyak fitur yang simple dan sangat gampang digunakan, kali ini saya akan share cara untuk memasang username dan password di node-red karena defaultnya node-red ini tidak memiliki authentifikasi.

Caranya gampang banget tinggal ke home dan akses .node-red dengan cara

cd $HOME/.node-red/

lalu buka setting.js dengan editor kesukaan kalian masing masing, saya sukanya pake nano jadi caranya akses ke nano setting.js tapi sebaiknya sebelum akses ke setting kita siapin passwordnya dulu yang nantinya akan kita ubah didalam setting.js, nah node-red sudah nyiapin password hashnya cara tinggal ketik command dibawah ini lalu masukkan password yang ingin kita hash lalu, copy hasil hashnya dan nanti masukkan ke dalam setting.jsnya. Dibawah ini cara hash passwordnya.

node-red-admin hash-pw

lalu kita bukan setting.js dengan cara

nano setting.js

Lalu cari setingan dibawah ini ubah username dan password dengan hasil hash yang tadi sudah kita buat.

adminAuth: {
    type: "credentials",
    users: [{
        username: "admin",
        password: "$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN.",
        permissions: "*"
    }]
},

Setelah itu kita restart node-red dengan cara

sudo service node-red restart

Selesai setelah itu coba akses node-red dan masukkan username dan password yang sudah kita buat dan node-red pun sudah memiliki autentifikasi sehingga lebih secure

Sekian tutorial kali ni semoga bermanfaat dan Happy Coding …

MQTT Subscribe esp8266


mqtt pub sub esp8266

Nambah catatan aja semoga bermanfaat juga buat yang membutuhkan cara subscribe ke mqtt server dengan esp8266

Pertama tama download dan pasang plugin ini di arduino libraries, lalu sesuaikan coding dibawah dengan alamat server dan topic yang anda gunakan

/*
 MQTT subscriber example

- connects to an MQTT server
 - subscribes to the topic "inTopic"
*/

#include <ESP8266WiFi.h>
#include <PubSubClient.h>

const char *ssid = "ssid"; // cannot be longer than 32 characters!
const char *pass = "pass"; //

// Update these with values suitable for your network.
IPAddress server(xx,xx,xx,xx);

#define BUFFER_SIZE 100

void callback(const MQTT::Publish& pub) {
 Serial.print(pub.topic());
 Serial.print(" => ");
 if (pub.has_stream()) {
 uint8_t buf[BUFFER_SIZE];
 int read;
 while (read = pub.payload_stream()->read(buf, BUFFER_SIZE)) {
 Serial.write(buf, read);
 }
 pub.payload_stream()->stop();
 Serial.println("");
 } else
 Serial.println(pub.payload_string());
}

WiFiClient wclient;
PubSubClient client(wclient, server);

void setup() {
 // Setup console
 Serial.begin(115200);
 delay(10);
 Serial.println();
 Serial.println();
}

void loop() {
 if (WiFi.status() != WL_CONNECTED) {
 Serial.print("Connecting to ");
 Serial.print(ssid);
 Serial.println("...");
 WiFi.begin(ssid, pass);

if (WiFi.waitForConnectResult() != WL_CONNECTED)
 return;
 Serial.println("WiFi connected");
 }

if (WiFi.status() == WL_CONNECTED) {
 if (!client.connected()) {

if (client.connect(MQTT::Connect("arduinoClient")
 .set_auth("username mqtt", "pass mqtt"))) {
 
 client.set_callback(callback);
 client.subscribe("topic");
 }
 }

if (client.connected())
 client.loop();
 }
}

 

Udah gitu aja, semoga bermanfaat

Happy coding !!!

connect to mqtt thethingsnetwork (ttn)


Akhirnya setelah kesana kemari browsing ketemu juga cara mqtt ke ttn kebetulan belakangan ini lagi iseng2 main lora dan gampangnya karena belum punya server sendiri saya pakai thethingsnetwork.org untuk test upload data ke server.

Nah semingguan ini saya penasaran ada ngga ya cara paling mudah untuk konek ke server ttn tanpa harus masuk ke console ttn, nah akhirnya ketemu juga caranya ternyata data kita di ttn bisa dibaca lewat mqtt.

Dengan mosquitto_sub kita bisa mengakses data di ttn, postingan ini sekali lagi bukan buat show off cuman sebagai catatan pribadi saya dan siapa tau bisa berguna buat yang lain juga.

mosquitto_sub -h <server>.thethings.network -t '+/devices/+/up' -u '<nama appid>' -P 'ttn-account-v2.<accesskey>' -v

Ganti beberapa paramater berikut saya bolak balik nyari akhirnya ketemu juga

  • <server> = server yang kita gunakan untuk upload data ke server ttn karena saya pake ttn handler asia sebagai server maka <server> saya ganti dengan asia-se
  • <nama appid> = lihat settingan di ttn ganti dengan Application ID
  • <access key> = ganti dengan access keys di bagian bawah applications

kalau berhasil maka di terminal kita akan muncul random text yang isinnya uplink data kita ke ttn atau mau lihat yang lain juga bisa baca baca formatnya disini

Semoga bermanfaat lanjut ngoprek …