New nrf24l01+ smd
-
@GertSanders said:
This board one is a one-trick pony. It is based on @m26872's concept of a very narrow board, but in my case I just need it to handle 2 magnetic switches.
This is what I was looking for as I need a small board for a reed switch. Please keep us posted about your testing
@alexsh1 My very narrow board was built and tested today. It works fine, I posted info on the hardware forum.
I must say I feel pity for this sliver of plastic and metal ...
-
@alexsh1 My very narrow board was built and tested today. It works fine, I posted info on the hardware forum.
I must say I feel pity for this sliver of plastic and metal ...
@GertSanders said:
@alexsh1 My very narrow board was built and tested today. It works fine, I posted info on the hardware forum.
I must say I feel pity for this sliver of plastic and metal ...
Excellent! I ordered your narrow board a few days ago as I thought it would be very useful.
One thing I can tell for sure - cutters are really well built. They are made in Japan and electrostatic safe. Most important they are not big as the ones I had before.
-
@Sweebee Very nice indeed!
I'm very surprised btw that you're using 2xAA to power the PIR. Will it work reliably (no false detections), even when the batteries are running out?
I use 2xAA to power Pro Mini + nRF and an extra AA to power the PIR. This way the supply to the PIR will stay > 3V over time. -
@Sweebee Very nice indeed!
I'm very surprised btw that you're using 2xAA to power the PIR. Will it work reliably (no false detections), even when the batteries are running out?
I use 2xAA to power Pro Mini + nRF and an extra AA to power the PIR. This way the supply to the PIR will stay > 3V over time.@Yveaux the pirs work fine if you only have interrupts with CHANGE. I don't use a sleep timer. If you wake it up every minute or so its unreliable yes. but only with interrupts from the pir it works fine. I have 10 pirs like this. Oldest one is from march 2015 and still running.
-
@Yveaux the pirs work fine if you only have interrupts with CHANGE. I don't use a sleep timer. If you wake it up every minute or so its unreliable yes. but only with interrupts from the pir it works fine. I have 10 pirs like this. Oldest one is from march 2015 and still running.
-
@Yveaux the pirs work fine if you only have interrupts with CHANGE. I don't use a sleep timer. If you wake it up every minute or so its unreliable yes. but only with interrupts from the pir it works fine. I have 10 pirs like this. Oldest one is from march 2015 and still running.
You have an excellent setup - I ordered those adapter as well at oshpark.
@Yveaux has got a point - I have been struggle to build a reliable PIR on 2xAA batteries. I have just started building it now. 1 year battery life and counting is impressive.@Sweebee Would you care to share your code? Maybe there is anything there which gives us some clues though I believe this is more a hardware issue.
-
You have an excellent setup - I ordered those adapter as well at oshpark.
@Yveaux has got a point - I have been struggle to build a reliable PIR on 2xAA batteries. I have just started building it now. 1 year battery life and counting is impressive.@Sweebee Would you care to share your code? Maybe there is anything there which gives us some clues though I believe this is more a hardware issue.
@alexsh1 said:
Would you care to share your code? Maybe there is anything there which gives us some clues though I believe this is more a hardware issue.
Agree. Apparently @Sweebee made modifications to the PIR (mainly to move some capacitors, judging from the photos) but maybe you did some more to improve battery life/stability?
-
I removed the left capacitor since it's not needed in 3.3v hack. And I moved the right one because otherwise it didn't fit into the case.
My sketch:
#include <MySensor.h> #include <SPI.h> #include <readVcc.h> // ********** CONFIG ********************************** #define NODE_ID AUTO // ID of node #define CHILD_ID 1 // ID of sensor #define PIR_PIN 3 // Pin connected to the PIR #define MIN_V 2000 // empty voltage (0%) #define MAX_V 3200 // full voltage (100%) // **************************************************** MyMessage msg(CHILD_ID, V_TRIPPED); MySensor node; int oldBatteryPcnt; int sentValue; int forceSend = 0; void setup() { node.begin(NULL, NODE_ID, false); node.sendSketchInfo("PIR Sensor", "1.2"); node.present(CHILD_ID, S_MOTION); pinMode(PIR_PIN, INPUT); digitalWrite(PIR_PIN, HIGH); } void loop() { // Get PIR int value = digitalRead(PIR_PIN); // Get value of PIR if (value != sentValue) { // If status of PIR has changed resend(msg.set(value), 5); // Send PIR status to gateway sentValue = value; } // Send batterylevel sendBattery(); // Sleep until something happens with the sensor node.sleep(PIR_PIN-2, CHANGE); } // FUNCTIONS void sendBattery() // Send battery percentage to GW { forceSend++; int batteryPcnt = min(map(readVcc(), MIN_V, MAX_V, 0, 100), 100); // Get VCC and convert to percentage if (batteryPcnt != oldBatteryPcnt || forceSend >= 20) { // If battery percentage has changed node.sendBatteryLevel(batteryPcnt); // Send battery percentage to gateway oldBatteryPcnt = batteryPcnt; forceSend = 0; } } void resend(MyMessage &msg, int repeats) // Resend messages if not received by GW { int repeat = 0; int repeatDelay = 0; boolean ack = false; while ((ack == false) and (repeat < repeats)) { if (node.send(msg)) { ack = true; } else { ack = false; repeatDelay += 100; } repeat++; delay(repeatDelay); } } -
I removed the left capacitor since it's not needed in 3.3v hack. And I moved the right one because otherwise it didn't fit into the case.
My sketch:
#include <MySensor.h> #include <SPI.h> #include <readVcc.h> // ********** CONFIG ********************************** #define NODE_ID AUTO // ID of node #define CHILD_ID 1 // ID of sensor #define PIR_PIN 3 // Pin connected to the PIR #define MIN_V 2000 // empty voltage (0%) #define MAX_V 3200 // full voltage (100%) // **************************************************** MyMessage msg(CHILD_ID, V_TRIPPED); MySensor node; int oldBatteryPcnt; int sentValue; int forceSend = 0; void setup() { node.begin(NULL, NODE_ID, false); node.sendSketchInfo("PIR Sensor", "1.2"); node.present(CHILD_ID, S_MOTION); pinMode(PIR_PIN, INPUT); digitalWrite(PIR_PIN, HIGH); } void loop() { // Get PIR int value = digitalRead(PIR_PIN); // Get value of PIR if (value != sentValue) { // If status of PIR has changed resend(msg.set(value), 5); // Send PIR status to gateway sentValue = value; } // Send batterylevel sendBattery(); // Sleep until something happens with the sensor node.sleep(PIR_PIN-2, CHANGE); } // FUNCTIONS void sendBattery() // Send battery percentage to GW { forceSend++; int batteryPcnt = min(map(readVcc(), MIN_V, MAX_V, 0, 100), 100); // Get VCC and convert to percentage if (batteryPcnt != oldBatteryPcnt || forceSend >= 20) { // If battery percentage has changed node.sendBatteryLevel(batteryPcnt); // Send battery percentage to gateway oldBatteryPcnt = batteryPcnt; forceSend = 0; } } void resend(MyMessage &msg, int repeats) // Resend messages if not received by GW { int repeat = 0; int repeatDelay = 0; boolean ack = false; while ((ack == false) and (repeat < repeats)) { if (node.send(msg)) { ack = true; } else { ack = false; repeatDelay += 100; } repeat++; delay(repeatDelay); } }@Sweebee Only real difference I see compared to my sketch is that I'm using a timeout when sleeping, so the watchdog stays enabled while sleeping.
According to the datasheet, the AtMega power consumption is roughly 4.7uA vs 0.6uA in powerdown mode with/without watchdog enabled:
This is a significant difference, but when including the PIR & nRF in the total power consumption it is only a small part.
-
I removed the left capacitor since it's not needed in 3.3v hack. And I moved the right one because otherwise it didn't fit into the case.
My sketch:
#include <MySensor.h> #include <SPI.h> #include <readVcc.h> // ********** CONFIG ********************************** #define NODE_ID AUTO // ID of node #define CHILD_ID 1 // ID of sensor #define PIR_PIN 3 // Pin connected to the PIR #define MIN_V 2000 // empty voltage (0%) #define MAX_V 3200 // full voltage (100%) // **************************************************** MyMessage msg(CHILD_ID, V_TRIPPED); MySensor node; int oldBatteryPcnt; int sentValue; int forceSend = 0; void setup() { node.begin(NULL, NODE_ID, false); node.sendSketchInfo("PIR Sensor", "1.2"); node.present(CHILD_ID, S_MOTION); pinMode(PIR_PIN, INPUT); digitalWrite(PIR_PIN, HIGH); } void loop() { // Get PIR int value = digitalRead(PIR_PIN); // Get value of PIR if (value != sentValue) { // If status of PIR has changed resend(msg.set(value), 5); // Send PIR status to gateway sentValue = value; } // Send batterylevel sendBattery(); // Sleep until something happens with the sensor node.sleep(PIR_PIN-2, CHANGE); } // FUNCTIONS void sendBattery() // Send battery percentage to GW { forceSend++; int batteryPcnt = min(map(readVcc(), MIN_V, MAX_V, 0, 100), 100); // Get VCC and convert to percentage if (batteryPcnt != oldBatteryPcnt || forceSend >= 20) { // If battery percentage has changed node.sendBatteryLevel(batteryPcnt); // Send battery percentage to gateway oldBatteryPcnt = batteryPcnt; forceSend = 0; } } void resend(MyMessage &msg, int repeats) // Resend messages if not received by GW { int repeat = 0; int repeatDelay = 0; boolean ack = false; while ((ack == false) and (repeat < repeats)) { if (node.send(msg)) { ack = true; } else { ack = false; repeatDelay += 100; } repeat++; delay(repeatDelay); } }@Sweebee I see in the sketch, that you are enabling internal pull-up on PIR input. This means, that if PIR is not detecting movement and its output is set to zero, this pull-up resistor consumes 60uA (in the best case).
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login





