Multisensor PIR based on IKEA Molgan



  • I now have a fresh supply of Molgan to be modified. And I will post my modification of the existing board soon. Status I can now use the input of the existing PIR signal. And I have discovered that by sending out a high or low on one of the arduino pins I can switch the existing LED on / off. Of course I can use a relay function to control but as it is running on batteries the sensor has to sleep. I was thinking of sending out a parameter (true / false) which enables the sensor to activate the LED on a trigger of the PIR. How could I send over this parameter? Any (creative) idea's as the sensor is sleeping most of the time?

    Now I am thinking of it, could it be possible that such a value is read by the sensor when the sensor is getting out of the sleep function.



  • Cool canΒ΄t wait for this,have bought 6 Molgans last week πŸ‘



  • @Didi Nice, I only bought four ....πŸ˜ƒ



  • In development branch there is a smartsleep function for receiving while sleeping (if I get it right)



  • @rollercontainer I could use the wait function
    /**

    • Wait for a specified amount of time to pass or until specified message received. Keeps process()ing.
    • This does not power-down the radio nor the Arduino.
    • Because this calls process() in a loop, it is a good way to wait
    • in your loop() on a repeater node or sensor that listens to messages.
    • @param ms Number of milliseconds to sleep.
    • @param cmd Command of incoming message.
    • @param msgtype Message type.
      */
      void wait(unsigned long ms, uint8_t cmd, uint8_t msgtype);

    And wait for a message, which is send out by the controller (by a rule) after receiving the PIR trigger. But it is a kind of waste of energy to wait for a signal which is not frequently used. As far as I can read in the code this is exactly what smart sleep does. But can how can prepare a reply by the gateway that will respond to such a heartbeat?



  • 0_1464292606824_IMG_5287.JPG
    It is unfortunately not a full How-To yet. But basically the IKEA PIR is ready for operation.

    • The PIR Runs on 3 Volt. There is a power regulator (U1). I am going to keep the 3 AAA batteries so I keep the regulator on the board.

    • I have removed the resistor (R17) and attached two wires to both the Original ends on the board. The one closest to the BISS0001 is your PIR signal. 3V when high and 0V for low. The other wire can be used to control the lights on the board. The wire is connected to the Q1 NPN transistor. Basically 3V high is on and 0V is off. But maybe you will also be able to dim the lights.

    • You also need to remove Resistor R11. The Original value is about 620 K and this will result in 30 seconds of ON after triggering. I have replaced it with 100 K and now it is about 5 seconds, a further reduction whill shorten this time lineair. So 10K = 0,5 sec. The PIR itself is retriggered.

    • With resistor R10 is controlling the time that the PIR cannot be triggered after a trigger. It is now approx 10K = 0,5 sec. So no need to change.

    • You need also to remove the photodiode on the front. Otherwise the PIR is only triggered when it is dark.

    • The powerconsumption of the PIR when not triggered is approx. 60 uA and when triggered 160 uA. So this is about the same as the standard PIR's. When the lights are activated the consumption is about 36 mA.

    • The PIR (without the hood) is quite sensitive. Even the slightest movement is already triggering the PIR.


  • Mod

    @dynamite Nice work!
    I'm currently working on the following Molgan hack:

    0_1464446092298_2016-05-15 12.30.57.jpg

    It is a small PCB (the red board) that overlays the original Molgan PCB.
    The original PIR & electronics stay in place.
    LEDs will remain functional (if you want) or can be partially removed to improve battery life, or completely to turn it into a motion-sensor only.
    It uses an SMD nRF24 module, has a mounting spot for SHA204A, FTDI and ISP connectors.

    The layout is currently at the board house.
    I'll report back when I get the PCBs and build one!



  • @Yveaux NICE! Can I get the files for the board as a sneak preview? Do you get the PIR signal / Light control from the same place as I was indicating?


  • Mod

    @dynamite Send me your email in a chat and it comes your way.
    I'll probably post it all on openhardware.io when it's finished and proven to work.
    Fun thing is I tried the power usage of the original PIR with and without the regulator, and the power usage was actually less with the regulator than without πŸ˜‹
    I'll use two of the three batteries to also power my addon board.
    The trigger is taken from the top led, just below the battery cover screw in the picture.
    I could take it from before the transistor, but this way I needed no extra wire.



  • @Yveaux Sent you a DM with my email adress. Can't you use the voltage level after the regulator? The regulator is rated up to 30 mA.


  • Mod

    @dynamite Possibly. I just wanted to keep options open.
    One wire is required to power the board; either from the batteries, or from the regulator.
    I'll just see what works best.


  • Admin

    This have to be posted on http://www.ikeahackers.net/ when done also.


  • Mod

    @hek Will do just nice, next to the AK47 Hemma Lamp 😳



  • @Yveaux @hek how do you know of the existance of such a site...?😦


  • Mod

    @dynamite I didn't. Got it from @hek :bowtie:



  • Did someone succeed in fitting a pro mini and radio in the Molgan while still using the original pir?
    It looks to me there isn't enough room for the additional components and I'm not sure what part of the pcb I can saw off while still being able to use the original pir.

    Does anyone have an idea?



  • @danta 0_1464637700422_image.jpeg
    Fits.... Ok i need to attach the wites but it will still fit. The NRF can be placed on the other side



  • Bought 3 pcs. to open / modify / try fitting things in it. The thing is that this housing is really perfect to place it on the ceiling or to fit things in. Better than a black box.
    What I'm going to try is remove all the plastic inside including the batteryhousing but not the "click"-system to mount it.
    I'm going to try to make it 230 volt compatible with a HLK-PM01 so that I can use it as a PIR, Temp and door sensor and connect it at the ceiling.

    Let you know how things are working out!


  • Mod

    @Sander-Stolk said:

    door sensor and connect it at the ceiling

    ???
    My house has its doors in the walls...



  • @Yveaux said:

    @Sander-Stolk said:

    door sensor and connect it at the ceiling

    ???
    My house has its doors in the walls...

    Well... connect a very small white wire in the hallway to the top of the door with a magnet.
    With white ceilings you can put little cables like out of sight


  • Mod

    @Sander-Stolk ah, OK. I think you can even run it all on batteries if you want



  • @Yveaux Yes it can BUT...
    I have 0 succesfull attempts with a APM with removed regulator on 2 AA batteries. For some reason it draws power and within 3 days my batteries are dead. It's something that I will ask on the forum in a while but for now this works all the time so for it is the easy way πŸ™‚



  • Here is my a picture of my modded version alt text. I used a Sensebender which is perfect for that use case having already a ATSHA204 and temp/humid sensor on board.



  • I put a more complete write up of my mod from the previous post on my blog including the link to the sketch.



  • @tomkxy Nice write up of the "conversion". One remark to save some time... instead of removing R12 to R16 you can just remove R17 ... same result less effort.



  • @dynamite said:

    @tomkxy Nice write up of the "conversion". One remark to save some time... instead of removing R12 to R16 you can just remove R17 ... same result less effort.

    Thanks for pointing that out!


  • Hero Member

    @tomkxy Nice write up! Do you have an idea on the accuracy of the humidity sensor within the case?



  • @TimO said:

    @tomkxy Nice write up! Do you have an idea on the accuracy of the humidity sensor within the case?

    I just put it up in my one of my rooms. It works at least at a distance of about 4m. I will try to do some measure at what distance it is working. I'll post the results.



  • @TimO said:

    @tomkxy Nice write up! Do you have an idea on the accuracy of the humidity sensor within the case?

    Sorry, just saw that you asked about the humidity sensor. No, I have no idea yet. Need to make some comparison measures.


  • Hero Member

    @tomkxy did you really need the voltage divider? I think the sensebender does a decent job of measuring battery percentage by default.



  • @korttoma As far as I can see the sensebender is fed by the 3 volt of the PIR. So you can not use this as a reference for voltage measurement.



  • @TimO @tomkxy I have the Dallas sensor within the case. The reading follows the same line as other temp sensors within the same room. No big delay or something. The only downside is that the PIR is mounted on the roof, so temp is always a bit higher.



  • I just realized that I see a lot of false triggers. Anybody else having that experience? Any idea how sensitivity of the PIR can be reduced?



  • @tomkxy You can change the sensitivity of the PIR. You have to change the value or R15. See here for a datasheet of the BISS001
    But I do not know whether you should increase or decrease it...?
    If you did not modify your PIR then the PIR will stay high for 30 SEC. What is the period between the false triggers?
    Could it have to do with powering your sensebender from the powersource within the PIR and not directly from the battery?



  • @dynamite I see no clear pattern for the false triggers. Most of the time it is after about 7 minutes. But not strictly. Sometimes more than a half hour.. Well if I would power the sense bender directly from the battery I either would have to use a regulator or remove one of the batteries. Would the PIR still work reliable with about 2.4V? Would it make sense to try a capacitor between the 3V where I power the sense bender from to ground?



  • @tomkxy The range of PIR is 3-5V so most probably 2.4 V will give some trouble.


  • Mod

    @tomkxy you can just use 3 batteries to power the pir and only 2 to power the atmega and radio. Just c
    Use the same ground on them, and tap the arduino power after the second battery.
    I have some pirs running this way and they work just fine!



  • @Yveaux @tomkxy You were one step ahead of me, I was just thinking of that solution. At the moment I am also preparing version 2 of the MOLGAN PIR based on Arduino pro Mini I will check on the false positives as well. But I will feed both the PIR and pro Mini directly from the three batteries.



  • @Yveaux @dynamite Thanks for your suggestion. I followed @Yveaux suggestion and tapped the power for the sensebender after the second battery. It is now working for 2 hours without any false triggers. I will continue the test (for test purposes the sensor is sitting in a room with usually has no movement).


  • Mod

    @tomkxy πŸ‘
    The same setup is working fine for me for quite a long time now!



  • @Yveaux Unfortunately, I still get false triggers. Do you also use a sensebender? Any ideas, what I can try. I tapped into as you suggested to the second battery.


  • Mod

    @tomkxy I have some ProMini's (8Mhz) with regulator bypassed which are 2xAA fed in this way.
    The PIRs are HC-SR501's, also with the regulator removed and 3xAA fed.
    I haven't tested this setup on the Molgan's yet, but assuming the IC's are both BISS0001 I expect results to be identical.

    Here's a picture of my setup:

    0_1465748316875_20160328-160217.jpg

    (Btw. components on the HC-SR501 have been moved to the side to decrease the unit's depth)


  • Mod

    FYI, I measured power comsumption on the Mogan when sleeping with and without regulator.
    The power consumption was significantly less with the voltage regulator, then when directly powered from 3xAAA (regulator removed).
    Therefore, my Molgan hack board design targets to use the PIR with regulator (3xAAA input) and the ATmega+nRF powered directly from 2xAAA.



  • @tomkxy I Will put mine for a test run online tonight in the closet. If no trigger than it should be ok.
    Edit: did something wrong when removing led from pro mini so some debugging is required.... No testing tonight 😒



  • I googled a bit regarding PIR false alarms and found a couple of links. Apart from small bugs - which I have not in the room - air vents could trigger false alarms. Thus, I put back the plastic dome and now have sind 4 hours no false alarms. I am now convinced that my false alarms a most probably triggered by placement and may be air vents.

    http://de.actmeters.com/advice/five-causes-of-pir-false-alarms/
    https://www.youtube.com/watch?v=h0bp91xy5vY
    http://www.hkvstar.com/technology-news/how-to-install-pir-sensor-minimize-the-false-alarm.html


  • Mod

    @tomkxy of course you should always mount the fresnel cover. It focuses the incoming IR on the sensor and forms a barrier. Without the cover the sensor will always be more sensitive and have a much smaller field of view, increasing sensitivity even more.
    If an unmodified Molgan doesn't suffer from false triggers, a modified one also shouldn't.

    This is one more confirmation of the importance of describing your setup accurately 😏



  • I made a couple of additional modifications based on posts here and google results:

    • put a short wait before the node goes to sleep -> based on reports from that forum
    • read the motion pin twice with a small wait in between
    • put a small alu foil between the radio and the PCB -> there are some reports in the internet that RF interference could cause false triggers

    I had a close look at the sensor today and everything looked okay so far. However, I was moving into the room in and out. Let's see what the result tomorrow will be.



  • @TimO said:

    @tomkxy Nice write up! Do you have an idea on the accuracy of the humidity sensor within the case?

    I did some comparison measure regarding temp and humidity. I place an open Sensebender just beside the modded Molgan. The humidity measured at the Molgan was about 11% lower than the humidity measured by the open Sensebender. With respect to temp the Molgans temp was about 6% lower than the temp measured by the open Sensebender.


  • Hero Member

    @tomkxy Thank you for reporting back!



  • Ok, so if I as a complete beginner want to use a the original pir and control the lights all I need to do is:

    Tap the power from the regulator U1 and power a 3.3v mini-pro (keeping the 3 batteries)

    Remove Resistor R17 and connect the solderpoint nearest the chip to an arduino input and I can then basicly be able to run the standard motion sketch ? (After removing the photodiode and bridging the connectors?)

    I can connect the the other solderpoint to an arduino output and if uploading a sketch witch puts that output HIGH the leds will turn on?

    If I am fine with 30secs of triggertime I do not have to do anything more?

    Are all my assumptions correct?



  • @Cliff-Karlsson correct!πŸ˜„



  • @Cliff-Karlsson
    Excellent summarized! Perfect HowTo!

    Voted Cliff-Karlson for Documentation Team πŸ˜„



  • Haha, right. Last question, if I also want the sensor to report battery-usage. Is there any way to accomplish that without soldering any more resistors?


  • Mod

    @Cliff-Karlsson Yes, there is!
    Use my Vcc library!



  • @Yveaux @Cliff-Karlsson but in the scheme of cliff he is taken the power after the power regulator. So you are not
    Measuring the battery with your VCC library.


  • Mod

    @dynamite You're right then. I didn't read his howto, just answered how to read battery voltage without voltage divider πŸ˜‰



  • Ok, but if I measured right when talking the power from the regulator you could get 3v or ~4.5v witch i guess is directly from the batteries. If I connect the 4.5v to the power input on the same side as the tx/rx can I still not use the vcc library?



  • How would a sketch for this PIR look like? I tried combining the PIR and RelayActuator but my skills are not enough.

    This is what I have came up with:

    /**
     * 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.
     *
     *******************************
     *
     * REVISION HISTORY
     * Version 1.0 - Henrik Ekblad
     * 
     * DESCRIPTION
     * Motion Sensor example using HC-SR501 
     * http://www.mysensors.org/build/motion
     *
     */
    
    // Enable debug prints
    #define MY_DEBUG
    
    // Enable and select radio type attached
    //#define MY_RADIO_NRF24
    #define MY_RADIO_RFM69
    
    #include <SPI.h>
    #include <MySensors.h>
    
    unsigned long SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds)
    #define DIGITAL_INPUT_SENSOR 3   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
    #define RELAY_1  9  // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
    #define NUMBER_OF_RELAYS 1 // 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
    
    
    #define CHILD_ID 1   // Id of the sensor child
    #define SECONDARY_CHILD_ID 4
    
    void before() { 
      for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS;sensor++, pin++) {
        // Then set relay pins in output mode
        pinMode(pin, OUTPUT);   
        // Set relay to last known state (using eeprom storage) 
        digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF);
      }
    }
    
    // Initialize motion message
    MyMessage msg(CHILD_ID, V_TRIPPED);
    
    void setup()  
    {  
      pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
      
      
    }
    
    void presentation()  {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("Light/Motion Sensor ikea", "1.0");
    
      // Register all sensors to gw (they will be created as child devices)
      present(CHILD_ID, S_MOTION);
      for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS;sensor++, pin++) {
        // Register all sensors to gw (they will be created as child devices)
        present(sensor, S_LIGHT);
    }
    
    void loop()     
    {     
      // Read digital motion value
      boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; 
            
      Serial.println(tripped);
      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, SLEEP_TIME);
    }
    
    void receive(const MyMessage &message) {
      // We only expect one type of message from controller. But we better check anyway.
      if (message.type==V_LIGHT) {
         // Change relay state
         digitalWrite(message.sensor-1+RELAY_1, 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());
      }
      }
    

    But it does not complie after the last part is added. And I would also like to get the vcc -stuff into the same sketch. Could someone post a working sketch for this?



  • @Cliff-Karlsson you can only use the VCC sketch if you by pass the voltage regulators. So power the arduino from two batteries by a separate wire.



  • @Cliff-Karlsson the receive routine is out of the repeat loop



  • Ok, tried placing it in the loop to but with the same result. In the RelayActuator it looks like it really is placed outside the loop: RelayActuator

    What would the prefered way be to connect the power to the a 3.3v arduino for the best battery time?

    4.5v from the PIR regulator --> Arduino RAW (using 3 batteries)
    3v from the PIR regulator --> Arduino VCC (3batteries)

    And how would I power it from only 2 batteries? would not the PIR or leds need higher voltage than 3v ?


  • Mod



  • Hi guys,

    I'm struggling with this one unfortunately, i can't get it to trip/untrip.

    Sketch is identical to the motion example.

    I've removed the photo diode (not bridged the gap, it looks like bridging the gap stops it from tripping at all, leaving it open means it trips whatever the light level is). This was tested without connecting to the arduino, working as normal.

    So i've removed resistor 17, and connected my arduino pin 4 up to the chip side of where R17 was. I'm running the main board of the existing power lines, but i've tapped into the + of the middle battery and that's going to VCC on the arduino. Arduino nano GND is connected to the main board -.

    Where am I going wrong? I've tried this on two boards now and they're both acting the same. Serial monitor is just showing me:

    send: 14-14-4-0 s=1,c=1,t=16,pt=0,l=1,sg=0,st=ok:1
    1
    send: 14-14-4-0 s=1,c=1,t=16,pt=0,l=1,sg=0,st=ok:1
    1
    send: 14-14-4-0 s=1,c=1,t=16,pt=0,l=1,sg=0,st=ok:1
    1

    Thanks,

    Patrick



  • @pjblink hi your setup sounds ok to me! And from your debug I think it is transmitting a value. Is this value submitted after activating the pir?
    After activation the is high for about 30 sec then it sound be low again. Maybe you can verify this procedure. Can you debug on the receiving side?



  • I have build a couple of these and they work fine. Replacing batteries with the baseplate is really a huge advantage, and battery life seems to be pretty good.

    I have one issue though: I have built one including an LDR. But this seems to freeze after a random time, no longer reacting to movement.
    @dynamite , can you may be share your code and the way you have attached your LDR to the arduino etc?

    Many thanks!



  • @gijss Hi I will try to find the code tonight and post it on github.



  • Guys,

    This is fantastic. Can someone summarise the best practises for using an Arduino Pro mini, to benefit from maximum battery life and voltage monitoring?

    Thank you!


  • Mod

    @Mark-Swift https://www.mysensors.org/build/battery has information on how to get good battery life



  • @dynamite , can you may be share your code and the way you have attached your LDR to the arduino etc?

    @gijss the code can be found here. But I don't know the actual status of this code as I have not used it for a while and I was busy creating a dimmer. But maybe you can copy parts out of it.

    https://github.com/rspaargaren/My-sensors-IKEA/blob/master/multisensor.ino



  • @dynamite said:

    @gijss the code can be found here. But I don't know the actual status of this code as I have not used it for a while and I was busy creating a dimmer. But maybe you can copy parts out of it.

    https://github.com/rspaargaren/My-sensors-IKEA/blob/master/multisensor.ino

    @dynamite Thanks for the code, I am sure it will prove to be useful. Will try to experiment this weekend. Can you also share how you connected the LDR to the arduino? I have the feeling I might be using a suboptimal wiring scheme (or wrong resistor) resulting in shorter battery life.



  • @Yveaux Did you finish the PCB for the molgan?, If so is it possible for you to share the files?


  • Hardware Contributor

    I would be interested too!


  • Mod

    @Cliff-Karlsson Yes, works like a charm!
    It has been on my ToDo list for quite a long time to publish the files -- please hold on a little longer πŸ˜‰



  • @Yveaux great as my project was on hold for a while but still on the to do list...:-)


  • Mod

    @Cliff-Karlsson @LastSamurai @dynamite I just published the PCB on [OpenHardware.io].(https://www.openhardware.io/view/274/Ikea-Molgan-Hack)
    A sketch will follow soon.

    Enjoy!



  • @dynamite

    It has been a while (mainly because the PIR was out of order for other reasons) but now I am restarting the project and again it happened that the PIR no longer responded. So I took a look at your code, but it seems your are using a BH1750 light sensor, is that correct? And are you using that in fact at the moment, or did you switch to LDR and is this perhaps not the latest version of the code?

    Thanks!

    Gijss



  • @gijss Hi let me check upon that as the PIR has not been on the top of my priority list. I have one of the PIR based on LDR sensor. But I was working on a BH1750 sensor. So most probably the code is related to that version.



  • Hi to all,
    I've realized my hacked version of the Ikea Molgan but the PIR sensor stays always HIGH.
    Everything works apart of this... Do you have any idea howto investigate?

    could I have broken it?



  • @ricmail85 hi iT has been a while ago but as far as I recollect I had the same problem with one of my sensors ...

    In normal situation the sensors gives a high signal for approx 30 sec.

    In the bricked PIR I have replace the pir board by a cheap and modified pir from Ali.



  • Ok thanks for your reply. I'll check the board for some weak connection and try again...
    bye!


  • Mod

    @ricmail85 I also have one Molgan that I just can't get to work correctly. Put it aside, thinking it was an incident, but if more people have issues, this might be a structural thing...



  • @Yveaux said in Multisensor PIR based on IKEA Molgan:

    @ricmail85 I also have one Molgan that I just can't get to work correctly. Put it aside, thinking it was an incident, but if more people have issues, this might be a structural thing...

    I'll give it a try. I have to check that the wires I soldered on the back of the breadboard are just fine...
    I'll let you know.

    bye!



  • @ricmail85 @Yveaux basically mine was shortcut by testing Some connection which I should not have Done....πŸ™„



  • @dynamite @Yveaux Ok I've done some testing. Here my results.

    I checked the wire connections between the Arduino and the PIR and they were ok. Actually when powering everything with batteries I always get HIGH from PIR.

    Then I tried to leave only the PIR without the Arduino and its radio (disconnected the GND wire) and the PIR (alone) was working! I checked with multimeter it oscillates between 0V and 3V if a movement was detected.

    So I concluded that the failure was due to the Arduino. If arduino+radio are powered (by the same battery source) i get always HIGH.

    Looking at this post https://forum.mysensors.org/topic/5273/ikea-molgan-hack/36 I found similar problems due to ripples. I added a capacitor (100uF) in parallel to the PIR capacitor and a 10uF capacitor between the + and - of the battery pack.

    By doing so I still cannot move from HIGH signal from PIR when everything was connected. So I've done more debugging and I found that everything works like a charm if I put a sleep (1000 ms) after sending a message (in my sketch I send 4 different message types when the Molgan wake up).

    Maybe there is still some disturb arising from the radio (sending a message require some power at least)? Now my project is working, actually with the sleep(1000) trick after each send.

    I don't know if the capacitors were effectively needed at this point...

    Hope this can help!
    bye!


  • Hardware Contributor

    I am the one from your post and the capacitors only helped a little. One of my molgans simply doesn't seem to work.
    But you are right sending takes a lot of energy (vs doing nothing) so a bigger capacitor and/or pauses in between definitely should help!



  • @LastSamurai
    Some more debugging and I see the problems arise when I do analogread, so does not seem related to the radio itself.

    If I send a message about a dht sensor (digitalread) it is ok. If I send a message of battery/light measure (analogread), the pir gets high...


  • Mod

    @ricmail85 does the behavior change when you swap the order of the messages sent? Eg first send the battery value.



  • @Yveaux yes, it seems to work better by sending before the messages performing analogread and then the one using digitalread...


  • Mod

    @ricmail85 could be power related then. Try adding some sleep or wait statements inbetween each message sent.



  • @Yveaux Yes I found a partial fix by adding sleep of 1000 ms after each send. And by doing analogread before digitalread. It seems related to power fluctuations. I ve already added some capacitors to the Pir. Shoul I add akso in parallel to the R2 resistance when reading the battery and light level?

    Bye!


  • Mod

    @ricmail85 I still think it's strange that you need the delays for a battery powered sensor. Normally the batteries can supply sufficient power to compensate for the bursts required when sending.
    I don't want to read back the whole thread now, but what was your setup again?



  • @Yveaux This is my configuration

    1. Arduino Pro Mini 3.3V
    2. RFM69 radio 433MHz
    3. Photo-resistor
    4. DHT11 temp sensor
    5. Battery voltage measurement through voltage partition.
    6. The arduino and radio are powered by a 3.3V MCP1700-3302E voltage regulator

    yesterday I've noticed the following. If I shutdown the gateway, the sensors fail to reach it and the PIR goes HIGH forever. By rebooting the gateway there is no chance to get it LOW. I have to remove the batteries and everything starts to work again.


  • Mod

    @ricmail85 said in Multisensor PIR based on IKEA Molgan:

    The arduino and radio are powered by a 3.3V MCP1700-3302E voltage regulator

    I suspect the regulator injects noise in your supply and/or isn't able to supply enough power for a series of transmissions.
    You could try powering directly from 2xAA battery, without using a regulator.
    Both the ATmega and radio will work directly on 2xAA.
    The DHT11 won't (IIRR) but there are many way better alternatives for it that work at less than 5V supply (e.g. Si7021, BME280, SHT11 etc.).
    The PIR needs > 3.3V; refer to this post on how to power only the PIR from 3xAA.

    If you don't need a lot of accuracy on the battery measurement (who does...) then you could consider using the Vcc library I wrote a while ago.



  • @Yveaux Thanks for your reply. I've done a lot of debugging today. And I guess I found the issue.
    It's definitely related to the radio power consumption as you suggested.

    I'm currently using the new RFM69 driver, with ATC enabled by default. As long as the power level stays below -4 dB, everything works fine. If the gateway is powered off, the radio power level automatically increases to 100% and the PIR behaves weird. It's always HIGH.

    By rebooting the gateway, the node relink itself and gradually lowers its power. As before, when it goes below -4dB the PIR starts to work again.

    Since it's a battery powered device I decided to set

    #define MY_RFM69_MAX_POWER_LEVEL_DBM (-4)

    at the beginning of the sketch file. Even if the gateway fails (shutdown) the PIR does not get HIGH anymore. All the measurements work fine now by limiting the max power to the radio.

    By doing so all the sleeps of 1000ms after each send are not needed anymore.


Log in to reply
 

Suggested Topics

  • 8
  • 7
  • 1
  • 2
  • 90
  • 5

11
Online

11.4k
Users

11.1k
Topics

112.7k
Posts