@aivaredze Great project. Absolutely great video! Love it. One question: how did you manage to hide the cables between your shield and the led strips? Maybe some pictures?
Posts made by HarryDutch
-
RE: Automatic stairs lighting +MySensors
-
RE: [SOLVED] Sleep dont run
@mar.conte A shot in the dark but have you tried to pull down pin 3 in order to prevent this pin is floating? Connect pin 3 to ground with a 10K resistor.
-
RE: [SOLVED] Sleep dont run
@mar-conte
What happens if you change your sleep function like this:sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), HIGH,0);
-
RE: New MS node creates lots of random sensors, as well as actual sensors [Domoticz]
Domoticz > Settings > uncheck "Accept new Hardware Devices". Don't forget to click Apply Settings.
-
RE: Looking for simple/clean Code example for sleep() external interrupt.
I think the sketch you need is here .
-
RE: [Solved] Strange behavior Sleep() function and interrupts in MyS library 2.1.1
@tekka Yes! This works. Thanks for your help. I'm still confused why my test script worked with 2.0.0. and not with 2.1.1. Thanks again.
-
RE: [Solved] Strange behavior Sleep() function and interrupts in MyS library 2.1.1
@Yveaux I'm using my own pcb's. Nothing special. It has the ATMEGA328p (8 Mhz) and the nrf radio. The hardware worked with MyS library 2.0.0. Using Arduino 1.8.1. Board UNO 8 Mhz 3.3v.
-
[Solved] Strange behavior Sleep() function and interrupts in MyS library 2.1.1
After upgrading the MySensors library from 2.0.0 to 2.1.1 I noticed that the sleep function with interrupts was working different than before. Have a look at the simple test sketch below . In 2.0.0 the loop is called only once after an interrupt. In 2.1.1 the loop is called twice before the sleep function becomes active. Below you have the serial log for 2.0.0 and 2.1.1. for 2 interrupts. Is this a bug or do I need to change some settings or use a different code?
//Test sleep function and interrupt in library 2.1.1 and 2.0.0 #define MY_DEBUG #include <SPI.h> #define MY_RADIO_NRF24 #include <MySensors.h> byte countInterrupt; void isr() {} void setup(void) { pinMode(3, INPUT_PULLUP); // intterupt 1 attachInterrupt(digitalPinToInterrupt(3), isr,FALLING); } void loop() { sleep(1,FALLING,0); Serial.print("interrupt "); Serial.println(countInterrupt++); wait(1000); }
Serial log 2.0.0 (this one works ok).
Starting sensor (RNNNA-, 2.0.0) TSM:INIT TSM:RADIO:OK TSP:ASSIGNID:OK (ID=2) TSM:FPAR TSP:MSG:SEND 2-2-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSP:MSG:READ 0-0-2 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=2) TSM:UPL TSP:PING:SEND (dest=0) TSP:MSG:SEND 2-2-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1 TSP:MSG:READ 0-0-2 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 2-2-0-0 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=ok:0100 TSP:MSG:SEND 2-2-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=ok:2.0.0 TSP:MSG:SEND 2-2-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=ok:0 TSP:MSG:READ 0-0-2 s=255,c=3,t=15,pt=6,l=2,sg=0:0100 TSP:MSG:READ 0-0-2 s=255,c=3,t=6,pt=0,l=1,sg=0:M Request registration... TSP:MSG:SEND 2-2-0-0 s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=ok:2 TSP:MSG:READ 0-0-2 s=255,c=3,t=27,pt=1,l=1,sg=0:1 Node registration=1 Init complete, id=2, parent=0, distance=1, registration=1 ****************** Start first interrupt ************************************* interrupt 0 ***************** Start second interrupt ************************************* interrupt 1
Serial log 2.1.1
0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1 4 TSM:INIT 4 TSF:WUR:MS=0 12 TSM:INIT:TSP OK 14 TSF:SID:OK,ID=2 16 TSM:FPAR 51 TSF:MSG:SEND,2-2-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 2060 !TSM:FPAR:NO REPLY 2062 TSM:FPAR 2099 TSF:MSG:SEND,2-2-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 2277 TSF:MSG:READ,0-0-2,s=255,c=3,t=8,pt=1,l=1,sg=0:0 2283 TSF:MSG:FPAR OK,ID=0,D=1 4106 TSM:FPAR:OK 4106 TSM:ID 4108 TSM:ID:OK 4110 TSM:UPL 4116 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1 4122 TSF:MSG:READ,0-0-2,s=255,c=3,t=25,pt=1,l=1,sg=0:1 4128 TSF:MSG:PONG RECV,HP=1 4132 TSM:UPL:OK 4134 TSM:READY:ID=2,PAR=0,DIS=1 4143 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100 4151 TSF:MSG:READ,0-0-2,s=255,c=3,t=15,pt=6,l=2,sg=0:0100 4159 TSF:MSG:SEND,2-2-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.1.1 4171 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0 4184 TSF:MSG:READ,0-0-2,s=255,c=3,t=6,pt=0,l=1,sg=0:M 4190 MCO:REG:REQ 4194 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2 4202 TSF:MSG:READ,0-0-2,s=255,c=3,t=27,pt=1,l=1,sg=0:1 4208 MCO:PIM:NODE REG=1 4210 MCO:BGN:STP 4212 MCO:BGN:INIT OK,TSP=1 4214 MCO:SLP:MS=0,SMS=0,I1=1,M1=2,I2=255,M2=255 4220 MCO:SLP:TPD 4222 MCO:SLP:WUP=1 ********************* Start first interrupt ******************************** interrupt 0 5226 MCO:SLP:MS=0,SMS=0,I1=1,M1=2,I2=255,M2=255 5230 MCO:SLP:TPD 5232 MCO:SLP:WUP=1 interrupt 1 6234 MCO:SLP:MS=0,SMS=0,I1=1,M1=2,I2=255,M2=255 6238 MCO:SLP:TPD 6240 MCO:SLP:WUP=1 ********************* Start second interrupt ******************************* interrupt 2 7243 MCO:SLP:MS=0,SMS=0,I1=1,M1=2,I2=255,M2=255 7247 MCO:SLP:TPD 7249 MCO:SLP:WUP=1 interrupt 3 8251 MCO:SLP:MS=0,SMS=0,I1=1,M1=2,I2=255,M2=255 8255 MCO:SLP:TPD
-
RE: PCB design with nRF24L01 and Arduino Pro Mini
@RaPo You can zip your .brd and .sch files and upload the zip file.
-
RE: PCB design with nRF24L01 and Arduino Pro Mini
@Raghavendra-Prasad Looks like interference between the radio module and and the pcb. Could also be a GROUND problem with your pcb (it works when you're touching the antenna).
First: remove the nrf from your pcb and reconnect with some jumper wires. Make sure the radio module is outside the pcb. If it works you have to redesign your pcb in such a way that the antenna is outside the pcb.
You could also try to shield your nrf (search the forum).
If it's still not working could you post your EAGLE files? (board and circuit file).
Success
-
RE: First Sensor project, Steep learning curve.
@lozzer65 I'm very curious where you bought the radio with the proper IC and components!
-
RE: PCB and 3D print companies
I have used seeedstudio.com for PCB's and laser cutting. They also do 3D printing. No complaints so far.
-
RE: Codebender on ipad hiding code
@mfalkvidd
When you open YouTube itself then look at the uppper right corner where you should see 3 dots. Tapping these dots will give you the all available options. -
RE: Codebender on ipad hiding code
@mfalkvidd
In Youtube you have an option to enable/disable Youtube links to open in Chrome. -
RE: Codebender on ipad hiding code
@mfalkvidd
Use Chrome on your iPad and your problem is solved! -
RE: Sensor pins
Have a look at MyConfig.h. If you have "#define WITH_LEDS_BLINKING" then D4, D5 and D6 are used for blinking the status led's. Could maybe explain your problem.
-
RE: Domoticz and heater
I've solved this problem with a LUA script in Domoticz. The script copies the values of temperature and humidity to a TEXT sensor (as a string). In the Arduino sketch (you need the MySensors development branch) the string is split in 2 separate values (Strings). Works like a charm.
LUA script:
tempString = "" stringReturn = "" sensor = '103OutsideTempHum' tempString = otherdevices_svalues[sensor] sep = ";" i=1 for str in string.gmatch(tempString, "([^"..sep.."]+)") do stringReturn = stringReturn .. str .. "#" i = i + 1 end commandArray = {} time = os.date("*t") if ((time.min % 5)==0) then--run script every 5 minutes commandArray[1] = {['UpdateDevice'] = 77 .. '|0|' .. tostring(stringReturn)} -- 77 = idx of TEXT sensor in Domoticz end return commandArray
Arduino sketch:
#include <SPI.h> #include <TFT_ILI9341.h> #include <MySensor.h> #define MY_RADIO_NRF24 #define CHILD_ID_TEXT 1 #define CHILD_ID_BUTTON 2 #define MIN_V 2600 #define MAX_V 3200 #define sclk 13 // Don't change #define mosi 11 // Don't change #define cs 17 #define dc 16 #define rst 15 // you can also connect this to the Arduino reset TFT_ILI9341 tft = TFT_ILI9341(); void Button() {} int interrupt; String tempSensor; byte batteryPcnt; MyMessage msgTemp(CHILD_ID_TEXT, V_TEXT); MyMessage msgButton(CHILD_ID_BUTTON, V_STATUS); void presentation() { sendSketchInfo("103 TEST", "1.0"); present(CHILD_ID_TEXT, S_INFO); present(CHILD_ID_BUTTON, S_BINARY); } void setup() { Serial.begin(9600); pinMode(4, OUTPUT); digitalWrite(4, HIGH); pinMode(3, INPUT_PULLUP); // int 1 used by button attachInterrupt(digitalPinToInterrupt(3), Button,FALLING); } void loop() { if(interrupt == 1) { send(msgButton.set(1)); request(CHILD_ID_TEXT, V_TEXT); batteryPcnt = min(map(readVcc(), MIN_V, MAX_V, 0, 100), 100); sendBatteryLevel(batteryPcnt); wait(500); Screen(); send(msgButton.set(0)); } digitalWrite(rst, LOW); digitalWrite(4, HIGH); wait(10); interrupt = sleep(1,FALLING); } void receive(const MyMessage &message) { if (message.sensor == 1) { tempSensor = message.getString(); } wait(200); } //====== Show screen after hitting button ============================== void Screen() { digitalWrite(4, LOW); wait(10); tft.init(); tft.setRotation(2); char c_tmp[6]; char c_hum[6]; int sepIndex1 = tempSensor.indexOf('#'); int sepIndex2 = tempSensor.indexOf('#',sepIndex1+1); String tmp = tempSensor.substring(0,sepIndex1); String hum = tempSensor.substring(sepIndex1+1,sepIndex2); tft.fillScreen(ILI9341_BLACK); wait(5);//don't touch this!! tft.setTextSize(1); tft.fillRoundRect(5, 5, 230, 180, 10, ILI9341_WHITE); tft.setTextColor(ILI9341_BLUE); tmp.toCharArray(c_tmp, 6); tft.drawCentreString(c_tmp,120,50,8); tft.fillRoundRect(5, 190, 230, 90, 10, ILI9341_WHITE); tft.setTextColor(ILI9341_BLACK); tft.setCursor(10,200,4); tft.print("Humidity "); tft.setTextColor(ILI9341_BLUE); tft.setCursor(120,200,4); hum.toCharArray(c_hum, 6); tft.print(c_hum); tft.print(" %"); tft.setCursor(200,245,4); tft.print(batteryPcnt); wait(15000L); } 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__) ADMUX = _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 }
-
RE: MySensors Network at a High School Farm
Wow! What a great project. It's on the top of my list now. Thanks!!
-
RE: Nano vs uno
You could try to enter the node id in your sketch instead of asking the controller for a node id. Maybe clearing you EEPROM first will help too.
gw.begin(NULL,190)
(190 is just an example of an id)
-
RE: Hall effect sensor
You need a linear hall efect sensor (output proportional to field strength). Search Ebay for A1301 Hall sensor.
More information here:
http://playground.arduino.cc/Code/HallEffect -
RE: Running ATmega328P on internal 8MHz clock
Have a look here:
http://www.gammon.com.au/breadboardThis is the easyiest way to bootload you Atmega328p with 8Mhz. Works like a charm.
-
RE: WITH_LEDS_BLINKING - for gateways only?
MySensors 1.5.1
Controller: DomoticzI'm using a simpel test sensor with the "blinking led's" to find "dead zones" in my house. The "blinking led's" are a big help for this and works flawlessly all the time.
/** * 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. * ******************************* */ #include <SPI.h> #include <MySensor.h> #define CHILD_ID_BUTTON 0 //pushbutton attached to interrupt 0 (= pin 2). #define CHILD_ID_LED 1 //LED that is switch on/off by the controller (Domoticz). MySensor gw; MyMessage msg(CHILD_ID_LED, V_LIGHT); MyMessage msg2(CHILD_ID_BUTTON, V_STATUS); byte firstTime = 1; //make sure that the mcu is going to sleep for the first time (no loop) void setup() { gw.begin(incomingMessage); gw.sendSketchInfo("Test sensor","1.0"); gw.present(CHILD_ID_LED, S_LIGHT); gw.present(CHILD_ID_BUTTON, S_BINARY); pinMode(2, INPUT_PULLUP); //interrupt = 0; pinMode(7, OUTPUT); //LED is attached to pin 7 digitalWrite(7, LOW); //make sure that the LED is off } void loop() { if(firstTime == 0) { gw.process(); gw.send(msg2.set(1)); // send to controller a message that the button has been pushed. The controller then swithes the LED on (incomingMessage) gw.wait(2000); if(digitalRead(7) == HIGH) digitalWrite(7, LOW); // switch the LED off after 2 seconds gw.send(msg.set(0)); // let the controller know that the mcu has switched off the LED gw.wait(2000); } firstTime = 0; gw.sleep(0,FALLING); // go to sleep and wait for the next button push } void incomingMessage(const MyMessage &message) { if (message.type == V_LIGHT) { if (message.getInt() == 1) digitalWrite(7, HIGH); } }
-
RE: Anybody else seeing - unstable nodes - Need restart every ~24-48 hours?
Have a look here. Remove all Serial.print(...) and Serial.println(...) and try again. Or use Serial.print(F(....)).
-
RE: How low can arduino can go?
To be honest I have not the foggiest idea why the current drops that much during sleep after a few days. What I do know is that 900 and 120 µA during sleep is way too much. The point is that whatever you connect to your Arduino, you have to switch it off when it’s not needed. At least when you use batteries to power your project. Take for example the DHT22 you use. According to the datasheet it’s using 50 µA in stand-by mode and the current drain of the light sensor (LM393?) is about 800 µA. I assume that you want to take a sample every 5 minutes or so? If that’s the case you can sleep the Arduino between 2 samples and switch off the light sensor and the DHT22 sensor at the same time.
There are a couple of ways to achieve that: using a transistor (http://jeelabs.org/2012/09/07/switching-with-a-pnp-transistor/#comments) using a MOSFET (logic level) (http://jeelabs.org/2012/09/08/switching-with-a-p-mosfet/) or using one of the I/O pins of the Arduino as a “power supply”. The last solution only works for low currents like 1.5 mA (max) for the DHT22. I don’t have the specs for the LM393 but it should be around 3 mA. There’s one important fact about using I/O pins as power pins and that is the voltage drop. When you click the first URL above you see a graph showing the relation between the pin output voltage and the source current. As you can see there is a voltage drop so that the sensor will not get the full supply voltage. Looking at the datasheet for the DHT22 the supply voltage goes from 3.3V (min) to 6V (max). If you are using a 3.3V Arduino Pro Mini it’s possible that the DHT22 is not getting enough voltage from the I/O pin to operate reliably (not tested). So in this case you can use the 5V Pro Mini. The code for the DHT22 looks something like this:
void setup() { pinMode(7, OUTPUT); // “power pin” you can use any other pin digitalWrite(7, LOW); // switch power off } void loop() { digitalWrite(7, HIGH);// switch power on delay(1000); // delay is needed for the sensor to stabilize // take a sample and the rest of your code digitalWrite(7, LOW);// switch power off }
You can try the same for the light sensor. Maybe you can use the same pin to power both sensors (not tested). Do not exceed 20 mA per pin. So try this and see if your problem is still present. I think it's a good idea to do some tests yourself with using a transistor/MOSFET as a switch. I learned a lot by doing these tests by myself.
-
RE: How low can arduino can go?
If you have a problem with your project (in this case you can't get the power consumption down to microamps) it's maybe a good idea to start with a bare minimum setup. In this case an Arduino Pro Mini, a regulated power supply and a sketch that's puts the Arduino to sleep. So for now you better focus on sleeping the Pro Mini and bring current consumption down to a couple of microamps before trying anything else.
First you need to understand what these power savings are all about. This site (Nick Gammon) is all you need to know about power saving techniques for microprocessors (a must read):
http://www.gammon.com.au/forum/?id=11497Read it all, do some of the examples yourself and above all try to understand what's happening.
After that start with your basic setup to put the Arduino to sleep. This is how I do it:
Arduino Pro Mini: use the 3.3v version. Remove the power led because it's useless and it's still using a couple of milliamps. I lift it off the board by using a small watchmaker screwdriver. Try to get it between the bottom side of the led and the pcb and use some force to lift it from the board. You could also cut one of the connections from the led to the board. For now don't remove the voltage regulator (more about this later).
For the power supply I use a 3.3 volt LDO voltage regulator. In this case the HT7333-A (TO-92 package). I know there are a lot more LDO voltage regulators to choose from, but I have good results with this LDO. Search Ebay for it. Price is about $4 for 20 pieces. They have an ultra low quiescent current of only 4 microamps. According to the datasheet you need a 10 uF cap across Vin and GND and Vout and GND so use them. Find and read the datasheet to find out how to connect it.
I’m using 3 AAA batteries (alkaline) to power the voltage regulator. Later on you can try other options (step-up, step-down, other regulators and so on) but for now stick with the setup as described above.
Finally use the sketch below to put the Mini to sleep and check with your multimeter the current consumption. In this case I measured 38 uA with the voltage regulator in place (Voltcraft VC170 digital multimeter). After removing the voltage regulator I measured a current of only 3uA. Be aware that measuring very low currents are influenced by burden voltage (this is a nice video about burden voltage https://www.youtube.com/watch?v=fRP98k3Rh1E).
#include <avr/sleep.h> void setup () { // disable ADC ADCSRA = 0; set_sleep_mode (SLEEP_MODE_PWR_DOWN); sleep_enable(); // turn off brown-out enable in software MCUCR = bit (BODS) | bit (BODSE); MCUCR = bit (BODS); sleep_cpu (); // sleep within 3 clock cycles of above } // end of setup void loop () { }
Question is if it's really necessary to remove the voltage regulator to save an extra 35 uA. There is a nice battery life calculator here: http://oregonembedded.com/batterycalc.htm that will show you the difference in battery life when using 3uA or 38uA. I think a minimum period of 1 year before you have to replace/recharge your batteries is acceptable. Suppose you're using 3 AAA alkaline batteries. Capacity rating is then 1200 mAh (capacity is automatically derated by 15% to account for some self discharge.) Current consumption (without the regulator) is 0.003 mA. Current consumption during wake is 25 mA and the number of wakeups per hour is 12 (for example you take a temperature measurement every 5 minutes). Durations of wake time is 50 ms. If you use these figures with the calculator, battery life is 16 years. If you change 0.003 mA into 0.038 mA battery life will be 2.7 years. So you have to ask yourself if removing the voltage regulator (with the risk of destroying your mini which happened to me more than once) is really necessary. In this case I think it's not.
If you really want to remove the regulator there are several ways to do this. Best way (at least for me) is first cutting the legs of the regulator with a very sharp scalpel. Be careful to cut only the legs and not the board beneath it. Then try to lift it from the board by using a needle nose pliers. Use minimal force! If you have to use too much force then try to cut the legs a little further.
So there you have it. First try to prove to yourself that it's possible to get current consumption for an Arduino Pro Mini down to a few microamps and only then continue your adventures in MySensors land! Hope this helps.
-
RE: Building an IR controller
I don't know which IR library you are using, but this one is very good:
https://github.com/cyborg5/IRLib
Several examples to troubleshoot IR issues and don't forget to read the manual there (84 pages!).
-
RE: Reusing arduinos?
If you mean EEPROM values above address 512 then you are right. The sketch only writes from 0 to 512. Your pro mini EEPROM however has 1024 addresses. Does this make sense?
-
RE: [closed] How to differentiate Arduino Pro Mini 3v3 and 5v?
If you have removed the regulator, take the bare minimum sketch, put Serial.begin(9600) in the setup and Serial.println("blablabla") in the loop. Then select Pro mini and 3.3v processor. If you get gibberish in you serial monitor you have a 5v version and if you see blablabla you have a 3.3v version. Try it. Works with 5v 16Mhz and 3.3v 8 Mhz.
-
RE: Repeater and blinking leds [SOLVED]
Hahaha. I've printed your comic. It's hanging now in front of me to remind me that there are different ways to solve a problem. By using the GW I now have a perfectly working project. Thanks for pointing me into the right direction. But I will still try to get the node to node communication working although it's no longer a problem!
-
RE: Repeater and blinking leds [SOLVED]
@rvendrame and Chaotic
You're both right of course. I'm now using the automation function in EasyIoT and that's working. So Node inside fridge -> Relay -> Gateway -> LED Node. On the other hand: node to node communication should be possible so I will do some more testing to see if I can get it to work. Thanks for now.
-
RE: Repeater and blinking leds [SOLVED]
Really appriciate your assistance. All this MySensors stuff is working perfectly well, so not getting this node to node communication right is driving me nuts!
First thing tomorrow I will try your suggestions. Thanks again.
-
RE: Repeater and blinking leds [SOLVED]
Moved code from IncomingMessage() to loop() and the led is on for 2 seconds. So the led is working as it should.
Did changed things a little bit . Node 2 (temperature/humidity sensor in the fridge) is sending temperature/humidity to controller and temperature to node 3 (the node with the leds).
gw.send(msgTemp.set(temperature,1));
gw.send(msgHum.set(humidity, 0));
gw.send(msgTemp.setDestination(3).set(temperature,1));//SEND TEMPERATURE ALSO TO NODE 3This is the output serial monitor node 2:
sensor started, id 2
send: 2-2-3-0 s=255,c=0,t=17,pt=0,l=5,st=ok:1.4.1
send: 2-2-3-0 s=255,c=3,t=6,pt=1,l=1,st=ok:3
send: 2-2-3-0 s=255,c=3,t=11,pt=0,l=15,st=ok:Pressure Sensor
send: 2-2-3-0 s=255,c=3,t=12,pt=0,l=3,st=ok:1.0
send: 2-2-3-0 s=0,c=0,t=7,pt=0,l=5,st=ok:1.4.1
send: 2-2-3-0 s=1,c=0,t=6,pt=0,l=5,st=ok:1.4.1
Temperature = 17.10Humidity = 57.90send: 2-2-3-0 s=1,c=1,t=0,pt=7,l=5,st=fail:17.1
send: 2-2-3-0 s=0,c=1,t=1,pt=7,l=5,st=ok:58
send: 2-2-3-3 s=1,c=1,t=0,pt=7,l=5,st=ok:17.1Looking at the last line it seems to me that sending the temperature value to node 3 is ok.
Node 3 (also a repeater) has now a copy of the Relay Actuator sketch where I have changes relays into leds. There are 3 leds that I can now switch on and off by using the controller. This is working. This is the code for the function IncomingMessage():
**void incomingMessage(const MyMessage &message) {
if (message.type==V_LIGHT) {
digitalWrite(message.sensor-1+LED_1, message.getBool()?LED_ON:LED_OFF);
gw.saveState(message.sensor, message.getBool());
}
// ==== THIS IS NOT WORKING ==========================
if (message.type==V_TEMP) {
digitalWrite(6, HIGH);
delay(2000);
digitalWrite(6, LOW);
}
**And this the output of the serial monitor of node 3:
**repeater started, id 3
send: 3-3-0-0 s=255,c=0,t=18,pt=0,l=5,st=ok:1.4.1
send: 3-3-0-0 s=255,c=3,t=6,pt=1,l=1,st=ok:0
send: 3-3-0-0 s=255,c=3,t=11,pt=0,l=3,st=ok:LED
send: 3-3-0-0 s=255,c=3,t=12,pt=0,l=3,st=ok:1.0
send: 3-3-0-0 s=1,c=0,t=3,pt=0,l=5,st=ok:1.4.1
send: 3-3-0-0 s=2,c=0,t=3,pt=0,l=5,st=ok:1.4.1
send: 3-3-0-0 s=3,c=0,t=3,pt=0,l=5,st=ok:1.4.1
read: 2-2-0 s=255,c=0,t=17,pt=0,l=5:1.4.1
send: 2-3-0-0 s=255,c=0,t=17,pt=0,l=5,st=ok:1.4.1
read: 2-2-0 s=255,c=3,t=6,pt=1,l=1:3
send: 2-3-0-0 s=255,c=3,t=6,pt=1,l=1,st=ok:3
read: 2-2-0 s=255,c=3,t=11,pt=0,l=15:Pressure Sensor
send: 2-3-0-0 s=255,c=3,t=11,pt=0,l=15,st=ok:Pressure Sensor
read: 2-2-0 s=255,c=3,t=12,pt=0,l=3:1.0
send: 2-3-0-0 s=255,c=3,t=12,pt=0,l=3,st=ok:1.0
read: 2-2-0 s=0,c=0,t=7,pt=0,l=5:1.4.1
send: 2-3-0-0 s=0,c=0,t=7,pt=0,l=5,st=fail:1.4.1
read: 2-2-0 s=1,c=1,t=0,pt=7,l=5:19.4
send: 2-3-0-0 s=1,c=1,t=0,pt=7,l=5,st=ok:19.4
read: 2-2-0 s=0,c=1,t=1,pt=7,l=5:51
send: 2-3-0-0 s=0,c=1,t=1,pt=7,l=5,st=fail:51
** -
RE: Repeater and blinking leds [SOLVED]
Thanks for taking your time. But still no luck with this. I now have stripped both the receiver and transmitter sketch to an absolute minimum. Just to see if a message goes from the transmiiting node (3) to the receiving node (7). If a message arrives at node 7 a led will be on for 2 seconds. But that is not working. Is there something wrong in this receiving sketch?
Receiving sketch:
<pre><code>
**#include <MySensor.h>
#include <SPI.h>MySensor gw;
#define ledPin 6
void setup()
{gw.begin(incomingMessage, AUTO, true);
Serial.begin(115200);
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, LOW);gw.sendSketchInfo("TEST", "1.0");
}void loop()
{
gw.process();
}void incomingMessage(const MyMessage &message) {
digitalWrite(ledPin, HIGH);
delay(2000);
digitalWrite(ledPin, LOW);
}**
</code></pre> -
Repeater and blinking leds [SOLVED]
I'm using EasyIoT as controller and have 2 sensors (one in the fridge and one outside) and 1 repeater (for the sensor in the fridge). This all works perfectly well. I'm now trying to achieve that on the repeater a red led blinks if temperature in the fridge drops below 4 °C and a green led blinks if temperature rises above 8 °C. I first made a third test sensor that is simply sending a fixed temperature value to the repeater just to see if the message arrives at the repeater and how it should process there. Node id test node is 3 and node id repeater is 7. This is the code for the test node:
<pre><code>
**#include <MySensor.h>
#include <SPI.h>#define TEMP_CHILD 0
unsigned long SLEEP_TIME = 60000;
MySensor gw;
MyMessage msgTemp(TEMP_CHILD, V_TEMP);
void setup()
{
gw.begin();gw.sendSketchInfo("Test Node", "1.0");
gw.present(TEMP_CHILD, S_TEMP);
}void loop()
{
float temperature = 123.0;
gw.send(msgTemp.setDestination(7).set(temperature,1));
gw.sleep(SLEEP_TIME); **
</code></pre>In the serial monitor and server console I can see that this test node is sending the fixed value of "123" to destination 7 (repeater):
send: 3-3-0-7 s=0,c=1,t=0,pt=7,l=5,st=ok:123.0
And then it stops. I have no idea how to process the incoming message at the repeater side (the blinking leds are not the problem but only the processing of the incoming message). I'm using the default MySensors sketch for the repeater. If someone could point me in the right direction (maybe some example somewhere on this forum. Have looked but cannot find it) I would be very gratefull.
-
RE: Power consumption NRF24L01+
Thanks for taking your time to answer my question.
I'm sure now that it was a faulty module. After replacing the module the current consumption during sleep is now 40 uA again. I'm only curious why a module like the NRF24L01 suddenly decides that it no longer wants to go to sleep. But it's now working perfectly again. So problem solved!
-
Power consumption NRF24L01+
I'm using several sensors with the NRF24L01+ module (with the EasyIoT controller). One of these sensors started to use much more power than before (5 mA instead of 50 uA). After some debugging it turned out that this was caused by the NRF24L01+ module itself. Replacing this module by a new one brought the power consumption back to 50uA. I'm very curious why the NRF module was suddenly starting to use much more current than before. Just a faulty module? Has anyone else ever experienced this ?
(Arduino Pro Mini 3.3V, voltage regulator 3.3V (HT7333-A), 3 x AAA batteries (4.5v), DHT22).