tamberg / fhnw-iot Goto Github PK
View Code? Open in Web Editor NEWFHNW Module IoT Engineering (iot)
FHNW Module IoT Engineering (iot)
Add abstract advantages of IoT platforms to lesson 3 slides, e.g. "decouples devices and clients".
Die DHT Library unterstützt den nRF52840 noch nicht, der Prozessor ist zu schnell mit 64MHz.
Um die CPU des nRF52840 zu unterstützen, muss die DHT Library angepasst werden. Im File DHT.h müssen die folgenden Zeilen eingefügt werden:
// 64MHz nRF52840 <== UNSER Controller
#elif (F_CPU == 64000000UL)
#define COUNT 20
am besten direkt nach den 2 Zeilen für den 48MHz Eintrag.
Der Wert für COUNT ist experimental.
Compiling https://github.com/tamberg/fhnw-iot/commits/master/03/Arduino/ESP8266_WiFiClientSecureCaCert leads to
...
ESP8266_WiFiClientSecureCaCert:44:15: error: 'class BearSSL::WiFiClientSecure' has no member named 'setCACert_P'
44 | if (!client.setCACert_P(caCert, caCertLen)) {
| ^~~~~~~~~~~
ESP8266_WiFiClientSecureCaCert:51:16: error: 'class BearSSL::WiFiClientSecure' has no member named 'verifyCertChain'
51 | if (client.verifyCertChain(host)) {
| ^~~~~~~~~~~~~~~
exit status 1
'class BearSSL::WiFiClientSecure' has no member named 'setCACert_P'
https://github.com/tamberg/fhnw-iot/blob/master/04/Arduino/ESP8266_WebServerSecure/ESP8266_WebServerSecure.ino#L10 creates key.pem, but no cert.pem
Tested on Feather nRF52 w/ Grove adapter for Particle Mesh.
Unter Linux stört der ModemManager das adafruit-util. Das führt dazu, dass Flashes nur sporadisch funktionieren und mit mehrfachen Resets. Gelöst werden kann es mit:
sudo bash -c "systemctl stop ModemManager&&systemctl disable ModemManager"
09:36:53.535 -> Advertising ...
09:36:57.550 -> Notify not set, or not connected
09:36:58.540 -> 0, connected to HUAWEI P9 lite
09:36:59.553 -> Notify not set, or not connected
09:37:01.553 -> Notify not set, or not connected
09:37:01.553 -> 0 disconnected, reason = 8
09:37:01.553 -> Advertising ...
reason = 8 =>
#define BLE_HCI_CONNECTION_TIMEOUT 0x08 /* Connection Timeout. */
When installing Node-RED with:
$ bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)
Installation stops with this error:
Bad install: Node.js missing
After installing Node-RED, Node.js no longer works:
$ node -v
Feather nRF52840 seems to reboot randomly.
TODO: test if this happens without Grove adapter.
The setName() call in https://github.com/tamberg/fhnw-iot/blob/master/05/Arduino/nRF52840_UartBlePeripheral/nRF52840_UartBlePeripheral.ino#L111 seems to have no effect.
(The same call seems to work in https://github.com/tamberg/fhnw-iot/blob/master/05/Arduino/nRF52840_HrmBlePeripheral/nRF52840_HrmBlePeripheral.ino#L94)
E.g. $ openssl s_client -showcerts -connect test.mosquitto.org:8883
Got Error: Cannot find module '@abandonware/noble'
?
Run $ npm install @abandonware/noble
in the same directory as your Node.js source code, e.g.
cd fhnw-iot/06/Nodejs
DigitalReadSerial of ESP8266 pin 0 / Grove D4 shows no output
Looks like the TTN LoRaWAN v3 payload received in the console changes every time for "Hello, World!" (with ABP).
Not from GitHub.
The Feather Huzzah ESP8266 board seems to reset if used with Particle Grove adapter.
The board keeps rebooting after a short while (check the serial output).
I'm still investigating the issue, maybe a pin pulled to GND.
(The issue only applies to this board.)
Panic /home/user/.arduino15/packages/esp8266/hardware/esp8266/2.4.2/cores/esp8266/abi.cpp:106 __throw_bad_function_call
ctx: cont
sp: 3ffffd60 end: 3fffffd0 offset: 01b0
>>>stack>>>
3fffff10: 3ffef6a8 0000010c 0000010c 4010020c
3fffff20: 3fffdad0 3ffef3c0 3fffff80 401006dc
3fffff30: 3ffef454 0001d4c0 00000001 4020681c
3fffff40: 3ffe8b83 3fffffa0 00000001 40206838
3fffff50: 3ffef6a8 00000107 00000107 4010020c
3fffff60: 3fffdad0 00000000 3fffffa0 401006dc
3fffff70: 00000000 00000000 00000000 40206ea9
3fffff80: 00000000 00000000 3ffef3c0 40203d5d
3fffff90: feefeffe 00000000 3ffef3c0 4020413d
3fffffa0: 00000000 00000000 3ffef629 40203554
3fffffb0: feefeffe 00000000 3ffef629 40207088
3fffffc0: feefeffe feefeffe 3ffe8540 40100739
<<<stack<<<
ets Jan 8 2013,rst cause:2, boot mode:(1,7)
ets Jan 8 2013,rst cause:4, boot mode:(1,7)
wdt reset
Feather Huzzah Error
#include <ESP8266MQTTClient.h>
#include <ESP8266WiFi.h>
MQTTClient mqtt;
void setup() {
Serial.begin(115200);
// WiFi.begin("42", "42424242");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
//topic, data, data is continuing
mqtt.onData([](String topic, String data, bool cont) {
Serial.printf("Data received, topic: %s, data: %s\r\n", topic.c_str(), data.c_str());
mqtt.unSubscribe("/qos0");
});
mqtt.onSubscribe([](int sub_id) {
Serial.printf("Subscribe topic id: %d ok\r\n", sub_id);
mqtt.publish("/qos0", "qos0", 0, 0);
});
mqtt.onConnect([]() {
Serial.printf("MQTT: Connected\r\n");
Serial.printf("Subscribe id: %d\r\n", mqtt.subscribe("/qos0", 0));
// mqtt.subscribe("/qos1", 1);
// mqtt.subscribe("/qos2", 2);
});
mqtt.begin("mqtt://test.mosquitto.org:1883");
// mqtt.begin("mqtt://test.mosquitto.org:1883", {.lwtTopic = "hello", .lwtMsg = "offline", .lwtQos = 0, .lwtRetain = 0});
// mqtt.begin("mqtt://user:[email protected]:1883");
// mqtt.begin("mqtt://user:[email protected]:1883#clientId");
}
void loop() {
mqtt.handle();
}
On MacOS with nRF52840 and Board Manager nRF52 v1.1.0 compiling
void setup() {
Serial.begin(115200);
}
void loop() {
Serial.println("hello");
}
results in
/Users/tamberg/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: sketch/sketch_sep27c.ino.cpp.o: in function `setup':
/Users/tamberg/Documents/Arduino/sketch_sep27c/sketch_sep27c.ino:10: undefined reference to `Serial'
/Users/tamberg/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /Users/tamberg/Documents/Arduino/sketch_sep27c/sketch_sep27c.ino:10: undefined reference to `Adafruit_USBD_CDC::begin(unsigned long)'
/Users/tamberg/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: sketch/sketch_sep27c.ino.cpp.o: in function `loop':
/Users/tamberg/Documents/Arduino/sketch_sep27c/sketch_sep27c.ino:22: undefined reference to `Serial'
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board Adafruit Feather nRF52840 Express.
Rendering glitches on page 5/6 of IoT02...Handout.pdf
(tried to regenerate it, still the same.)
In https://github.com/tamberg/fhnw-iot/wiki/Feather-nRF52840-Express#pinout [FIXED]
and in the script http://www.tamberg.org/fhnw/2019/hs/IoT02Microcontrollers.pdf p. 15 [TODO]
// See https://www.bluetooth.com/wp-content/uploads/Sitecore-Media-Library/Gatt/Xml/Services/org.bluetooth.service.heart_rate.xml
// and https://www.bluetooth.com/wp-content/uploads/Sitecore-Media-Library/Gatt/Xml/Characteristics/org.bluetooth.characteristic.heart_rate_measurement.xml
// and https://www.bluetooth.com/wp-content/uploads/Sitecore-Media-Library/Gatt/Xml/Characteristics/org.bluetooth.characteristic.body_sensor_location.xml
The page https://github.com/tamberg/fhnw-iot/wiki/Feather-nRF52840-Express#setup-for-experts refers to https://www.adafruit.com/package_adafruit_index.json
for the additional Adafruit boards.
The new URL is https://adafruit.github.io/arduino-board-index/package_adafruit_index.json
, source: https://github.com/adafruit/Adafruit_nRF52_Arduino#recommended-adafruit-nrf52-bsp-via-the-arduino-board-manager
The proposed solution https://github.com/tamberg/fhnw-iot/blob/master/02/Arduino/nRF52840_KitchenTimer/nRF52840_KitchenTimer.ino requires short button press times only, < 100 ms.
(via R. Previti)
[28132] Error loading Python lib '/var/folders/y3/10ms8xj50fzbnrzyc6tbpdw80000gn/T/_MEI4xOfhq/libpython3.8.dylib': dlopen: dlopen(/var/folders/y3/10ms8xj50fzbnrzyc6tbpdw80000gn/T/_MEI4xOfhq/libpython3.8.dylib, 10): Symbol not found: _preadv
Referenced from: /var/folders/y3/10ms8xj50fzbnrzyc6tbpdw80000gn/T/_MEI4xOfhq/libpython3.8.dylib (which was built for Mac OS X 11.1)
Expected in: /usr/lib/libSystem.B.dylib
in /var/folders/y3/10ms8xj50fzbnrzyc6tbpdw80000gn/T/_MEI4xOfhq/libpython3.8.dylib
exit status 255
/Applications/Arduino.app/Contents/Java/arduino-builder returned 255
Error compiling for board Adafruit Feather nRF52840 Express.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.