tag:blogger.com,1999:blog-14845355165100955942024-03-13T20:55:09.802+01:00HandverdrahtetThoMohttp://www.blogger.com/profile/04642076950659900073noreply@blogger.comBlogger121125tag:blogger.com,1999:blog-1484535516510095594.post-30498690698473844572023-01-19T23:31:00.008+01:002023-01-19T23:37:03.617+01:00Using rootful podman-compose on Centos9<p>In the last weeks I updated my home server from Centos8 to Centos 9 stream. As part of this I also switched from docker to podman. This was no problem for single container but in case of multiple container working together - aka are composed - it wont work as expected. </p><p>E.g in a setup of two container in a pod - app and db - the app can't resolve (and reach) the db. </p><p>After multiple trial and error setups, crawling, reading through the web - filter out obsolete tips etc. I switch to "netavark" - (see <a href="https://github.com/containers/podman-compose/issues/455">https://github.com/containers/podman-compose/issues/455</a>), be aware that the mentioned command <code>podman system reset --force</code> will remove all volumes (Yes, I did have a backup.)</p><p></p><p>In the end - all does not help ... I was about to give up. But then I found a hint how to look in the dns config of the container:</p>
<pre>$ more /run/containers/networks/aardvark-dns/gogs_default
10.89.0.1
9951847ba473d97b6bf1e834b490 10.89.0.4 gogs_db,db,9951847ba473
6b06aee614d7584d32f3912e3b2c 10.89.0.5 gogs_app,app,6b06aee614d7
</pre>
<p>Ok, this mean the aardvark-dns is configured right. Next I look in the logs:</p>
<pre>$ journalctl -t aardvark-dns
21:06:57 s...de aardvark-dns[1998]: Received SIGHUP will refresh servers: 1
21:06:57 s...de aardvark-dns[1998]: Unable to start server unable to start CoreDns server: \
Address already in use (os error 98)
</pre>
Looks like the aardvark-dns is in conflict with my name server runing on the same maschine.
<pre>$ ps 1998
PID TIME COMMAND
1998 0:00 /usr/libexec/podman/aardvark-dns --config /run/containers/networks/aardvark-dns -p 53 run
</pre>
Interesting - it is running on port 53 - like bind.
<p>Finally I found out how to configure the port aardvark is using: it is a further entry in the file where I already switch to netavark.</p>
<pre>$ more /etc/containers/containers.conf
[network]
# Explicitly use netavark.
# See https://github.com/containers/podman-compose/issues/455
network_backend = "netavark"
dns_bind_port = 5533
</pre>
Restart ... it runs.ThoMohttp://www.blogger.com/profile/04642076950659900073noreply@blogger.com0tag:blogger.com,1999:blog-1484535516510095594.post-36936901787389344782021-11-22T20:40:00.001+01:002021-11-22T20:40:13.178+01:00Update: Wifi Scanner with ESP8266 + TFT ST7735B (NodeMCU)<p>I updated the lua code of the <a href="http://www.handverdrahtet.org/2017/01/wifi-scanner-with-esp8266-tft-st7735b.html" target="_blank">Wifi Scanner</a>. It now runs with the sdk 3.0.1.</p>
<script src="https://gist.github.com/thomo/1d8d87eedca8a518a1d8cdd0f12ec9fb.js"></script>ThoMohttp://www.blogger.com/profile/04642076950659900073noreply@blogger.com0tag:blogger.com,1999:blog-1484535516510095594.post-59591875738855024712021-10-17T16:37:00.003+02:002021-10-17T16:37:31.294+02:00Update: Display TTN-Gateway status <p>After migrating my TTN gateway to the new <span style="background-color: #fefdfa;">The Things Stack Community Edition (see previous <a href="http://www.handverdrahtet.org/2021/10/migrate-ttn-gateway-to-things-stack.html" target="_blank">blog post</a>) my script to display the gateway status stopped working. The reason behind was, that the new stack does not provide the noc api which was used in the script.</span></p><p><span style="background-color: #fefdfa;">After searching in the TTN forum I found the thread <a href="https://www.thethingsnetwork.org/forum/t/new-api-for-gateway-mapping-status-and-info/49778" target="_blank">New API for gateway mapping, status and info</a>. Using this API I just need to change one line in my script and now it works again.</span></p>
<pre style="background-color: #ffd7d5;">- cmd = "curl -s http://noc.thethingsnetwork.org:8085/api/v2/gateways/eui-b827ebfffe06902a | jq -r '.timestamp'"</pre>
<pre style="background-color: #ccffd8;">+ cmd = "curl -s https://mapper.packetbroker.net/api/v2/gateways/netID=000013,tenantID=ttn,id=eui-b827ebfffe06902a | jq -r '.updatedAt'"
</pre>
The updated script is available in the <a href="https://github.com/thomo/raspi-status" target="_blank">github repo</a>.ThoMohttp://www.blogger.com/profile/04642076950659900073noreply@blogger.com0tag:blogger.com,1999:blog-1484535516510095594.post-54749435360394223532021-10-17T15:03:00.003+02:002021-10-17T15:03:21.559+02:00Migrate TTN-Gateway to The Things Stack Community Edition (aka V3)<p> I just migrate my TTN-gateway to the new The Things Stack Community Edition (aka V3). </p><p>I followed the instructions I found in the <a href="https://github.com/ttn-zh/ic880a-gateway/issues/76" target="_blank">thread</a> on GitHub.</p><p></p><ol style="text-align: left;"><li>Create a new gateway on the things network (<a href="https://eu1.cloud.thethings.network/console/gateways" target="_blank">link</a>)</li><li>Change the server url in your <code>local_conf.json</code> to <code>eu1.cloud.thethings.network</code></li><li>Restart the gateway</li></ol><div>Unfortunately the new stack does not provide a NOC api - so my <a href="http://www.handverdrahtet.org/2020/01/ttn-gateway-in-box.html">script</a> to output the gateway status to a OLED stop working. I will invest into this next.</div><p></p>ThoMohttp://www.blogger.com/profile/04642076950659900073noreply@blogger.com0tag:blogger.com,1999:blog-1484535516510095594.post-81864741327163246772020-10-12T22:07:00.005+02:002020-10-13T01:07:55.971+02:00Photovoltaic dashboard with Grafana<p>I have a SolarEdge Inverter which is monitored by a energy meter (SolarEdge SE-MTR-3Y-400V-A). The energy meter gets measurements from the inverter and measures voltage and current at the house entry point.</p><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-VLtblRLUEsI/X4ThrRonU0I/AAAAAAAABc0/I1IdsZthyhgw2W9B6sdW59R6hPBKSdo7ACLcBGAsYHQ/s781/System%2BArchitecture.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="556" data-original-width="781" height="456" src="https://1.bp.blogspot.com/-VLtblRLUEsI/X4ThrRonU0I/AAAAAAAABc0/I1IdsZthyhgw2W9B6sdW59R6hPBKSdo7ACLcBGAsYHQ/w640-h456/System%2BArchitecture.png" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><p>SolarEdge provide a monitoring service and a mobile app to monitor the system. An example is shown here:</p><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-RF-F7Krhosw/X4Thm3khqXI/AAAAAAAABcs/XfIXDGWZhPgJsuP_tUi0uX2ypJGuWb-GgCLcBGAsYHQ/s592/Example%2BSolarEdge%2BGraph.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="486" data-original-width="592" height="526" src="https://1.bp.blogspot.com/-RF-F7Krhosw/X4Thm3khqXI/AAAAAAAABcs/XfIXDGWZhPgJsuP_tUi0uX2ypJGuWb-GgCLcBGAsYHQ/w640-h526/Example%2BSolarEdge%2BGraph.png" width="640" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div>To be able to monitor and evaluate the measurements by myself I use the following applications:</div><div><ul style="text-align: left;"><li><a href="https://github.com/volkszaehler/mbmd">mbmd</a> - to read the measurements from the inverter and energy meter</li><li>nodered - to calculate some derived values </li><li>mqtt - to "transport" the measurements between the apps</li><li>telegraf - to write the measurements into influxdb</li><li>influxdb - to store the measurements</li><li>grafana - to display the measurements</li></ul></div><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-OfiE-a-GDjs/X4ThhVJM9SI/AAAAAAAABco/HU9leux113gk9nKku-WTN7Eait9WuwL6QCLcBGAsYHQ/s1765/Data%2Bflow.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="299" data-original-width="1765" height="108" src="https://1.bp.blogspot.com/-OfiE-a-GDjs/X4ThhVJM9SI/AAAAAAAABco/HU9leux113gk9nKku-WTN7Eait9WuwL6QCLcBGAsYHQ/w640-h108/Data%2Bflow.png" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><div><br /></div><div>The result looks like this (a snapshot is available <a href="https://snapshot.raintank.io/dashboard/snapshot/kBJYmaYHGBw6MK8zqp7zcL2zq7Ix2MaY" target="_blank">here</a>):</div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-GQKK2T6sbIE/X4Tha8GaKvI/AAAAAAAABcg/e_hL792l4E4bWi_K1L0ehaJ9DduoTxZ9ACLcBGAsYHQ/s611/Example%2BGrafana%2BGraph.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="457" data-original-width="611" height="478" src="https://1.bp.blogspot.com/-GQKK2T6sbIE/X4Tha8GaKvI/AAAAAAAABcg/e_hL792l4E4bWi_K1L0ehaJ9DduoTxZ9ACLcBGAsYHQ/w640-h478/Example%2BGrafana%2BGraph.png" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><h3 style="text-align: left;">Configuration </h3><h4 style="text-align: left;">mbmd</h4><div>The mbmd reads the measurements from the inverter and (via the inverter) from the energy meter.
<pre>pi@racknode:/etc $ more mbmd.yaml
# REST api, use 127.0.0.1 to restrict to localhost
api: 0.0.0.0:8080
# mqtt config
mqtt:
broker: my.mqtt.server:1883
topic: mbmd
# user:
# password:
clientid: mbmd
qos: 0
homie: ""
# homie: homie
# adapters are referenced by device
adapters:
- device: inverter.ip.addr:1502
# list of devices
devices:
- name: inverter
type: SE
id: 1
subdevice: 0 # use subdevice to access SunSpec subdevices
- name: powermeter
type: SE
id: 1
subdevice: 1 # use subdevice to access SunSpec subdevices</pre></div>
<h4 style="text-align: left;">Node-Red</h4><div>To calculate the "self consumption" and split the measured power in Import/Export I create a Node-Red flow:</div><div><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-XpUTBXpT66w/X4ThOsZ54kI/AAAAAAAABcc/MK2WXBT1vac-QL2qy2EC9qiVNIevW9srwCLcBGAsYHQ/s913/PV%2BNode-RED%2Bflow.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="285" data-original-width="913" height="200" src="https://1.bp.blogspot.com/-XpUTBXpT66w/X4ThOsZ54kI/AAAAAAAABcc/MK2WXBT1vac-QL2qy2EC9qiVNIevW9srwCLcBGAsYHQ/w640-h200/PV%2BNode-RED%2Bflow.png" width="640" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div>Here is the corresponding <a href="https://gist.github.com/thomo/da4fcd9710333670b58c9df20a67b98d">flow code</a>.<h4 style="text-align: left;">Telegraf</h4><div>The telegraf is configured to transfer the mqtt messages to the influxdb. </div><div><br /></div><div>The config is available <a href="https://gist.github.com/thomo/b568f330f7a8e47f84d0b53599899ac6" target="_blank">here</a>.</div><h4 style="text-align: left;">Grafana</h4><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-Uxj2ZyotX8g/X4TgUKIKz5I/AAAAAAAABcU/O19juuSOLXchYHmR3AjSld29KJpB6WImQCLcBGAsYHQ/s1305/PV%2BDashboard.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="567" data-original-width="1305" height="278" src="https://1.bp.blogspot.com/-Uxj2ZyotX8g/X4TgUKIKz5I/AAAAAAAABcU/O19juuSOLXchYHmR3AjSld29KJpB6WImQCLcBGAsYHQ/w640-h278/PV%2BDashboard.png" width="640" /></a></div><br /><div><br /></div><div>A snapshot of the dashboard is available <a href="https://snapshot.raintank.io/dashboard/snapshot/kBJYmaYHGBw6MK8zqp7zcL2zq7Ix2MaY" target="_blank">here</a> and also the <a href="https://gist.github.com/thomo/e9bf20b8b3a14bc5eb002a9533852624">dashboard.json</a> is available.</div><div><br /></div><div><br /></div>ThoMohttp://www.blogger.com/profile/04642076950659900073noreply@blogger.com0tag:blogger.com,1999:blog-1484535516510095594.post-69366029242470638422020-10-03T14:42:00.003+02:002020-10-03T14:42:40.322+02:00HP MFP M754DN Fix "Scan to Network" error<p>My multifunction printer HP MFP M754DN has the ability to scan to a network folder. The target folder is provided by a samba server running CentOS8. It works with out problem but stops to be able to access the network folder some weeks ago. </p><p>Testing the connection on the webgui results in the message: "<span style="color: #cc0000;">Cannot connect to the network folder. Ensure the shared folder name is correct.</span>"</p><p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-tjAzNFFjx-U/X3hrtRUyQFI/AAAAAAAABbE/XGO49xudgrQMLAOz0Epu2SKr4Rah76EIACLcBGAsYHQ/s360/Screen%2BShot%2B2020-10-03%2Bat%2B14.14.44.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="148" data-original-width="360" src="https://1.bp.blogspot.com/-tjAzNFFjx-U/X3hrtRUyQFI/AAAAAAAABbE/XGO49xudgrQMLAOz0Epu2SKr4Rah76EIACLcBGAsYHQ/s320/Screen%2BShot%2B2020-10-03%2Bat%2B14.14.44.png" width="320" /></a></div><div><br /></div>To fix it I have added the following lines in the <code>smb.conf</code> file on the samba server.
<pre>server min protocol = NT1
min protocol = NT1
</pre>
A further analysis of my last update activities showed that this was related to the update of the samba package from samba-4.10.4-101.el8_1.x86_64 to samba-4.11.2-13.el8.x86_64. <div>According to <a href="https://github.com/samba-team/samba/blob/59cca4c5d699be80b4ed22b40d8914787415c507/WHATSNEW.txt" target="_blank">Samba 4.11 WhatsNew</a> the "SMB1 is disabled by default" now - and the HP printer unfortunately uses only SMB1. With the mentioned settings you enabled the SMB1 protocol again.</div>ThoMohttp://www.blogger.com/profile/04642076950659900073noreply@blogger.com1tag:blogger.com,1999:blog-1484535516510095594.post-397748544930827372020-04-19T11:46:00.000+02:002020-04-19T11:46:07.851+02:00A 3d printable case for a ZigBee GatewayI create a 3D model of a case for the ZigBee board.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-qck3a0khqaI/XpwcjOrL4QI/AAAAAAAABWo/-APuFo9lBLslBnf-5bkl4ERQ8h-FB2HZQCLcBGAsYHQ/s1600/ZigBeeCase_1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="533" data-original-width="400" height="320" src="https://1.bp.blogspot.com/-qck3a0khqaI/XpwcjOrL4QI/AAAAAAAABWo/-APuFo9lBLslBnf-5bkl4ERQ8h-FB2HZQCLcBGAsYHQ/s320/ZigBeeCase_1.jpg" width="240" /></a> <a href="https://1.bp.blogspot.com/-9o9CrkYXG1I/XpwcjDBl6gI/AAAAAAAABWs/OSw0mi-djxYtZ8dXBEsksHTkzlkw9eYRACLcBGAsYHQ/s1600/ZigBeeCase_2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="400" data-original-width="400" height="320" src="https://1.bp.blogspot.com/-9o9CrkYXG1I/XpwcjDBl6gI/AAAAAAAABWs/OSw0mi-djxYtZ8dXBEsksHTkzlkw9eYRACLcBGAsYHQ/s320/ZigBeeCase_2.jpg" width="320" /></a></div>
<br />
In the cap is a cutout to place a neodymium magnet.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-p_46vYKEtqU/Xpwc_h92QTI/AAAAAAAABW4/A0fi3gkl9B8dYRzvXGGlgPT1AuPjPmLHQCLcBGAsYHQ/s1600/ZigBeeCase_Cap.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="297" data-original-width="400" height="237" src="https://1.bp.blogspot.com/-p_46vYKEtqU/Xpwc_h92QTI/AAAAAAAABW4/A0fi3gkl9B8dYRzvXGGlgPT1AuPjPmLHQCLcBGAsYHQ/s320/ZigBeeCase_Cap.png" width="320" /></a></div>
<br />
STL files are uploaded to my Thingivers account (<a href="https://www.thingiverse.com/thing:4019004">link</a>).ThoMohttp://www.blogger.com/profile/04642076950659900073noreply@blogger.com0tag:blogger.com,1999:blog-1484535516510095594.post-21414217917389051502020-03-20T23:25:00.002+01:002020-03-20T23:25:59.646+01:00Using Cucumber with Gradle with tagsI want to run Cucumber from Gradle with the possibility to specify tags. Here is a <code>build.gradle</code> to do this:<br />
<br />
<script src="https://gist.github.com/thomo/3198d2bce6bf9cbec285027ecf21e39d.js"></script>
<br />
<ul>
<li><code>gradle cucumber</code> - will run all cucumber scenarios but not these tagged with <b>@Ignore</b></li>
<li><code>gradle cucumber -P tags=@Smoketest</code> - will run all smoketests but again will ignore these with the tag <b>@Ignore</b>.
</li>
</ul>
ThoMohttp://www.blogger.com/profile/04642076950659900073noreply@blogger.com0tag:blogger.com,1999:blog-1484535516510095594.post-67787108916067391592020-01-03T12:11:00.000+01:002020-01-03T12:12:32.348+01:00TTN-Gateway in a boxDuring the last days I worked on the installation of my TTN-Gateway into a case. This is the result:
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-bfcA6X-K2YM/Xg8f2qxTk3I/AAAAAAAABVE/nt6nQnU0CKEbhAwAUcu8YUEU1EsMBRsXgCLcBGAsYHQ/s1600/ttn-gw%2B-%2B2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1280" data-original-width="1280" height="320" src="https://1.bp.blogspot.com/-bfcA6X-K2YM/Xg8f2qxTk3I/AAAAAAAABVE/nt6nQnU0CKEbhAwAUcu8YUEU1EsMBRsXgCLcBGAsYHQ/s320/ttn-gw%2B-%2B2.jpg" width="320" /></a><a href="https://1.bp.blogspot.com/-XLgpyIdzjT8/Xg8f2vpMTgI/AAAAAAAABVI/LIIFy1pv1v8GXVQ5I2r_3qzSzKFAHkVYgCLcBGAsYHQ/s1600/ttn-gw%2B-%2B1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1280" data-original-width="1280" height="320" src="https://1.bp.blogspot.com/-XLgpyIdzjT8/Xg8f2vpMTgI/AAAAAAAABVI/LIIFy1pv1v8GXVQ5I2r_3qzSzKFAHkVYgCLcBGAsYHQ/s320/ttn-gw%2B-%2B1.jpg" width="320" /></a></div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-JY6x5_uTQcg/Xg8f2d-PK_I/AAAAAAAABVA/1bkzfUlZIBIdPnxS2NAuHaqHhOHuZI81wCLcBGAsYHQ/s1600/ttn-gw%2B-%2B3.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1280" data-original-width="1280" height="320" src="https://1.bp.blogspot.com/-JY6x5_uTQcg/Xg8f2d-PK_I/AAAAAAAABVA/1bkzfUlZIBIdPnxS2NAuHaqHhOHuZI81wCLcBGAsYHQ/s320/ttn-gw%2B-%2B3.jpg" width="320" /></a><a href="https://1.bp.blogspot.com/-M-YCoVYXxzE/Xg8f3fRarNI/AAAAAAAABVM/ff02P5i43AA1VWRgXLOiTIT9LaezODVuACLcBGAsYHQ/s1600/ttn-gw%2B-%2B4.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1280" data-original-width="1280" height="320" src="https://1.bp.blogspot.com/-M-YCoVYXxzE/Xg8f3fRarNI/AAAAAAAABVM/ff02P5i43AA1VWRgXLOiTIT9LaezODVuACLcBGAsYHQ/s320/ttn-gw%2B-%2B4.jpg" width="320" /></a></div>
<br />
<br />
<br />
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.<br />
<br />
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.<br />
<br />
The software is available on <a href="https://github.com/thomo/raspi-status">github</a>.ThoMohttp://www.blogger.com/profile/04642076950659900073noreply@blogger.com0tag:blogger.com,1999:blog-1484535516510095594.post-27428741823659661052020-01-03T09:49:00.000+01:002020-01-03T11:52:16.462+01:00Little helper: mwc = more-without-commentWhile configuring my linux nodes I found my alias <code>mwc</code> very helpful:<br/><br/>
<script src="https://gist.github.com/thomo/1f1d7bb86e74b9686bf7afbaed01b982.js"></script>
I used it to show the relevant (= uncommented and non-empty) lines in typical linux config files.ThoMohttp://www.blogger.com/profile/04642076950659900073noreply@blogger.com0tag:blogger.com,1999:blog-1484535516510095594.post-82795912941236986612019-12-29T13:55:00.001+01:002019-12-29T13:55:49.468+01:00Raspi + RAK831 + converter board - make standard i2c bus availableThe 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 <a href="https://downloads.rakwireless.com/en/LoRa/RAK831-LoRa-Gateway/Hardware-Specification/RAK831%20Datasheet%20V1.3_RU.pdf">page 15</a>) but does not uses it as i2c bus. The consequence is that the standard i2c bus cannot be used.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-ron9vcFIxQQ/XgicUKTwkAI/AAAAAAAABUE/WvnFxiUDB3olyIpNvMYKs0mQSCv4s5AxgCLcBGAsYHQ/s1600/Converterboard%2B-%2Bi2c%2Bpins.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="821" data-original-width="813" height="400" src="https://1.bp.blogspot.com/-ron9vcFIxQQ/XgicUKTwkAI/AAAAAAAABUE/WvnFxiUDB3olyIpNvMYKs0mQSCv4s5AxgCLcBGAsYHQ/s400/Converterboard%2B-%2Bi2c%2Bpins.png" width="395" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
On the other hand when looking how to connect the RAK831 direct with a Raspi (e.g. <a href="https://projects-raspberry.com/getting-started-with-the-rak-831-lora-gateway-and-rpi3/">here</a>) the RAK pins 7 and 9 are not used.<br />
<br />
This means the i2c bus can be revitalize by removing the 0R bridges R11 and R6 on the converter board.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-UTweudqcO6s/XgigC_wbyjI/AAAAAAAABUY/8p-eQ7cSIoMDD2BVc-35bDYnHYiIkMndQCLcBGAsYHQ/s1600/converter_i2c%2B-%2B1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="960" data-original-width="1280" height="240" src="https://1.bp.blogspot.com/-UTweudqcO6s/XgigC_wbyjI/AAAAAAAABUY/8p-eQ7cSIoMDD2BVc-35bDYnHYiIkMndQCLcBGAsYHQ/s320/converter_i2c%2B-%2B1.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/--N6UIj6PJOA/XgihuGBX_NI/AAAAAAAABUs/4ND2cb266r0iFpxuo53Kl4Tkcm4xZR-nACLcBGAsYHQ/s1600/converter_i2c%2B-%2B1a.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="172" data-original-width="268" height="205" src="https://1.bp.blogspot.com/--N6UIj6PJOA/XgihuGBX_NI/AAAAAAAABUs/4ND2cb266r0iFpxuo53Kl4Tkcm4xZR-nACLcBGAsYHQ/s320/converter_i2c%2B-%2B1a.jpg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-Vb0BMDQ-3Gg/XgigC5eeXYI/AAAAAAAABUU/iXm4flxYScMSqlWpL3AAbRkkPHD5_XwFgCLcBGAsYHQ/s1600/converter_i2c%2B-%2B2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="960" data-original-width="1280" height="240" src="https://1.bp.blogspot.com/-Vb0BMDQ-3Gg/XgigC5eeXYI/AAAAAAAABUU/iXm4flxYScMSqlWpL3AAbRkkPHD5_XwFgCLcBGAsYHQ/s320/converter_i2c%2B-%2B2.jpg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-qyUUWrdeML0/XgigCy8HiqI/AAAAAAAABUQ/iUM7X3Vo09sqqzBKCA5wFGh2He5aOmrBQCLcBGAsYHQ/s1600/converter_i2c%2B-%2B3.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="960" data-original-width="1280" height="240" src="https://1.bp.blogspot.com/-qyUUWrdeML0/XgigCy8HiqI/AAAAAAAABUQ/iUM7X3Vo09sqqzBKCA5wFGh2He5aOmrBQCLcBGAsYHQ/s320/converter_i2c%2B-%2B3.jpg" width="320" /></a></div>
<br />
<br />ThoMohttp://www.blogger.com/profile/04642076950659900073noreply@blogger.com0tag:blogger.com,1999:blog-1484535516510095594.post-62726860894300428722019-12-11T20:26:00.002+01:002019-12-11T20:26:23.996+01:00Updated inadyn-mt package for CentOS 8I have updated my inadyn-mt rpm/srpm package for CentOS 8. It is based on inadyn-mt v02.28.10.<br />
<ul>
<li><a href="http://public.handverdrahtet.org/files/inadyn-mt-2.28.10-4.el8.x86_64.rpm">inadyn-mt-2.28.10-4.el8.x86_64.rpm</a> (RPM)</li>
<li><a href="http://public.handverdrahtet.org/files/inadyn-mt-2.28.10-4.el8.src.rpm">inadyn-mt-2.28.10-4.el8.src.rpm</a> (SRPM)</li>
</ul>
<div>
I follow again the steps I described <a href="https://www.handverdrahtet.org/2015/10/install-inadyn-mt-on-centos7.html">here</a>, but started with the current source rpm <a href="http://download-ib01.fedoraproject.org/pub/fedora/linux/releases/31/Everything/source/tree/Packages/i/inadyn-mt-2.28.10-4.fc31.src.rpm">inadyn-mt-2.28.10-4.fc31.src.rpm</a></div>
ThoMohttp://www.blogger.com/profile/04642076950659900073noreply@blogger.com0tag:blogger.com,1999:blog-1484535516510095594.post-38343974578555685922019-12-03T16:55:00.005+01:002020-10-11T14:19:59.044+02:00Setting up a Zigbee2mqtt gateway Here are the steps I performed to setup a Zigbee2mqtt gateway using a CC2530+CC2591 board and a RaspberryPI 3.
<br />
<ul>
<li>My RaspberryPI 3 is running
<pre>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</pre>
</li>
<li>
My Zigbee board:
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-afMcO6-lVA8/XeJotgS1spI/AAAAAAAABSw/6MDYIT_618AYH8MsHTFzBBYhXZ9bJllFQCLcBGAsYHQ/s1600/zigbee2mqtt_%2B-%2B1.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1600" data-original-width="1200" height="200" src="https://1.bp.blogspot.com/-afMcO6-lVA8/XeJotgS1spI/AAAAAAAABSw/6MDYIT_618AYH8MsHTFzBBYhXZ9bJllFQCLcBGAsYHQ/s200/zigbee2mqtt_%2B-%2B1.jpg" width="150" /></a> <a href="https://1.bp.blogspot.com/-A6siMgzSRek/XeJotLEVyeI/AAAAAAAABSs/1XRLDogHKrsU1ej3sSCWowHlD-YeJPTEwCLcBGAsYHQ/s1600/zigbee2mqtt_%2B-%2B2.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1600" data-original-width="1200" height="200" src="https://1.bp.blogspot.com/-A6siMgzSRek/XeJotLEVyeI/AAAAAAAABSs/1XRLDogHKrsU1ej3sSCWowHlD-YeJPTEwCLcBGAsYHQ/s200/zigbee2mqtt_%2B-%2B2.jpg" width="150" /></a></div>
<br />
</li>
</ul>
The steps can be structured in three groups:
<br />
<br />
<ol>
<li><a href="https://www.blogger.com/blogger.g?blogID=1484535516510095594#flash">Flash the Z-Stack coordinator firmware on the Zigbee board</a></li>
<li><a href="https://www.blogger.com/blogger.g?blogID=1484535516510095594#install">Install zigbee2mqtt to run on the Raspberry Pi</a></li>
<li><a href="https://www.blogger.com/blogger.g?blogID=1484535516510095594#daemon">Setup a daemon to run zigbee2mqtt</a></li>
</ol>
<br />
<h3 id="flash">
Flash the Z-Stack coordinator firmware on the Zigbee board</h3>
<ul>
<li>Connect the Zigbee board with the Raspberry (<b>Note: this is the connection schema for flashing the firmware, while normal operation another connection schema is used.</b>)<br /><br />
<table border="1">
<thead>
<tr><th>Name </th><th> Raspi </th><th> CC2530+CC2591* </th></tr>
</thead>
<tbody>
<tr><td>3,3V/VCC </td><td>Pin01</td><td>P12 Pin02</td></tr>
<tr><td>GND </td><td>Pin39</td><td>P12 Pin01</td></tr>
<tr><td>RESET </td><td>Pin35</td><td>P12 Pin03</td></tr>
<tr><td>DC </td><td>Pin36</td><td>P14 Pin04</td></tr>
<tr><td>DD </td><td>Pin38</td><td>P14 Pin05</td></tr>
</tbody></table>
<span style="font-size: x-small;">
*) P12 - 12pin connector, P14 - 14 pin connector</span><br /><br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-C2k703Iw288/XketxbU2RvI/AAAAAAAABV8/z2tU-q4RPNQ2vtYyQAMBZb78v135I1VCQCLcBGAsYHQ/s1600/Screen%2BShot%2B2020-02-15%2Bat%2B09.33.35.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="644" data-original-width="1150" height="179" src="https://1.bp.blogspot.com/-C2k703Iw288/XketxbU2RvI/AAAAAAAABV8/z2tU-q4RPNQ2vtYyQAMBZb78v135I1VCQCLcBGAsYHQ/s320/Screen%2BShot%2B2020-02-15%2Bat%2B09.33.35.png" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-ciKUM8TL7EI/XeJotzJeLCI/AAAAAAAABTE/f0uY5sPWdrkaxWhHHSZEbWv7O4GVuA22QCEwYBhgL/s1600/zigbee2mqtt_%2B-%2B3.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://1.bp.blogspot.com/-ciKUM8TL7EI/XeJotzJeLCI/AAAAAAAABTE/f0uY5sPWdrkaxWhHHSZEbWv7O4GVuA22QCEwYBhgL/s320/zigbee2mqtt_%2B-%2B3.jpg" width="320" /></a></div>
<br />
</li>
<li>Install the wiringPI library<br />
<pre>sudo apt-get install wiringpi</pre>
</li>
<li>Install git
<pre>pi@racknode:~ $ sudo apt-get install git
</pre>
</li>
<li>Clone the flasher repo
<pre>git clone https://github.com/jmichault/flash_cc2531.git</pre>
</li>
<li>Test the connection
<pre>pi@racknode:~/flash_cc2531 $ ./cc_chipid
ID = a524.</pre>
</li>
<li>Get the firmware - as mentioned above I need the CC2530+CC2591 version. See <code>https://github.com/Koenkk/Z-Stack-firmware/tree/master/coordinator/Z-Stack_Home_1.2/bin/default</code> for the correct version.
<pre>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</pre>
</li>
<li>Extract the archive
<pre>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 $</pre>
</li>
<li>Erase the <strike>CC2531</strike> CC2530<pre>pi@racknode:~/flash_cc2531 $ ./cc_erase
ID = a524.
erase result = 00a6.
pi@racknode:~/flash_cc2531 $</pre>
</li>
<li>Write the new firmware (takes about 2-3 minutes)
<pre>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:~ $</pre>
</li>
</ul>
<h3 id="install">
Install zigbee2mqtt to run on the Raspberry Pi</h3>
Steps based on
<br />
<ul>
<li><a href="https://www.zigbee2mqtt.io/information/connecting_cc2530.html">Connecting CC2530</a></li>
<li><a href="https://www.zigbee2mqtt.io/getting_started/running_zigbee2mqtt.html">Running zigbee2mqtt</a></li>
</ul>
My steps were
<br />
<ul>
<li>Connect the Zigbee board with the Raspberry for operation mode
<br /><br />
<table border="1">
<thead>
<tr><th>Name </th><th> Raspi </th><th> CC2530+CC2591* </th></tr>
</thead>
<tbody>
<tr><td>3,3V/VCC</td><td>Pin01</td><td>P12 Pin02</td></tr>
<tr><td>GND </td><td>Pin39</td><td>P12 Pin01</td></tr>
<tr><td>TX (R→Z)</td><td>Pin08</td><td>P12 Pin07</td></tr>
<tr><td>RX (R←Z) </td><td>Pin10</td><td>P12 Pin08</td></tr>
</tbody></table>
<span style="font-size: x-small;">
*) P12 - 12pin connector</span>
<br /><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-qC0zwKSbYg8/XeQFNz3WP9I/AAAAAAAABTc/RDAxKb8vI0Ya7V8wbl9DczNGBziMu6StACLcBGAsYHQ/s1600/Screen%2BShot%2B2019-12-01%2Bat%2B19.22.59.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="538" data-original-width="954" height="225" src="https://2.bp.blogspot.com/-qC0zwKSbYg8/XeQFNz3WP9I/AAAAAAAABTc/RDAxKb8vI0Ya7V8wbl9DczNGBziMu6StACLcBGAsYHQ/s400/Screen%2BShot%2B2019-12-01%2Bat%2B19.22.59.png" width="400" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-5bMFrihEGJg/XeaFGCGgevI/AAAAAAAABTo/xGSivNm7EsIBE2BRtzmqo7FoNdEiaUyJACLcBGAsYHQ/s1600/zigbee2mqtt%2B-%2B1.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://1.bp.blogspot.com/-5bMFrihEGJg/XeaFGCGgevI/AAAAAAAABTo/xGSivNm7EsIBE2BRtzmqo7FoNdEiaUyJACLcBGAsYHQ/s320/zigbee2mqtt%2B-%2B1.jpg" width="320" /></a></div>
<br />
<br />
</li>
<li>Enable UART and disable UART use for Bluetooth by adding following lines to <code>/boot/config.txt</code>
<pre>pi@racknode:~ $ sudo vi /boot/config.txt
enable_uart=1
dtoverlay=pi3-disable-bt
</pre>
</li>
<li>Disable modem system
<pre>sudo systemctl disable hciuart</pre>
</li>
<li>Remove the serial console entry from <code>/boot/cmdline.txt</code><br />
Before
<pre>pi@racknode:~ $ cat /boot/cmdline.txt
dwc_otg.lpm_enable=0 <span style="color: red;">console=serial0,115200</span> console=tty1 root=...
</pre>
After
<pre>pi@racknode:~ $ cat /boot/cmdline.txt
dwc_otg.lpm_enable=0 console=tty1 root=...
</pre>
</li>
<li>Reboot the Raspberry</li>
<li>Installing the node.js 10.0 repo and install node.js
<pre>pi@racknode:~ $ sudo curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -</pre>
... and install node.js
<pre>pi@racknode:~ $ sudo apt-get install -y nodejs</pre>
</li>
<li>Clone the zigbee2mqtt repo
<pre>pi@racknode:~ $ sudo git clone https://github.com/Koenkk/zigbee2mqtt.git /opt/zigbee2mqtt</pre>
... and change own to <code>pi</code>
<pre>pi@racknode:~ $ sudo chown -R pi:pi /opt/zigbee2mqtt</pre>
</li>
<li>Install the dependencies
<pre>pi@racknode:~ $ cd /opt/zigbee2mqtt
pi@racknode:/opt/zigbee2mqtt $ npm ci<br />
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</pre>
</li>
<li>Fix the mentioned issues
<pre>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 $
</pre>
</li>
<li>Enter your configuration in <code>/opt/zigbee2mqtt/data/configuration.yaml</code>
<pre>vi data/configuration.yaml</pre>
Enter your settings <pre># MQTT settings
mqtt:
# MQTT base topic for zigbee2mqtt MQTT messages
base_topic: <span style="color: red;">zigbee2mqtt</span>
# MQTT server URL
server: 'mqtt://<span style="color: red;">localhost</span>'
# MQTT server authentication, uncomment if required:
# user: my_user
# password: my_password
# CC2590 is connected to serial line
serial:
port: <span style="color: red;">/dev/ttyAMA0</span>
<span style="color: red;">advanced:
baudrate: 115200
rtscts: false
</span></pre>
</li>
<li>Start zigbee2mqtt
<pre>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}'</pre>
</li>
</ul>
<h3 id="daemon">
Setup a daemon to run zigbee2mqtt</h3>
based on <a href="https://www.zigbee2mqtt.io/getting_started/running_zigbee2mqtt.html#5-optional-running-as-a-daemon-with-systemctl">zigbee2mqtt - 5. (Optional) Running as a daemon with systemctl</a>
<br />
<ul>
<li>Create a zigbee2mqtt service
<pre>sudo vi /etc/systemd/system/zigbee2mqtt.service</pre>
enter
<pre>[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
</pre>
</li>
<li>Verify that it works
<pre>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)</pre>
</li>
<li><pre> 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...</pre>
</li>
<li>Configure the autostart of the service
<pre>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.</pre>
</li>
<li>Reboot the Raspberry to verify your setup
<pre>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:~ $</pre>
</li>
</ul>
<h3>
Links</h3>
<ul>
<li>https://www.zigbee2mqtt.io/</li>
</ul>
<h3>
Update</h3>
<div>
2020-02-15: Fix error in flash connection table and picture.</div>
ThoMohttp://www.blogger.com/profile/04642076950659900073noreply@blogger.com12tag:blogger.com,1999:blog-1484535516510095594.post-82206349668704569532019-10-08T17:41:00.000+02:002019-10-29T23:37:42.143+01:00Setup TTN Gateway using Raspi3 with RAK831 and converter boardFinally I was able to put my TTN Gateway into operation.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-ULs6ptGRYCg/XZyrIj4SIWI/AAAAAAAABRI/Fz-ig0PNFgYXlt2wMHyOf3npzrw1AcZWwCLcBGAsYHQ/s1600/20191008%2B165639%2B60D.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="351" data-original-width="800" height="140" src="https://1.bp.blogspot.com/-ULs6ptGRYCg/XZyrIj4SIWI/AAAAAAAABRI/Fz-ig0PNFgYXlt2wMHyOf3npzrw1AcZWwCLcBGAsYHQ/s320/20191008%2B165639%2B60D.jpg" width="320" /></a>
<a href="https://1.bp.blogspot.com/-ud3MWQ1yWig/XZyrI1KvrvI/AAAAAAAABRM/TclZIzBf_QINFyVor7wg78h9HhXMAmX_QCLcBGAsYHQ/s1600/20191008%2B165651%2B60D.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="" border="0" data-original-height="85" data-original-width="300" height="56" src="https://1.bp.blogspot.com/-ud3MWQ1yWig/XZyrI1KvrvI/AAAAAAAABRM/TclZIzBf_QINFyVor7wg78h9HhXMAmX_QCLcBGAsYHQ/s200/20191008%2B165651%2B60D.jpg" title="RAK Part No: RAK831 868MHz" width="200" /></a></div>
<br />
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.<br />
<br />
My essential setup steps:<br />
<ol>
<li>Put the parts together. <br /><b>Caution: Do not power up the RAK831 card without connecting the antenna.</b></li>
<li>Prepare a SDCard with a Raspberry Image - I use "Raspbian Buster with desktop" (Release date: 2019-09-26, Kernel 4.19)</li>
<li>Perform a general update<br /><pre>sudo apt-get update && sudo apt-get upgrade</pre>
</li>
<li>Enable SPI using <code>raspi-config</code></li>
<li>Clone the ttn gateway repo<br /><pre>git clone https://github.com/ttn-zh/ic880a-gateway.git</pre>
</li>
<li>Run the setup script<br /><pre>cd ic880a-gateway
sudo ./install.sh</pre>
</li>
<li><a href="https://console.thethingsnetwork.org/gateways/register" target="_blank">Register the gateway</a> on TTN website</li>
</ol>
After the restart I check the service status:
<br />
<br />
<pre>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]: <b>ERROR: [main] failed to start the concentrator</b>
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'.
</pre>
<br />
Damn - the same problem as at first try! :-(<br />
<br />
An <a href="https://github.com/ttn-zh/ic880a-gateway/issues/33" target="_blank">issue thread on github</a> 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. <a href="https://dzone.com/articles/contributing-an-iot-lorawan-raspberry-pi-rak831-ga" target="_blank">On another page about the setup</a> I found the crucial clue: The converter board uses a different reset pin (it use pin 17 instead of 25).<br />
<br />
After changing the corresponding setting in <code>/opt/ttn-gateway/bin/start.sh</code><br />
<pre>#! /bin/bash
# Reset iC880a PIN
# SX1301_RESET_BCM_PIN=25
<b>SX1301_RESET_BCM_PIN=17</b>
echo "$SX1301_RESET_BCM_PIN" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio$SX1301_RESET_BCM_PIN/direction
</pre>
<br />
... it worked as expected. And I see the status "connected" on the TTN console (on TTN website).<br />
<br />
To enable the GPS module I have to:<br />
<ol>
<li>Disable the serial login shell but keep the serial interface enabled - via raspi-config - interface setup.</li>
<li>add the following lines to /opt/ttn-gateway/bin/local_conf.json<br />
<pre>"gps_tty_path": "/dev/ttyS0",
"fake_gps": false,
</pre>
</li>
<li>
Reboot and check if it works (it may take some minutes to fetch the GPS position)<pre>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
</pre>
</li>
</ol>
Used hardware:<br />
<br />
<div style="text-align: center;">
Raspi3</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-hLqRFRATxt4/XZyrGXDJ4II/AAAAAAAABRU/D7Xrah1MnaMAiHjAOjmLzX1suDFe8OjJwCEwYBhgL/s1600/20191008%2B164353%2B60D.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="525" data-original-width="800" height="210" src="https://1.bp.blogspot.com/-hLqRFRATxt4/XZyrGXDJ4II/AAAAAAAABRU/D7Xrah1MnaMAiHjAOjmLzX1suDFe8OjJwCEwYBhgL/s320/20191008%2B164353%2B60D.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
The converter board with GPS support</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-W3tvTLaPpK8/XZyrGeLOduI/AAAAAAAABRQ/04UBG6pSmiAapKkA97NmyS3-2S803yySACEwYBhgL/s1600/20191008%2B164631%2B60D.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="476" data-original-width="800" height="190" src="https://1.bp.blogspot.com/-W3tvTLaPpK8/XZyrGeLOduI/AAAAAAAABRQ/04UBG6pSmiAapKkA97NmyS3-2S803yySACEwYBhgL/s320/20191008%2B164631%2B60D.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
RAK831 module</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-pNKMEgolzok/XZyrGvnSQeI/AAAAAAAABRc/K9JbY3jCcBcoRJyaoX2JBaB90hCu8Lc5gCEwYBhgL/s1600/20191008%2B164658%2B60D.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="567" data-original-width="800" height="226" src="https://1.bp.blogspot.com/-pNKMEgolzok/XZyrGvnSQeI/AAAAAAAABRc/K9JbY3jCcBcoRJyaoX2JBaB90hCu8Lc5gCEwYBhgL/s320/20191008%2B164658%2B60D.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
On the left side: </div>
<div class="separator" style="clear: both; text-align: center;">
top - the TTN antenna</div>
<div class="separator" style="clear: both; text-align: center;">
bottom - the GPS module (optional)</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-XJ5sStHJtKE/XZyrHtNcyEI/AAAAAAAABRY/-ZTy1fivWX8Kt-Ugv3e6QTZxwf_ROYzpwCEwYBhgL/s1600/20191008%2B165114%2B60D.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="508" data-original-width="800" height="203" src="https://1.bp.blogspot.com/-XJ5sStHJtKE/XZyrHtNcyEI/AAAAAAAABRY/-ZTy1fivWX8Kt-Ugv3e6QTZxwf_ROYzpwCEwYBhgL/s320/20191008%2B165114%2B60D.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
Connection of the GPS signal</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-NYlgpA5-Iu4/XZyrIKRABnI/AAAAAAAABRg/KWi3bDPmsIEnjGDRhgfuUGDHC4gGB2b9ACEwYBhgL/s1600/20191008%2B165317%2B60D.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="521" data-original-width="800" height="208" src="https://1.bp.blogspot.com/-NYlgpA5-Iu4/XZyrIKRABnI/AAAAAAAABRg/KWi3bDPmsIEnjGDRhgfuUGDHC4gGB2b9ACEwYBhgL/s320/20191008%2B165317%2B60D.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Update: The <a href="https://downloads.rakwireless.com/en/LoRa/RAK831-LoRa-Gateway/Application-Notes/Interface-Panel-Wiring-Instructions.pdf" target="_blank">wiring</a> of the converter board is available on the RAK website.</div>
ThoMohttp://www.blogger.com/profile/04642076950659900073noreply@blogger.com0tag:blogger.com,1999:blog-1484535516510095594.post-37896830488575075212019-07-14T19:08:00.000+02:002019-07-14T19:08:31.971+02:00Update: ESP8266 based SensorNode V2I updated the circuit and pcb design of my Esp based SensorNode.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-HR6V35No3Cg/XStgqeqHt0I/AAAAAAAABOs/3trwEwnCfIkfUErG91T6kIv9k48mkwwMQCLcBGAs/s1600/SensorNodeV2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1600" data-original-width="1600" height="320" src="https://1.bp.blogspot.com/-HR6V35No3Cg/XStgqeqHt0I/AAAAAAAABOs/3trwEwnCfIkfUErG91T6kIv9k48mkwwMQCLcBGAs/s320/SensorNodeV2.jpg" width="320" /></a></div>
Further details in the <a href="https://github.com/thomo/sensornode" target="_blank">github repository</a>.ThoMohttp://www.blogger.com/profile/04642076950659900073noreply@blogger.com1tag:blogger.com,1999:blog-1484535516510095594.post-8181640172118043562019-07-14T19:03:00.000+02:002019-07-14T19:09:16.344+02:00ESP ProgrammerI put together an adapter board to attach a CP2104 board to ESP8266 and provide auto programming mode.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-2HfaIifZw-c/XStf2QSFJZI/AAAAAAAABOk/7GmVd6hxcCkrJes8ipTEsI62XjGK8o3ggCLcBGAs/s1600/prototype.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://1.bp.blogspot.com/-2HfaIifZw-c/XStf2QSFJZI/AAAAAAAABOk/7GmVd6hxcCkrJes8ipTEsI62XjGK8o3ggCLcBGAs/s320/prototype.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
For further details see <a href="https://github.com/thomo/espprogrammer" target="_blank">the github repository.</a></div>
<br />ThoMohttp://www.blogger.com/profile/04642076950659900073noreply@blogger.com0tag:blogger.com,1999:blog-1484535516510095594.post-10202988895693939042019-04-29T00:04:00.000+02:002019-04-29T00:04:07.765+02:00ESP8266 based SensorNode<div class="separator" style="clear: both; text-align: left;">
In last weeks I put together a Sensor-Node based on ESP8266. The software part provides:</div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<ul>
<li>the standard WiFiMonitor to setup the WiFi credentials</li>
<li>a web page to configure the connected sensors</li>
<li>a web service to read the configuration and current sensor values</li>
<li>the data are published via MQTT in a format to be feed into a influxdb</li>
</ul>
The following sensors are supported:<br />
<div class="separator" style="clear: both; text-align: left;">
</div>
<ul>
<li>DS18B20 (multiple)</li>
<li>BME280</li>
<li>Si7021</li>
</ul>
<div>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://2.bp.blogspot.com/-xlzHk5J-95U/XMXFy3-jXfI/AAAAAAAABM8/N5iW_Vfc5Eo-RW6fOAweqEk1WLrLIaAMgCLcBGAs/s1600/SensorNode_ConfigPage.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img alt="SensorNode config page" border="0" data-original-height="425" data-original-width="717" height="377" src="https://2.bp.blogspot.com/-xlzHk5J-95U/XMXFy3-jXfI/AAAAAAAABM8/N5iW_Vfc5Eo-RW6fOAweqEk1WLrLIaAMgCLcBGAs/s640/SensorNode_ConfigPage.png" title="SensorNode config page" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">SensorNode configuration page<br />
<br />
<div style="text-align: left;">
<span style="font-size: small;">I designed a board to be put into a USB port with a temperature and a humidity sensor. </span></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td><a href="https://2.bp.blogspot.com/-vMyc6ojZvHw/XMXFymmbwcI/AAAAAAAABM4/5L5yaiK8ggoK1PHuEcQfmhTrCLAr31ZjgCLcBGAs/s1600/SensorNode_Circuit.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img alt="SensorNode circuit" border="0" data-original-height="681" data-original-width="977" height="446" src="https://2.bp.blogspot.com/-vMyc6ojZvHw/XMXFymmbwcI/AAAAAAAABM4/5L5yaiK8ggoK1PHuEcQfmhTrCLAr31ZjgCLcBGAs/s640/SensorNode_Circuit.png" title="SensorNode circuit" width="640" /></a></td></tr>
<tr><td class="tr-caption">SensorNodeUSB circuit<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td><a href="https://3.bp.blogspot.com/-hmN3l2Bhgns/XMXGgyOXDjI/AAAAAAAABNI/HihkRRSbN90KjAeUDb-UrW1L95H_kB8QgCLcBGAs/s1600/SensorNodeUsb_Bottom.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img alt="SensorNode pcb bottom side" border="0" data-original-height="493" data-original-width="1600" height="123" src="https://3.bp.blogspot.com/-hmN3l2Bhgns/XMXGgyOXDjI/AAAAAAAABNI/HihkRRSbN90KjAeUDb-UrW1L95H_kB8QgCLcBGAs/s400/SensorNodeUsb_Bottom.png" title="SensorNode pcb bottom side" width="400" /></a></td></tr>
<tr><td class="tr-caption">SensorNodeUSB PCB bottom side<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td><a href="https://4.bp.blogspot.com/-LdRSBhqEuLE/XMXGhKfnpxI/AAAAAAAABNM/6UcQm2jBHAMtJNWvCbeHEvrlNtW2BPTVwCLcBGAs/s1600/SensorNodeUsb_Top.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img alt="SensorNode pcb top side" border="0" data-original-height="493" data-original-width="1600" height="122" src="https://4.bp.blogspot.com/-LdRSBhqEuLE/XMXGhKfnpxI/AAAAAAAABNM/6UcQm2jBHAMtJNWvCbeHEvrlNtW2BPTVwCLcBGAs/s400/SensorNodeUsb_Top.png" title="SensorNode pcb top side" width="400" /></a></td></tr>
<tr><td class="tr-caption">SensorNodeUSB PCB top side</td></tr>
</tbody></table>
</td></tr>
</tbody></table>
</td></tr>
</tbody></table>
</td></tr>
</tbody></table>
More information can be found in the GitHub repo <a href="https://github.com/thomo/sensornode" target="_blank">SensorNode</a>.<br />
<br />
<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
ThoMohttp://www.blogger.com/profile/04642076950659900073noreply@blogger.com2tag:blogger.com,1999:blog-1484535516510095594.post-67441300594424769952018-03-25T13:02:00.000+02:002018-03-30T10:48:48.276+02:00ESP8266 - Convert from human readable date/time to epoch timestamp in Lua<p>
For my current ESP8266 NodeMCU project I need a Lua function to convert the date/time returned by the DS3231 to epoch timestamp.
</p>
<p>
<b>Update:</b> I also wrote a function to verify the validity of the input parameter (see <a href="https://gist.github.com/thomo/0068bf8e881fa88a778fdf8dae9c8e6c">this github gist</a>)
</p>
<script src="https://gist.github.com/thomo/8ac2bceb6400eb8868c651e8897be958.js"></script>
ThoMohttp://www.blogger.com/profile/04642076950659900073noreply@blogger.com1tag:blogger.com,1999:blog-1484535516510095594.post-54483081673438351632017-01-07T20:31:00.000+01:002019-07-14T19:10:02.355+02:00Wifi Scanner with ESP8266 + TFT ST7735B (NodeMCU)After <a href="http://www.handverdrahtet.org/2017/01/esp8266-nodemcu-18-inch-tft-lcd-display.html">successful connect the ESP8266 with the ST7735 display</a> I want to do more than the demo - so here comes a Wifi Scanner.<br />
<br />
Same hardware setup as in the previous blog post.
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-p9ZIxvEKPz8/WHFBPypIhnI/AAAAAAAAA5w/ivjhvmOJve4aud5LAc8MSf5HL2UXe2s0ACLcB/s1600/IMG_5103.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="182" src="https://3.bp.blogspot.com/-p9ZIxvEKPz8/WHFBPypIhnI/AAAAAAAAA5w/ivjhvmOJve4aud5LAc8MSf5HL2UXe2s0ACLcB/s400/IMG_5103.jpg" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /><iframe width="320" height="266" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/a1xX6_wVmso/0.jpg" src="https://www.youtube.com/embed/a1xX6_wVmso?feature=player_embedded" frameborder="0" allowfullscreen></iframe></div>
<br />
And here is the source code:
<script src="https://gist.github.com/thomo/1d8d87eedca8a518a1d8cdd0f12ec9fb.js"></script>
ThoMohttp://www.blogger.com/profile/04642076950659900073noreply@blogger.com16tag:blogger.com,1999:blog-1484535516510095594.post-64355612418574716422017-01-02T14:55:00.001+01:002021-11-22T20:59:15.241+01:00ESP8266 (NodeMCU) + 1.8 Inch TFT LCD Display Modul 128X160 SPI Serial ST7735B<div>
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.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/--mTDQ_ZHfCU/WGo9pvcurlI/AAAAAAAAA5Y/i7i0I1jh9Rk5HOKg7rCpBFX9_tJn3EAogCLcB/s1600/IMG_5098.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="266" src="https://3.bp.blogspot.com/--mTDQ_ZHfCU/WGo9pvcurlI/AAAAAAAAA5Y/i7i0I1jh9Rk5HOKg7rCpBFX9_tJn3EAogCLcB/s320/IMG_5098.jpg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-BICq8oPP098/WGo9py2PCTI/AAAAAAAAA5c/TZQ7uvnFLqAMhZhDq_liLCSd-qXHXdqrACLcB/s1600/IMG_5099.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="268" src="https://4.bp.blogspot.com/-BICq8oPP098/WGo9py2PCTI/AAAAAAAAA5c/TZQ7uvnFLqAMhZhDq_liLCSd-qXHXdqrACLcB/s320/IMG_5099.jpg" width="320" /></a></div>
<br />
<br />
You need a NodeMCU firmware with (at least) the modules <b>bit</b> and <b>UCG</b> (with st7735 display option).<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://1.bp.blogspot.com/-rfvD2hlcZIE/YZv1c21VV3I/AAAAAAAACUU/J_aWBT1WbyYqQqqy5JQAZtYmn9qzAlGcwCPcBGAYYCw/s795/NodeMCU_custom_builds.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="NodeMCU custom build options." border="0" data-original-height="795" data-original-width="706" height="451" src="https://1.bp.blogspot.com/-rfvD2hlcZIE/YZv1c21VV3I/AAAAAAAACUU/J_aWBT1WbyYqQqqy5JQAZtYmn9qzAlGcwCPcBGAYYCw/w400-h451/NodeMCU_custom_builds.png" title="NodeMCU custom build options." width="400" /></a></td></tr><tr><td class="tr-caption"><a href="https://nodemcu-build.com/"><br class="Apple-interchange-newline" />NodeMCU custom build</a> options.</td></tr></tbody></table>
[Update] Also SPI must be selected! (Thanks to Lorenz)</div><br /><br />
<h2>
Pinout/Connection</h2>
<div>
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.</div>
<div>
<br /></div>
<pre> 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
</pre>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://4.bp.blogspot.com/-brz9Ox36T9g/WGouyc02w2I/AAAAAAAAA5A/ElpqO5azjDoYJIvc_alW1ATHHlHjuS6bwCEw/s1600/IMG_5093.jpg" style="margin-left: auto; margin-right: auto;"><img border="0" height="230" src="https://4.bp.blogspot.com/-brz9Ox36T9g/WGouyc02w2I/AAAAAAAAA5A/ElpqO5azjDoYJIvc_alW1ATHHlHjuS6bwCEw/s400/IMG_5093.jpg" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-size: 12.8px;">ESP8266 NodeMCU dev board</span> connected to 16pin interface of TFT</td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://3.bp.blogspot.com/-fLmlNqxIp2U/WGouxU2UYWI/AAAAAAAAA48/FsNPmdP8ThMukOj8s4fiyT7Rf-TG8ayZwCEw/s1600/IMG_5094.jpg" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://3.bp.blogspot.com/-fLmlNqxIp2U/WGouxU2UYWI/AAAAAAAAA48/FsNPmdP8ThMukOj8s4fiyT7Rf-TG8ayZwCEw/s400/IMG_5094.jpg" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-size: 12.8px;">ESP8266 NodeMCU dev board</span> connected to 8pin interface of TFT</td></tr>
</tbody></table>
<h2>
Test</h2>
I use the GraphicsTest.lua to test the connection. <a href="https://github.com/nodemcu/nodemcu-firmware/tree/master/lua_examples/ucglib">GraphicsTest</a> is part of the NodeMCU examples (you have to upload also all GT_*.lua files to run the test).<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/YOC47XXzriY/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/YOC47XXzriY?feature=player_embedded" width="320"></iframe></div>
<br />ThoMohttp://www.blogger.com/profile/04642076950659900073noreply@blogger.com6tag:blogger.com,1999:blog-1484535516510095594.post-57082987499675364302016-12-29T19:08:00.000+01:002016-12-29T19:10:15.059+01:00Flash ESP8266-12/12ESteps to flash new firmware:<br />
<ol>
<li>(optional) Backup flash<pre>esptool.py --port port-of-esp8266 --baud 115200 read_flash 0x000 4194304 fw_backup.bin</pre>
</li>
<li>Erase flash<pre>esptool.py --port port-of-esp8266 --baud 115200 erase_flash</pre>
</li>
<li>Write esp init data (see <a href="http://nodemcu.readthedocs.io/en/latest/en/flash/#sdk-init-data">SDK Init Data</a>)<pre>esptool.py --port port-of-esp8266 --baud 115200 write_flash 0x3fc000 esp_init_data_default.bin</pre>
</li>
<li>Write firmware<pre>esptool.py --port port-of-esp8266 --baud 115200 write_flash 0x0000 fw.bin</pre>
</li>
</ol>
ThoMohttp://www.blogger.com/profile/04642076950659900073noreply@blogger.com0tag:blogger.com,1999:blog-1484535516510095594.post-52887573678493187112016-08-04T15:45:00.002+02:002019-07-14T19:10:02.326+02:00Notes about ESP8266-12/12e adapter plate<div class="separator" style="clear: both; text-align: left;">
Below you see the "circuit" on the ESP8266-12/12e adapter board. </div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-3wXElffrXlg/V7sJvwdJiVI/AAAAAAAAAi4/pTrUfeeCOLUHYmvgmJHA59anLnOVHscuwCLcB/s1600/IMG_0607.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://2.bp.blogspot.com/-3wXElffrXlg/V7sJvwdJiVI/AAAAAAAAAi4/pTrUfeeCOLUHYmvgmJHA59anLnOVHscuwCLcB/s320/IMG_0607.png" width="319" /></a>
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-Ie4IPJGQfBw/V7sJwF3lhfI/AAAAAAAAAi8/NmRU97sJmwA7F9_R6Lw47hV0wf9-AipzACLcB/s1600/IMG_0606.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="316" src="https://1.bp.blogspot.com/-Ie4IPJGQfBw/V7sJwF3lhfI/AAAAAAAAAi8/NmRU97sJmwA7F9_R6Lw47hV0wf9-AipzACLcB/s320/IMG_0606.png" width="320" /></a></div>
<br />
<br />ThoMohttp://www.blogger.com/profile/04642076950659900073noreply@blogger.com0tag:blogger.com,1999:blog-1484535516510095594.post-47602811597517775942016-07-24T12:10:00.000+02:002016-07-24T12:10:00.222+02:00Updated inadyn-mt package for CentOS7I have updated my inadyn-mt rpm/srpm package for CentOS7. It is based on inadyn-mt v02.28.06.<br />
<ul>
<li><a href="https://sites.google.com/a/handverdrahtet.org/public/files/inadyn-mt-2.28.06-2.el7.centos.x86_64.rpm">inadyn-mt-2.28.06-2.el7.centos.x86_64.rpm</a> (RPM)</li>
<li><a href="https://sites.google.com/a/handverdrahtet.org/public/files/inadyn-mt-2.28.06-2.el7.centos.src.rpm">inadyn-mt-2.28.06-2.el7.centos.src.rpm</a> (SRPM)</li>
</ul>
<div>
<br /></div>
ThoMohttp://www.blogger.com/profile/04642076950659900073noreply@blogger.com0tag:blogger.com,1999:blog-1484535516510095594.post-12953064306842862852016-04-10T14:11:00.002+02:002019-07-14T19:10:02.007+02:00ESP-01 + DHT22: Send data to influxdb 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.
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-qxfdnuViSyk/VwpA6ce7wYI/AAAAAAAAAh0/2E270sJTqFo6K9iWGc31YwR5jO8gWDPwQ/s1600/esp8266_dht22.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://4.bp.blogspot.com/-qxfdnuViSyk/VwpA6ce7wYI/AAAAAAAAAh0/2E270sJTqFo6K9iWGc31YwR5jO8gWDPwQ/s400/esp8266_dht22.png" width="400" /></a></div>
<br />
The influxdb is then used by a Grafana instance where I define a panel for the temperature and humidity. Here are the first measurements:
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-uLtctSAj_R4/VwpCZD2neAI/AAAAAAAAAiA/9bELG1Gt7yQbl-ME-C-5SEgggEnUCPXlw/s1600/grafana%2Boutput%2Bdht22.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="156" src="https://3.bp.blogspot.com/-uLtctSAj_R4/VwpCZD2neAI/AAAAAAAAAiA/9bELG1Gt7yQbl-ME-C-5SEgggEnUCPXlw/s640/grafana%2Boutput%2Bdht22.png" width="640" /></a></div>
<br />
Looks like there where a glitch at about 12:30 - I will have a look how often this happen.<br />
And here is the corresponding ESP code:<br />
<script src="https://gist.github.com/thomo/54daf529a2df41731444b75c54dad35a.js"></script>ThoMohttp://www.blogger.com/profile/04642076950659900073noreply@blogger.com0tag:blogger.com,1999:blog-1484535516510095594.post-75792809867590342432016-04-07T20:55:00.000+02:002019-07-14T19:10:02.468+02:00First Steps with ESP-01 on OS X El Capitan - Part 2In <a href="http://www.handverdrahtet.org/2016/03/first-steps-with-esp-01-on-os-x-el.html" target="_blank">part 1</a> I described how I setup my my environment. In this part I will show my first lua programming steps with the ESP8266 using the <a href="https://nodemcu.readthedocs.org/en/dev/" target="_blank">Lua based NodeMCU firmware</a>.<br />
<br />
First I create an init script (init.lua). This will be loaded by the firmware after each boot/restart.<br />
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 <a href="https://3.bp.blogspot.com/-awlKbSKGPw4/Vvrts2h0AgI/AAAAAAAAAhE/ZeV41EDzd0MxiapLdG8qJ7WQFnX6Spj6A/s1600/Bildschirmfoto%2B2016-03-29%2Bum%2B22.59.23.png" target="_blank">last screenshot in part 1</a>).<br />
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.<br />
<br />
I'm looking around an found a post about <a href="https://bigdanzblog.wordpress.com/2015/04/24/esp8266-nodemcu-interrupting-init-lua-during-boot/" target="_blank">Methods of Interrupting init.lua during boot</a>. My init.lua code based mainly on the ideas described there. But here it is:
<script src="https://gist.github.com/thomo/b50470b05ce8cc5202001d22d6151f36.js"></script>
<br />
<ol>
<li>it calls <code>firmwareInfo()</code> to output information about the firmware. For the moment it just inform if it is a FLOAT or INTEGER version</li>
<li>after a delay of <code>BootTimeout</code> ms (to give the NodeMCU some time to initialize it self) <code>init()</code> is called</li>
<li>in <code>init()</code> the serial port is initialized and configured to watch for a transmitted ENTER key</li>
<li>if an ENTER is received the function <code>abort()</code> is called, which set the <code>abortFlag</code> to true.</li>
<li>After <code>AbortTimeout</code>ms <code>startup()</code> is called. There the <code>abortFlag</code> is checked and the startup is canceled or executed by trying to load and execute 'user.lua'</li>
</ol>
The output of such a run without interrupt is shown below:
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-apOQaexBUyU/VwamlJgxEAI/AAAAAAAAAhU/oRbSh5e4vowsLfIGFr9zQq1PgmKM5KIRQ/s1600/output%2Bof%2Binit_lua%2Bwithout%2Buser%2Bscript.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://3.bp.blogspot.com/-apOQaexBUyU/VwamlJgxEAI/AAAAAAAAAhU/oRbSh5e4vowsLfIGFr9zQq1PgmKM5KIRQ/s1600/output%2Bof%2Binit_lua%2Bwithout%2Buser%2Bscript.png" /></a></div>
<br />
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.<br />
<script src="https://gist.github.com/thomo/bb539bb7d5b5f2398a62c7d6ef1231b4.js"></script>
<br />
Output running the script
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-VjCv1Uqizm8/VwassrLPEoI/AAAAAAAAAhk/qV0njZqqMz0ybsBSMvmNAQJG7tP4rkuLQ/s1600/output%2Bdht22%2Bsensor%2Bvalues.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://2.bp.blogspot.com/-VjCv1Uqizm8/VwassrLPEoI/AAAAAAAAAhk/qV0njZqqMz0ybsBSMvmNAQJG7tP4rkuLQ/s1600/output%2Bdht22%2Bsensor%2Bvalues.png" /></a></div>
ThoMohttp://www.blogger.com/profile/04642076950659900073noreply@blogger.com0