@mwalker Excellent, your suggestion worked perfectly. Many Thanks Sir...you are a STAR
tango156157
@tango156157
Best posts made by tango156157
-
RE: Round water tank level sensor
Latest posts made by tango156157
-
RE: Multi Button Relay Sketch
@korttoma Hello Sir, many thanks for such an elegant piece of code for controlling multiple relays.
I would greatly appreciate if you provide me some tips or updated code on using your code for a "Bi stable" Button setup, i.e. using conventional home switches (ON or OFF states) for controlling relays.Thanks
T -
ESP8266 Gateway Sending data directly to Cloud MQQT or Thingspseak...?
Hi,
I am planning to create Door Sensor running on MySensors using low power hardware and sleeping most of the time.
At receiving end, I want to build an ESP8266 Gateway connected as per MySensor design.
I, however want to send data directly to cloud based service like MQTT or Thingspeak.
I want to then display data on a Mobile App or website. I want to keep the cost low
so bypassing the local Controller is the only option (usually Domoticz running on a RPi3 etc..)
Plus I can keep the Node (Door Sensor on Reed Switch) running on Battery and the Gateway kept anywhere in the house where Wifi is available with a 24X7 power source.I wanted to check with the forum members if this is feasible? On a high level this sounds doable but wanted to check before I go down this road.
Many Thanks~~~
T -
RE: coin-cell (CR2032) powered temperature sensor
@fleinze thanks for sharing your code for Si7021 sensor. I tried compiling but getting below error. Not sure if I am using incorrect header file for Si7021 sensor. I am using MySensors ver 2.1.0 for compiling. Any view? Thanks
C:\Users\abc\AppData\Local\Temp\arduino_modified_sketch_641038\sketch_may14a.ino: In function 'void loop()': sketch_may14a:91: error: 'si7021_thc' was not declared in this scope si7021_thc temphum = sensor.getTempAndRH(); ^ sketch_may14a:91: error: expected ';' before 'temphum' si7021_thc temphum = sensor.getTempAndRH(); ^ sketch_may14a:95: error: 'temphum' was not declared in this scope float temperature = (float)(temphum.celsiusHundredths) / 100.0; ^ Multiple libraries were found for "SI7021.h" Used: C:\Users\abc\Documents\Arduino\libraries\SI7021 Not used: C:\Program Files (x86)\Arduino\libraries\SI7021 exit status 1 'si7021_thc' was not declared in this scope Insert Code Here
-
RE: coin-cell (CR2032) powered temperature sensor
@fleinze Great work with the CR2032 coin cell temp. sensor. I am trying to do a similar exercise with Si7021 sensors but getting into issues while coding. The examples from other posts around Si7021 adapted for latest MySensor lib seem to get stuck in my IDE giving lot of errors. I have tried getting all the required Header files but still get stuck due to some random error. Is it possible for you to share your code based on CR2032 temp node running on Si7021? Thanks....
-
RE: My Sensorized Weighing scale - Need help in code modification
@kontrollable Thanks, that looks like a better option.. I will try this option and come back with how it went....Thanks All for ur suggestion as awlays
-
My Sensorized Weighing scale - Need help in code modification
I have been working on creating a Weighing scale using a 5 Kg Load Cell and HX711 Amp connected to a MySensor node. I plan to have a dynamic weighing scale for reporting weight of anything kept on the Load cell sensor (Aluminium Bar form factor load cell) . Ideal use case can be a Weight scale node kept in a refrigerator measuring the weight of a Milk bottle. The system will send out notification in case the milk bottle starts running low, which can be a trigger to go shop for groceries when your away from home.
Initial code for calibration of Load cell was taken from this website and then factored into My Sensor code. I have since been able to make a working node in MySensor and able to display weight data in Domoticz. I would like to further refine the code and make it more practical.
Source webiste: [http://circuits4you.com/2016/11/25/hx711-arduino-load-cell/](link url)
I am beginner in MySensor and C/C++ coding so thought it would be best if the My Sensor community can help me out in below objectives:
-
Ideally, I would want the sensor to be battery powered so I have ensured that I run a barebones Atmega 328p on 8 Mhz internal clock. Is it possible that
the sensor node is always in deep sleep consuming min battery power and only wake up if only requested from the Controller (in my case Domoticz). This way
the sensor will only report weight data when asked for and result in minimal battery usage and user can "Query" the node for the weight. Not sure if this will use
an Interrupt function. The readings from the Load Cell sampled every 3 seconds in my code below vary by a very small amount say by .001 gms. -
Send a keep alive message say every 1 hour and update controller on the Weight.
Any help suggestions are welcome and really appreciate the MySensors Team and Community for being awwsum every time!
Thanks....Source Code created for the Weight node
#define MY_DEBUG #define MY_RADIO_NRF24 #define MY_NODE_ID 10 #include <MySensors.h> #include <SPI.h> #include "HX711.h" #define DOUT 3 #define CLK 2 HX711 scale(DOUT, CLK); float calibration_factor = -465000; //calcuated by trial and error; goal was to ensure Zero weight reading when no weight on the load cell #define CHILD_ID_WEIGHT 1 unsigned long waitTime = 3000; // delay in milliseconds to set time between data readings float weight_read; MyMessage msgVolume(CHILD_ID_WEIGHT, V_LEVEL); void setup() { scale.set_scale(); scale.tare(); } void presentation() { sendSketchInfo("Weight Sensor", "1.0"); present(CHILD_ID_WEIGHT, S_DUST,"Weight"); } void loop() { data_calc(); { send(msgVolume.set(weight_read, 3)); } wait(waitTime); //Wait then back to loop } void data_calc() { scale.set_scale(calibration_factor); #ifdef MY_DEBUG Serial.print("Reading: "); Serial.print(scale.get_units(), 3); Serial.print(" kg"); weight_read = scale.get_units(); Serial.print(" Weight Read by sensor: "); Serial.print(weight_read, 3); Serial.println(); #endif }
Output in Serial monitor
Starting sensor (RNNNA-, 2.0.0) TSM:INIT TSM:RADIO:OK TSP:ASSIGNID:OK (ID=10) TSM:FPAR TSP:MSG:SEND 10-10-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSP:MSG:READ 0-0-10 s=255,c=3,t=8,pt=1,l=1,sg=0:0 TSP:MSG:FPAR RES (ID=0, dist=0) TSP:MSG:PAR OK (ID=0, dist=1) TSM:FPAR:OK TSM:ID TSM:CHKID:OK (ID=10) TSM:UPL TSP:PING:SEND (dest=0) TSP:MSG:SEND 10-10-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1 TSP:MSG:READ 0-0-10 s=255,c=3,t=25,pt=1,l=1,sg=0:1 TSP:MSG:PONG RECV (hops=1) TSP:CHKUPL:OK TSM:UPL:OK TSM:READY TSP:MSG:SEND 10-10-0-0 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=ok:0100 TSP:MSG:SEND 10-10-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=ok:2.0.0 TSP:MSG:SEND 10-10-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=ok:0 TSP:MSG:READ 0-0-10 s=255,c=3,t=6,pt=0,l=1,sg=0:M TSP:MSG:SEND 10-10-0-0 s=255,c=3,t=11,pt=0,l=13,sg=0,ft=0,st=ok:Weight Sensor TSP:MSG:SEND 10-10-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=ok:1.0 TSP:MSG:SEND 10-10-0-0 s=1,c=0,t=24,pt=0,l=6,sg=0,ft=0,st=ok:Weight Request registration... TSP:MSG:SEND 10-10-0-0 s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=ok:2 TSP:MSG:READ 0-0-10 s=255,c=3,t=27,pt=1,l=1,sg=0:1 Node registration=1 Init complete, id=10, parent=0, distance=1, registration=1 Reading: 0.000 kg Weight Read by sensor: -0.000 TSP:MSG:SEND 10-10-0-0 s=1,c=1,t=37,pt=7,l=5,sg=0,ft=0,st=ok:-0.000 Reading: 0.001 kg Weight Read by sensor: 0.002 TSP:MSG:SEND 10-10-0-0 s=1,c=1,t=37,pt=7,l=5,sg=0,ft=0,st=ok:0.002 Reading: 0.229 kg Weight Read by sensor: 0.229 TSP:MSG:SEND 10-10-0-0 s=1,c=1,t=37,pt=7,l=5,sg=0,ft=0,st=ok:0.229 Reading: 0.229 kg Weight Read by sensor: 0.228 TSP:MSG:SEND 10-10-0-0 s=1,c=1,t=37,pt=7,l=5,sg=0,ft=0,st=ok:0.228 Reading: 0.229 kg Weight Read by sensor: 0.228 TSP:MSG:SEND 10-10-0-0 s=1,c=1,t=37,pt=7,l=5,sg=0,ft=0,st=ok:0.228 Reading: 0.228 kg Weight Read by sensor: 0.227 TSP:MSG:SEND 10-10-0-0 s=1,c=1,t=37,pt=7,l=5,sg=0,ft=0,st=ok:0.227 Reading: 0.229 kg Weight Read by sensor: 0.228 TSP:MSG:SEND 10-10-0-0 s=1,c=1,t=37,pt=7,l=5,sg=0,ft=0,st=ok:0.228 Reading: 0.227 kg Weight Read by sensor: 0.228 TSP:MSG:SEND 10-10-0-0 s=1,c=1,t=37,pt=7,l=5,sg=0,ft=0,st=ok:0.228 Reading: 0.229 kg Weight Read by sensor: 0.227
-
-
RE: Round water tank level sensor
@mwalker Excellent, your suggestion worked perfectly. Many Thanks Sir...you are a STAR
-
RE: Round water tank level sensor
@mwalker Thanks for the explanation, that makes sense. I was actually doing scale testing on a small water container which has calibrated level in litres. I am also still catching up on C which is as rusty if not worse Please could you help me in how we can declare Decimals argument in the msg set?
' Many Thanks -
RE: Round water tank level sensor
Hi again. I added the 3 lines of code you provided to my code and below is the output i get in the serial capture. The height calculations are coming out correctly, however the calculated volume of water available is 1 or 0 (evident from the output below).
I am using MPX5010DP differential pressure sensor. Thanks for your help.
53518 TSF:MSG:SEND,9-9-0-0,s=1,c=1,t=37,pt=2,l=2,sg=0,ft=0,st=OK:0 53529 TSF:MSG:SEND,9-9-0-0,s=2,c=1,t=37,pt=1,l=1,sg=0,ft=0,st=OK:10 Raw sensor value: 111 sensor value: 0.75 height calculated: 9.76 Percentage Available: 10 Litres Available: 1 Raw sensor value: 46 sensor value: 0.11 height calculated: 1.43 Percentage Available: 90 Litres Available: 0 59545 TSF:MSG:SEND,9-9-0-0,s=1,c=1,t=37,pt=2,l=2,sg=0,ft=0,st=OK:0 59555 TSF:MSG:SEND,9-9-0-0,s=2,c=1,t=37,pt=1,l=1,sg=0,ft=0,st=OK:90 Raw sensor value: 41 sensor value: 0.07 height calculated: 0.91 Percentage Available: 100 Litres Available: 0
-
RE: Round water tank level sensor
Hi Boots33,
I was going through your post and found the Water level sensor project really awwsum.
I re-did the project, but this time with a Differential Pressure sensor connected to a watertight pipe connected to it. The height of the water determines the incremental pressure differential created in the sensor which provides the reading. I then convert the
reading into sensed height of the water level and calculate volume of remaining water in a cylindrical water tank. In the initial testing of the code I did without mysensor setup - the results were quite accurate. I am however facing challenge in displaying data onto Domoticz where volume is showing up incorrectly. I have borrowed heavily from your code (Many thanks for this )Issues I face, where I request your / any forum members help is:
- Calculated Water volume and Water %is showing as Zero
- If I tweak the variable 'waterAvail' as float, i get errors - "call of overloaded 'set(float&)' is ambiguous"
- Volume is showing as Zero in Domoticz.
Can I modify the presentation layer to show as Info and V_text?
Please advise.
Thanks
Regards
T#define MY_DEBUG #define MY_RADIO_NRF24 #define MY_NODE_ID 9 #include <MySensors.h> #include <SPI.h> #define CHILD_ID_WATER 1 #define CHILD_ID_PERCENT 2 unsigned long heartbeatDelay = 120; // how often the heartbeat will be sent, in minutes unsigned long lastHeartbeat = millis(); // holder for last time heartbeat was sent unsigned long waitTime = 3000; // delay in milliseconds to set time between data readings signed int waterAvail; // holds current water available in litres byte oldWaterPercent; byte waterPercent = 0 ; // used to hold the tank water level percentage const float SensorOffset = 36; float sensorValue; float height; float volume; MyMessage msgVolume(CHILD_ID_WATER, V_LEVEL); //water availble in liters MyMessage msgPercent(CHILD_ID_PERCENT, V_LEVEL); // water percentsge available void setup() { } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Tank Level", "1.0"); // Register all sensors to gateway (they will be created as child devices) present(CHILD_ID_WATER, S_DUST,"Water Available"); present(CHILD_ID_PERCENT, S_DUST,"Water Percentage Available"); } void loop() { data_calc(); // perform calculations to get water remaining etc. if(oldWaterPercent != waterPercent) { //check to see if new water data is available send(msgVolume.set(waterAvail)); send(msgPercent.set(waterPercent)); oldWaterPercent = waterPercent; } heartbeatCheck(); // call heartbeat function wait(waitTime); //Wait then back to loop } void heartbeatCheck(){ unsigned long millisNow = millis(); // get the current time if ((millisNow - lastHeartbeat) > (heartbeatDelay*60000)) { sendHeartbeat(); wait(5); // sendBatteryLevel(100); lastHeartbeat = millis(); #ifdef MY_DEBUG Serial.println("Heartbeat Sent" ); #endif } } void data_calc() { sensorValue = (analogRead(A0)-SensorOffset)/100.0; // Offset used here to correct Sensor read value height = (sensorValue*(9.5/0.73)); // Calculating height derived from sensor value * sensor constant waterAvail = (((5.8*5.8)*3.14)*height)/1000; // calculating volume of hollow cylinder with radius 5.8 cms waterPercent = map(height,0,10,100,0); // calculate the percentage of water available #ifdef MY_DEBUG Serial.print("sensor value: "); Serial.println(sensorValue); Serial.print("height calculated: "); Serial.println(height); Serial.print("Percentage Available: "); Serial.println(waterPercent); Serial.print("Litres Available: "); Serial.println(waterAvail); #endif }