I updated the lua code of the Wifi Scanner. It now runs with the sdk 3.0.1.
Posts mit dem Label Electronic werden angezeigt. Alle Posts anzeigen
Posts mit dem Label Electronic werden angezeigt. Alle Posts anzeigen
2021-11-22
2021-10-17
Migrate TTN-Gateway to The Things Stack Community Edition (aka V3)
Labels:
Admin,
DIY,
Electronic,
Internet,
iot,
Linux,
maker,
python,
Raspberry PI,
ttn
I just migrate my TTN-gateway to the new The Things Stack Community Edition (aka V3).
I followed the instructions I found in the thread on GitHub.
- Create a new gateway on the things network (link)
- Change the server url in your
local_conf.jsontoeu1.cloud.thethings.network - Restart the gateway
Unfortunately the new stack does not provide a NOC api - so my script to output the gateway status to a OLED stop working. I will invest into this next.
2020-01-03
TTN-Gateway in a box
During the last days I worked on the installation of my TTN-Gateway into a case. This is the result:
Beside the LoraWAN hardware I have installed an OLED display and 3 sensors (1x Si7021, 2x DS18B20). The OLED display is connected via I2C, the sensors via 1-wire and I2C.
The sensor data is read by Python3 Script and published with MQTT. The OLED is also controlled by a Python3 script. Both scripts run as systemd-service.
The software is available on github.
Beside the LoraWAN hardware I have installed an OLED display and 3 sensors (1x Si7021, 2x DS18B20). The OLED display is connected via I2C, the sensors via 1-wire and I2C.
The sensor data is read by Python3 Script and published with MQTT. The OLED is also controlled by a Python3 script. Both scripts run as systemd-service.
The software is available on github.
2019-12-29
Raspi + RAK831 + converter board - make standard i2c bus available
Labels:
DIY,
Electronic,
iot,
maker,
Raspberry PI,
ttn
The RAK831 converter board connects the standard i2c pins of the Raspi with the RAK831 board (RASPI.PIN3 -> RAK.PIN7, RASPI.PIN5 -> RAK.PIN9) (see picture). The RAK831 documentation states the line(s ?) are used to enable the RFSW1012 (see page 15) but does not uses it as i2c bus. The consequence is that the standard i2c bus cannot be used.
On the other hand when looking how to connect the RAK831 direct with a Raspi (e.g. here) the RAK pins 7 and 9 are not used.
This means the i2c bus can be revitalize by removing the 0R bridges R11 and R6 on the converter board.
This means the i2c bus can be revitalize by removing the 0R bridges R11 and R6 on the converter board.
2019-12-03
Setting up a Zigbee2mqtt gateway
Labels:
DIY,
Electronic,
Home,
iot,
Linux,
maker,
mqtt,
Raspberry PI,
zigbee
Here are the steps I performed to setup a Zigbee2mqtt gateway using a CC2530+CC2591 board and a RaspberryPI 3.
My steps were
- My RaspberryPI 3 is running
pi@racknode:~ $ uname -a Linux racknode 4.19.42-v7+ #1219 SMP Tue May 14 21:20:58 BST 2019 armv7l GNU/Linux pi@racknode:~ $ hostnamectl Static hostname: racknode Icon name: computer Machine ID: confidential Boot ID: confidential Operating System: Raspbian GNU/Linux 9 (stretch) Kernel: Linux 4.19.42-v7+ Architecture: arm -
My Zigbee board:
- Flash the Z-Stack coordinator firmware on the Zigbee board
- Install zigbee2mqtt to run on the Raspberry Pi
- Setup a daemon to run zigbee2mqtt
Flash the Z-Stack coordinator firmware on the Zigbee board
- Connect the Zigbee board with the Raspberry (Note: this is the connection schema for flashing the firmware, while normal operation another connection schema is used.)
*) P12 - 12pin connector, P14 - 14 pin connectorName Raspi CC2530+CC2591* 3,3V/VCC Pin01 P12 Pin02 GND Pin39 P12 Pin01 RESET Pin35 P12 Pin03 DC Pin36 P14 Pin04 DD Pin38 P14 Pin05
- Install the wiringPI library
sudo apt-get install wiringpi
- Install git
pi@racknode:~ $ sudo apt-get install git
- Clone the flasher repo
git clone https://github.com/jmichault/flash_cc2531.git
- Test the connection
pi@racknode:~/flash_cc2531 $ ./cc_chipid ID = a524.
- Get the firmware - as mentioned above I need the CC2530+CC2591 version. See
https://github.com/Koenkk/Z-Stack-firmware/tree/master/coordinator/Z-Stack_Home_1.2/bin/defaultfor the correct version.pi@racknode:~/flash_cc2531 $ wget https://github.com/Koenkk/Z-Stack-firmware/raw/master/ coordinator/Z-Stack_Home_1.2/bin/default/CC2530_CC2591_DEFAULT_20190608.zip
- Extract the archive
pi@racknode:~/flash_cc2531 $ unzip CC2530_CC2591_DEFAULT_20190608.zip Archive: CC2530_CC2591_DEFAULT_20190608.zip inflating: CC2530ZNP-Prod.hex inflating: CC2530ZNP-Prod.bin pi@racknode:~/flash_cc2531 $
- Erase the
CC2531CC2530pi@racknode:~/flash_cc2531 $ ./cc_erase ID = a524. erase result = 00a6. pi@racknode:~/flash_cc2531 $
- Write the new firmware (takes about 2-3 minutes)
pi@racknode:~/flash_cc2531 $ ./cc_write CC2530ZNP-Prod.hex ID = a524. reading line 15490. file loaded (15497 lines read). writing page 128/128. verifying page 128/128. flash OK. pi@racknode:~/flash_cc2531 $ cd .. pi@racknode:~ $
Install zigbee2mqtt to run on the Raspberry Pi
Steps based onMy steps were
- Connect the Zigbee board with the Raspberry for operation mode
*) P12 - 12pin connectorName Raspi CC2530+CC2591* 3,3V/VCC Pin01 P12 Pin02 GND Pin39 P12 Pin01 TX (R→Z) Pin08 P12 Pin07 RX (R←Z) Pin10 P12 Pin08
- Enable UART and disable UART use for Bluetooth by adding following lines to
/boot/config.txtpi@racknode:~ $ sudo vi /boot/config.txt enable_uart=1 dtoverlay=pi3-disable-bt
- Disable modem system
sudo systemctl disable hciuart
- Remove the serial console entry from
/boot/cmdline.txt
Beforepi@racknode:~ $ cat /boot/cmdline.txt dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=...Afterpi@racknode:~ $ cat /boot/cmdline.txt dwc_otg.lpm_enable=0 console=tty1 root=...
- Reboot the Raspberry
- Installing the node.js 10.0 repo and install node.js
pi@racknode:~ $ sudo curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
... and install node.jspi@racknode:~ $ sudo apt-get install -y nodejs
- Clone the zigbee2mqtt repo
pi@racknode:~ $ sudo git clone https://github.com/Koenkk/zigbee2mqtt.git /opt/zigbee2mqtt
... and change own topipi@racknode:~ $ sudo chown -R pi:pi /opt/zigbee2mqtt
- Install the dependencies
pi@racknode:~ $ cd /opt/zigbee2mqtt pi@racknode:/opt/zigbee2mqtt $ npm ci
prebuild-install WARN install No prebuilt binaries found (target=10.17.0 runtime=node arch=arm libc= platform=linux) make: Entering directory '/opt/zigbee2mqtt/node_modules/zigbee-herdsman/ node_modules/@serialport/bindings/build' CXX(target) Release/obj.target/bindings/src/serialport.o CXX(target) Release/obj.target/bindings/src/serialport_unix.o CXX(target) Release/obj.target/bindings/src/poller.o CXX(target) Release/obj.target/bindings/src/serialport_linux.o SOLINK_MODULE(target) Release/obj.target/bindings.node COPY Release/bindings.node make: Leaving directory '/opt/zigbee2mqtt/node_modules/zigbee-herdsman/ node_modules/@serialport/bindings/build' > serialport@8.0.1 postinstall /opt/zigbee2mqtt/node_modules/zigbee-herdsman/ node_modules/serialport > node thank-you.js Thank you for using serialport! If you rely on this package, please consider supporting our open collective: > https://opencollective.com/serialport/donate npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/ zigbee-herdsman/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/ fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"}) added 1356 packages from 856 contributors and audited 877179 packages in 220.282s found 3 high severity vulnerabilities run `npm audit fix` to fix them, or `npm audit` for details - Fix the mentioned issues
pi@racknode:/opt/zigbee2mqtt $ npm audit fix npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || ↵ >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but ↵ none is installed. You must install peer dependencies yourself. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/↵ zigbee-herdsman/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: ↵ wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: ↵ wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"}) updated 2 packages in 52.752s fixed 3 of 3 vulnerabilities in 877319 scanned packages pi@racknode:/opt/zigbee2mqtt $ - Enter your configuration in
/opt/zigbee2mqtt/data/configuration.yamlvi data/configuration.yaml
Enter your settings# MQTT settings mqtt: # MQTT base topic for zigbee2mqtt MQTT messages base_topic: zigbee2mqtt # MQTT server URL server: 'mqtt://localhost' # MQTT server authentication, uncomment if required: # user: my_user # password: my_password # CC2590 is connected to serial line serial: port: /dev/ttyAMA0 advanced: baudrate: 115200 rtscts: false
- Start zigbee2mqtt
pi@racknode:/opt/zigbee2mqtt $ npm start > zigbee2mqtt@1.7.1 start /opt/zigbee2mqtt > node index.js Logging to directory: '/opt/zigbee2mqtt/data/log/2019-11-30.16-53-43' Starting zigbee2mqtt version 1.7.1 (commit #b459c35) Starting zigbee-herdsman... zigbee-herdsman started Coordinator firmware version: '{"type":"zStack12","meta":{"transportrev":2,↵ "product":0,"majorrel":2,"minorrel":6,"maintrel":3,"revision":20190608}}' Currently 0 devices are joined: `permit_join` set to `true` in configuration.yaml. Allowing new devices to join. Set `permit_join` to `false` once you joined all devices. Zigbee: allowing new devices to join. Connecting to MQTT server at mqtt://xxx.xxx.xxx Connected to MQTT server MQTT publish: topic 'zigbee/bridge/state', payload 'online' MQTT publish: topic 'zigbee/bridge/config', payload '{"version":"1.7.1",↵ "commit":"b459c35","coordinator":{"type":"zStack12","meta":{"transportrev":2,↵ "product":0,"majorrel":2,"minorrel":6,"maintrel":3,"revision":20190608}},↵ "log_level":"info","permit_join":true}'
Setup a daemon to run zigbee2mqtt
based on zigbee2mqtt - 5. (Optional) Running as a daemon with systemctl- Create a zigbee2mqtt service
sudo vi /etc/systemd/system/zigbee2mqtt.service
enter[Unit] Description=zigbee2mqtt After=network.target [Service] ExecStart=/usr/bin/npm start WorkingDirectory=/opt/zigbee2mqtt StandardOutput=inherit StandardError=inherit Restart=always User=pi [Install] WantedBy=multi-user.target
- Verify that it works
pi@racknode:/opt/zigbee2mqtt $ sudo systemctl start zigbee2mqtt pi@racknode:/opt/zigbee2mqtt $ sudo systemctl status zigbee2mqtt ● zigbee2mqtt.service - zigbee2mqtt Loaded: loaded (/etc/systemd/system/zigbee2mqtt.service; disabled; ↵ vendor preset: enabled)
Active: active (running) since Tue 2019-12-03 08:35:46 CET; 7s ago Main PID: 626 (npm) Tasks: 23 (limit: 4915) CGroup: /system.slice/zigbee2mqtt.service ├─626 npm ├─643 sh -c node index.js └─644 node index.js Dec 03 08:35:46 racknode systemd[1]: Started zigbee2mqtt. Dec 03 08:35:50 racknode npm[626]: > zigbee2mqtt@1.7.1 start /opt/zigbee2mqtt Dec 03 08:35:50 racknode npm[626]: > node index.js Dec 03 08:35:53 racknode npm[626]: [..] Logging to directory: '/opt/zigb Dec 03 08:35:53 racknode npm[626]: [..] Starting zigbee2mqtt version 1.7 Dec 03 08:35:53 racknode npm[626]: [..] Starting zigbee-herdsman...- Configure the autostart of the service
pi@racknode:/opt/zigbee2mqtt $ sudo systemctl enable zigbee2mqtt.service Created symlink /etc/systemd/system/multi-user.target.wants/zigbee2mqtt.service ↵ → /etc/systemd/system/zigbee2mqtt.service.
- Reboot the Raspberry to verify your setup
pi@racknode:/opt/zigbee2mqtt $ sudo reboot Connection to racknode closed by remote host. Connection to racknode closed. $ ssh pi@racknode Linux racknode 4.19.66-v7+ #1253 SMP Thu Aug 15 11:49:46 BST 2019 armv7l The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Tue Dec 3 08:42:26 2019 from 10.0.0.171 pi@racknode:~ $ sudo journalctl -u zigbee2mqtt.service -f -- Logs begin at Thu 2016-11-03 18:16:43 CET. -- [..] Started zigbee2mqtt. [..] > zigbee2mqtt@1.7.1 start /opt/zigbee2mqtt [..] > node index.js [..] Logging to directory: '/opt/zigbee2mqtt/data/log/2019-12-03.08-44-14' [..] Starting zigbee2mqtt version 1.7.1 (commit #b459c35) [..] Starting zigbee-herdsman... [..] zigbee-herdsman started [..] Coordinator firmware version: '{"type":"zStack12","meta":{"transportrev":2,↵ "product":0,"majorrel":2,"minorrel":6,"maintrel":3,"revision":20190608}}' [..] Currently 1 devices are joined: [..] 0x00158d00029acb06 (0x00158d00029acb06): MFKZQ01LM - Xiaomi Mi/Aqara smart ↵ home cube (EndDevice) [..] `permit_join` set to `true` in configuration.yaml. [..] Allowing new devices to join. [..] Set `permit_join` to `false` once you joined all devices. [..] Zigbee: allowing new devices to join. [..] Connecting to MQTT server at mqtt://mqtt.thomo.de [..] Connected to MQTT server [..] MQTT publish: topic 'zigbee/bridge/state', payload 'online' [..] MQTT publish: topic 'zigbee/0x00158d00029acb06', payload '{"battery":31,↵ "voltage":2825,"linkquality":18,"angle":10.55,"side":3}' [..] MQTT publish: topic 'zigbee/bridge/config', payload '{"version":"1.7.1",↵ "commit":"b459c35","coordinator":{"type":"zStack12","meta":{"transportrev":2,↵ "product":0,"majorrel":2,"minorrel":6,"maintrel":3,"revision":20190608}},↵ "log_level":"info","permit_join":true}' ^C pi@racknode:~ $
Links
- https://www.zigbee2mqtt.io/
Update
2020-02-15: Fix error in flash connection table and picture.
2019-10-08
Setup TTN Gateway using Raspi3 with RAK831 and converter board
Labels:
Admin,
DIY,
Electronic,
GPS,
iot,
Linux,
Raspberry PI,
ttn
Finally I was able to put my TTN Gateway into operation.
The first attempt a few month ago failed and therefore the project was on hold until now. An article in make 03/2019 gave me the impetus for a new attempt.
My essential setup steps:
Damn - the same problem as at first try! :-(
An issue thread on github list some possible reasons, among other "the wiring might be wrong". You may also interpret it as "other then expected or as default" and this was the key. On another page about the setup I found the crucial clue: The converter board uses a different reset pin (it use pin 17 instead of 25).
After changing the corresponding setting in
... it worked as expected. And I see the status "connected" on the TTN console (on TTN website).
To enable the GPS module I have to:
The first attempt a few month ago failed and therefore the project was on hold until now. An article in make 03/2019 gave me the impetus for a new attempt.
My essential setup steps:
- Put the parts together.
Caution: Do not power up the RAK831 card without connecting the antenna. - Prepare a SDCard with a Raspberry Image - I use "Raspbian Buster with desktop" (Release date: 2019-09-26, Kernel 4.19)
- Perform a general update
sudo apt-get update && sudo apt-get upgrade
- Enable SPI using
raspi-config - Clone the ttn gateway repo
git clone https://github.com/ttn-zh/ic880a-gateway.git
- Run the setup script
cd ic880a-gateway sudo ./install.sh
- Register the gateway on TTN website
pi@ttn-gateway:~ $ systemctl status ttn-gateway ● ttn-gateway.service - The Things Network Gateway Loaded: loaded (/lib/systemd/system/ttn-gateway.service; enabled; vendor preset: enabled) Active: activating (auto-restart) (Result: exit-code) since Tue 2019-10-08 14:05:42 CEST; 779ms ago Process: 346 ExecStart=/opt/ttn-gateway/bin/start.sh (code=exited, status=1/FAILURE) Main PID: 346 (code=exited, status=1/FAILURE) ttn-gw ttn-gateway[346]: INFO: Statusstream data is enabled ttn-gw ttn-gateway[346]: INFO: Beacon is disabled ttn-gw ttn-gateway[346]: INFO: Monitor is disabled ttn-gw ttn-gateway[346]: INFO: Contact email configured to "my email" ttn-gw ttn-gateway[346]: INFO: Description configured to "ttn-rak831" ttn-gw ttn-gateway[346]: INFO: Successfully contacted server router.eu.thethings.network ttn-gw ttn-gateway[346]: INFO: [main] Starting the concentrator ttn-gw ttn-gateway[346]: ERROR: [main] failed to start the concentrator ttn-gw systemd[1]: ttn-gateway.service: Main process exited, code=exited, status=1/FAILURE ttn-gw systemd[1]: ttn-gateway.service: Failed with result 'exit-code'.
Damn - the same problem as at first try! :-(
An issue thread on github list some possible reasons, among other "the wiring might be wrong". You may also interpret it as "other then expected or as default" and this was the key. On another page about the setup I found the crucial clue: The converter board uses a different reset pin (it use pin 17 instead of 25).
After changing the corresponding setting in
/opt/ttn-gateway/bin/start.sh#! /bin/bash # Reset iC880a PIN # SX1301_RESET_BCM_PIN=25 SX1301_RESET_BCM_PIN=17 echo "$SX1301_RESET_BCM_PIN" > /sys/class/gpio/export echo "out" > /sys/class/gpio/gpio$SX1301_RESET_BCM_PIN/direction
... it worked as expected. And I see the status "connected" on the TTN console (on TTN website).
To enable the GPS module I have to:
- Disable the serial login shell but keep the serial interface enabled - via raspi-config - interface setup.
- add the following lines to /opt/ttn-gateway/bin/local_conf.json
"gps_tty_path": "/dev/ttyS0", "fake_gps": false,
-
Reboot and check if it works (it may take some minutes to fetch the GPS position)
pi@ttn-gateway:/opt/ttn-gateway/bin $ sudo tail -f /var/log/syslog | grep -i gps Oct 8 17:55:36 ...: INFO: GPS serial port path is configured to "/dev/ttyS0" Oct 8 17:57:39 ...: INFO: GPS is enabled Oct 8 17:57:39 ...: INFO: Using real GPS if available. Oct 8 17:57:39 ...: INFO: [main] TTY port /dev/ttyS0 open for GPS synchronization Oct 8 17:57:39 ...: INFO: GPS thread activated. Oct 8 17:57:39 ...: WARNING: [gps] GPS out of sync, keeping previous time reference Oct 8 17:57:39 ...: WARNING: [gps] GPS out of sync, keeping previous time reference Oct 8 17:57:39 ...: WARNING: [gps] GPS out of sync, keeping previous time reference Oct 8 17:57:39 ...: WARNING: [gps] GPS out of sync, keeping previous time reference Oct 8 17:57:39 ...: ### [GPS] ### Oct 8 17:57:39 ...: # Valid gps time reference (age: 0 sec) Oct 8 17:57:39 ...: # System GPS coordinates: latitude 50.94322, longitude 7.37443, altitude 272 m Oct 8 17:57:39 ...: ### [GPS] ### Oct 8 17:57:39 ...: # Valid gps time reference (age: 0 sec) Oct 8 17:57:39 ...: # System GPS coordinates: latitude 50.94322, longitude 7.37443, altitude 274 m
Raspi3
The converter board with GPS support
RAK831 module
On the left side:
top - the TTN antenna
bottom - the GPS module (optional)
Connection of the GPS signal
Update: The wiring of the converter board is available on the RAK website.
2019-07-14
Update: ESP8266 based SensorNode V2
I updated the circuit and pcb design of my Esp based SensorNode.
Further details in the github repository.
Further details in the github repository.
ESP Programmer
I put together an adapter board to attach a CP2104 board to ESP8266 and provide auto programming mode.
For further details see the github repository.
2019-04-29
ESP8266 based SensorNode
Labels:
coding,
Electronic,
esp8266,
Home,
Project
In last weeks I put together a Sensor-Node based on ESP8266. The software part provides:
- the standard WiFiMonitor to setup the WiFi credentials
- a web page to configure the connected sensors
- a web service to read the configuration and current sensor values
- the data are published via MQTT in a format to be feed into a influxdb
- DS18B20 (multiple)
- BME280
- Si7021
![]() | ||||||
| SensorNode configuration page
I designed a board to be put into a USB port with a temperature and a humidity sensor.
|
2017-01-07
Wifi Scanner with ESP8266 + TFT ST7735B (NodeMCU)
Labels:
Electronic,
esp8266,
make,
maker
After successful connect the ESP8266 with the ST7735 display I want to do more than the demo - so here comes a Wifi Scanner.
Same hardware setup as in the previous blog post.
And here is the source code:
Same hardware setup as in the previous blog post.
And here is the source code:
2017-01-02
ESP8266 (NodeMCU) + 1.8 Inch TFT LCD Display Modul 128X160 SPI Serial ST7735B
Labels:
Electronic,
esp8266
Some notes how to connect a "1.8 Inch TFT LCD Display Modul 128X160 SPI Serial ST7735B IC SD Card für Arduino" to a ESP8266 running with NodeMCU.
You need a NodeMCU firmware with (at least) the modules bit and UCG (with st7735 display option).
[Update] Also SPI must be selected! (Thanks to Lorenz)
You need a NodeMCU firmware with (at least) the modules bit and UCG (with st7735 display option).
![]() |
NodeMCU custom build options. |
Pinout/Connection
The display has a 8-pin and 16-pin interface. The TFT interface in both are the same. You can choose either of the two interfaces for wiring.
ESP8266 -- DISP -- ESP8266
OPTION 1 OPTION 2
--------------------------
| ST7735B 1.8 TFT |
| |
GND -- | GND (1) |
3V3 -- | VCC (2) |
| NC (3) |
3V3 -- | BL (4) (1) RST | -- GPIO16 (D0)
| NC (5) (2) CS | -- GPIO15* (D8)
GPIO16 (D0) -- | RST (6) TFT (3) D/C | -- GPIO02 (D4)
GPIO02 (D4) -- | RS (7) TFT (4) DIN | -- GPIO13 (D7)
GPIO13 (D7) -- | SDA (8) TFT (5) CLK | -- GPIO14 (D5)
GPIO14 (D5) -- | SCK (9) TFT (6) VCC | -- 3V3
GPIO15* (D8) -- | CS (10)TFT (7) BL | -- 3V3
| CLK (11)SD (8) GND | -- GND
| MISO (12)SD |
| MOSI (13)SD |
| CS (14)SD |
| NC (16) |
| NC (15) |
--------------------------
*) pull-down 10k to GND
![]() |
| ESP8266 NodeMCU dev board connected to 16pin interface of TFT |
![]() |
| ESP8266 NodeMCU dev board connected to 8pin interface of TFT |
Test
I use the GraphicsTest.lua to test the connection. GraphicsTest is part of the NodeMCU examples (you have to upload also all GT_*.lua files to run the test).2016-12-29
Flash ESP8266-12/12E
Labels:
Electronic,
esp8266,
osx
Steps to flash new firmware:
- (optional) Backup flash
esptool.py --port port-of-esp8266 --baud 115200 read_flash 0x000 4194304 fw_backup.bin
- Erase flash
esptool.py --port port-of-esp8266 --baud 115200 erase_flash
- Write esp init data (see SDK Init Data)
esptool.py --port port-of-esp8266 --baud 115200 write_flash 0x3fc000 esp_init_data_default.bin
- Write firmware
esptool.py --port port-of-esp8266 --baud 115200 write_flash 0x0000 fw.bin
2016-08-04
2016-04-10
ESP-01 + DHT22: Send data to influxdb
Labels:
Electronic,
esp8266,
Home,
make,
maker
My first ESP-01 "system" is running now. It measures temperature and humidity using a DHT22 every 20 seconds and send the data to an influxdb database.
The influxdb is then used by a Grafana instance where I define a panel for the temperature and humidity. Here are the first measurements:
Looks like there where a glitch at about 12:30 - I will have a look how often this happen.
And here is the corresponding ESP code:
The influxdb is then used by a Grafana instance where I define a panel for the temperature and humidity. Here are the first measurements:
Looks like there where a glitch at about 12:30 - I will have a look how often this happen.
And here is the corresponding ESP code:
2016-04-07
First Steps with ESP-01 on OS X El Capitan - Part 2
Labels:
Electronic,
esp8266,
make,
maker,
osx
In part 1 I described how I setup my my environment. In this part I will show my first lua programming steps with the ESP8266 using the Lua based NodeMCU firmware.
First I create an init script (init.lua). This will be loaded by the firmware after each boot/restart.
As last step in the boot/restart process the firmware loads and executes the script init.lua (you can see a corresponding error message in the last screenshot in part 1).
It is recommended to provide an opportunity to interrupt the execution of init.lua to be able to change anything. Otherwise it may happen e.g. if your code contains a fatal error which cause a reboot that you are unable to deactivate/fix the code - and finally have to reflash the firmware to be break the loop.
I'm looking around an found a post about Methods of Interrupting init.lua during boot. My init.lua code based mainly on the ideas described there. But here it is:
Next step was to wrote a script to read out a DHT22 sensor. The user_dht22.lua script shown below reads temperature and humidity every 2 sec and prints both values. Depending on the used firmware the output is generated using different format and in case of integer also further values.
Output running the script
First I create an init script (init.lua). This will be loaded by the firmware after each boot/restart.
As last step in the boot/restart process the firmware loads and executes the script init.lua (you can see a corresponding error message in the last screenshot in part 1).
It is recommended to provide an opportunity to interrupt the execution of init.lua to be able to change anything. Otherwise it may happen e.g. if your code contains a fatal error which cause a reboot that you are unable to deactivate/fix the code - and finally have to reflash the firmware to be break the loop.
I'm looking around an found a post about Methods of Interrupting init.lua during boot. My init.lua code based mainly on the ideas described there. But here it is:
- it calls
firmwareInfo()to output information about the firmware. For the moment it just inform if it is a FLOAT or INTEGER version - after a delay of
BootTimeoutms (to give the NodeMCU some time to initialize it self)init()is called - in
init()the serial port is initialized and configured to watch for a transmitted ENTER key - if an ENTER is received the function
abort()is called, which set theabortFlagto true. - After
AbortTimeoutmsstartup()is called. There theabortFlagis checked and the startup is canceled or executed by trying to load and execute 'user.lua'
Next step was to wrote a script to read out a DHT22 sensor. The user_dht22.lua script shown below reads temperature and humidity every 2 sec and prints both values. Depending on the used firmware the output is generated using different format and in case of integer also further values.
Output running the script
2016-03-29
First Steps with ESP-01 on OS X El Capitan
Labels:
Electronic,
esp8266,
make,
maker,
osx
Environment: MacBook Pro Mid 2010, OS X El Capitan 10.11.4
ESP-01 Module + Simple DIY Dev Board (based on this)
ESP-01 Module + Simple DIY Dev Board (based on this)
- Install
esptoolto backup/change/update ESP8266 firmware - Clone git repository
https://github.com/themadinventor/esptool$ git clone https://github.com/themadinventor/esptool.git Cloning into 'esptool'... ...
cd esptool- run install routine
$ sudo python setup.py install Password: running install ... Installing esptool.py script to /usr/local/bin
- Connect ESP8266 ESP-01 Board via CH340G Converter to MBP
- Install CH340G driver (WCH provides a signed driver)
- Identify the tty port
$ ls /dev/tty.w* /dev/tty.wchusbserial410
- activate ESP boot loader (needs to be repeat before each esptool command) by reset ESP and pull GPIO 0 to GND meanwhile.
- Check communication
$ esptool.py --port /dev/tty.wchusbserial410 --baud 115200 flash_id Connecting... Manufacturer: c8 Device: 4013 $ esptool.py --port /dev/tty.wchusbserial410 --baud 115200 chip_id Connecting... Chip ID: 0x009b82bc
- (optional) make a backup of the original firmware - takes about 48sec
$ time esptool.py --port /dev/tty.wchusbserial410 --baud 115200 read_flash 0x000 524288 fw_backup.bin Connecting... Please wait... real 0m47.721s user 0m0.762s sys 0m0.344s
(Note: ESP12-E has a bigger flash - 4MB = 4194304) - Flash alternative firmware - I want to give NodeMCU firmware a try
- Use standard NodeMCU firmware (download from github) or
- Config your own customized NodeMCU firmware
- Get the download links (integer and float version) about 2min later (you can also use the preconfigured
- Flash it to the ESP-01 (I start with the integer version)
$ time esptool.py --port /dev/tty.wchusbserial410 --baud 115200 write_flash 0x00000 nodemcu-master-9-modules-2016-03-29-19-22-38-integer.bin Connecting... Erasing flash... Took 1.22s to erase flash block Wrote 403456 bytes at 0x00000000 in 48.2 seconds (66.9 kbit/s)... Leaving... real 0m50.195s user 0m0.383s sys 0m0.126s
- Connect to ESP. I use SerialTools (AppStore Link) - Note: Baud Rate is 76800
2016-01-10
Setup/Configuration for another Magic Mirror
Labels:
Electronic,
Home,
Linux,
Raspberry PI
Note: Unfortunately, a glitch from the TV, which sometimes occurred before, seems now to be manifested. The TV doesn't power on anymore, neither using remote control nor buttons. I couldn't find a faulty component on TV circuit board. I will/have to stop this project. However, I have learned a lot, so it was not wasted time.
General setup
- Raspberry PI 2
- SEG ArtColor TV
- PIR module (GPIO 17, 18), IR transmitter (GPIO 4)
The PIR module will detect motion. If a motion is sense the TV will be switched on via the IR transmitter (simulation of IR remote). After a predefined timeout periode without further motion the TV will switched off (to standby).
Install and enable lirc
-
install
lircsudo apt-get install lirc
- enable
lircmodule - edit/boot/config.txtdtoverlay=lirc-rpi,gpio_out_pin=4,gpio_in_pin=22
- configure
lirc- edit/etc/lirc/hardware.confLIRCD_ARGS="" ... DRIVER="default" DEVICE="/dev/lirc0" MODULES="lirc_rpi"
Setup IR command to power on/off the TV
- learn IR command
irrecord -d /dev/lirc0 ~/lircd.conf
- copy new file
sudo cp ~/lircd.conf /etc/lirc/lircd.conf
- edit the name parameter in
/etc/lirc/lircd.confI choose magicmirror - start
lircpi@mamomami /etc/lirc $ sudo /etc/init.d/lirc start [ ok ] Loading LIRC modules:. [ ok ] Starting remote control daemon(s) : LIRC :.
- check if IR command is available
pi@mamomami /etc/lirc $ irsend LIST "magicmirror" "" irsend: 00000000000043bc KEY_POWER
- run
lircservice on start upsudo update-rc.d lirc defaults
2015-10-23
Magic-Mirror: OpenWeatherMap Fix und TimeStamp bei den News
Labels:
Electronic,
make,
maker,
Raspberry PI
Wegen einer Änderung der API bei OpenWeatherMap bedurfte mein MagicMirror einer Wartung. Zum Glück waren die Änderungen gering: Beschrieben sind sie schon an anderer Stelle, daher hier nur ein Link auf eine Beschreibung in Deutsch und beim Magic-Mirror Autor.
Daneben habe ich die Gelegenheit gleich genutzt, um die Anzeige der News um die Angabe der Veröffentlichungszeit zu ergänzen. Das ganze sieht jetzt so aus:
Das GitHub Projekt ist entsprechend aktualisiert - wer will ... bitte schön.
Daneben habe ich die Gelegenheit gleich genutzt, um die Anzeige der News um die Angabe der Veröffentlichungszeit zu ergänzen. Das ganze sieht jetzt so aus:
Das GitHub Projekt ist entsprechend aktualisiert - wer will ... bitte schön.
2015-05-01
Raspberry Pi - PIR Sensor
Labels:
Electronic,
make,
maker,
Raspberry PI
For my next project I want to detect movements and switch on/off something (or finally the monitor).
Here is the experimental setup
and the corresponding source code:
To start the script at boot time I use the following initd script:
- Raspberry Pi Rev2.0
- PIR sensor (connected to GPIO 4 + 17) - I use two pins because then I can assign a rising and falling edge event handler (see the code)
- 2x LED (connected to GPIO 24 + 25)
- 2x 100Ohm Resistor
- (also on the board but not yet in use: temperature sensor)
and the corresponding source code:
To start the script at boot time I use the following initd script:
2015-03-15
Ring Clock
At end of 2014 I had enough time to finish my Ring Clock project (or at least push some steps forward).
I used a picture frame as casing. The passepartout serves as rack for the led ring. I have put a circle of red carton in the middle of the led ring. The carton masks the display board and contains a hole for the light sensor. Two thin carton frames act as spacer to put some distance between the glas plate and the led ring. A sheet of sandwich paper is used as diffusor.
The electronic part is assembled of a Arduino Pro Mini (Watterott), a DCF77 receiver (Pollin), a DS1307 RTC module (ebay), a DS18B20 temperature sensor (ebay), a light sensor (GL5528), a 8 digit display - using 8 old VQB18C modules and a driver (ebay) - and a 60 RGB led ring (Watterott).
I used a picture frame as casing. The passepartout serves as rack for the led ring. I have put a circle of red carton in the middle of the led ring. The carton masks the display board and contains a hole for the light sensor. Two thin carton frames act as spacer to put some distance between the glas plate and the led ring. A sheet of sandwich paper is used as diffusor.
The electronic part is assembled of a Arduino Pro Mini (Watterott), a DCF77 receiver (Pollin), a DS1307 RTC module (ebay), a DS18B20 temperature sensor (ebay), a light sensor (GL5528), a 8 digit display - using 8 old VQB18C modules and a driver (ebay) - and a 60 RGB led ring (Watterott).
The source code and further information can be found here.
Abonnieren
Posts (Atom)
























































