I thought I'd share a part of my 'workshhop'. Only part of it due the rest being in a bit of a mess at the moment, so here is the 'good' bit......
Best posts made by skywatch
-
RE: Your workshop :)
-
RE: Over the air updates
I would really like to get OTA working here as it's freezing outside and I have to go there to update the software in the greenhouse control system.
So please, can we have a 'how to' step-by-step guide to OTA? Please?
S.
-
Merry Christmas and a Happy New Year
Merry Christmas and a Happy New Year to all of you on (or behind) this forum.
Here's to 2018 and a much better year for us all!
-
Merry Christmas / Happy New Year
Seasons greeting to all of you. Hope you have a nice festive season.
-
RE: I am in need of some programming help.
@bc123 said in I am in need of some programming help.:
I have a cool project
So does everyone else
I hired someone to do about a year ago, but it never worked entirely.
Why is that?
need some help with the programming.
Then post your code and the issues you are facing and someone might help you out.
Project: Driveway alert system, looooong driveway.
So it's just a basic 'alert system' - good.
I have 4 sensor beams shooting across the driveway and they are spaced about 100' apart from each other.
That is good if that is what you want/need for your cool project.
Each can provide a NO or NC contact.
Good.
I have conduit running between all 4 points
Good idea if you don't want jammable RF.....
and was planning to run Ethernet wire between them
So only empty conduit at the moment then?
The board has a LORA radio on it
Good.
and is transmitting to my Arduino receiver, which is tied to a pi running Domoticz.
Good.
I hired someone a year ago to build a system for me using 4 transmitters (one for each sensor),
You already told us this bit.
but I don't think he knew what he was doing.
Why is that?
We got several running temperature/humidity data
That wasn't the original 'alert' spec was it? Or maybe it was? Maybe it is supposed to be a driveway alert system with temperature and humidity sensors 100 feet apart? Who knows? What are you 'really' wanting to do here?
but, the input pins donโt work like theyโre supposed to.
So is this faulty hardware issue then?
Why 4 sensors on the driveway? Eventually Iโll install my railroad signals and be able to direct one way traffic up and down the driveway! How cool is that!
If you really have that much traffic on your driveway then it might be a better idea to have a 2-lane driveway.
Help anyone? Happy to compensate for your efforts!
How can we help? You posted an 'alert' dream that later included temperature and humidity. Then it morphed into a traffic control system (either automatic or manually controlled, we don't know which at this stage).
Then you ask for programming help and don't even post a single line of code.Yes that was all a bit 'tounge-in-cheek' but hopefully you get the idea.
First define what you actually want.
Post code you are trying to get working.
Post drawings of how it is all connected up.
Post photos of the project.Where is the project located on this once fine planet?
Where do I get my compensation from? -
RE: Is ARM the future of MySensors?
The current NRF24 set up is more secure than bluetooth or wifi from attack.
I say this based on the fact that anyone with a laptop, mobile etc can have software to crack/hack/spoof/inject into bluetooth or wifi. It is not that difficult for kids to do.
The NRF is another matter as to achieve this on that radio module would require acquiring a module, setting it up with a pc/phone and then getting software to attack it.
People often go the easiest route and I am less worried about nrf24 than I would be if the system used bluetooth/wifi or cloud.
Just my thoughts on a dark and wet Monday morning.....
-
RE: nrf24+ module with stick antenna
@ben999 said in nrf24+ module with stick antenna:
@skywatch oh great thanks for that !
by removing the smd then the signal becomes "compatible" with a 2.4ghz stick antenna ?
It completely removes the strip antenna on the pcb as well as the matching stub. The component is likely a zero ohm resistor. So you will be taking the RF from the point before the antenna and it should work.
or shall i go with wire and adjust length ?
That is up to you! You could always try both and see what works best for you. It's only a few minutes work. Don't forget to post your findings for others to learn from...
-
RE: Problems with the neighbours
Your best bet is still to simply change to a different unused channel.
Nrf24l01+ has over 100 channels available, why insist on using one in use by someone else nearby?
Even if you do encrypt all data the radios will still suffer due the the high level of signals around swamping the receiver front ends and reducing sensitivity adn increasing liklihood of packet collisions.
Far better to find a clear channel and use that, but it's up to you at the end of the day.
-
RE: Sensor doesn't assisiate with gateway
@TheStaticTurtle You are using an older version of mysensors. 2.3.2 is current so first of all upgrade to that.
Second, looking at the node log it never finds the gateway. FPAR is "find parent" and it never does, so nowhere to send the data. The "!TSM:FPAR:FAIL" is also a clue as to no comms with the gateway.
Why this is I don't know as you haven't posted your code.
-
Merry Christmas and a Happy New Year.
Just to say I wish you all good health in 2021 and thanks for the stimulating discussions and friendly forum.
god Jul och Gott Nytt ร r!
-
RE: Advice needed
There are 2 ways of doing this.
First is to have a 'dumb' node that sends data to the controller. Then the controller decides if the relay has to be on or off and sends a signal to make it happen. This is how many systems work.
The down side to this is that if the gateway becomes unavailable or the controller crashes, the relay state will not change.
Personally I prefer to make the node as smart as possible, collecting data, doing calaculations and performing actions while sending the results to the controller for display. The controller can still send commands to the node but if the gateway or controller fail the realy will still operate as expected.
You could even have the nodes request/send data to each other to confirm the status of the realy or anything else for that matter. That's really a third option
So I would approch it by haing node 1 get temp, send to controller and node 2. Have node 2 decide on realys status, switch relay and inform node 1 and controller of the status change. I am sure you can think of variations on this as well because you know best how you want things to work.
-
Merry Christmas and a Happy New Year !!!
Just to wish those who celebrate it a Happy Christmas and of course a Happy New Year to you all!
Lets hope 2022 is better than 2021
-
RE: 2nd sensor in sketch not showing up in HA
@BearWithBeard You beat me to it by a minute!
-
RE: NRF51822 door sensor - help needed [Solved]
@Puneit-Thukral It looks ot me that your sleep calls are the problem here.
You sleep the mcu with no way of waking up when an interrupt happens. In my door node I have a sensor for the door open/closed and an anti-tamper which triggers if the unit is moved from the wall. Here is how I did the sleep and interrupt call.....
sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, digitalPinToInterrupt(DIGITAL_INPUT_ANTITAMPER), CHANGE, SLEEP_TIME);
This way the mcu will sleep, but awake when an interrupt changes.
I hope this helps you get it working!
-
RE: Please can you tell me where I have gone wrong here?
@wallylama
I already did that! - That's why I now need to make it all work!!!
-
RE: Fewer home automation postings? What's behind it?
I think it would be good to track users posts and then see when they stop posting to the forum.
From my personal experience, it will be failure and frustration that gets people down. They arrive at this site and it all looks really good.....until you come to try it and then you discover a whole nets of vipers just waiting.
I have hit brick walls in the past and given up to concentrate on project with a higher chance of success. I still come back and ech time get stuck again.
Most recently I wanted a temp sensor that sent temp every 2 mins and battery level every 1/2 hour. It didn't work and none of the helpful suggestions could make it work. So it's all sat there disconnected until I see a solution to the problem.
I also use MyController and have issuse with suddenly loosing all sensors except those internal to the pi. The MYSGW still gets data. At the moment I have nrf attached directly to the pi. The MyC team suggest adding an arduino and running it differently to solve the issue.
What would be aHuge improvement would be a traffic light system where each of the 'build' pages shows if it all works as expected under the current releases.
Green = all working as it should, Amber = minor problems but OK for most and Red = Stop, don't even bother just yet.Just my experience/
-
RE: Waking up on timer AND interrupt
@BearWithBeard Thank you for sharing this great tip! - It works great and maybe finally I get my lightning detector working!
Thanks @mfalkvidd For putting this in with the docs where it will hopefully help others. We need more examples like this in a knowledge base to save time reading through lots of posts that are many years old.
-
RE: Recommendations for soldering temperature
This depends on a number of factors.
- Tip size and shape will change the optimum temp for soldering.
- Thermal inertia of the soldering iron station controller.
- Heating element used inside soldering iron.
- Type and brand of solder used.
- Type of solder pad you are soldering to.
It goes on and on. But I usually use 350-380 for that. I prefer a quicker heating of the spot to get a good flow and then done. The lower the temperature the longer you need to apply the heat and the more chance there is of overheating and dry joints.
So it is all down to experience and a little trial and error, which is exactly what you are doing!
-
RE: 3V battery for door sensor node.
Thanks for all the input and ideas - I'll go with cr2032 and see how it goes. Batteries, holders and ceramic caps are all on their way, so time will tell on this one.
Thanks all!
-
RE: What does 1 and 0 in send(msg.set(value==HIGH ? 1 : 0)) really means?
@pl_rekin It's great when the 'penny drops' - Learning is not so bad when you can admit not knowing something and move on with enhanced knowledge!
-
RE: Sensor advice
@noclue You could start right here, but we can't help much without knowing what you want to sense etc.
-
RE: [SOLVED] High battery usage (Pro-Mini / RFM69 / Si7021)
Your sleep interval is set for 1 minute but the comment says 10 minutes.
If you want 10 minutes between sends then you have to change the sleep_interval from 60000 to 600000. (note the extra '0').
-
Arduino IDE 1.8.10 - Warning....
The new arduino 1.8.10 has problems. I updated to this and previously compiled sketches will not compile. I reverted to 1.8.9 and all is well again.
There is a lot of posts on arduino about issues with 1.8.10. - I am using the win 10 x64 version.
-
RE: Supply 230V/5V for node ? Mini Pro, NRF24L01, ams1117
@evb The last 2 photos on this thread show those cheap crappy Chinese power converters that wouldn't likely pass electrical safety checks in many countries (they can get away with it as it is not a finished product and is not subject to electrical safety inspection in your country before you get it).
Power supplies are not an area you want to scrimp on!
Make sure that they are properly isolated with a large gap (preferably an air gap) for the high voltage side along with fuses, filters and mov's.
The most important things with power is safety (your life and other peoples).
Fire risk (would your home insurance pay out if one of these was found to be the cause of a fire?).
Heat. All power converters generate heat of some sort. It needs to go somewhere or the life of the components will be shortened and the risk of fire increases.
Lets also not forget that the fewer components on a power board will usually make the output electrically 'noisier' and can cause thier own problems with the radio side of things or other equipment. -
RE: Dual radio repeater?
@lammietv200 If the ship is made of metal then it'll be really luckly if it works. For watertightness and fire refulations you may not be able to drill new holes in any wall/bulkhead.
The engine room most likely has a riser or other means of getting existing power and control cables in/out. So I would start looking there and thinking of a wired node as interference will be another concern in an engine room environment. -
RE: Supply 230V/5V for node ? Mini Pro, NRF24L01, ams1117
@Didou I know that cheap price is attractive, but in the long run it may not be the wisest path to take, especially with things connected to high voltages.
When I mentioned the 4 'fake' power supplies back up this thread the thing that alerted me to be concerned was the fact that the power cables sent with them broke THREE electrical safety regulations in the UK. People are importing dangerous items and using them unawares. Its frightning really as there was even a case of a child being killed by a fake games console bad power supply. The risks are real.
If you understand spoken English there is a TV program called 'Fake Britain' which i believe is on the web too. It follows investigations into all sorts of fake and dangerous items that get into the country. It's a very enlightening watch.
-
RE: Raspberry PI killing memory cards
@zboblamont said in Raspberry PI killing memory cards:
@skywatch Agreed entirely on the supply quality for the Pi, but disagree with the "bonus" of throwing away the SD. Murphy's Law applies, a RO card allows you to revert to a spare OS card if the drive ever fails...
No problem with your view on this, it gives the OP different ideas and approaches to the original issue. All my pi back themselves up to the SSD or server on a weekly or daily schedule. So I don't worry about reverting the system. I use kingston 20Gb SSD's with usb adaptor cables and all running smoothly.....just wait for something to happen now I have said that!
The Pi3 has 4xUSB2, the Pi4 uprated to 2xUSB2 + 2xUSB3, the data transfer limits of the Pi3 are lower, but still plenty fast.
I just oreder my first pi4 (4Gb) - if it is as good as it seems then a few pi3's will be made into cameras and replaced by pi 4's during the rest of the year. I just wish they put a MCLK out on the pi 4 for pro audio use......ah well......
PS - I recall some USB adapters for SSD could cause issues for the Pi, fairly sure it was on a video by the "Swiss guy"...
Compatability is always going to be an issue is seems. ;(
-
RE: ๐ฌ Air Humidity Sensor - DHT
Hurrah!
Now I can sleep at night again
Good job!
-
RE: Raspberry PI killing memory cards
@zboblamont No problem with your thoughts on that
@iancu Hope the answers here have helped a little for you (or maybe confused the issue even more!).... Let us know what tou decied and how it works for you
-
RE: ๐ฌ Building a Raspberry Pi Gateway
Maybe you didn't enable SPI on the pi.
From command prompt type 'sudo raspi-config', then select option 5 from the menu. This takes you to where you can enable the SPI bus on the pi. Then try again.
S>
-
RE: Which vector network analyzer should we buy?
@NeverDie I love the screen printing on the PS 100
ANTENNA ANAL YZER !!!
I don't know your intended use case for this, but a better professional tester that doesn't YZER your rear end might be a better long term solution. Either that or get a RF design company to create what you need.
-
RE: MH-Z19 CO2 sensor
Thank you for posting this..... I tried it today and it works well!
To test it I wondered where to get a source of co2 from, then an idea hit me......So I opened a beer
I tipped it into a pint glass and drank most of it. Then, when I remembered the reason for opening the beer, I dangled the sensor into the glass, well above the liquid, placed my hand on top to seal it and swirled the beer around to release the co2 that makes it fizzy - result?Well in the room I was getting a constant reading of 395, but in the beer glass it went to 1711, 3055, 5000 !!! - So it works!
Removing the sensor back to normal room air and it dropped back to 396 within 90 seconds.
So quite impressed at the moment. So far this it the most expensive sensor I have used. About $18 for the 'B' version.
-
RE: Best 3d printers
3D printing is quite a minefield at the moment. Technology is developing rapidly and new models appear all the time.
A few thoughts I can offer as a year long 3d printer owner are as follows......
How good are you at engineering? Are you happy taking the printer apart to clean the print head nozzle?
What are your expectations? what are you intending to use it to print?
What material do you want to print with? pla? abs? nylon? carbon fibre?
What sort of 3D printing do you have in mind? There are different types with wildly varying uses (and prices!).
How big is the biggest item you want to print?
How strong does the print have to be? WIll it be used outdoors? Does it need to be waterproof?
What is your budget - for the printer and the running costs including material used for printing?If I were you I'd spend a week looking at you tube videos on the subject and look at a few dedicated online 3d printing forums to get a feel for it.
FWIW I went with a branded 'ready to use out the box' printer (flashforge finder) and it has given me a good introduction to 3d design and printing. There are occasions when I wish the build area was bigger, but often things can be made in sections and assembled into a larger item, but not always...
-
RE: Wireless remote door lock - HW choices
I am quite worried about this. You will need a very stable gateway/controller to do this in the first place. Unless there are local overrides for the locks on each door (both sides).
What concerns me is if there is a power outage, how will you open the doors?
If the power is taken out by something catching fire, how will people exit?
Don't forget security either. Message signing is the minimum requirement for this type of setup. -
RE: Laundry sensors
@tbowmo I grinned when reading this!
I would try an infra red beam and try that first as it will have a longer service life than any laser I know.
Also, don't cut wifi to the whole house as you will 'punish' everyone else too (though it might generate some peer pressure it might also start a war).You could set up a camera to catch the culprit and then send the photo and 'suitable advice' to their phone along with a message about posting it to their social media sites if corrective action is not taken. Hah!
-
RE: HLK-PMxx protection: choosing the right MOV / fuse value
@Encrypt The capacior and inductor may be optional for some useage, but they are there to reduce smaller spikes and interference on the power line entering the power supply and I strongly recommend that you use them for your application.
As for the mov, your mains voltage is 230V+/- 10%. This gives us a range of 207V - 253V AC. A 250V mov should start to conduct at 250V, so in this case it could blow even if the AC is within specification.
Usually the mov is there to protect against large spikes or surges from lightning strikes or faulty equipment supplying power to your area. In my opinion the 350V in the statsheet you have is spot on for this application.
-
RE: HLK-PMxx protection: choosing the right MOV / fuse value
The thing I am saying is just tha MOV is a device conneted in short between live >and neutral and with ability to fail short and not open it poses potential risks.
No it does not pose 'potential risks' - it removes a very real danger to the equipment and persons using that equipment.
A MOV is OPEN circuit when new. It only goes into conduction when a voltage greater than the value on the package is reached. When this happens it shorts live to neutral blowing the fuse and protecting the rest of the circuit and the person(s) using the device. This way it shorts the voltage surge to neutral (often ground) and in blowing the fuse it disconnects the power from the device.
Without a fuse in place it would be an issue, but that is why you ALWAYS use a fuse with a mov.
-
RE: New simply node sensor project - please some advise
@DenisJ Depending on how often you intend to send data, it looks OK to me.
The capacitor you linked to is good too (if you put them in parallel the capacitance will add - like putting resistors in series adds). So you can always add another across the first if you find you need more - you just have to try it out.
-
RE: ๐ฌ Solar Energy Harvester
@mar The three tiny holes may not go to ground. They are probably 'vias' that take a trace from one side of the board to the other.
Vias are through plated at manufacture and shouldn't need anything from you.
But I don't know this particular board and so things might be different here. Use a multimeter to check the circuit diagram against the board.
-
RE: Best 3d printers
@crumpy10 The creality CR-10 seems good for the price, but be careful which one, some are made of metal and some from acrylic (usually the cheaper ones). It has a decent build area but a few people have reported issues with the controller board.
As you are an avionics eng you could also consider building your own from scratch. It will take longer but you will know how it all went together and how to fix/upgrade it. All the stuff is out there to buy...Stepper motors, power supply, controller board, frame extrusion, hotend etc.... So that could be an option for you.
Another idea is to look for any 3D printing or 'maker' places near you and have a chat with them.
Whatever you do good luck - when you start 3D printing it soon becomes addictive (and sometimes frustrating).
-
RE: Motion sensor increase Time high status via software
I have this for lighting and it is so easy.....
Set trigger (as you said) to minimum value on pir.
Then in code detect motion (use arduino uno pin 2 or 3 as interrupt). Then simply put a wait(time-in-milliseconds) after that.
Here is my example....
void loop() { //sendHeartbeat(); // Read digital motion value bool tripped = digitalRead(DIGITAL_INPUT_SENSOR); // send(msg.set(tripped?"1":"0"),true); // Send tripped value to gw if (tripped == HIGH){ send(msg.set(tripped = 0),true); } while(tripped == HIGH){ tripped = digitalRead(DIGITAL_INPUT_SENSOR); wait(5000); } send(msg.set(tripped = 1),true); // Sleep until interrupt on motion sensor. Send update every ten minutes. sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME); }
Just change wait(5000) to wait(10000).
-
RE: BME280 How to use it outdoors
I got 2x "BME280" from China today - they are not bosch sensors. If you are having problems, check carefully the markings with magnifying glass or microscope.
This may be the problem.....??
-
RE: ๐ฌ "Drรถmsyn" Weather prediction lamp
@openhardware-io That looks great! - Perhaps they could make a version for the UK market called "regnsyn" ??? ;0
-
RE: Best 3d printers
@homer said in Best 3d printers:
Thanks mate! So far I'm liking it, so I'm sorry to say that I won't be sending it to >you anytime soon haha
Awwwww....
I would like to start making my own boxes for my Mysensors, but don't know >what program to use. I've never done this sort of thing before, so at the moment >I'm a little concerned about the learning curve, so if you or anyone knows of a >program that is simple to use for this purpose, please share what it is!
As I said, try tinkercad. It's a free online 3D design tool that will give you a good taste of 3D design and the features you may want/need in a full paid product.
You probably won't stop printing now for at least 6 months!
-
RE: Build retry funtionality into the mysensors library
I wonder about this. It's a neat idea by @alowhum but my experiences with 'ack' have been wildly frustrating. Even without 'ack' I sometimes get instant response from node to a command, other times it can take minutes (yes minutes) until the command is actually performed. More retries will cause more traffic on the airwaves and increase the possibility of message collisions meaning even more retries are required. It could be a downward sprial from there.
-
RE: SSR 3-way relay suggestion
@alexsh1 You should not replace the isolator.
The isolator is there to enable disconnection of all power for service/cleaning/replacement/emergency disconnect. Also your labeling of the light switch is wrong. Com is actually Live and L1 should be SL. There is no common or neutral wire in a light switch.
At the moment, the light switch controls whether the fan is on or off. There is also the permanent live and neutral connections to the fan so I expect the fan has a time delay built in so that it continues working for a while after the light is switched off.
To control the fan independently of the light switch you simply need to connect a relay in the line from the fan isolator output L1 and input SL on the fan (SL = Switched Live).
You only need a single pole relay/switch or triac to do this.
-
RE: Best 3d printers
@TheoL I stick by what I said at the start of this topic. But once you get printing you will wish you got a larger print area unless you have defined your requirements in stone first.
There are dual head printers. colour printers, resin printers (which are best for quality builds of a small size so maybe worth looking into for you?).
If you just want to create quickly then there are online places that will print your designs (and they take the hit if a bad print needs a second run). So if you just want a few things then that is an option.
-
RE: Mesh network
@chey As far as I understand this is alrady possible to make all nodes 'repeater; nodes. But the downside is that this will generate more RF 'network' traffice ans could be counter productive.
Better to try out the 'tree' network first and make repeaters where they are the only other option.
-
RE: Resettable fuses.
@grumpazoid I would not do it.
You are obviously aware of the dangers and potential for a fire. So why save a few coins and get important electrical safety products from a fashion company off ebay?
This is one area where getting real approved components is worth a little more - These could be rejects found in a dumpster and sold on.
Where safety is concerned, get it from a repuatble source directly (RS, Mouser, Farnell) etc..... You know you are worth it!
-
OTA sending updates ?
HI,
I now understand how to burn the OTA bootloader, but what I don't know is how then to send the program updates to it? Do I just connect an Uno to the laptop with a nrf24l01+ in arduino as isp mode and it'll work?
Thanks for any pointers.
-
RE: Best 3d printers
@Alex-Miller If you have a 'maker' space near you it might be better to get him some lessons before buying a printer - That way he will know if he is going to be able to use it for what he wants and get all his questions answered by people who know about 3D printing..... Just a thought.....
-
RE: MyControler V1.4.0 issues
@andmaster I have mycontroller starting via crontab and this always works for me, you could try that and see how it works for you. Here on pi3 it is working no problem and every reboot mycontroller comes right back up.
If you can I would recommend replacing the SD card with a SSD HDD. They are quite cheap now (less than ยฃ20 in UK) and seem much faster and more stable. I have mine connected to pi via usb adaptor and it is working well.
Another thing to keep in mind is that a good quality power supply and good thick cable from power supply to raspberry pi are strongly advised. Pi seems to be affected by power quality easily. I have been around the block a few times with this!
-
RE: Resettable fuses.
@grumpazoid said in Resettable fuses.:
I have made up some 500mA quick blow fuses that I already have from a trusted source.
I am very happy to hear this. I am sure you will sleep safer and be prouder of your project by being more professional about safety.
Whilst there are some things you can get away with using cheap components for, safety and power supplies are not to be taken lightly.
-
RE: Lightning Detection
Thanks, That is a different sensor to the one I have (mine has simply digital and analog outputs). Still, I will have a read through it, I can already see that V-VAR1 is in use, never seen that before.....still learning!!!
-
RE: Best 3d printers
@vomaxa If you look at my post at the top of this thread (second posting) then all that still really applies. You need to list your requirements and then research until you find a compromise you believe to be the right one for your needs.
I also added a creality ender 5 plus a couple of years ago. This has a bigger build volume and is very upgradeable with new control boards from creality and third party vendors as well as having many common components to other printers in the range.
Whatever you decide it is a leraning curve and more frustrating than the promotional videos would have you believe. Still it is rewarding to make things that previously you couldn't at home.....
-
RE: Setup problem
@Skysurfer14 I am not totally sure what you have done, so this might help you get more help.
- The sensor is connected to what?
- Post the gateway code so we can see what is happening there.
- Your debug shows that the node cannot find the parent (gateway) and therefore fails. Again, how it is all connected (drawing, photo) would help.
-
RE: Push-button not working
If the door bell push button is outside then it is likely the contacts are not too good - that is why the original bell probably used 24 or higher voltage (likely AC) to overcome this.
Take the cover off the button and lightly sand or file the contacts until you have shiny metal again. Do the same with the screws and wires that are held by the screws. Finally, give it a spray of wd40 and reassemble. Test again. Hopefully it will work now.
If you do not feel confident doing that a new door bell push button is probably not that expensive and you would only need to clean the wires where they meet the contacts.
Finally, be careful with the wires. Electricians leave little extra and they will very likely be solid core and can break easily.
-
RE: DARPA - Sensor lifetime lengthened from weeks to years
Maybe they have a glass dielectric nano battery with graphene supercapacitor charging from it?
-
RE: ๐ฌ Air Humidity Sensor - DHT
What @Skywatch meant was that "#define DHT_DATA_PIN 2" is STILL in the example code on this page. Anyone who even gets as far as working it all out and wiring it all up and it still it won't work like that! - Not when it needs to be connected to PIN 3 instead (esp if the NRF is using pin 2, which is likely).
Happy New Year to you all! -
RE: Where to send messages about battery charge and signal strength?
@Clone-Tv If you go to Resources > Nodes and click the view button (far right) you get to the node details.
In the Details window click Edit and see if there is anything in the rssi section. You may have to add here manually..... But I never use this as nrf24 don't send rssi data so it's just my best guess at a way to help you out here!
-
RE: Setting up the 2nd RF24 network..
@pvoj There is something called the 'poor mans scanner' out there - This uses the nrf24l01 to scan all it's channels and record signal activity and levels.
This might help you find the best channels, but be aware that some equipment can do this sutomatically, so from day to day it might change. Also, some routers etc look for clearest channel at power on and then stay there until next power up.
Frequency hopping would help if your environment is 'noisy' but dynamic channel changing is not supported in mysensors (afaik), so that's something you would have to do yourself. I did try a 'slow hopping' solution years ago, but that was without mysensors and hopped at 1ch/sec. It worked well though.
Just keep the rf modules and antennas as far apart as you can to avoid any cross interference.
-
RE: RPi as a 'node'?
@mfalkvidd Thanks for the helpful hints! Theres a long cold winter to fill!
-
RE: ๐ฌ Temperature Sensor
Sorry for the dealy, I have had a week of plumbing problems at home - yuck!
So, I came back fresh to this and noticed that I had put the interrupt into the code ready for the water leak sensor (apt considering this weeks activities!) - BUT, I had not assigned the pin nor initialised it in the code. So maybe it was floating and giving random triggers?
I tested by changing from int8_t sleep(1, FALLING, SLEEP_TIME); to int8_t sleep(SLEEP_TIME); but now I get battery level sent every single second! - This is making me crazy......The log for the gateway has the following.....
Sep 3 07:00:37 HAAS rsyslogd-2007: action 'action 17' suspended, next retry is Sun Sep 3 07:02:07 2017 [try http://www.rsyslog.com/e/2007 ] Sep 3 06:26:28 HAAS rsyslogd0: action 'action 17' resumed (module 'builtin:ompipe') [try http://www.rsyslog.com/e/0 ] Sep 3 06:26:28 HAAS rsyslogd-2359: action 'action 17' resumed (module 'builtin:ompipe') [try http://www.rsyslog.com/e/2359 ]
Not sure what the above is all about. Nor the below....
7:15:45 HAAS dhcpcd[474]: eth0: Router Advertisement from fe80::3291:8fff:fe06:64bc
But here is sending data every second.....
Sep 3 12:46:52 HAAS mysgw: TSF:MSG:READ,5-5-0,s=255,c=3,t=0,pt=1,l=1,sg=0:75 Sep 3 12:46:53 HAAS mysgw: TSF:MSG:READ,5-5-0,s=255,c=3,t=0,pt=1,l=1,sg=0:75 Sep 3 12:46:54 HAAS mysgw: TSF:MSG:READ,5-5-0,s=255,c=3,t=0,pt=1,l=1,sg=0:75 Sep 3 12:46:55 HAAS mysgw: TSF:MSG:READ,5-5-0,s=255,c=3,t=0,pt=1,l=1,sg=0:75 Sep 3 12:46:56 HAAS mysgw: TSF:MSG:READ,5-5-0,s=255,c=3,t=0,pt=1,l=1,sg=0:75 Sep 3 12:46:57 HAAS mysgw: TSF:MSG:READ,5-5-0,s=255,c=3,t=0,pt=1,l=1,sg=0:75 Sep 3 12:46:58 HAAS mysgw: TSF:MSG:READ,5-5-0,s=255,c=3,t=0,pt=1,l=1,sg=0:75 Sep 3 12:46:59 HAAS mysgw: TSF:MSG:READ,5-5-0,s=255,c=3,t=0,pt=1,l=1,sg=0:75 Sep 3 12:47:00 HAAS mysgw: TSF:MSG:READ,5-5-0,s=255,c=3,t=0,pt=1,l=1,sg=0:75
Will try debug on node next....
-
V 1.5.0 stability problem solved (my fault!)....
I have been running mycontroller for years now as it is light weight on resources and yet very flexible. The support is amazing too.
I was having problems with stability and auto updates. I used to stop all mycontroller services, update, upgrade and then reboot the pi to restart all services with the new updates. This it seems was the root of the problem.
Now I stop the mycontroller services, update, upgrade and then simply restart mycontroller services without a reboot and all runs smoothly.
I can't explain why this works better than a clean reboot, it just does. Maybe something with the serial port drivers? Who knows.
Anyway, I hope this helps if anyone else has issues like this.
-
RE: Is it worth it adding a reset circuit to MySensors nodes?
@bjacobse Thank you - I learn something new!
I have WDT enabled on one of the RF gateways and still it crashes (ir never sleeps as it is a GW node). I am using the stock bootloader (chinese clone uno) so I wonder if this is the issue. I will try and upload the optiboot to that GW node and see if it helps.
I also run a script in mycontroller to reboot the GW node if it is down, but that isn't working as I expected either..... Luckily I have plenty of time at home now, unluckily I have a lot of domestic chores and support a vulnerable person living at another address, so time for mysensors is still limited, at least for now.
-
RE: Reducing power for battery node.
Here in the UK it is not legal to have a power plug in this area. The 'airing' cupboard does have 240V for sure, but a socket or outlet is a big 'no - no' (nej-nej).....;)
So batteries it has to be, and due to the size of enclosure I have chosen, 2xAAA is all I can use (though smaller 3V batteries are possible like 2x A76)....
Thank you so much for taking the time to try and help me out here though....very kind of you
-
RE: ๐ฌ Building a Serial Gateway
Perfect - Just what I needed to know!
Thanks!
-
RE: Anyone using PiDome successfully?
I tried pidome last year. But the outdated tutorials didn't help me get going.
Recently I have reported the steroids/viagra/pr*n links that fill the site, but nothing happened.
This week the site has been down. Maybe they are back and fixing it? Maybe it's just crumbled from neglect.
I moved to mycontroller. It shows potential and the developer is very responsive.
-
RE: MH-Z19 CO2 sensor
@Joseph-Gill My sensor has taken a few knocks but still works really well. I have got another one now to use in the car (when I get around MYSing the car that is).
The last readings from my sensor.....
Readings are high as the sensor is currently too low to the ground. I will attend to this when I have time to make it into a cased unit.
-
RE: Lightning Detection
I tried it with a simple digital binary sketch and it worked as far as the display goes. I could get a graph so I could know at what time the lighting strikes were. Trouble is, no lightning to test it fully with
-
RE: [security] Introducing signing support to MySensors
No problems. I have enough to learn a lot from now!
Just curious though as to what would be replacing the AT328p for v3.0 and signing and encryption - thinking to maybe order some now and get used to them..... Raspberry pi zeros everywhere or ...?
-
RE: ๐ฌ Relay
Can I suggest a change to this page?
As it stands the wiring diagram only applies to sketch 1 (without switch). It could get confusing as the 2 sketches use different pins for the relay and there is no need for this.
I propose that the wiring diagram be changed for the relay to be attached to pin 4.
The first sketch needs the relay pin to change from pin 3 to pin 4.That's it. Then the diagram and sketches will work whichever way the builder wants to do it.
-
RE: HLK-PMxx protection: choosing the right MOV / fuse value
@monte You will never get rid of all risk, it is a fact of life.
Considering that the diagram above shows a 500mA fast blow fuse, I doubt it will last a whole second with full mains across it. If worried about the fuse then use 2 or 3 in series.
As for the fire risk even the first link says "Under normal utility voltage conditions, this is not a problem."
The fact is that this is the best solution that gobal engineers have used for decades. It is an industry standard for protection. It is even used in Fluke multimeters to protect their input electronics from over voltage.
If you feel that there is a better solution with the same or better protection and lower risk, then please share it.
-
RE: One GW with 2 controllers?
Thank you all for taking the time to reply.
I will take a look at the documentation, but then realised I could just have one controller at a time running to test at first (doh!)... -
Still, this really is all about an end product that works for my needs with learning new stuff into the bargain.
I'll let you know if I do need to try it - nice to know it's an option!
-
RE: wait microseconds available?
@Nca78 That makes perfect sense! - Thanks for the clarification.....Onwards and upwards!
-
RE: ๐ฌ Relay
I would agree that more advanced sketches 'should' be included on the same page. Keep all the info in one resource place. Provided it is clearly marked as an advanced project it might help people looking for similar functionality or just interested in learning more about programming....
-
RE: Which radio / wireless module to choose? Please recommend
@tssk That is promising news and thanks for the update.
For the longer distance try a yagi antenna (bought or homemade) - It should make a fair difference.
As for the batteries, they will suffer a lot in colder weather. Consider rechargeables with solar or wind to charge them up. Alternatively make them easily removable to recharge in the house and reinstall.
Also think about effects of damp or humid weather. Corrosion will happen in these instances so some form of conformal coating or other 'tropicalisation' treatment would be recommended. A fully sealed box with O-rings or silicon gunk might also be an option.
-
RE: 3V battery for door sensor node.
Thanks to you both!
I was thinking of using these....
I have these already for other things, but I will look into measuring the quiescent current (my old fluke meter won't go down to the levels of nA).....Maybe I will get find a histab resistor and put it in series with the supply positive and see what voltage I get across it on the meter or scope. A little Ohms law and I should be done!
It's taken a long time - but I am getting there now!
-
RE: Combine several scetches to 1 node
@xypzo said in Combine several scetches to 1 node:
This should do it - It compiles but I cannot test it, so that is down to you!
#define MY_DEBUG #define MY_RADIO_NRF24 #define MY_REPEATER_FEATURE static const uint64_t UPDATE_INTERVAL = 60000; static const uint8_t FORCE_UPDATE_N_READS = 10; #define DIGITAL_INPUT_SENSOR 3 #define CHILD_ID 1 #define CHILD_ID_HUM 3 #define CHILD_ID_TEMP 4 #define DHT_DATA_PIN 8 #define SENSOR_TEMP_OFFSET 0 #define RELAY_PIN 4 // 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 1 // GPIO value to write to turn on attached relay #define RELAY_OFF 0 // GPIO value to write to turn off attached relay #include <SPI.h> #include <MySensors.h> #include <DHT.h> 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); MyMessage msg(CHILD_ID, V_TRIPPED); DHT dht; void before() { for (int sensor = 1, pin = RELAY_PIN; 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); pinMode(DIGITAL_INPUT_SENSOR, INPUT); digitalWrite(DIGITAL_INPUT_SENSOR, HIGH); } } void presentation() { // Send the sketch version information to the gateway sendSketchInfo("DHT & Relays", "2.0"); // Register all sensors to gw (they will be created as child devices) present(CHILD_ID, S_DOOR); present(CHILD_ID_HUM, S_HUM); present(CHILD_ID_TEMP, S_TEMP); for (int sensor = 1, pin = RELAY_PIN; sensor <= NUMBER_OF_RELAYS; sensor++, pin++) { // Register all sensors to gw (they will be created as child devices) present(sensor, S_BINARY); metric = getControllerConfig().isMetric; } } void setup() { dht.setup(DHT_DATA_PIN); // set data pin of DHT 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() { // 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; // apply the offset before converting to something different than Celsius degrees temperature += SENSOR_TEMP_OFFSET; if (!metric) { temperature = dht.toFahrenheit(temperature); } // Reset no updates counter nNoUpdatesTemp = 0; 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++; } bool tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; send(msg.set(tripped?"1":"0")); // Send tripped value to gw // Sleep until interrupt comes in on motion sensor. Send update every two minute. sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, UPDATE_INTERVAL); // Sleep for a while to save energy //sleep(UPDATE_INTERVAL); } void receive(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. if (message.type == V_STATUS) { // Change relay state digitalWrite(message.sensor - 1 + RELAY_PIN, message.getBool() ? RELAY_ON : RELAY_OFF); // Store state in eeprom saveState(message.sensor, message.getBool()); // Write some debug info Serial.print("Incoming change for sensor:"); Serial.print(message.sensor); Serial.print(", New status: "); Serial.println(message.getBool()); } }
I am not sure it is possible for the node to receive a message when it is asleep?
-
RE: ๐ฌ Dust Level Sensor
Oh, I see - By 'THIS' I mean this 'build' page and the build example herein.
-
RE: Network with nRF24l01 modules
What is the value of x?
If it is less than 253 then you can do it with mysensors, if not, then you have to give us a bit more of a clue as to what you want to do before anyone can help you.
-
RE: 3V battery for door sensor node.
Thank you for taking the time to post that and help me out - All posts here should be a reference for the current 'best practice' for battery powered nodes!
I was just looking at the chip on the boards I posted (ADP2018A) - and whilst advertised as 'low quiescent current' devices, I guess that 'low' is a subjective term!
All you said makes sense, so that is the route I will go. Now I have to find the battery holders......they're here somewhere!
CHeers and Happy New Year.
-
RE: Sketch for Lightning Sensor
@neverdie Last night was the first lightning to test it out - 3 storm cells went through with hail and lightning, but nothing from the sensor
So today I have rewired it, made some changes to the program and if we get lightning tonight I might have some news
-
RE: ๐ฌ Atmospheric Pressure Sensor
The initial description on this page refers to BMP085.
The 'Example' states it is for BMP085 with Adafruit library (linked for dowbload).
The sketch uses a BME280 with library from Embedded Adventures.
The Datasheet is linked for a BMP085.
The shopping guide links to a BMP180.????
-
RE: Extend footprint pads beyond nRF5 module; bad practice?
@ncollins It will add a tiny bit more capacitance between the pads, but I doubt it will be enough to cause any issues. Especially compared to the track routing on the board which will have much more affect on operation.
-
RE: CDEBYTE's new NRF24 modules are great! (and cheap)
@alowhum You may be correct on this as they have changed the photos and description in the last month or so - it now says components "Imported from Japan, USA & Germany" and then 'original nordic imported' - So that is clearer than it was before.
-
RE: IR Sensor only reading every other button press
@kiesel Good work on finding the issue. Delay will block the cpu from performing other tasks (maybe that is what you want). Usually in mysensors we use wait(100); instead.
I have just finished my first IR send and receive node and have another 2 to build this weekend (hopefully).....
-
RE: MySensors 2.3.1 released
@hyla You got it right!
I just tried and it works. So it seems that the default setting on arduino IDE is for no compilier warnings at all! - I set it to default and now it is working as expected.
Good Job!
@mfalkvidd If MySensors is relying on these messages to inform/warn users, then it would be worth putting something in the 'getting started' area about how to enable compilier messages to the required level within the arduino IDE.
-
RE: How to measure remote voltage from anamometer
@ricvice My first venture was to monitor my greenhouse temp and humidity remotely. I did this using the tmrh nrf24l01 library for arduino and displayed it on an lcd. screen.
If all you want is a display for the items you mention then this would be the cheapest option (and simplist once you understand the tmrh library).
Mysensors is better if you want to add more things in the futurem but you will need to make a gateway and have a controller to make it work.
Best thing is to spend a weekend going through this site and thinking about what you want and making a decision based on your own requirements.
-
RE: CDEBYTE's new NRF24 modules are great! (and cheap)
@mfalkvidd Thank you! - If I had known I would have used one with better soldering for the photo It was just to show that the newer cheaper ones were not identical to the original ones they sold a few months ago.
I use either 1206 or 0805 ceramic multilayer capacitors, 47uF, 6.3V. All nrf's get this treatment before use. A jewellers eyepiece is good for checking the joints and I solder them by hand but it needs a pair of tweezers or fine pliers.
-
RE: IR Sensor only reading every other button press
@kiesel You are welcome! - We are all here to learn!
As to my code, here is the thread with the problems I had and how I fixed them....
I am still tinkering around the edges and I expect a final version to be about a week away. It is mostly getting it all the way I want it now!
-
RE: ๐ฌ Battery Powered Sensors
@Puneit-Thukral I understand 'poor mans alternative' soooo well!
Glue on the wirewraps will help keep them in place and mitigate thermal stress to some degree and also stop dust and moisture. But over time the glue will change and shrink/crack and things will start to become strange with that arrangement.
It's hard to beat a good soldered joint in the end, that's why all the commercial kit is done that way.
Nice case BTW. I also am working on 3D printed cases for some nodes. Another 6 weeks of lockdown and I should have started on them!
-
RE: How to measure remote voltage from anamometer
@ricvice You have reached the 'interesting' point now. You have the hardware, you sort of know what you want, but need to learn how to do it. We have all been there!
So start with a clear idea of the system. Where are the displays going to be etc.
Then try to make it work. Start off with simple sketches that do things like measure analog voltage (see battery powered sketch) This will be useful for the wind speed.Then look at the 'build' section at the top of this page for temp sensor. Again, try it and see how it goes. Gradually things will become clearer and you will be able to try and combine sketches into one that does it all for you. Small steps go a long way with this.
You will need to make a gateway and choose a controller to use mysensors and display data, but you can easily see graphs etc so it could be worth it for you. A simple raspberry pi 3 and a pro mini would do for controller and gateway.
If you get stuck or can't figure something out then post on here with your code and someone will help you.
IF you don't want to go the mysensors route then the arduino forum would be a better place to ask as this is really only for mysensors related discussions.
-
RE: Has anyone else seen a varistor/MOV failure in a power supply?
@sundberg84 Try this one......
MOV:Varistors โ 10:48
โ Electronics ProjectsBut mainly once you know how they work and what they do, you really only need to look up the data sheet(s) to see which one is suitable for your application.
My rule has been to use 1.5x - 2.0x the usual operating voltage. Remember this is protection from big surges and spikes, not to limit noise and glitches on the power line. For that you need capacitors and a common mode inductor.
-
RE: isAck(): differentiation between sent and received messages
@frober Great news! - Perhaps you can post an example to help others who may hit the same problem?
-
RE: ๐ฌ The Sensor Network
@frydrik I think you need to spend more time with mysensors to appreciate it's strengths and weaknesses and from that experience decided if it is suitable for your needs.
-
RE: Output voltage problem with StepUp Booster 3.3V
@emre299 @Yveaux Is right. You could try adding a 47uF or 100uF capacitor across the 3.3V and gnd on the radio module. it is known to help in some cases.
If you have access to an oscilliscope you might be able to see the noise. If it is sharp spikes then a 100nF capacitor can help as before. You may need both in parallel on the radio power connections.
-
RE: Which pro mini? 328? 328P? or 168?
@mfalkvidd Thank you - That is exactly the sort of info I needed - The datasheets are not much use as all the headline parameters seem to be identical with varying parameters also looking the same on paper.
I will try and find some good 328 today - I need 5V ones for in house mains powered projects, I already have a load of 3.3v ones for battery power, but I will check these to see if they are 'P' or not. If not, I may be in for some more soldering practice!
Cheers
-
RE: NRF51822 door sensor - help needed [Solved]
@Puneit-Thukral Please find below my full code for a node with debounce, sleep, anti-tamper and battery level reporting.
Hopefully you will see the patterns in the coding and use the example to modify your code to work as you want./* ******** FOR LOW POWER PRO-MINI 1MHz - 1,8V BOD ******** * * D2 - AntiTamper switch * D3 - Sensor * A0 - Battery Sense Pin * */ // Enable debug prints // #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_RF24 #define MY_RF24_PA_LEVEL RF24_PA_HIGH //Options are: MIN, LOW, HIGH or MAX #define MY_NODE_ID 4 #define MY_RF24_CHANNEL (97) #define MY_PARENT_NODE_ID 0 #define MY_PARENT_NODE_IS_STATIC #define DIGITAL_INPUT_ANTITAMPER 2 // Anti-Tamper switch connection. #define DIGITAL_INPUT_SENSOR 3 // The digital input you attached your Door/Window sensor. #define CHILD_ID_ANTITAMPER 0 // Id of the Anti-Tamper sensor child. #define CHILD_ID_SENSOR 1 // Id of the door/window sensor child. // Define a lower baud rate for Arduino's running on 8 MHz (Arduino Pro Mini 3.3V & SenseBender) #if F_CPU == 8000000L #define MY_BAUD_RATE 2400 // check this as it might need reducing!!!!! #endif #include <MySensors.h> uint32_t SLEEP_TIME = 60000 * 30; // Sleep time between reports (in milliseconds). int BATTERY_SENSE_PIN = A0; // select the input pin for the battery sense point int batteryPcnt = 0; int lastbatteryPcnt = 0; bool oldValueAT = -2; bool oldValueDoor = -1; // Initialize door/window message MyMessage msgANTITAMPER(CHILD_ID_ANTITAMPER, V_TRIPPED); //Tamper. MyMessage msgSENSOR(CHILD_ID_SENSOR, V_TRIPPED); //Door/Window. void setup() { pinMode(DIGITAL_INPUT_SENSOR, INPUT_PULLUP); // sets the door/window sensor digital pin as input pinMode(DIGITAL_INPUT_ANTITAMPER, INPUT_PULLUP); // sets the Anti-Tamper sensor digital pin as input } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Patio Door", "4.0"); // Register all sensors to gw (they will be created as child devices) present(CHILD_ID_ANTITAMPER, S_DOOR, "Patio Tamper",true); present(CHILD_ID_SENSOR, S_DOOR, "Patio Door",true); } void loop() { // Read digital anti-tamper. bool tripped = digitalRead(DIGITAL_INPUT_ANTITAMPER) == HIGH; if (tripped != oldValueAT) { send(msgANTITAMPER.set(tripped ? "1" : "0"), true); // Send anti-tamper tripped value to gw oldValueAT = tripped; } //Read digital door/window value. tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; if (tripped != oldValueDoor) { send(msgSENSOR.set(tripped ? "1" : "0"), true); // Send door/window tripped value to gw oldValueDoor = tripped; } int sensorValue = analogRead(BATTERY_SENSE_PIN); batteryPcnt = sensorValue / 10; if (batteryPcnt != lastbatteryPcnt) { sendBatteryLevel(batteryPcnt); lastbatteryPcnt = batteryPcnt; } wait(100); sendHeartbeat(); // Sleep until interrupt comes in on motion sensor. Send battery update every 15 minutes. || (digitalPinToInterrupt(DIGITAL_INPUT_SENSOR_3)) sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, digitalPinToInterrupt(DIGITAL_INPUT_ANTITAMPER), CHANGE, SLEEP_TIME); }
AS to your situation I would say the folowing......
- You only need ONE sleep call and that should be in the main void loop()
- If you want to detect the door change of state instantly you need to use interrupts if you sleep the node.
- You don't need separate 'open' and 'closed' variables and messages. One will do. IF the door is not open, then by default, it is closed. Makes sense?
- Node will not 'spam the gateway' unless you program it to do so. Use tests to detect change and then send the change status.