i tested that if the relay is powered directly and not through the aduino and for all my usb chargers, the switch is 100% responding. dont know really why but it seems better.
Posts made by fhenryco
-
RE: Best way to power nano and relay?
-
RE: Best way to power nano and relay?
Thank you for your comments.
Indeed i'm using the relay module so in principle i avoid problems and it should be fine. -
RE: Best way to power nano and relay?
Well, it can only be a problem of powering given that for one of my USB power devices everything works fine most of the time. The wiring diagram is completely defined by what i specified: exactly what you have here
https://www.mysensors.org/build/relay
except i use the 5V pin of a nano arduino to the Vcc of the relay...and that the nano is powered through it's usb connector.I intend to do some tests with a breadboard to see if it works better when the relay is powered directly instead of through the arduino ... as i'v seen such advice somewhere else on the web...
somewhere else people were talking about reducing the power of the RF24 (MY_RF24_PA_LEVEL ) in Myconfig.h ...(?) -
Best way to power nano and relay?
Hello , i have a relay actuator connected to an arduino nano (powered by it's 5V pin) .
When the nano is itself powered through it's usb mini connector by a small USB cable plugged into-
a computer USB port...the relay does not work.
-
A 3 ports 5V 3A USB power adapter ...the relay does not work.
(tested with 2 such adapters). for instance:
- A 1 port 5V 3A USB power adapter of another brand ... the relay works (clicking the switch in domoticz , triggers the relay) most of the time but not all the time.
So i'm wondering what is the correct way to power the arduino&relay so that it works all the time? why it does not always work even powered by standard 5v 3a usb power adapters ?
Controller side, i tested it with domoticz on raspberry with mysensors usb gateway.
thanks in advance. -
-
RE: MySensors vs Zigbee
I have a similar question : "Mysensors vs Bluetooth BLE".
More specifically, what was the point to develop the mysensor protocol when BLE is available with very low cost modules (which is not the case for zigbee in general much more expansive) ?Is it that BLE is constrained to remain on 2.4 GHz when mysensors protocol can run on many frequencies kind of transmitters ?
Is it that mysensors can be even cheeper ?
As far as i have understood a similiratity is that both are not IP based nor mesh protocols.
....
BLE is a much more complex protocol up to the application layer however the success of mysensors in the DiY community seems to imply that much of the extra offered capabilities by BLE (security?, complete endpoint identification to the network?, network management capabilities? ) are of little value for most domotics applications ...(?)Or may be it's just that BLE is not designed to allow the BLE nodes to declare themselves to controllers such as domoticZ , ...
-
RE: Diy Awake signal sensor
@gohan the last pulse count seems to be requested from the gateway ... does the gateway automatically reflects all user variables defined in the controller so that other nodes can access them by requesting from the gateway?
-
Diy Awake signal sensor
I did not find any info about how i could use reception of the heartbit signal in domoticz to build a AWAKE/SLEEPING variable...and smartsleep is also not supported by DZ.
SO i'm trying the other way which is to have a sensor that would indicate to the controller when the node is awake so that the controller could use such device variable in a script and react to this in order to send various switches commands which were kept in the state of a dummy switch just waiting for the node to wake up.To have such a DiY awake/sleep sensor detector i was thinking that i could use one pin of the node reflecting the state of the node (for instance HIGH when the node is awake and LOW when the node is sleeping: i can do that in nodemanager with nodeManager.setAutoPowerPins(true) for the pin i want ) and use this as an interrupt toward another pin of the node defined as the input pin of a sensor switch (as in a motion detector) ... : so waking up of the node would interrupt itself and the controller would be notified
i managed to make this work (in node manager) but sometimes it is unstable and i also realized by chance that such sensor switch could trigger when the nodes wake up even if it is left open (not connected to any other pin).
But unsurprisingly i also encountered some apparantly instable behaviours (glitches) from time to time... so i'm wondering what much more simple solution did i miss..
any comment or suggestion welcome! -
RE: 💬 Relay
i also just realized that there is a special AREF pin intended for what i was thinking about ... but it's not available on the mini pro.
My measurements using Vcc as Ref have been indeed very fluctuating, however what i get was highly sufficient to monitor the battery feeding a 3.3v step up regulator to the arduino and help anticipate failure
-
RE: 💬 Relay
wow! fantastic! ... the github link readme warns that it's not yet fully ready but the interface is already impressive!
I still have the same question i had for nodemanager though : for measuring another battery than the one that feeds Vcc obviously another pin is needed, however why not propose as well the option of measuring such pin voltage but with Vcc as the reference rather than the internal 1.1V which most of the time makes necessary a voltage divider ? Actually i did the modification in nodemanager.cpp to use DEFAULT (~3.3V) rather than INTERNAL (1.1V) reference for a 3.3 pro mini and i can get the expected battery level without any voltage divider.Another unrelated question i have is : could there be any way to adapt the idea of the readVcc method (which is to measure the internal 1.1V against the Vcc reference to get Vcc) but using any voltage applied to a pin as the reference to again measure the internal 1.1 against it ? This would allow the masurement of any voltage greater than 1.1 without voltage divider while the usual method would be applied for measuring any voltage lower than 1.1 ... what did i miss that makes this impossible ?
-
RE: 💬 Relay
After testing some functionalities of nodemanager, i was wondering if already somebody was working on making a GUI for nodemanager which would allow to build one's sketch completely from a graphical interface (at least the most common and basic functionalities) : i thing the great work that resulted in Nodemanager has so well structured the various functions needed that it has already paved the way for creating such a graphical interface.
-
RE: 💬 Relay
@mfalkvidd You are right but may be should there be for each sensor or actuator first the most basic sketch but also at the end of the page a complete version with all functionalities and granted to work by the mysensors team.
Of course for the complicated sketch version a big warning in red letters that this is not recommended for newbies would help...
-
voltperbits and reference voltage
Hi,
i'm currently testing the functionalities of node manager as for battery monitoring.
As i understand it your
void setBatteryInternalVcc(bool value) in case bool =true is only to measure the Vcc the arduino is powered through.
To measure another voltage , for instance the input voltage Vbatt of a step up regulator that feeds the arduino, Vbatt then being the actual battery voltage, we have no option except using bool = false and use a voltage divider to measure Vbatt on a chosen arduino pin with 1.1V as the reference.
... or what did i miss because your default value for voltperbits which is ~ 3.3 /1024 seems to imply that the reference is 3.3V in which case a voltage divider is not needed...what is your actual reference when measuring voltages? is it actually not defined and needing to be defined by using void setReference(int value) ? ... a bit misleading because in your documentation this void is not refered to in your battery management section
-
RE: GPS and GSM
what would you say is the main benefit of the A6 module with respect to a sim800L
-
RE: GPS and GSM
@gohan
That's what i'm trying to understand ... also MQTT gateway needs ethernet, and there is no such thing available for a gps tracker which can only communicate through gsm, and once the data are received through the gsm network , one would just like to be able to collect them and translate to a location on a map or to get them in a controller where it can be used with other sensor data to trigger scripts ... for all this i was wondering why the simplest solution would not be the better : (mfalkvidd seems to agree) just a sketch to collect gps data and send them as sms and nothing else ... However part of the mysensors protocol devoted to presentation of child objects and so on would make sense if the final receiver, for instance domoticZ could recognize it even though it was received through SMS ...(i don't have the impression that this is possible so far? i don't even know wether domoticZ can recognize and handle sensors and actuators through SMS. yet that would be cool all the more since we have this smsgateway sketch which could evolve to become a genuine SMSgateway or even WAN gateway if it could talk to a controller through the exchange of SMS or Lora messages and to other sensors with the wireless short distance mysensors protocol )LoraWan will be the next step. Actually i dont have a specific project, i'm just exploring as much as i can all IoT possibilities as a teacher in networks and telecoms... Many thanks for all the valuable info i got from mysensors forum
-
RE: GPS and GSM
What i don't get is why you propose this : would there be any benefit of such an ethernet gateway (if the specific mysensors protocol is actually useless) over a mere arduino with sketch for GPS_GSM tracker module ?
If i merge part of the mysensors GPS sketch which uses softwareserial on A0 and A5 (but A5 can actually be left unconnected)
and part of the SMS sketch taken from mysensors SMSgateway sketch , using softwareserial on pin 2 and 3 , i learn from here https://forum.arduino.cc/index.php?topic=398856.0 that two software serial can't listen at the same time
so they advice the alternativesBEST: GSM on pins 8 & 9 (AltSoftSerial), GPS in pins 0 & 1 (Serial). Disconnect pin 0 to upload.
2nd BEST: GSM on pins 0 & 1 (disconnect pin 0 to upload), GPS on pins 8 & 9 (AltSoftSerial).
3rd BEST: GSM on pins 8 & 9, GPS on any two pins with NeoSWSerial.
However the GPS mysensor sketch is (surprisingly) using analog pins for the software serial ... is the limitation on two ss unable to listen at the same time circumvented this way ?
-
GPS and GSM
Re: GPS and GSM
Just to be sure, when you say that you would just use an ethernet or MQTT gateway for a GPS tracker, the ethernet module is actually not needed right ? Indeed a GPS tracker is in general not near any ethernet network ...
So we are talking about just the gateway arduino (with ethernet gateway sketch supplemented by GPS and GSM sketches) connected to GPS and GSM modules, and of course a battery ...
which Lorawan module do you have ? -
RE: 💬 Relay
@fhenryco Actually the internal resistor of the solenoid is 27 Ohm while the resistance between C and E of the transistor in the passing state is 35 Ohm ... so it remains less than Vcc/2 for my solenoid which needs 12V ... so i need to tune my boost module at the max ==> more than 30V ... that does not seem ideal, may be i shoud choose another transistor with less internal resistor, but i have little experience with transistors : studied them a long time ago , so if someone can suggest something smart, ready to buy it ...
-
RE: 💬 Relay
It works very well with the transistor and schematic posted above. I think the valve is a latching valve because it only discharges the battery when there is a transition. The only remaining problem is that the 5V arduino alone is too much power consuming. So i'm wondering if the transistor could as well work with a 3.3V arduino, that is when the signal level on the transistor Base is 3.3V rather than 5 V ... then i also could remove the arduino led but i'll need to keep the arduino regulator because my 3.7V cell voltage is too much greater than 3.3V
-
RE: Which 12V solar charger solution ?
@gohan Sure but those latching valves are probably much more expensive than my 5 euros solenoid valve
-
Which 12V solar charger solution ?
Hello,
I'm currently using the TP4056 linear charger to charge a single cell lithium-ion3.7 V battery from a solar panel as explained here : http://www.instructables.com/id/DIY-SOLAR-LI-ION-LIPO-BATTERY-CHARGER/
However what i need is 12V rather than 3.7V for my project , and i still want the automatic solar panel recharge every day, so:
-
Either may be should i use a 3.7V to 12 V boost up module such as
http://www.ebay.com/itm/25W-DC-DC-3-3V-3-7V-5V-to-12V-Step-Up-Boost-Module-LED-Moter-Router-Power-Supply-/281237769996
but i have no idea what extra power consumption such boost up module implies for an output charge working at ~ 300 mA ... (on 12V) ... (i'm not so worried because the output charge (a solenoid valve) will be active only 5' per day) -
another solution would be to have several 3.7 cells in series to reach beyond 12V and then a step down regulator to get 12V, but several TP4056 can only charge as many 3.7 V in parallell : using the cells in series at the same time ==> shorcuts ! i did not find a low cost module equivalent to TP4056 to charge several such cells while they are working in series ...
so i'm back to 1) unless someone can suggest something else ...
-
-
RE: 💬 Relay
@rozpruwacz
thanks , i will use 2N2222 because the valve needs between 200 and 400 mA.
I'v read the 2N3904 is OK for < 100 mA -
RE: 💬 Relay
@rozpruwacz
thanks, but do you mean that the schematic simply would not work for the regular valve or that it would work but not be low power cinsumption design anymore ?
I have a regular solenoid valve but in my application the valve is normally closed and it will be only exceptionnally opened and for a short time when the 12V is applied, so i guess that i can live with it ...
As for the transistor in the schematic, except it seems to be a NPN , i don't know if i need a particular one for it . probably i can just buy a 2N3904 , or is there a better choice? -
RE: 💬 Relay
I was looking for a solution for a low consumption relay and i was adviced in this thread to use a latching relay.
However since i just need to switch on or off a 12V Vcc (from Li ion battery) to trigger a solenoid valve, i'm wondering whether i need a relay for that :
looking at the schematic from post #2 in https://forum.arduino.cc/index.php?topic=436555.0 may be i coud just have my solenoid valve directly in place of the relay in the schematic. In other words , i just need a transistor and not a real relay ... just because my application is a low voltage (12V to apply directly to the Vcc in the schematic) rather than 230V one: can someone confirm ? There is a diode in the schematic : what is it needed for ? -
RE: 💬 Relay
@gohan not sure this is going to be an easy way: need find arduino code for latch relay, dont know if domoticz is supporting this device ?, ...
-
RE: 💬 Relay
@gohan can you explain the benefit (for a low power app) of a relay switching on electrical pulse rather something else ?
i mean, even the regular relay has both an open by default circuit output and close by default circuit ouput so it could remain on the desired state even when not powered up ... -
RE: 💬 Relay
@mfalkvidd smartsleep was not supported by domoticz at the begining of the year ... but there was a domoticz upgrade in july ... do you know if it's now supported ?
-
RE: 💬 Relay
thanks , indeed it's because the relay is controlling a 12V battery power to solenoid valve , that low power consumption is needed. BTW the 12V is obtained from a 4S lipo (16.5V max voltage) and a 12 regulator and i dont know if its better to feed the arduino from a 5V regulator fed by the same Lipo , or use an additional set of AA batteries ... i remember that it's better to have an as low as possible drop in voltage to save power...
-
RE: 💬 Relay
Hello,
since the relay has leds and is therefore power consuming, i was wondering if someone has written a sketch for a low power usage of the relay (as for the sensors) allowing the arduino (and the relay) to sleep all the time and wake up every 5 minutes for instance just to check if the controller has changed the desired state of the switch.
Of course then the relay could be as late as 5minute, but this is not an issue for my application ...
thanks for any suggestion
-
RE: Distance sensor power
@zboblamont just to be sure i understand : the 5V echo from the sensor is because in the case you are speaking about the sensor is still powered in 5V even though it receives triggers in 3.3V ?
And when you say that the sensor is unreliable in 3.3 , it's really when the sensor is both powered in 3.3 and receives triggers in 3.3, and of course should echo in 3.3V to the arduino then ? : strange that it does not work properly in this case ! ... -
RE: Distance sensor power
@fhenryco
Yet i can read for the HC_SR04 on some web pages:- Voltage : 3-5.5VDC
- Logical lvel IO: 3.3V / 5V.
so are you really sure guys that it does not work on 3.3 ?
-
RE: Distance sensor power
@qqlapraline thanks but i find it more simple and have a good experience feeding the arduino 3.3 with a step up 3.3 booster. Now of course i did not realize that the 3.3 logical levels would not work with the 5V sensor so that not only a 5V step up booster is needed for the sensor but also a logical converter ... it would be a little simpler if there was such low cost distance sensors working in 3.3V rather than 5V
-
RE: Distance sensor power
sorry i should have re readen https://www.mysensors.org/build/battery
where they say that the solution is still arduino 3.3V and step up regulator for the 5V sensor... -
Distance sensor power
the HC-SR04 distance sensor needs 5v so i can't use the 3.3 mini pro. I was just wondering if it also makes sense for the 5V minipro to remove leds and regulator to have a long lasting set of AA battery in series with this arduino.... wondering because so far i only saw this method adviced for the 3.3 mini pro.
For the 5V arduino what is the best strategy to power it : 3 AA = 4.5V or 2 AA =3V and 5V step up boost module ?
-
RE: 3.3V step up regulator voltage monitoring
well i don't need great precision, just need to be alerted
when the battery voltage is getting dangerously low -
RE: 3.3V step up regulator voltage monitoring
actually, as i now remember i was using the voltage divider to reduce the battery voltage below the reference internal voltage ~ 1.1V ... this is some people advice for better accuracy. I'm now wondering if i can avoid this (the voltage divider) and still have a correct precision
-
RE: 3.3V step up regulator voltage monitoring
@flopp Ok but are you sure ? i mean if the step up fails to output 3.3V when battery level gets too low, monitoring a decrease of the regulator output (to arduino Vcc) might indicate death coming soon ... and after all this is all i need to know except if "coming soon" means " too soon" to react and prevent failure by changing battery
-
RE: 3.3V step up regulator voltage monitoring
@flopp yes your link is to the method i'm currently using to monitor Vcc which is about 3.3V. But my battery is actually 2 AA in series which output voltage is 3.3 V only when new...and should decrease progressively. My question is: is it necessary to monitor the Voltage of this battery or is it safe to only monitor the Vcc which is the output of the step up 3.3V regulator ?
-
3.3V step up regulator voltage monitoring
Hi
I'm using the 3.3V step regulator with my 3.3V mini pro
and' i'm very satisfied with this solution because the mini pro without led and regulator removed has as promissed a very low consumption.
But then if i really want to monitor the battery voltage its a little bit less easy than simply monitor the arduino Vcc (output of the regulator) because requires an additional voltage divider and analog read. This would allow to monitor the progressive linear decrease of the battery voltage with time. But i'm wondering if after all , it would be enough only monitoring the Vcc, since as the battery will get out of juice, this should result in the step up regulator not being able to maintain the 3.3V. What i'm wondering is how sudden will be the drop in the regulator output voltage as the battery will progressively get out of juice because if it's too fast, then monitoring this output (rather than the inout of the regulator) is of course useless...
-
RE: Office plant monitoring
It's a pity that at least one sketch for the analog reading of moisture sensor is not v2 compatible and made available on the main page ... i have no idea if making it v2 compatible would be a hard job...even if it's just a question of changing some library calls i'm afraid i don't have the skill for that...
-
RE: GPS and GSM
@mfalkvidd Thanks for the info, i don't know much about LoraWAN , but the modules seem much more expansive than SIM800 GSM. for a DiY GPS tracker in a vehicle, the low energy consumption is also less crucial if the GSM is only used when motion is detected (GPS coordinates change).
-
GPS and GSM
GSM at node level is necessary for instance if one want to build a DIY GPS tracker. The arduino wold both read the GPS data and send them through GSM only when there is a significant change in position. This would need merging the sketches for the GPS and the GSM but also removing the unneeded code related to NRF transfers but also the whole mysensors protocol fro communication between nodes and gateway_to_controller. Eventually this is not related anymore to a smarthome network so probably this is not the good forum to discuss this project...
However If the receiver is also a GSM node connected to a gateway i'm wondering wether we could keep the mysensors protocol being understood that it's just a matter of replacing the usual NRF24 communication by a GSM communication.
-
RE: reporting battery to domoticZ
@Rene046
not
msgbatt.set(batteryPcnt ,1);
but
send(msgbatt.set(batteryPcnt ,1));also may be better to use S_MULTIMETER and V_VOLTAGE (rather than S_INFO and V_TEXT) as adviced by AWI and also 2 decimals hence
send(msgbatt.set(batteryPcnt ,2)); -
RE: reporting battery to domoticZ
@Rene046
This is the instruction in your sketch which allows to see the battery level of devices in domoticZ
sendBatteryLevel(batteryPcnt);
But as you noticed , this is not reported in the logs. One possibility to see it in the Log is to as well send this batteryPcnt information with a send(msgbatt.set(batteryPcnt ,1);
provided you have defined
MyMessage msgbatt(CHILD_ID_BATT, V_TEXT);In other words you send the battery info as if it was the info of an additional sensor sending text type info
which you also need to present in the presentation void withpresent(CHILD_ID_BATT, S_INFO);
For instance if you already have two sensors in you sketch let's say temp and hum with ID =0 and 1 respectively you would give the battery level the next unused ID
CHILD_ID_BATT=2
There might be a simpler and more natural way but i don't know it . -
RE: reporting battery to domoticZ
using V_text and S_info is a workaround to avoid grouping
-
RE: reporting battery to domoticZ
@fhenryco it did nothing different ... still have a single sensor temp+hum don't understand why ...
-
RE: reporting battery to domoticZ
@fhenryco apparantly something like send(msgTemp.setSensor(CHILD_ID_TEMP).set(temperature,1));
send(msgHum.setSensor(CHILD_ID_HUM).set(humidity,1));
should do the job ! going to try that
but i'm surprised this is not done by default since msgHum and msgTemp are defined separately for each sensor Id -
RE: reporting battery to domoticZ
ok, thanks again, something else i v been wondering about is why domoticz will show the temp + humidity sensor as a single sensor even though there are separate instructions
for the presentation :
present(CHILD_ID_HUM, S_HUM);
present(CHILD_ID_TEMP, S_TEMP);
and for the messages themselves
MyMessage msgHum(CHILD_ID_HUM, V_HUM);
MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
send(msgTemp.set(temperature, 1));
send(msgHum.set(humidity, 1));
what should be modified if i want domoticZ to treat the two sensors separately ? (this is for Yana, a speech recognition software that has a plugin for domoticZ, but apparantly is not able to handle several values for a given sensor).is it the sendSketchInfo("TemperatureAndHumidity", "1.1"); that needs to be replaced by two sendSketchInfo, one for temp and one for humidity ?
-
RE: reporting battery to domoticZ
this morning , i get 102% , much closer to the actual value ... assuming that the ADC activity did not discharge my battery at an unprecedented level (i had this sketch working for two monthes with very little discharge of the battery before adding this battery monitoring functionality). I will know for sure if the battery level does not drop further in the coming days...i'm concerned that the delay 500 might produce non negligible battery consumption
-
RE: reporting battery to domoticZ
@sundberg84 thanks,
the delay 500 has a big effect , now i get 116% hence a battery voltage=3.5V, while the multimeter gives it 3V ! may be the internal reference is not 1.1V in my low cost chinese pro mini 3.3v .
BTW i did not understand why you have also a delay 500 after reading the analog pin, i would have thought that a delay before reading the analog pin is sufficient ... (?) -
RE: reporting battery to domoticZ
@sundberg84 thank you but as i said i did no modification to the sketch in https://www.mysensors.org/build/battery appart merging it with a DHT11 sketch. However i did notice something strange: when i switch on the arduino (sensor side) the first percentage i get in DomoticZ was 102%, then at the next update it fell to 60% and has not changed since then. I'm suspecting there is something wrong measuring the battery level from A0 pin just after sending a temperature value ??
Insert Code Here/** * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each * repeater and gateway builds a routing tables in EEPROM which keeps track of the * network topology allowing messages to be routed to nodes. * * Created by Henrik Ekblad <henrik.ekblad@mysensors.org> * Copyright (C) 2013-2015 Sensnology AB * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors * * Documentation: http://www.mysensors.org * Support Forum: http://forum.mysensors.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * ******************************* * * REVISION HISTORY * Version 1.0: Henrik EKblad * Version 1.1 - 2016-07-20: Converted to MySensors v2.0 and added various improvements - Torben Woltjen (mozzbozz) * * DESCRIPTION * This sketch provides an example of how to implement a humidity/temperature * sensor using a DHT11/DHT-22. * * For more information, please visit: * http://www.mysensors.org/build/humidity * */ // Enable debug prints #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 //#define MY_RS485 #include <SPI.h> #include <MySensors.h> #include <DHT.h> // Set this to the pin you connected the DHT's data pin to #define DHT_DATA_PIN 3 // Set this offset if the sensor has a permanent small offset to the real temperatures #define SENSOR_TEMP_OFFSET 0 // Sleep time between sensor updates (in milliseconds) // Must be >1000ms for DHT22 and >2000ms for DHT11 static const uint64_t UPDATE_INTERVAL = 600000; int BATTERY_SENSE_PIN = A0; // select the input pin for the battery sense point int oldBatteryPcnt = 0; // Force sending an update of the temperature after n sensor reads, so a controller showing the // timestamp of the last update doesn't show something like 3 hours in the unlikely case, that // the value didn't change since; // i.e. the sensor would force sending an update every UPDATE_INTERVAL*FORCE_UPDATE_N_READS [ms] static const uint8_t FORCE_UPDATE_N_READS = 10; #define CHILD_ID_HUM 0 #define CHILD_ID_TEMP 1 float lastTemp; float lastHum; uint8_t nNoUpdatesTemp; uint8_t nNoUpdatesHum; bool metric = true; MyMessage msgHum(CHILD_ID_HUM, V_HUM); MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); DHT dht; void presentation() { // Send the sketch version information to the gateway sendSketchInfo("TemperatureAndHumidity", "1.1"); sendSketchInfo("Battery Meter", "1.0"); // Register all sensors to gw (they will be created as child devices) present(CHILD_ID_HUM, S_HUM); present(CHILD_ID_TEMP, S_TEMP); metric = getConfig().isMetric; } void setup() { // use the 1.1 V internal reference #if defined(__AVR_ATmega2560__) analogReference(INTERNAL1V1); #else analogReference(INTERNAL); #endif dht.setup(DHT_DATA_PIN); // set data pin of DHT sensor if (UPDATE_INTERVAL <= dht.getMinimumSamplingPeriod()) { Serial.println("Warning: UPDATE_INTERVAL is smaller than supported by the sensor!"); } // Sleep for the time of the minimum sampling period to give the sensor time to power up // (otherwise, timeout errors might occure for the first reading) sleep(dht.getMinimumSamplingPeriod()); } void loop() { // get the battery Voltage int sensorValue = analogRead(BATTERY_SENSE_PIN); #ifdef MY_DEBUG Serial.println(sensorValue); #endif // 1M, 470K divider across battery and using internal ADC ref of 1.1V // Sense point is bypassed with 0.1 uF cap to reduce noise at that point // ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts // 3.44/1023 = Volts per bit = 0.003363075 int batteryPcnt = sensorValue / 10; #ifdef MY_DEBUG float batteryV = sensorValue * 0.003363075; Serial.print("Battery Voltage: "); Serial.print(batteryV); Serial.println(" V"); Serial.print("Battery percent: "); Serial.print(batteryPcnt); Serial.println(" %"); #endif if (oldBatteryPcnt != batteryPcnt) { // Power up radio after sleep sendBatteryLevel(batteryPcnt); oldBatteryPcnt = batteryPcnt; } // Force reading sensor, so it works also after sleep() dht.readSensor(true); // Get temperature from DHT library float temperature = dht.getTemperature(); if (isnan(temperature)) { Serial.println("Failed reading temperature from DHT!"); } else if (temperature != lastTemp || nNoUpdatesTemp == FORCE_UPDATE_N_READS) { // Only send temperature if it changed since the last measurement or if we didn't send an update for n times lastTemp = temperature; if (!metric) { temperature = dht.toFahrenheit(temperature); } // Reset no updates counter nNoUpdatesTemp = 0; temperature += SENSOR_TEMP_OFFSET; send(msgTemp.set(temperature, 1)); #ifdef MY_DEBUG Serial.print("T: "); Serial.println(temperature); #endif } else { // Increase no update counter if the temperature stayed the same nNoUpdatesTemp++; } // Get humidity from DHT library float humidity = dht.getHumidity(); if (isnan(humidity)) { Serial.println("Failed reading humidity from DHT"); } else if (humidity != lastHum || nNoUpdatesHum == FORCE_UPDATE_N_READS) { // Only send humidity if it changed since the last measurement or if we didn't send an update for n times lastHum = humidity; // Reset no updates counter nNoUpdatesHum = 0; send(msgHum.set(humidity, 1)); #ifdef MY_DEBUG Serial.print("H: "); Serial.println(humidity); #endif } else { // Increase no update counter if the humidity stayed the same nNoUpdatesHum++; } // Sleep for a while to save energy sleep(UPDATE_INTERVAL); }
-
reporting battery to domoticZ
Hello, i'm using the sketch given here https://www.mysensors.org/build/battery without modification to report battery level to domoticZ. obviously i can't use the Vcc library because the voltage i'm monitoring is the battery voltage, while the arduino is fed through the step up regulator at a stable 3.3V.
I 'm not sure to understand then why domoticz shows 60% battery when my battery level is actually at about 3V so i would expect 3/3.44 = 87% .So i'm suspecting that sendBatteryLevel(batteryPcnt); does not actually send batteryPcnt as computed in the sketch but a rescaled percentage in order to match 0% when the battery will be at about 2.7V .... can someone confirm ? where can i read the actual void sendBatteryLevel() to understand what it is doing exactly ?
-
RE: GPS not recognized
i have version 2.0.0 for mysensors libraries and version 3.5837 (October 30th 2016) for DomoticZ. do you think it's an issue that is fixed in mysensors 2.1.1 ... ? i just found this topic on the subforum you gave me : https://www.domoticz.com/forum/viewtopic.php?f=42&t=13403&p=96840&hilit=gps+latitude#p96840 but i will need to struggle a bit to understand what it means: apparantly V_position is not supported in domoticz ...
thank you -
GPS not recognized
Hello,
I'm afraid that the GPS is not recognized in domoticZ. I use the sketch of this site for the GPS , and the transmission is all right for GPS data to serial gateway (i can see the latitude longitude... ) and there is no strange message on arduino monitor...
yet domoticz does not recognized my NEO-6M GPS (exactly the same as in your build page) , i get this message in the logs :Error: MySensors: Unknown/Invalid sensor type (49)
i don't understand wether the GPS actually correctly presented itself to the controller, i see no trace of a message with S_GPS (38) ... i'm tempted to believe that since MY_REGISTRATION_FEATURE is enabled, the sensor correctly presented itself to domoticz , otherwise it would not be allowed to send data as it does ...
in this message:
Error: MySensors: Unknown/Invalid sensor type (49)
49 is the id of V_position, so it appears as if the controller is receiving the sensors data before having received the presentation message ...could someone help please, i'm just using the sketch as given in your build page... is it actually true that domoticz is compatible with the GPS sensor as the table https://www.mysensors.org/controller seems to imply ?
thank you in advance
-
RE: How to Reestablish lost NRF24 connection
@Jan-Gatzke
thanks , i will have to retest this ... i'm concerned because a few days ago i had an interruption of the connection that lasted a full night ... yet i just needed to swith off and on the battery of the arduino and the signal was back ... the battery level was also all rightSo im tempted to believe that i should always favour the best conditions (max PA_level ) to avoid lost connections, if it's confirmed that the arduino might not try to recover connction may be after a number of unsuccessfull attempts or some timeout...
-
RE: How to Reestablish lost NRF24 connection
Nobody can answer whether fthe lost connection will be recovered automatically after some time?
-
How to Reestablish lost NRF24 connection
Hello,
I did a few tests to figure out up to what distance my NRF24 would be able to transmit the temperature of my dht temp sensor, this for different PA_levels. So for better testing i modified the sketch for the sensor to send it's data any 2 seconds. What i don't understand is that when the signal becomes too low and the gateway does not anymore receive the data, the connection is lost and transmissions do not restart even if i come back near the gateway .... is this normal , what is the logic behind this?, would the transmission be automatically restarted after sometime (i did not wait much)?
: with a power cycle the sensor arduino recovered the connection...(represented itself to the gateway) .
-
several channels mode
Would it be possible to modify the Mysensors protocol so that a gateway could work on several channels simultaneously ,thereby completely avoiding collisions ? (but the object side arduinos would still transmit and receive on a single channel each).
Actually is there any mechanism already implemented for collision avoidance ... ?
I understand the very rare and short length packet transmissions on a smart objects network probably makes such kind of effort completely worthless (?) , detection of collisions by not receiving the expected acknowledge being more than enough , however being able for a repeater to transmit and receive simultaneously on two different channels would make it possible to grant the lowest latencies (one would not need to receive a complete packet before starting to forward it ).
-
RE: dht11 CR2032 longevity
eventually, i was more skilled with a second mini pro : after removing both LED and board regulator, the consumption i measured is about 19mA when active and 80 microA when sleeping , i guess mainly because of the step up regulator (from 2xAA to 3.3V)
-
RE: dht11 CR2032 longevity
Now that i have received pro minis 3.3 i can practice !
following the method in http://www.home-automation-community.com/arduino-low-power-how-to-run-atmega328p-for-a-year-on-coin-cell-battery/
i just tried to cut the trace to the LED with a cutter, ... but the LED remained shining after several deeper and deeper attempts .... so i just removed the LED, but now my mini pro is not responding anymore: dead!so i'm wondering if i have destroyed something else trying to cut this trace , and considering how easy it is rather to just remove the led, i'm wondering why the guy advices to cut the trace which is probably a more dangerous method for the pro mini
-
RE: dht11 CR2032 longevity
Oh! sorry, i had completely missed this battery section on this site "build" page. All right
There is just something that is not yet completely clear for me for this recommended usage of 2 AA batteries in series.
The boost 3.3 V regulator is presented as a good way to take "all the juice from batteries" for them to last longer, but at the same time, as a regulator it is expected to continuously draw current even during sleeping time ... and in this way reduce lifetime of batteries
so i remain a little bit confused as for the actual usefullness of such step up regulator : is it only usefull in a project where sensors are transmitting very often so that the sleeping current is not the dominant factor reducing battery lifetime ? -
RE: dht11 CR2032 longevity
Last question : what about 3 AA LR6 in series then :
- also has the problem of a large internal resistance ?
- sharp drop of voltage again because voltage ~ 4.5 V still too much greater than 3.3 ==> bad regulator efficiency , right ?
-
RE: dht11 CR2032 longevity
@fhenryco
eventually it also appears that i have ordered step up regulators for nothing unless ... in which case might these be usefull and operate for a longtime ? -
RE: dht11 CR2032 longevity
MMM OK, hesitating just because i'm not sure removing this regulator is going to be as easy and safe for board as i would like ...
just to be sure , if i keep the regulator what you say about connecting power directly to Vcc is in case the power is provided by a single CR2032, right ?
About your third other points (BOD modification) : this is necessary in case the voltager that the atmega eventually receives (either through RAW without regulator , or through Vcc) is lower than a regulated 3.3 V, do i understand well ?
about your last point (capacitor and sleep between consecutive transmissions): is this again related to the above harware choices for powering the board ? i mean is it made necessary again by the fact that the atmega is running on a less than 3.3V CR2032 ? just to be sure i understand
thanks again
-
RE: dht11 CR2032 longevity
@fhenryco said:
" Is it really necessary to remove the regulator ? my previous message linked to an analysis according to which even with a regulator like LQ33 (what about LG33 ?) the arduino could last one year on CR2032 ..."
And apparantly according this more complete datasheet for LG33 , which has the same very low GND current as LQ33 for vanishingly small load currents :
http://ww1.microchip.com/downloads/en/devicedoc/mic5219.pdf
it's not really mandatory to remove such regulator to get long live CR2032... no objection around ? -
RE: dht11 CR2032 longevity
and if i can keep the arduino regulator (with no step up regulator) i could still use two CR2032 in series , true ?
-
RE: dht11 CR2032 longevity
@Nca78
thanks but ...
!! that's much less trivial than i anticipated... OK to use small voltage sensors and to remove Leds but :
Is it really necessary to remove the regulator ? my previous message linked to an analysis according to which even with a regulator like LQ33 (what about LG33 ?) the arduino could last one year on CR2032 if sleeping most of the time ... i really don't mind replacing CR2032 once a year ... -
RE: dht11 CR2032 longevity
Found this interesting page
http://www.home-automation-community.com/arduino-low-power-how-to-run-atmega328p-for-a-year-on-coin-cell-battery/but the gnd pin and quiescent currents of the minipros regulator LQ33 the guy is talking about in this page (80 microA at 0.1mA load current), may be much bigger than for my minipro which regulator has LG33 written on it , so if the following is the correct datasheet:
http://pdf1.alldatasheet.com/datasheet-pdf/view/308176/ELM-TECH/ELM1117LG-33-S.html
it has a typical 5mA quiescent current. This is much much higher than the previous (LQ33) one but the load current is also not specified so i'm not sure...
All in all do the analysis of the above page apply to the 3.3 minipro which i bought through the store on your site ?
It says that "Even though the standard voltage regulator is not efficient at low current, it is still good enough to run the 3.3 V Pro Mini on 3 AA Alkaline batteries for more than one year, based on the measured power consumption of 54 μA in power-down sleep and 3.90 mA in active mode."
Thank you in advance, it's the first time in my life i try to understand a datasheet... -
RE: dht11 CR2032 longevity
thank you,
No link ?
the problem is not the lack of information but the excess of informations on the web, often inaccurate, often contradicting each other, almost all the time incomplete ...
but is there somewhere a complete and rigorous reference guide/method on how to reliably compute those things not forgetting any major contribution? :
consumption of arduino, RF and sensor during sleeping time
consumption of arduino, RF and sensor during active time,
actual relative duration of active time ...here i'm talking about one of the most basic and most used Mysensor sketch : the humidity sketch on the Build page, and i did not change any parameter (default RF power, default sleeping duration)
so i guess that people who have worked on the protocol to optimize energy consumption have already figured out this in details ... so i prefer to get this information from Mysensors admins and developpers than from anywhere else (often people not exactly using the same sketches and protocols ...)Also i don't need an accurate estimation but an order of magnitude ...
regards
-
dht11 CR2032 longevity
Hello,
I'm wondering if CR2032 is an interesting option for powering a pro mini 3.3V (needs the step up regulator) running the temperature and humitidty sketch on this site for a DHT11.
How long can i expect the CR2032 to last if :- the arduino sleeps 1 minute between each wake up and sendind of temperature&humidity
- the arduino sleeps 15 minute ...........
if it's no more than a few weeks i would extrapolate that there is actually not any sensor project where the CR2032 could be actually an interesting option in practice right?
so what is the best powering option (and arduino) to have such kind of sensor (sleeping almost all the time) running at least 1 year on a battery ? a standard 12V battery on a nano Vcc ?
thank you in advance for helping advices and comments
-
conflicting libraries ?
hello,
2.0 is needed to be up to date but some sensors such humidity and temperature DHT11 was in version 1.5.4, and no more present in 2.0 ==> working with two libraries isn't going to produce issues ? (conflicts) -
USB gateway for 433MHz
Hello
i have ordered the 2.4 GHz RF transmitters and waiting for them but for the time being i only have those 433 MHz
http://www.ebay.com/itm/380717845396?rmvSB=true
and would like to try them with the USBgateway sketch on my nano arduino (mini pro sensor side) and domoticZ . How should i modify the sketch for those simple 433 MHz RF ?
Thanks in advance