發表文章

目前顯示的是 10月, 2020的文章

Zigbee2mqtt Node-red google sheet

圖片
  Excel sheet is an old old tradition of engineering. I have my zig2mqtt runs correctly on Pi3B, as well as mqtt and node-red. But the document on how to write data to google sheet seems very unclear to me. I did a search in managing palette and there is 2: With article on the  viseo one: https://www.rodened.com/posts/how-to-read-and-write-data-to-a-google-sheet-in-node-red-1/ I tried the  node-red-contrib-viseo-google-spreadsheet after correctly set up credential, share the google sheet, I was able to access the google sheet, for get cell..etc. But when I try to append a row I could not figure out what is the data format to feed in the node. I gave up after a night of testing. then I found this blog: https://grassrootengineer.medium.com/apply-node-red-to-google-sheet-e0c7db9ada8  This lead me to this node: node-red-contrib-google-sheets still no much documentation, but I have better luck on this. This node will log the payload into the cell. and I figure out how to append a row. [[&qu

Booting pi 4 from USB with SSD on Jmicron SATA USB adapter

圖片
I have a Pi4 4GB version, it boots ok with sd card. I followed the instruction here:  https://www.tomshardware.com/how-to/boot-raspberry-pi-4-usb it works with my TDK 32GB usb drive, but it does not work with my SATA to USB3 adapter. Mine looks like the one in this video then in this discussion: https://www.raspberrypi.org/forums/viewtopic.php?t=286835 it talks about the adapter of JMicron, and what to do to make it works. https://www.raspberrypi.org/forums/viewtopic.php?t=286835#p1734395 after all the update of eeprom, and setup the pi config, plug in your ssd, use lsusb to find the ID of your adapter. the number may vary, mine is 152d:0578 pi@raspberrypi:~ $ lsusb Bus 002 Device 002: ID 152d:0579 JMicron Technology Corp. / JMicron USA Technology Corp. Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 003: ID 1411:1819 Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub then do the sd copier stu

cubecell and IIC sensors powered by Vext issue

  http://community.heltec.cn/t/cubecell-vext-with-i2c-sensors/886/2 Testing on IIC sensor such as BME280/BMP280 and DH1750, and controlled by Vext, it seems there is a problem on IIC bus when power back the Vext. The dirty solution is to add     Wire.begin(); and Wire.end(); so my structure is like this:(power related in red, IIC in green, sensors in blue)   pinMode(Vext, OUTPUT);   digitalWrite(Vext, LOW);   delay(200);  Wire.begin();   if (!bme280.init()) {     Serial.println("bme280 error!");   }   delay(100);   temperature = bme280.getTemperature();   pressure =  bme280.getPressure() / 100;   humidity = bme280.getHumidity();   if(lightMeter.begin()) {   Serial.println(F("BH1750 inited"));   } delay(100);// critical to get reading, but the first reading is always 0   float lux = lightMeter.readLightLevel(true);     Serial.print("Light: ");   Serial.print(lux);   Serial.println(" lx");   Wire.end();     digitalWrite(Vext, HIGH);// turn off the

zigbee2Mqtt part 1 with CC2530 and FTDI

圖片
from here: https://github.com/koenkk/zigbee2mqtt https://www.zigbee2mqtt.io/information/supported_devices.html Zigbee2mqtt supports several CC2530 and CC2531 devices. Both can be used as a router or coordinator. A discussion of these devices can be found  here . For more information about a coordinator and routers can be found  here . Z-Stack coordinator firmwares This repository contains various Z-Stack coordinator firmwares. Overiew Z-Stack Device Zigbee Direct children Routes Notes Z-Stack_Home_1.2 (default) CC2531 1.2 HA 20 30/0 CC2530, CC2530 + CC2591, CC2530 + CC2592 1.2 HA 16 30/0 Z-Stack_Home_1.2 (source_routing) CC2531, CC2530, CC2530 + CC2591, CC2530 + CC2592 1.2 HA 5 40/40 Z-Stack_3.0.x CC2531 3.0 15 40/0 -  Discussion #1445 - Max 40 Zigbee 3.0 devices CC2530, CC2530 + CC2591, CC2530 + CC2592 3.0 10 40/0 -  Discussion #1445 - Max 40 Zigbee 3.0 devices Z-Stack_3.x.0 CC26X2R1, CC1352P_2 3.0 50 100/200 -  Discussion #1429 - Max 200 Zigbee 3.0 devices an

LoraWAN TTN node device Part2: with MCCI LoRaWAN LMIC library on TTGO ESP32 Lora

圖片
 For LMiC based lib, the most recommended is MCCI LoraWan https://github.com/mcci-catena/arduino-lmic since it's an active project, frequently maintained, well documented. even with a doc on how to add region , but I don't have enough knowledge to understand the code. functions tested with loraWan 1.02/1.03, support OTAA. Adafruit has an article on this lib with their feather board. https://learn.adafruit.com/the-things-network-for-feather/overview Before starting coding, you  have to go to your TTN console and register a device in your existing application,  the Device ID is some thing for your memo, nothing related to the network.  For the device EUI, since we don't have one on chip, you can ckick on the symbol, this EUI will be generated by TTN.  once every thing is ready, the register tap will become green, now register it. then you will have your device EUI, applicaiton EUI and app key, you will need these in your code. Some library will make these parameters configur

TTN data integration

圖片
TTN has several integrations, almost every thing you need. I tried the unidots, which is very simple to use, get an account of it, and put in your ttn application key, then you can start with nice dash board. https://help.ubidots.com/en/articles/2362758-integrate-your-ttn-data-with-ubidots-simple-setup I used a Cubecell board, with BME280 to measure temp/humidity/pressure, send data every 10mins. I used a 18650 li ion to power it. started 10/13, after a week, it only drop 0.01 v. it seems promising, Let's see how long it can last...  

LoraWan TTN device libraries, which one to use?

For the device side, if you search on arduino library manager, you will found a lot of libs with very similar names, arduino LMIC, LMIC arduino, lorawan LMIC...etc. if you look on git, there are plenty more...very confusing... I found this good discussion on TTN forum, it gives a clear view of available ones, and their stories, differences.(2020/10/14)   https://www.thethingsnetwork.org/forum/t/overview-of-lorawan-libraries-howto/24692 Currently there are 2 major parents of this kind of libraries: 1. LMiC from IBM   ‘LoRa MAC in C’   , which is a very old one. 2. Semtech LoRaMac-node  the complication:  1. LMIC has been ported to different frameworks. 2. on arduino, the lib mustly work with most MCU supported by arduino. But soem are adapted to specified MCU platform and sometimes different Mac chip. 3. Some of this lib is no longer supported, so you need to find the most updated. 4. Lora spec is upgrading, (slowly getting bigger). So not updated lib will not have the latest feature. F

LoraWan TTN deice part1: Heltec cube cell for AS2 frequency plan with OTAA

圖片
 Heltec has an arduino lib for their cube cell, which works, but the location of library is quite different from other lib. it will goes with board definition. And their also put some lora definition in the menu of arduino, such as region, mode,Class...etc  https://github.com/HelTecAutomation/ASR650x-Arduino/issues/81 I firstly install  https://github.com/HelTecAutomation/ASR650x-Arduino   with board manager, version 1.1, sensor, Lora, lorawan work fine, I can use it in my AS2 frequency plan.  on the day of writting this blog, heltec do note on the git that there is a AS2 frequency plan support. But it would be available form arduino board manager until their next release. But there is a  way to install it through git, which should work.  https://github.com/HelTecAutomation/ASR650x-Arduino/issues/145 To install via git in windows, they do provide good step by step tutorial.(I first uninstall cubecell from board manager)   https://github.com/HelTecAutomation/ASR650x-Arduino/blob/master/

LoraWan gateway part1 with RAK831 and RPi 3 for AS1/AS2

圖片
 I have purchased rak831 from the company few years ago, it was a whole set including Pi3 and a premade SD card. But it did not work at all. Not enough documentation nor reply from the company, I just put it aside and work on 1ch gateway... As documentations of TTN is getting better, in terms of HW and frequency plan support, I decided to give it a try...again... I followed these 2 links, which are very similar.. https://www.hackster.io/naresh-krish/getting-started-with-the-rak831-lora-gateway-and-rpi3-e3351d https://learn.pi-supply.com/make/getting-started-with-the-rak831-lora-gateway-and-raspberry-pi/ 1st. make a fresh sd card connect to wifi, and do the update and up grade of apt-get, install git.. 2nd enable the SPI and the serial shell... 3rd install the forwarder from ttn git clone https://github.com/ttn-zh/ic880a-gateway.git cd ~/ic880a-gateway sudo ./install.sh During the installation, your will see a 8bytes stuff, it's your gateway EUI which you need to use it when regis