STM32 (Bluepill) with i2c bme280


Sample code stm32duino upload via stlink

#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>

Adafruit_BME280 bme;

void setup() 
{
    Serial.begin(115200);
    bme.begin(0x76); //i2c address must declare,or try i2c scanner first
}
void loop() 
{
    Serial.print("Temperat: ");   
    Serial.println(bme.readTemperature(),1);
    Serial.print("Humidity: ");
    Serial.println(bme.readHumidity(),1);
    Serial.print("Pressure: ");     
    Serial.println((bme.readPressure()/100),1);              
    delay(1000);
}

Sponsored Post Learn from the experts: Create a successful blog with our brand new courseThe WordPress.com Blog

WordPress.com is excited to announce our newest offering: a course just for beginning bloggers where you’ll learn everything you need to know about blogging from the most trusted experts in the industry. We have helped millions of blogs get up and running, we know what works, and we want you to to know everything we know. This course provides all the fundamental skills and inspiration you need to get your blog started, an interactive community forum, and content updated annually.

Rumus menghitung panjang antenna LoRa 923 Mhz untuk monopole antenna


Detailnya silahkan lihat video diatas

Dan untuk diindonesia karena menggunakan Freq 920-923 kira kira panjang antena yang digunakan adalah sekitar 7,79 – 7,81 cm

Happy Coding

Salam Ngoprek

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

Internet speed monitoring using grafana and telegraf in docker


Clone project here https://github.com/susiloharjo/internet-speedtest-docker-grafana-telegraf

Edited for running on raspberry pi

Happy codding

Salam ngoprek

Multiple output function in node-red


This is sample flow for multiple output in one function in node-red

[{"id":"5f08a336.d9c24c","type":"function","z":"2aaa7997.d6ad76","name":"","func":"raw = msg.payload.object;\n\nvar msg1 = { payload:raw.analogInput[1]};\nvar msg2 = { payload:raw.analogInput[2]};\nvar msg3 = { payload:raw.analogOutput[3]};\nvar msg4 = { payload:raw.temperatureSensor[3]};\nvar msg5 = { payload:raw.humiditySensor[4]};\nvar msg6 = { payload:raw.barometer[5]};\n\n\nreturn [ msg1, msg2, msg3, msg4, msg5, msg6 ];\n\n// msg.payload ={\n//     battery : raw[1],\n//     solar:raw[2]\n// }\n// return msg;","outputs":6,"noerr":0,"initialize":"","finalize":"","x":520,"y":660,"wires":[["719a5264.f5757c"],["1d8c7f1.9f75281"],["e4b2ebe4.6b0728"],["418e174c.6f7258"],["46ea126c.0ec36c"],["703fee7.477581"]]}]

Arduino zero serial print not show


I bought The SAMD21 Mini is a Pro Mini-sized for the ATSAMD21G18 from bangood this is arduino zero clone platform and the form factor is really small and i think this is great replacement for arduino mini pro, this is the spec

  • ATSAMD21G18 32-bit/48MHz ARM Cortex-M0+
  • 256KB Flash Memory
  • 32KB SRAM32KB of EEPROM (emulated in Flash)
  • 22 GPIO Count 
  • 14 ADC Channels at 12-bit ResolutionAnalog-to-Digital and Digital-to-Analog Converters (ADC & DAC) 
  • RAW: 3.5V-6.0VVCC: 600mA  3.3V 
  • Pro Mini/Micro Layout
  • Integrated USB Controller

And today i connected this modul to Bosch sensor BME 680 modul using i2c connection, for the first time this board not print any Serial println, after browsing at internet i found the serial print must be activated by adding some command below

#define Serial SerialUSB

And this the complete code if you want to try it

Continue reading “Arduino zero serial print not show”

install pihole at docker swarm with nfs share


I’m using portainer

This is my stack

version: "3.7"
services:
  pihole:
    image: pihole/pihole:latest
    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "67:67/udp"
      - "80:80/tcp"
      - "443:443/tcp"
    environment:
      TZ: 'Asia/Jakarta'
      WEBPASSWORD: 'password'
    volumes:
      - 'pihole.vol:/etc/pihole/'
      - 'pihole.dns:/etc/dnsmasq.d/'

volumes:
  pihole.vol:
    driver: local
    driver_opts:
      type: "nfs"
      o: addr=192.168.0.13,nolock,soft,rw
      device: ":/media/fdisk/container/pihole2/pihole"
      
  pihole.dns:
    driver: local
    driver_opts:
      type: "nfs"
      o: addr=192.168.0.13,nolock,soft,rw
      device: ":/media/fdisk/container/pihole2/dnsmasq.d"

Don’t forget to mkdir pihole and dnsmasq.d in share directory

Install node-red in docker swarm with share data in nfs


I’m using portainer

Please read my note before this for setting nfs

This is my docker stack ‘

version: "3.7"

services:
  node-red:
    image: nodered/node-red:latest
    environment:
      - TZ=Asia/Jakarta
    ports:
      - "1880:1880"
    networks:
      - node-red-net
    volumes:
      - nodered.vol:/data
    user: root:root

volumes:
  nodered.vol:
    driver: local
    driver_opts:
      type: "nfs"
      o: addr=192.168.0.13,nolock,soft,rw
      device: ":/media/fdisk/nodered/"

networks:
  node-red-net:

If you have permission problem when you running your stack in nfs share maybe you can add user:root:root in your stack it works for me

Happy Coding

Salam Ngoprek

Share nfs volume docker swarm


//Docker stack

version: "3.7"
services:
  web:
    image: nginx
    volumes:
      - nginx.vol:/usr/share/nginx/html
    ports:
      - 80:80
    networks:
      - web

networks:
  web:
    driver: overlay
    name: web

volumes:
  nginx.vol:
    driver: local
    driver_opts:
      type: "nfs"
      o: addr=192.168.0.13,nolock,soft,rw
      device: ":/media/fdisk"


// nfs setting /etc/exports

/media/fdisk *(rw,insecure,sync,no_subtree_check,no_root_squash)


I had problem with nfs share if i use vfat partition, and i change to ext4 for partition usb fdisk and now all volumen working properly (dont forget to change media share to 777 if you have problem to read and write)

Source :

https://pimylifeup.com/raspberry-pi-nfs/

https://sysadmins.co.za/docker-swarm-persistent-storage-with-nfs/

https://linuxize.com/post/how-to-mount-an-nfs-share-in-linux/

https://serverfault.com/questions/212178/chown-on-a-mounted-nfs-partition-gives-operation-not-permitted