NodeManager on STM32F103C8 - RS485 Gateway + INA219 + OLED
-
Hi all,
two monts ago I've created simple RS485 gateway (with NodeManager) based on STM32F103C8. It's working very stable (ok right now I'm using only two nodes- for test reason) and now I've created 2-nd version with INA219 and OLED SH1106.
The reason is that I'd like to make something like PoE (my RS485 are connected over CAT7 cable with 2 pairs as power line 12V for nodes) and my RS485-gateway should send to Domoticz status of voltage, summary current and power consumption of my 485-nodes. Because I'd like to use display in vertical (2xDIN case) need to use U8g2lib.h library. It's working ok with constant text but how I can read out vales of NodeManager variable eg.float voltage = ((ina219*)nodeManager.getSensor(0))->getValueFloat();
General my question is how can I, in main loop, get value from NodeManager sensors?
Part of my code - compile error (because of variable)// call NodeManager before routine nodeManager.before(); u8g2.begin(); u8g2.firstPage(); do { u8g2.setFont(u8g2_font_helvR10_tf); u8g2.drawStr(3,15,"Voltage"); u8g2.drawStr(3,45,"Current"); u8g2.drawStr(3,75,"Power"); } while ( u8g2.nextPage() ); delay(5000); u8g2.clear(); u8g2.firstPage(); do { u8g2.drawStr(1, 32, "START"); } while ( u8g2.nextPage() ); }
// loop void loop() { // digitalWrite(MY_DEFAULT_ERR_LED_PIN, state); while (transportCheckUplink() == false){ u8g2.firstPage(); do { u8g2.setFont(u8g2_font_helvR14_tf); // 14 px height u8g2.drawStr(3, 32, "Disconnected!"); } while ( u8g2.nextPage() ); } // call NodeManager loop routine nodeManager.loop(); int sensorIna219_Id = nodeManager.registerSensor(ina219); float voltage = ((ina219*)nodeManager.getSensor(0))->getValueFloat(); float current = ((ina219*)nodeManager.getSensor(1))->getValueFloat(); float power = ((ina219*)nodeManager.getSensor(2))->getValueFloat(); u8g2.firstPage(); do { u8g2.setFont(u8g2_font_helvR10_tf); u8g2.drawStr(3,15,"Voltage"); u8g2.drawStr(3,45,"Current"); u8g2.drawStr(3,75,"Power"); u8g2.setFont(u8g2_font_fub30_tn); u8g2.setCursor(3, 35); u8g2.print(voltage); u8g2.setCursor(3, 70); u8g2.print(current); u8g2.setCursor(3, 100); u8g2.print(power) } while ( u8g2.nextPage() ); }
I know it's little be chaotic - hope not problem to understand
B.R.
AdamP.S.
my ArduinoIDE 1.8.9, MySensors 2.3.1 and NodeManager 1.9 dev
-
@adampr1 sorry for reading this thread only now with so much delay
Nice project btw! Which compilation error are you receiving from Nodemanager? I also wonder if you can leverage Nodemanager's hooks capabilities to interact with it in a more clean way. Thanks!
Suggested Topics
-
Sensors db
My Project • 16 Apr 2014, 07:06 • Dvbit 16 Apr 2014, 17:37 -
DS18B20 ESP32 nodemanager problem
NodeManager • 13 Sept 2022, 10:59 • A3V 15 Sept 2022, 22:11 -
Compilation error
NodeManager • 19 Sept 2020, 15:41 • htaxil 18 Oct 2020, 09:37 -
Help needed with connecting MySensors node to Home Assistant
NodeManager • 16 May 2024, 09:59 • HJ_SK 19 May 2024, 15:01 -
Battery Level
NodeManager • 7 Aug 2022, 21:11 • bbastos 7 Aug 2022, 21:11 -
Nrf5x on NodeManager
NodeManager • 9 Apr 2019, 14:26 • nullos 6 Nov 2020, 09:28