Yes, that’s possible, you can use another arduino nano where you flash the my sensors gw on and connect it to your pi
-
How to Mysensors.
-
Thank you. Now I have a lot of work to do 😁
-
I have made a lot of sensors. For beginners and people that already have made some sensors will find out that its annoying to attach the radio cables (quite a lot). So I ordered some:
NRF24L01+ smd 1.27mm (mini)
NRF > arduino pro mini shieldHaven’t received them yet, but this makes soldering sensors much faster and easier Just wanted to share
example:
-
@sweebee
very nice! what do these shields cost?pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebookmake it so !
-
@leader21 2.25 dollar per 3pcs. free shipping.
-
I’ve ordered 12 of them
And a few of those nrf modules, now I can compact my sensors even more! -
@sweebee : I don’t understand. When I look for example at this set, It comes with antenna’s (the gold zig-zag) at one end.
What do you mean with “radio cables”? Are you talking about the antenna(s) or something else?
And why would I chose the “NRF24L01+ smd (mini)” you are referring to? Are they better? -
@Harry-van-der-Wolf the shields i ordered have place for the nrf smd versions, they are much smaller than the default nrfs. This shield can be soldered directly on the pro mini. Normally you have to solder all the wires from the nrf to the pro mini. Soldering one is fine, but soldering like 10 nrfs is killing. And with those shields and smd nrfs it’s much smaller.
@leader21 i found out that I ordered the wrong nrfs. I placed a link of the 1.7mm version. There is even a smaller version that the shield needs (1.27mm).
-
OK. Now I understand. I had not recognised the pro mini in the image you shared. I thought it was another “something”
-
Shields arrived. Now waiting for the nrfs.
-
@sweebee
thx for the info! i ordered some of the shields and nrf. now let’s see if i can finally make the step into the mysensor worldpimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebookmake it so !
-
@sweebee Nice!
What is the type of the PIR on the photo? And where can these be ordered? -
that’s a standard HC-SR501 as it seems.
If using this on 3V you will have to do some adaptions.
you can have a look here http://forum.mysensors.org/topic/225/hc-sr501-motion-sensor/25
or maybe @sweebee gives a short description on how he built it?pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebookmake it so !
-
Its a normal HC-SR501. I just modified it so it could fit in my case and it works on <3V
I removed all the headers and rewired the left capacitor (removed the capacitor and put wires between it) so it fits tightly in my case.
-
In my bookmarks I have this connection. I have not tested this.
PIR Motion Sensor on 3.3vPimatic = Smart Home
-
Radio’s have arrived:
-
looks really nice and compact, good work soldering soldier
did you use the same code as here on your arduino?? could you say something about your battery lifetime?
I’m using the same code like motionsensor to get the soil 0/1 of my plant every hour.
#include <MySensor.h> #include <SPI.h> #include <Bounce2.h> #define CHILD_ID 4 #define BUTTON_PIN 8 // Arduino Digital I/O pin for button/reed switch MySensor gw; Bounce debouncer = Bounce(); int oldValue=-1; // Change to V_LIGHT if you use S_LIGHT in presentation below MyMessage msg(CHILD_ID,V_TRIPPED); void setup() { gw.begin(); // Setup the button pinMode(BUTTON_PIN,INPUT); pinMode(6, OUTPUT); // Power Pin for A/D Module // Activate internal pull-up digitalWrite(BUTTON_PIN,LOW); // After setting up the button, setup debouncer debouncer.attach(BUTTON_PIN); debouncer.interval(5); // Register binary input sensor to gw (they will be created as child devices) // You can use S_DOOR, S_MOTION or S_LIGHT here depending on your usage. // If S_LIGHT is used, remember to update variable type you send in. See "msg" above. gw.present(CHILD_ID, S_DOOR); } // Check if digital input has changed and send in new value void loop() { digitalWrite(6, HIGH); // Power on YL-38 A/D Module delay(2000); debouncer.update(); // Get the update value int value = debouncer.read(); if (value != oldValue) { // Send in the new value gw.send(msg.set(value==LOW ? 1 : 0)); oldValue = value; } delay(2000); digitalWrite(6, LOW); // Power off YL-38 A/D Module delay(3600000); // wait a hour, then reloop }
If i dont care about the power of the soil-sensor-module the contacts corrode in a few days.
Maybe someone have a battery-friendlier solution… with delay(3600000) maybe its not the best solution for powering with batteries. -
@xCite86 theoretically they should run for around 450 days. I’m using my own sketch.
It measures the battery life (uses readVcc).
Resends if a message fails, thanks to @n3ro.
Does also send a false signal.#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); } }
For your sketch, replace delay(3600000)) with sleep(3600000)
-
great sketch and the battery-lifetime was great
if i woult add readVcc in my sketch, did i need resistors too?? i’m in a voltage-range between 4 and 6 Volt.
replace delay with sleep(3600000); gets an error on compiling
sketch_mar16a.ino: In function 'void loop()': sketch_mar16a:81: error: 'sleep' was not declared in this scope 'sleep' was not declared in this scope
-
@xCite86 readVcc only works if the batteries are directly connected to the vcc of the arduino/uC. So no regulator. If you want it your way you need resistors yes, and readVcc is not needed for that.
for good battery life you need to remove the powerled, don’t use the regulator and modify the fuses so it can run till around 1.8V.
You’re using an arduino nano, not great for battery life. Arduino Pro Mini 3.3v are the best.
Ah yea you need
gw.sleep(3600000);