Next logic step is flipping polarity like here: http://gardenbot.org/howTo/soilMoisture/

Posts made by rollercontainer
-
RE: 💬 Soil Moisture Sensor
-
RE: Why I quit using MySensors for actuators
My communication problems vanished by exchanging the amplified version by a normal NRF24.
-
RGB LED strip controller with FastLED
Hi,
I built a 1m x 1,5m accoustic absorber with Basotect for the ceiling in my living room. To generate ambient lighting, I installed a non-smart analog 5m LED strip on the top side. My first attempt was to use PWM from arduino which resultet in visual steps when do slow fading. Next approcach was a 12bit PWM motor shield, resulting in 4096 steps which were smooth but I couldn't use the real good FastLED library. So I ended up with a P9813 RGB MosFET Board from ebay which represents a single pixel. (But can easily chained for several strips in the room.) FastLED is dithering between the 256 steps of the arduino and produces very smooth transitions.
Hardware:
- Arduino Nano (~5€)
- NRF24L01 (~2€)
- P9813 RGB MosFet Board from ebay (Full Color RGB LED Strip Driver Sensor v1.1 for Arduino STM32 AVR P9813) (4,29€)
- LM2596S DC-DC Step-Down Converter for 12V->5V (~1€)
- 5m RGB LED Strip ( < 10€)
- old 12V laptop power supply
Software:
My setup is a mqttClientGateway and a raspi with node-red.
To change color, you can send a RRGGBB string to mysensors-in/node-id/0/1/0/40
To change the fade time you can send a integer from 0 to 255 to mysensors-in/node-id/1/1/0/24
To persist the current settings to eeprom you can send a "1" (meaning bool "true") to mysensors-in/node-id/2/1/0/2
To set the brightness you can send 0 to 100 (V_PERCENTAGE) to mysensors-in/node-id/3/1/0/3https://github.com/rollercontainer/nanoP9813FastLEDMySensors/blob/master/main.cpp
This code is working. Nevertheless it could be a lot better. It is posted, to help people take code lines or inspirations out of it. I think, I change the setup to esp8266 because of the OTA flash ability.
Greetings
-
RE: My Slim 2AA Battery Node
searched a bit and found that @ceech already made a harvester with a coin cell.
http://www.ebay.de/itm/BQ25570-thermal-solar-energy-harvester-/332071662285
still too big and too expensive in comparison with dozens of alkaline batteries which will run for years, but that is the way to go sometime.
-
RE: My Slim 2AA Battery Node
Did you considered a tiny solar cell like enocean does?
https://www.enocean.com/en/enocean_modules/stm-320/
That would be perfect... -
RE: My Slim 2AA Battery Node
Maybe its better to measure the voltage every 10 or 100 loops and only send one custom message/alert when its dropped below a threshold. I am using the MQTTClientGateway and Node-Red. In case of a battery-low message, node-red could send me an email with the node name. I will give it a try...
From https://www.mysensors.org/download/serial_api_20:
V_TEXT 47 Text message to display on LCD or controller device S_INFO V_CUSTOM 48 Custom messages used for controller/inter node specific commands, preferably using S_CUSTOM device type. S_CUSTOM```
-
RE: My Slim 2AA Battery Node
Just noticed, that I use another login at home. So, the Tim-Abels is the rollercontainer... Sorry for that.
-
RE: My Slim 2AA Battery Node
@AWI one step forward, two steps back... Thanks for the hint.
I guess, I should send battery percentage every 10 interrupts or so. Even if the contact doesn't trigger for a while, I can force it by showing my neighbours my ocd on doors ^^ (knock, knock, knock - Penny!)
What do you think?
-
RE: My Slim 2AA Battery Node
Maybe there is something like a counter (variable++) which causes a overflow after two month?
-
RE: My Slim 2AA Battery Node
@AWI said in My Slim 2AA Battery Node:
@rollercontainer Your sleep looks good. Did you remove this piece of code?
// Activate internal pull-ups digitalWrite(PRIMARY_BUTTON_PIN, HIGH); digitalWrite(SECONDARY_BUTTON_PIN, HIGH);
Take a look at this thread for a < 1 uA consumption...
Hmm, I noticed, that I have to disable the internal pullups. But instead of removing the lines, I set them to LOW. I will test it without the lines and come back. Thank you @AWI.
-
RE: My Slim 2AA Battery Node
@sundberg84: Thanks, so I will stick to my 12µA
@AWI: I am using sleep with Interrupt as in this example:
sleep(PRIMARY_BUTTON_PIN-2, CHANGE, SECONDARY_BUTTON_PIN-2, CHANGE, 0);
-
RE: My Slim 2AA Battery Node
I only come down to 12µA with one reed switch, 1MOhm pullup, 1Mhz bootloader and the binarySwitchSleepSketch. Measured with two different multimeters. This is nearly ten times higher than in the first posting. Changing all internal pullups to LOW doesn't change anything.
Is there a way to optimize the power consumption or is it "good enough" ?
-
RE: Multisensor node using Ceech board
Can someone explain, why the charger isnt charging all the time or at least earlier? BattVoltage is 3.96V on the right end. Is the cell considered full?
-
RE: Multisensor node using Ceech board
D'oh! I thought, the wiper of the trimmer is at the flat side, but its opposite to the flat, got it finally. Now pimatic is showing a current (0.74A).
-
RE: Multisensor node using Ceech board
Ok, now I've got a 12V 50mA solar cell and a 3,7V 2000mAh LiPo. Potentiometer is at 12 o'clock (flat segment at the single solder pad)
Can you please try to explain what exactly the potentiometer is adjusting?
Does the charger only charge if the cell voltage is below the adjusted voltage level?Your example sketch is not showing any charging current:
Vcc = 3.32V Charge current = 0.00mA Solar cell voltage = 0.24V Battery voltage = 3.79V CHRG = 424
Vcc = 3.32V Charge current = 0.00mA Solar cell voltage = 7.44V Battery voltage = 3.79V CHRG = 409
Vcc = 3.32V Charge current = 0.00mA Solar cell voltage = 11.72V Battery voltage = 3.79V CHRG = 0
-
RE: Multisensor node using Ceech board
I wanted to use it outside for collecting weather data. But the battery which the board is designed for isn't suitable for temperatures below 0°C.
Is that right so far?
Or did you successfully used Li-Ion outside below 0°C?
-
RE: Multisensor node using Ceech board
I thought, sunset will be enough to terminate charging on NiCd?
So its easier to take 3,2V LiFePo4, right? And because my board only regulates down, I have to take 2 in series to provide enough voltage to regulate, right?
All these flat LiPo types provide ~3,7V. Is that enough to feed the regulator (+dropout)?
-
RE: Multisensor node using Ceech board
I am not amused...
I will buy additonal batteries and a second solar cell.
-
RE: Multisensor node using Ceech board
In the ebay auction I bought it your text says buck boost converter. On the chip there is a number gnq 666 601, but I cant find him. Board says: 77534K_Y471
-
RE: Multisensor node using Ceech board
I've got light a bit closer and a current showed up:
Vcc = 3.01V Charge current = 2.23mA Solar cell voltage = 4.89V Battery voltage = 2.85V CHRG = 0
Is Vcc messuring the voltage comming from the usb device?
-
RE: Multisensor node using Ceech board
As I understood, there is a buck boost converter that lifts the battery voltage to 3,3V. So I thought, two 1,5V batteries would be sufficient. Am I wrong?
I've got a 5V solar panel and turned the trimmer clockwise to the end. Correct? (tried counterclockwise also, nothing changed.)
Vcc = 2.96V Charge current = 0.00mA Solar cell voltage = 4.89V Battery voltage = 2.79V CHRG = 0
-
RE: Multisensor node using Ceech board
Thank you very much!
The 1180 ohm value was found in the IoT_pro_04.sch file at https://www.openhardware.io/view/44/Solar-powered-sensor-board#tabs-design. Or isnt it the resistance value? Maybe a smd size?
-
RE: Multisensor node using Ceech board
Hi ceech,
first things first: I have a really small knowledge about charging batteries.
Could you give me a hint how to adopt the floating voltage for a NiCd battery?
By reading the datasheet I only found NiMh with a 3kOhm PROG resistor while yours is 1180Ohm. Do I have to modify him to lower the charge current?
And how about the timer capacitor. I red, that NiCd shouldn't charged too long. You pulled TIMER to ground, so the device will charge forever?Maybe this problem is solved by the sunset itself?
Again thanks for your contribution!
-
RE: Multisensor PIR based on IKEA Molgan
@Cliff-Karlsson
Excellent summarized! Perfect HowTo!Voted Cliff-Karlson for Documentation Team
-
RE: [SOLVED] upgraded to Mysensors 2.0.0
I had similar problems.
With V1.5 normal nodes send data at a lower power level, only the gateway got full power. Now it seems to be set to high power even for nodes.[see answer below]
Lowering the PA Power made my node send reliable again.#define MY_RF24_PA_LEVEL RF24_PA_LOW
-
RE: irlz44n not fully open using 3.3V Arduino
Nice... Ordered yesterday some IRLZ34n for my project... D'Oh!
-
RE: Converting a sketch from 1.5.x to 2.0.x
Maybe related to this problem?
https://github.com/mysensors/MySensors/issues/449My gateway does the same. No presentation, but sending data.
-
RE: {DEV} Multi-Sensor Node goes into boot loop
I am not a coder, just a user. So I am not able to fix errors here.
-
RE: {DEV} Multi-Sensor Node goes into boot loop
read above again:
Gateway 2.0.0beta with Node 2.0.0 = UPL:FAIL (which means UPLink)
Gateway 2.0.0 with Node 2.0.0 = FPAR:FAIL (which means FindPARent)my error is reported to github, maybe you should do this too with yours?
https://github.com/mysensors/MySensors/issues -
RE: MySensors 2.0.0 Released
Thank you to all contributors for this fine piece of software!
Cheers!
-
RE: {DEV} Multi-Sensor Node goes into boot loop
Well, 2.0 seems buggy. Now my Node is trying to find its parent. Funny, because I told him which to use:
#define MY_DEBUG #define MY_RADIO_NRF24 #define MY_NODE_ID 10 #define MY_PARENT_NODE_ID 0 #define MY_PARENT_NODE_IS_STATIC
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: 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: 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: 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: !TSM:FPAR:FAIL !TSM:FAILURE TSM:PDT
-
RE: {DEV} Multi-Sensor Node goes into boot loop
MY_DEBUG disabled, MQTT Gateway comes up on regular power. Bug?
-
RE: {DEV} Multi-Sensor Node goes into boot loop
Hm, MQTTGateway only comes up on PC, not on USB power supply. And it is not presenting itself, but sendig local DHT values.
-
RE: {DEV} Multi-Sensor Node goes into boot loop
Nope. Recompiled MQTT Gateway: Node error persists... CHKUPL:Fail
-
RE: {DEV} Multi-Sensor Node goes into boot loop
Ok, 2.0 looks like to be stable now (-> Master branch) We both struggle at point "CHKUPL" which means "Check Uplink". So, maybe our Gateway has to be updated too. I will give it a try...
-
RE: {DEV} Multi-Sensor Node goes into boot loop
Same thing here. I am using MQTT gateway.
#include <string.h> #define __FILENAME__ (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__) #define SKETCH_NAME __FILENAME__ #define SKETCH_DATE __DATE__ #define MY_DEBUG #define MY_RADIO_NRF24 #define MY_NODE_ID 100 #include <SPI.h> #include <MySensors.h> #include <Wire.h> #include <SI7021.h>
Starting sensor (RNNNA-, 2.0.0-beta) TSM:INIT TSM:RADIO:OK TSP:ASSIGNID:OK (ID=100) TSM:FPAR TSP:MSG:SEND 100-100-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSM:FPAR TSP:MSG:SEND 100-100-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSP:MSG:READ 0-0-100 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=100) TSM:UPL TSP:PING:SEND (dest=0) TSP:MSG:SEND 100-100-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1 TSP:CHKUPL:FAIL (hops=255) !TSM:UPL:FAIL TSM:FPAR TSP:MSG:SEND 100-100-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSM:FPAR TSP:MSG:SEND 100-100-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSP:MSG:READ 0-0-100 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=100) TSM:UPL TSP:PING:SEND (dest=0) TSP:MSG:SEND 100-100-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1 TSP:CHKUPL:FAIL (hops=255) !TSM:UPL:FAIL```
-
RE: Which are the *best* NRF24L01+ modules?
it is working with lower voltages at 1mhz, thats the reason I use it on a 2 AA node.
-
RE: Which are the *best* NRF24L01+ modules?
flashed the 1MHz Optiboot again, compiled the sketch and loaded it up. Idle current is staying under 0,01mA. So, looks like the 2.0.0beta libs are "guilty".
-
RE: Which are the *best* NRF24L01+ modules?
I setup a new Arduino IDE 1.6.9 portable with MySensors 1.5 and flashed a standard 8MHz bootloader with BOD off.
Idle current is nearly unmessureable by my MM, showing only 0,01 mA at 60,00 mA range.
Next step is to get a 1MHz bootloader to work with low current.Thx for your words, guys.
-
RE: Which are the *best* NRF24L01+ modules?
@NeverDie I already bought these ~20 radios from 5 different dealers...
@AWI I am not sure, therefore I am asking here. But what more can I do? I am using a default sketch with only this modification:#define MY_NODE_ID 70 #define MY_PARENT_NODE_ID 0 #define MY_REPEATER_FEATURE false
The node is useable, so it sends reed contact changes to the mqttClientGateway which sends it to my raspi. Is the static method preventing the node from deep sleep?
I live in northern germany. Thx for the offer. But I dont really believe, that all radios are faulty by now.
-
RE: Which are the *best* NRF24L01+ modules?
Holidays are over, back to work ^^
To clarify it again:
First I tried with complete 2AA slim node, several radios, sensor and the default binarySwitchSleep 2.0.0beta sketch. (15mA)
For the second run: NO radio, sensor or MySensors.h were used. Therefore I wrote a minimal sketch with SLEEP_MODE_PWR_DOWN to ensure that the AVR is going to sleep mode. (< 0,1 mA)
This leads me to the conclusion, that every of my ~20 radios is faulty. Are there any ways to prove this? -
RE: Which are the *best* NRF24L01+ modules?
You both missed the point. My problem isnt the idle consumption yet. My problem is, that all the radios consume too much. Is there a way to get it down, or do I have to dump them all?
-
RE: Which are the *best* NRF24L01+ modules?
@GertSanders I wrote "below 1mA" because I couln't recal the exact value, just for pointing to the relation between radio consumption and idle without radio.
I've got 328P from Reichelt.de and messured again withoput mysensors.h and with SLEEP_MODE_PWR_DOWN. The multimeter reads 0,09mA at 60.00mA range set. Looks valid to me.
-
RE: Which are the *best* NRF24L01+ modules?
All of my ~20 NRF24's from 5 different dealers are consuming 15mA when the node is in sleep mode. Is this really a radio problem, or a software problem?
By pulling out the radio, current drops below 1mA.
- 2.0.0beta binarySwitchSleep sketch
- My-Slim-2AA-Battery-Node
- bootloader from My-Slim-2AA-Battery-Node OpenHardware source
- BOD disabled by fuses, 1MHz internal
- current messuered with Fluke multimeter
-
RE: Multisensor PIR based on IKEA Molgan
In development branch there is a smartsleep function for receiving while sleeping (if I get it right)
-
RE: Air Quality Sensor
Hm, in the loop, mq135_ro will be read and used. As written in line 78, the MQ135_DEFAULTRO can be overwritten by the messured mq135_ro. Ok, but where is the 10kOhm voltage divider in this calculation? Included in the measurement of mq135_ro?
https://github.com/empierre/arduino/blob/master/AirQuality-MQ135.ino#L78 -
RE: Air Quality Sensor
@alexsh1 I dont think so, in epierres sketch both values appear:
https://github.com/empierre/arduino/blob/master/AirQuality-MQ135.ino#L25
https://github.com/empierre/arduino/blob/master/AirQuality-MQ135.ino#L33So, what the heck is mq135_ro? And what to tune to?
-
RE: Air Quality Sensor
@alexsh1 I bought a breakout board and desoldered everything but the sensor and the 33Ohm resistor for the heating. Then I soldered a 10kOhm pulldown from analog signal out to ground.
-
RE: Air Quality Sensor
So, obvious these are two variables. Wherefore is the mq135_ro? Is it the load resistor from signal to ground?
-
RE: Air Quality Sensor
@alexsh1 Thx
Is "RZERO" the same as "mq135_ro" or is it a seperate variable? (ro = R0 = RZERO?) -
RE: Air Quality Sensor
Hey guys, I am struggeling to get the MQ135 to work. Is there a step by step howto? Or can someone answer my question from 3 days ago?
I would appreciate it very much. -
RE: My Slim 2AA Battery Node
Bought another 2 radios from different dealers. The one with the blob on the die is going down to 2mA, but isnt working at all (node does not come up). The next one is working, but again 15mA. This is frustrating. Anyone here with a good source for radio modules?
Even with a stripped down sketch without any sensors with only delay and sleep in the loop, the current stays the same.
-
RE: Air Quality Sensor
Can someone tell me how to read this line?
float mq135_ro = 10000.0; // this has to be tuned 10K Ohm
Do I have to messure the sensor and adjust the variable or do I have to tune the resistance? If I have to do the first thing, when do I have to messure it? In warm state and clean air with a multimeter?
-
RE: Uno as serial gateway? Can it also be a sensor node?
I've got a MQTTClientGateway using an Uno with DHT22 sensor attached. It's working for weeks without problems.
-
RE: My Slim 2AA Battery Node
Ok, where to buy NRF24's which are genuine for sure and not too expensive in europe?
-
RE: My Slim 2AA Battery Node
Hm, I built some nodes and messured the current with a Fluke 179: 15mA even with a minimal sketch with sleeping enabled. AVRs are not from china, but the NRF24 are. So, is the radio the problem?
Greetings
-
RE: pimatic-mysensors controller plugin
I've seen the "protocol" line. Is it suitable for 2.0.0beta sketches ?
-
RE: Cant't get MQTTGateway to work
Which total wire length is between the W5100 and the next active port (switch/router) ?
-
RE: My Slim 2AA Battery Node
I ordered a proto pack on 15th of April and received it on 30th of April. Pretty fast, I think.
-
RE: Slim Node Si7021 sensor example
According to the datasheet the absolute maximum time to get ready is 80ms.
-
RE: Slim Node Si7021 sensor example
The most SI7021 coming from ebay are with voltage regulator and level shifter. I searched for a raw version and there are only very few... If you are not sure, post a link or a foto.
-
RE: [ProMini] Blue LED on Pin 13 wont turn off
Here are some scientific messurements: http://cc.oulu.fi/~kmikhayl/site-assets/pdfs/2012_NTMS.pdf
Table on last page says: SoftSPI consumes about double the electricity of a Hardware SPI on a PIC system. So, desoldering the LED is the thing to do.
Thx for the hint.
-
RE: [ProMini] Blue LED on Pin 13 wont turn off
Excellent question. I dont know.
-
RE: [ProMini] Blue LED on Pin 13 wont turn off
no problem, my fault was solved. Feel free to capture the thread ^^
-
RE: [ProMini] Blue LED on Pin 13 wont turn off
How about an I2C Display? Two wires on A4 &A5...
-
RE: [ProMini] Blue LED on Pin 13 wont turn off
@sundberg84 Thanks a lot for opening my eyes!
I moved the radio to soft spi and now it works like intended.
#define MY_DEBUG #define MY_RADIO_NRF24 // RobotDyn Pro Mini 3,3V 8Mhz has blue LED on Pin13 which is used by radio and will be lit all the time. // Therfore, I moved the radio as it is done for the ethernet gateway. #define MY_SOFTSPI #define MY_SOFT_SPI_SCK_PIN 14 // Analog 0 #define MY_SOFT_SPI_MOSI_PIN 15 // Analog 1 #define MY_SOFT_SPI_MISO_PIN 16 // Analog 2 #define MY_RF24_CE_PIN 5 #define MY_RF24_CS_PIN 6 #define SKETCH_NAME __FILENAME__ #define SKETCH_DATE __DATE__ #define MY_NODE_ID 70 #define MY_PARENT_NODE_ID 0 #define MY_REPEATER_FEATURE false
-
RE: [ProMini] Blue LED on Pin 13 wont turn off
You are right, I missed that one. 13 is a radio pin AND the led output. So I have to move the radio pin or desolder the led, right?
-
[ProMini] Blue LED on Pin 13 wont turn off
I try to get a 2 AA node to work. I desoldered the voltage regulator and the power led from my 3,3V 8Mhz Pro Mini. Then I tried 1 MHz bootloaders and fuses. But the Pin13 LED keeps on burning. I tried to set it to low and high (for maybe chinese reverse logic) but it wont turn off. Strange is: I can blink it on purpose. Then I thought: maybe its an bootloader issue. But same thing wirth original bootloader and on another Pro Mini guess what? Right, the same thing.
Is there something in the beta lib lighting up my led?
I am using this 2.0.0-beta sketch with SI7021:
// Relais Node for MySensors 2.0.0-beta // I am using the filename and compile date for sktech announcements: #include <string.h> // Strip the path info from __FILE__ // For Windows use '\\' instead of '/'. #define __FILENAME__ (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__) #define MY_DEBUG #define MY_RADIO_NRF24 #define SKETCH_NAME __FILENAME__ #define SKETCH_DATE __DATE__ #define MY_NODE_ID 70 #define MY_PARENT_NODE_ID 0 #define MY_REPEATER_FEATURE false #include <SPI.h> #include <MySensor.h> #include <Wire.h> #include <SI7021.h> #include <RunningAverage.h> #include <avr/power.h> //#define BATT_SENSOR 199 #define AVERAGES 2 #define CHILD_ID_TEMP 0 #define CHILD_ID_HUM 1 #define MEASURE_INTERVAL 60000 #define FORCE_TRANSMIT_INTERVAL 30 #define HUMI_TRANSMIT_THRESHOLD 0.5 #define TEMP_TRANSMIT_THRESHOLD 0.5 #define LED 13 #define SI7021_POWER 2 SI7021 humiditySensor; MyMessage msgHum(CHILD_ID_HUM, V_HUM); MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); #ifdef BATT_SENSOR MyMessage msgBatt(BATT_SENSOR, V_VOLTAGE); #endif // Global settings int measureCount = 0; int sendBattery = 0; boolean isMetric = true; boolean highfreq = true; boolean transmission_occured = false; // Storage of old measurements float lastTemperature = -100; int lastHumidity = -100; long lastBattery = -100; RunningAverage raHum(AVERAGES); /**************************************************** Setup code ****************************************************/ void setup() { pinMode(SI7021_POWER, OUTPUT); //pinMode(LED, OUTPUT); digitalWrite(SI7021_POWER, HIGH); //digitalWrite(LED, HIGH); delay (100); Serial.begin(9600); raHum.clear(); sendTempHumidityMeasurements(false); sendBattLevel(false); humiditySensor.begin(); digitalWrite(SI7021_POWER, LOW); //flashLED(5); } void presentation() { sendSketchInfo(SKETCH_NAME, SKETCH_DATE); present(CHILD_ID_HUM, S_HUM, "Humidity"); present(CHILD_ID_TEMP, S_TEMP, "Temperature"); #ifdef BATT_SENSOR present(BATT_SENSOR, S_POWER); #endif } /*********************************************** Main loop function ***********************************************/ void loop() { digitalWrite(SI7021_POWER, HIGH); //digitalWrite(LED, LOW); delay (100); measureCount ++; sendBattery ++; bool forceTransmit = false; transmission_occured = false; if (measureCount > FORCE_TRANSMIT_INTERVAL) { // force a transmission forceTransmit = true; measureCount = 0; } sendTempHumidityMeasurements(forceTransmit); digitalWrite(SI7021_POWER, LOW); //digitalWrite(LED, HIGH); sleep(MEASURE_INTERVAL); } /********************************************* Sends temperature and humidity from Si7021 sensor Parameters - force : Forces transmission of a value (even if it's the same as previous measurement) *********************************************/ void sendTempHumidityMeasurements(bool force) { bool tx = force; si7021_env data = humiditySensor.getHumidityAndTemperature(); raHum.addValue(data.humidityPercent); float diffTemp = abs(lastTemperature - (isMetric ? data.celsiusHundredths : data.fahrenheitHundredths) / 100.0); float diffHum = abs(lastHumidity - raHum.getAverage()); Serial.print(F("TempDiff :")); Serial.println(diffTemp); Serial.print(F("HumDiff :")); Serial.println(diffHum); if (isnan(diffHum)) tx = true; if (diffTemp > TEMP_TRANSMIT_THRESHOLD) tx = true; if (diffHum > HUMI_TRANSMIT_THRESHOLD) tx = true; if (tx) { measureCount = 0; float temperature = (isMetric ? data.celsiusHundredths : data.fahrenheitHundredths) / 100.0; float humidity = data.humidityPercent; Serial.print("T: "); Serial.println(temperature); Serial.print("H: "); Serial.println(humidity); send(msgTemp.set(temperature, 1)); send(msgHum.set(humidity, 1)); lastTemperature = temperature; lastHumidity = humidity; transmission_occured = true; if (sendBattery > 60) { sendBattLevel(true); // Not needed to send battery info that often sendBattery = 0; } //flashLED(1); } } /******************************************** Sends battery information (battery percentage) Parameters - force : Forces transmission of a value *******************************************/ void sendBattLevel(bool force) { if (force) lastBattery = -1; long vcc = readVcc(); if (vcc != lastBattery) { lastBattery = vcc; #ifdef BATT_SENSOR send(msgBatt.set(vcc)); #endif // Calculate percentage vcc = vcc - 1900; // subtract 1.9V from vcc, as this is the lowest voltage we will operate at long percent = vcc / 14.0; sendBatteryLevel(percent); transmission_occured = true; } } /******************************************* Internal battery ADC measuring *******************************************/ long readVcc() { // Read 1.1V reference against AVcc // set the reference to Vcc and the measurement to the internal 1.1V reference #if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) ADMUX = _BV(REFS0) | _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1); #elif defined (__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__) ADMUX = _BV(MUX5) | _BV(MUX0); #elif defined (__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) ADcdMUX = _BV(MUX3) | _BV(MUX2); #else ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1); #endif delay(2); // Wait for Vref to settle ADCSRA |= _BV(ADSC); // Start conversion while (bit_is_set(ADCSRA, ADSC)); // measuring uint8_t low = ADCL; // must read ADCL first - it then locks ADCH uint8_t high = ADCH; // unlocks both long result = (high << 8) | low; result = 1125300L / result; // Calculate Vcc (in mV); 1125300 = 1.1*1023*1000 return result; // Vcc in millivolts } void flashLED(int count) { int i; for (i = 0 ; i < count ; i++) { digitalWrite(LED, HIGH); delay(10); digitalWrite(LED, LOW); delay(200); } }
-
RE: MYSBootloader 1.3 pre-release & MYSController 1.0.0beta
I've just tried two 3,3V Pro Minis. Flashed the 8MHz MYSBootloader without problems (Nano as ISP). After that I connected the FTDI Adapter and programmed Blink and ReadAnalogVoltage examples without error. Both didn't worked on both Pro Minis. With original Bootloaders, they work.
Where is my fault?
-
RE: MQTT Client gateway
Got it to work. Removed serial.print lines and changed sleep() to wait().
-
RE: MQTT Client gateway
I'am trying to add a local DHT22 sensor but as soon as anything is in the loop(), the gateway stops to work.
even if I delete the sleep() rows. Hasn't it to be wait() ?
-
RE: MyController - 0.0.3-Alpha2 pre-release - volunteers required to test
me too, i you need more tester.
-
RE: Cant't get MQTTGateway to work
Seems, that your ip adresses dont match your network. What is the ip of your router? The first 3 numbers have to match in a normal home network...
Are you aware how to do that?
-
RE: maybe interesting wall enclosure
At the logilink page there is a pdf with drawings.
I will get one and will post some pictures...
-
maybe interesting wall enclosure
Found this enclosure for wall mounted sensors. Optional keystone inserts for powering or sensor extension. Available as single and double port. Price from 1€ to 1,95€ at reichelt.de. Only drawback: the two holes on top. Can be closed with dymo tape ^^
http://www.logilink.eu/Produkte_LogiLink/Passive_Netzwerkkomponenten/Modulare_Anschlusstechnik/Keystone_Aufputzdose_2_Port_UTP-weiss.htm
https://www.reichelt.de/Keystone-Gehaeuse-und-Halterungen/LOGILINK-NK4032/3/index.html?ACTION=3&GROUPID=6901&ARTICLE=141645&OFFSET=500&There is another, bigger one with three ports and dust protection for 5€.
https://www.reichelt.de/Keystone-Gehaeuse-und-Halterungen/DELOCK-86262/3/index.html?ACTION=3&GROUPID=6901&ARTICLE=149073&OFFSET=500& -
RE: 2.0 beta, compatible with 1.5?
@cdr by using MyController 0.0.3-alpha, correct?
-
RE: Arduino and NRF24 Mesh Code
The NodeId + SensorId are the adress of that switches, so the same Childs on different nodes are allowed:
- Livingroom Node 10, ChildIds 1,2,3,4,5,6
- Kitchen: Node 20, ChildIDs 1,2,3,4,5,6
you have to present every single one of them. You can use a loop for that like:
#define RELAY_1 3 // Arduino Digital I/O pin number for first relay (second on pin+1 etc) #define NUMBER_OF_RELAYS 4 // Total number of attached relays #define RELAY_ON 0 // GPIO value to write to turn on attached relay #define RELAY_OFF 1 // GPIO value to write to turn off attached relay // [...] for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS;sensor++, pin++) { // Register all sensors to gw (they will be created as child devices) gw.present(sensor, S_LIGHT); } }```
-
RE: Arduino and NRF24 Mesh Code
There is always only one gateway. This has to be NodeID 0. NodeID of the for all other nodes are free of choice or assigned automaticly.
ChildIDs are for the children of the nodes: the sensors themself. They are presented to the gateway. -
RE: Arduino and NRF24 Mesh Code
The gateway is always Node 0 and that "target" is coded as default. If you want to go from Node 2 (S) to Node 1 (R) and then to the Gateway (GW) as stated on your painting above, you have to init Node 2 with "target" Node 1 insted of 0 and tell Node 1, that it is a repeater. This is done by create repeating node.
-
RE: MYSBootloader 1.3 pre-release & MYSController 1.0.0beta
sorry, you are right. Since the source isnt yet available, you cant compile your custom bootloader. So, thats a no.
-
RE: Handling ACK from MySensors
Endpoint to endpoint, not only from node to gateway. Controllers knows the exact state.
-
RE: Cheap LDO for battery usage
My thoughts: Every voltage conversion isnt effective. So why not dump all regulations? ^^
- ATMega328P DIL with internal Clock, 1Mhz, BOD disabled (min 1,8V)
- NRF24 (min 1,9V)
- SI7021 (min 1,9V)
- 2 AA batteries
-
RE: Handling ACK from MySensors
There is a second way for end2end verification:
1.) Controller sends command "Relais: ON" -> Gateway -> Node
2.) Controller asks for the state of the Relais -> Gateway -> Node (reads pin and creates answer) -> Gateway -> Controller
3.) If the states doesnt match, the controller has to send the command again.Requesting a state is done like here:
http://forum.mysensors.org/topic/1467/how-to-deal-with-a-request-for-information-from-controller/19 -
RE: MYSBootloader 1.3 pre-release & MYSController 1.0.0beta
I have to ask again: GatewayW5100MQTTClient or the old Broker Gateway?
I am not able to connect to my GatewayW5100MQTTClient on port 1883 or 5003 with MYSController 1.0.0beta.
The gateway is in working condition with openHAB. -
RE: MYSBootloader 1.3 pre-release & MYSController 1.0.0beta
So its working with a GatewayW5100MQTTClient aswell? That would be fantastic, I thought its only for serial and ethernet gateways. Do I also have to use port 5003?
-
RE: How to deal with a request for information from controller?
I dont see openHAB requesting any state, so maybe its a better idea to read the state of the output pin immediately after setting the relay and publish this and bind it to a control lamp. If this isnt toggling, the command wasnt received.
-
RE: How to deal with a request for information from controller?
I would like to share my sketch for 2.0.0-beta. Its a node with two relays and the ability to read the status from mqtt.
// Relais Node for MySensors 2.0.0-beta // I am using the filename and compile date for sktech announcements: #include <string.h> // Strip the path info from __FILE__ // For Windows use '\\' instead of '/'. #define __FILENAME__ (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__) // #define MY_DEBUG #define MY_RADIO_NRF24 #define SKETCH_NAME __FILENAME__ #define SKETCH_DATE __DATE__ #define MY_NODE_ID 2 #define MY_PARENT_NODE_ID 0 #define MY_REPEATER_FEATURE false #include <SPI.h> #include <MySensor.h> #define RELAY_1 3 // Arduino Digital I/O pin number for first relay (second on pin+1 etc) #define NUMBER_OF_RELAYS 2 // Total number of attached relays #define RELAY_ON 0 // GPIO value to write to turn on attached relay #define RELAY_OFF 1 // GPIO value to write to turn off attached relay void before() { for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS;sensor++, pin++) { // Then set relay pins in output mode pinMode(pin, OUTPUT); // Set relay to last known state (using eeprom storage) digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF); } } void setup() { } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo(SKETCH_NAME, SKETCH_DATE); for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS;sensor++, pin++) { // Register all sensors to gw (they will be created as child devices) present(sensor, S_LIGHT); } } void loop() { } void receive(const MyMessage &message) { int msgcmd = mGetCommand(message); // Verify its a switch command (V_LIGHT) if (message.type==V_LIGHT) { // Command type 1 is a set command if (msgcmd==1){ // Change relay state digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF); // Store state in eeprom saveState(message.sensor, message.getBool()); } // Command type 2 is a request for the sensor state if (msgcmd==2){ // construct message body with requested sensor-id and type V_LIGHT (= switch) MyMessage msg(message.sensor,V_LIGHT); // Example: requested sensor is 2 (message.sensor). // The programm reads the digital pin 4, calculated by 2 (sensor) - 1 (static) + 3 (first relay pin) // after that, the reading is compared to the RELAY_ON value (might be invers logic, regarding to your relais schematic) // if it is matching, the payload is set to 1, otherwise its set to 0 send(msg.set(digitalRead(message.sensor-1+RELAY_1) == RELAY_ON ? 1 : 0)); } } }
and here are the lines in my openhab2 items.item:
Switch node2_sw1 "N2SW1" (all,node2) { mqtt=">[mosquitto:mysensors-in/2/1/1/0/2:command:ON:1],>[mosquitto:mysensors-in/2/1/1/0/2:command:OFF:0],<[mosquitto:mysensors-out/2/1/2/0/2:state:default]" } Switch node2_sw2 "N2SW2" (all,node2) { mqtt=">[mosquitto:mysensors-in/2/2/1/0/2:command:ON:1],>[mosquitto:mysensors-in/2/2/1/0/2:command:OFF:0],<[mosquitto:mysensors-out/2/2/2/0/2:state:default]" }
I would like to repeat: Its for the last versions of mysensors and openhab2. Notice the absence of any "gw." and the different structure in the mqtt strings !
Can someone tell me, if it is a problem to redefine the "MyMessage msg(message.sensor,V_LIGHT); " every time a request is done? I am not sure.
Greetings