💬 MyMultisensors


  • Contest Winner

    This looks good!
    @scalz The PIR parts, are they based on the app note I showed you way back? 🙂


  • Hardware Contributor

    @anticimex almost! in fact i noticed that's mostly the same schematic if you look at different source. of course it's a PIR ! Regarding the app note you showed me, resistors, capa values changed, and not same ref of comparator (lower power consumption here). so it's very low power 🙂



  • Would it be possible to buy it pre-assembled soon?


  • Hardware Contributor

    Hi.

    yes i'm preparing files for the fabhouse.
    As you can see i've done a little update on my description, i'm focusing on my "work in progress" stuff to "released" at openhardware because i would like to release my others boards etc. and have my mind free for software. That will be hard for a pcb addict like me 🙂
    I hope we'll get a reasonable price..This will be a project for contributing to Mysensors project 😉


  • Hero Member

    @scalz
    Which enclosure do you recommend to go with it?


  • Hardware Contributor

    @NeverDie
    3d printed box for a tailored stuff. I'll also upload .stl and design files. i'm looking at which parts can be "DP" on my BOM, for the pcba..


  • Hardware Contributor

    Hi,
    is it possible to get the actual sketch ?



  • Hola,
    Very nice, I order PCBs.
    I have a question which size for the resonator 8Mhz X1 ?
    By Advance thanks,


  • Hardware Contributor

    hi.
    i've updated the bom. you can use CSTCE8M00G55-R0.
    it's optional, you can omit it if you want, and use internal 8mhz



  • @scalz Thanks !


  • Hardware Contributor

    Hi, which tool do you use for programming with your pogo pin avr isp ?

    Why didn't use pogo pin for FTDI too ?


  • Hardware Contributor

    you can also use pogopin for ftdi, why not 😉
    for avrisp, i use an usbasp.


  • Hardware Contributor

    @scalz Thx but how do you connect your USBASP on the pogo pins ?
    I use an usbasp like this http://d1gsvnjtkwr6dd.cloudfront.net/large/AC-PG-USBASP_LRG.jpg but i don't see how to connect him on the pogo pins 😉


  • Hardware Contributor

    nothing fancy..with dupont cable.
    of course you won't connect the pogo directly on the usbasp.
    make a small adapter. simple and cheap 🙂
    Example with ftdi adapter
    0_1482922538752_ftdi_pogo.png



  • @scalz Awesome board, really. However, I'm a bit worried about its practical use. You see, the motion sensors are commonly placed near the ceiling or sometimes on the ceiling. This may induce a serious drift in the reported temperature. Ideally, a temperature sensor should be placed in the middle of the wall.
    Some people would have the impression that they're wasting energy on heating during winter while others would boost their A/C units during the summer just to read they temperature they feel confortable with. This effect would be mitigate by either concealing the motion sensor at a proper height for temperature reading, or use a reference sensor for calibration and compensate the reported value of an improperly placed sensor, and that's assuming that the seasonal variation is linear.
    Anyway, excellent SMD work, I'm still in the PTH ice age 😀


  • Hardware Contributor

    @mihai-aldea
    thx 🙂
    of course i won't use temperature/hum sensor on the ceiling. Boards are small i can put them everywhere i want.
    On my side, i just need one temp/hum/lum per room, and at least one PIR. This board needs to be well placed of course.
    But if i need more PIR only, or temp/hum only... it's also possible. So i don't need to have a dedicated pcb per use. I stencil only what i need 😉



  • I guess ordering the pcb will only get me the pcb. I need to do the soldering etc myself ?
    But I really wonder how to solder such a board seemingly being smd soldering. Are there any guides available for someone like me (pretty handy, but not experienced in this hardware stuff) ?
    Thanks !


  • Hero Member

    @Sander-Teunissen said:

    I guess ordering the pcb will only get me the pcb. I need to do the soldering etc myself ?
    But I really wonder how to solder such a board seemingly being smd soldering. Are there any guides available for someone like me (pretty handy, but not experienced in this hardware stuff) ?
    Thanks !

    @hek
    Speaking of which, I thought there were going to be some mysensors manufacturering partners who would actually make this stuff, including the soldering. When is that going to happen?


  • Hardware Contributor

    i've been so busy during december, i'll be back for the new year 😉

    About pcba (assembling), it's already possible to use partners in your openhardware account. They may ask for more details if projects need it.


  • Hero Member

    @scalz
    Would they actually make a quantity 1?



  • @scalz said:

    But if i need more PIR only, or temp/hum only... it's also possible. So i don't need to have a dedicated pcb per use. I stencil only what i need 😉

    Yeah, makes sense, a modular sensor PCB, a more advanced version than my Si7021 / DS18B20+ or PIR / door-window PCBs.


  • Admin

    @NeverDie

    PCBWay have quoted a few fully assembled boards on openhardware.io but the prices is pretty high as they won't stock/produce larger batches.

    It's a bit problematic to get low price at low volumes (and low financial commitment).

    I suggest hardware contributors to setup some cooperation directly with the manufacturers. You should have a direct channel to them in the closed manufacturing forum here (accessible for all open hardware contributors).



  • @hek Have you considered using the Seeedstudio PCB assembly service? I haven't tried this service as all my PCB's are using old school PTH. But will try them at some point. It says that "Assembly Fee Starts from $25" but there's no mention whether it's a flat fee or it includes some components assembly. The pricing information is rather fuzzy and I wasn't needing the service for time being anyway so I didn't ask.


  • Admin

    Yes, Seeed Studio have access to quote assembled boards (since a couple of weeks back) on openhardware.io, but they haven't so far as it is a bit more complicated (time consuming) to get a accurate price.

    @scalz and I have been in contact with Seed about this particular board. But we've not had time to follow up on some of their documentation requirements.


  • Hardware Contributor

    @scalz said:

    I stencil only what i need 😉

    I know it's a probably a bit late now, but have you considered making a separate board only for the PIR ?
    Then the "main" board with other sensors would be (relatively) easy to solder and cheap to produce by PCBA, then people could order the PCBA of the PIR only separately if they need.

    And it would be pretty useful for every other board maker on this forum also as a low power PIR is not a real option 😄
    I'm thinking about stealing your design to make a dedicated PIR child board, but I'm afraid my routing skills and electronic knowledge are not good enough yet to make a stable solution that will not be rigged by false detection problems 😞


  • Hardware Contributor

    @Nca78
    My best wishes for the new year 🙂

    I designed this little pir sensor board last month with an optional lux sensor which i think is a nice sensor associated with a PIR. I will post files soon (I'm recovering today, phew!)
    https://www.openhardware.io/view/292/Motion-And-Lux-Shield-V1
    I also derivated it with MYSX connector, so it could be plugged on some new neat sensebender mk for instance 🙂

    And i've asked a pcba for this sensor board, for curiosity. but i've been busy during december.. let's see what we'll get 😉

    But about MyMultisensors. I've designed V2 last month. I didn't need it..just because i wanted to try.
    I've improved cost, changed PIR strategy, new mcu, still low power, and size is 30.5x25.5 ! with all sensors, and a new thing too. I stop talking.I should get the pcb soon and i'll show. .
    Also, that will be a time2time work on the software part because of the mcu choice.



  • Any news about the enclosure ? Or did i miss a comment



  • Hello, this is really an excellent sensor!
    I would like to buy the components for this project, but I do not know which to choose precisely: when I am looking for a capacitor 100n pack 0603 I have 16 V, 20 V, 15%, 20% etc ...
    Do you have a list of references to help us?
    Thanks !


  • Hardware Contributor

    I'll put stl for box soon, i need to check few things, and i'm busy.

    As i've no time for the moment to upload a complete list with manufacturer parts etc.. it's a 3.3v board without regulator, so with passive >6V (for the 100uF for instance) you should be fine. So for others, 16v etc is enough. Rule i use in general, is 2x what my boards need 😉



  • Thanks, and is it OK if I buy 16V for the passive too ?
    Like this one http://www.conrad.fr/ce/fr/product/457889/Condensateur-cramique-CMS-0603-Kemet-C0603C104K4RAC-01-F-16-V-10-X7R-1-pcs?ref=searchDetail for the 100nF for instance.


  • Hardware Contributor

    Yes it's OK to buy 16V. And it should be a rule to buy x7r, so you should be good with those.
    But for big values capacitors (used as power reserve), try to take as low voltage as possible on your circuit as leakage is proportionnal to rated voltage.



  • Thank you so much, so I will buy 16V for 1u capacitor or more, and 6.3V for others.
    And is there a rule for active ? (Watts, volts, amps...)


  • Hardware Contributor

    @particle said:

    Thank you so much, so I will buy 16V for 1u capacitor or more, and 6.3V for others.

    No, it's the opposite 😄
    The higher the voltage rating, the more leakage/losses you will have. It's not important for small capacitors, but for reserve capacitors like 100µF it's better to take as low as possible, basically 2x the voltage used on your board.
    Honestly it's not a big issue if you use 16V instead of 6V, but with a board as optimized for battery life as this one, it would be sad not to optimize the capacitors also 😉



  • OK understood, it's clear now ! 🙂
    And yes with the optimization work, I would like to pay tribute to him!
    And is there a rule for active ? (Watts, volts, amps...)


  • Hardware Contributor

    Hey!

    Sorry for being so late, too much pending projects 🙂

    but here is how looks the custom box for my project. I need to polish a few things, especially sort of mounting plate, then i'll release my stl.

    Box is 62x29x 11.6mm
    No nails no screws.
    i don't like to search my screwdriver or needing screws, or a shorting circuit screw.. So when i can i prefer snaps!

    0_1486292646968_Assembly_multisensors_b.PNG

    And in real

    0_1486292675023_20170205_115515.jpg

    0_1486292691253_20170205_115658.jpg

    See you soon!


  • Hardware Contributor

    @scalz Very good work dude ! What about de V2 ? because i want to build this awesome node but i have read somewhere, you are working on the V2 😉


  • Hardware Contributor

    oki.
    v2 won't be released soon (not this month sure) because i miss time, also it's not mysensors compatible yet. and not rfm69 too 😉


  • Hardware Contributor

    @scalz Oki. And for the nrf24 version ? 🙂


  • Contest Winner

    Unfortunately this circuit and pcb contain a little mistake in reverse polarity protection module. Q1 must be connected as on the following diagram
    reverse polarity
    So just reverse connections of drain and source of Q1, and the next version of your board will contain correct reverse polarity protection 😉
    PS
    Otherwise your circuit will be powered through mosfet body diode (with a drop to ~0.6V of course) when polarity is crossed. 😧


  • Hardware Contributor

    @Koresh thx for feedback 👍 Files are now updated and added a note

    @tonnerre33 sorry for late reply. yes this will be nrf24 compatible, not rfm69. i'll try to show something soon, time does not help me!


  • Hardware Contributor

    @scalz nrf24 for the V1 or V2? Because if V2 isn't mysensors compatible, i prefer use V1 but in nrf24 version 😉



  • So there is no option yet to order complete boards with components in place from manufacturarer? Or am i not getting openhardware correct. Order 10 PCBs will just get me the pcb right?


  • Hardware Contributor

    @Yeitso you are right, 10pcbs order will just give you the pcb 😉


  • Hardware Contributor

    I'm finalizing the nrf24 version because it's a nice board, that would be too bad for nrf24 user

    Did you finish the nrf24 version @scalz ?


  • Hardware Contributor

    @tonnerre33 sorry for delay. yep, sure i finished it a while (rev 1.1 nrf), never ordered it, i use rfm for this node. but i'll upload this week oki


  • Hardware Contributor

    @scalz Thx a lot ! I tried to replace the transmitter myself but the routing is too hard for me.

    I'll try to check the schema before order the board 😉



  • This looks like an awesome unit! Is there a way to buy this with components assembled? Looks like a lot of work to solder all those smds..



  • I also wish I could buy assembled ones.



  • Likewise, to be able to buy assembled would be great



  • @scalz hi, excellent sensor! Do you know if the atmega328 memory is enough? You must have a large sketch for all sensors + signin


  • Hardware Contributor

    @alexsh1 thx 🙂
    memory ok if sketch optimized (radio driver footprint too) and without much debug msg.
    V2 will improve memory, cost and device size (will be 9in1 this time so i needed more mem) but for nrf24 networks only. i should release it soon if i can get rid of a little sw bug..



  • How long can you get these running on a single battery?


  • Hero Member

    @scalz Would also be very interested in buying assembled modules. But why no more RFM69?



  • @mpp I suppose depends on which battery and what sensors - there are a few options here.



  • @scalz atmega328 is only good for simple sketches nowadays. I am struggling with a simple temp/hum/baro sensor with signing and debug as It runs on low memory and the sensor freezes after a few hours. I suppose we have to move to SAMD.
    Do you have the STL file for the box please?


  • Contest Winner

    @alexsh1 regarding low memory problems, debug is intended for just that; debug. Once deployed, you can disable debug to ensure the longevity of your program. Probably the sketch eventually dies due to stack shortage.



  • @Anticimex Completely agree. Having said that I have a few nodes where I left debug purely for convenience. I do not want to re-flash the node to debug it in case need be. Right now I am in the process of changing the GW and may need to see node's debug.


  • Hardware Contributor

    @alexsh1
    I agree with you about 328 and 8bits. And that's a while i've done a board for these 😉
    I won't use it in v2 though, tiny 9in1... not possible!
    I also have custom SAMD boards, missing time to release those one too, but imho these mcu are not ultra low power (SAML is).

    I'll publish stl this week..



  • @scalz ATSAM D21 is already compatible with MySensors, whereas ATSAM L21 may be in the pipeline. So for now, we all are stuck with SAMD.

    Looking forward to your stl



  • Phenomenal!

    I have a stupid question.. clicking buy on the page.. what exactly does that buy you>?



  • @Konrad-Walsh You buy PCBs (10 0r 15 of them).



  • I am sorry.. I should have been more clear...
    When you say PCB.. Is that a fully assembled product with all the mentioned sensors? Or is it a board and you add sensors to it..

    Please excuse my ignorance



  • @Konrad-Walsh Click on the link and see it yourself 😉
    PCB means a bare board and not a ready product. You have to procure parts and assemble it.



  • @alexsh1 Thank you



  • @Konrad-Walsh said in 💬 MyMultisensors:

    you

    No problem.

    @scalz There is a lot of interest from others to have an assembled sensor. Maybe as a suggestion, you would be interested talking to Itead or similar guys to get it arranged?
    Personally, I am comfortable assembling an SMD board down to 0605 (though it is more difficult with the fan). My preference would be 0805 and up


  • Hardware Contributor

    thx for the interest though 🙂
    for the moment, the quotation i got was not so great imho.. oki i'll try again with other fabhouse for this one 😉 as v2 will cover nrf only


  • Hardware Contributor

    @scalz could you give an idea of the price ? I'm curious 🙂



  • Where might I find the source code?



  • @Carywin a source code for what? There are many combinations of sensors.
    I am sure @scalz can help 🙂


  • Hero Member

    Still very much interested in buying the board with RFM69 footprint! Just saying!



  • @scalz do you mind me asking where you bought PIR lens, eeprom, and most important that fancy small antenna??? Thanks


  • Hardware Contributor

    sorry to be so quiet actually 🙂
    I buy most of my ic at electronic suppliers like Mouser, Digikey, Arrow etc.



  • @scalz Thank you. I do shopping at those sites as well if I do a large order, but delivery charge is just killing if I need to order 1-3 items.

    I am going to try 2450 with your board. It has 600mAh so I am hoping that using eeprom is fine with this coincell. Regarding 2032, I agree with you. I have a node, which consumes 5-6uA (with watchdog) and I had to disable the LED to use it with coincell. It just drains too much energy from a low capacity battery.

    Yes, simple wire would work fine, but ANT-868-USP is just looking very tidy.



  • Just waiting for some components to finalise it

    0_1496745207972_IMG_5142.JPG


  • Hardware Contributor

    @alexsh1
    nice assembly 👍 oshpark i guess ??
    I agree too, for PIR use, CR2450 is a minimum.
    Well, with my tinkering and some stock in case, i usually get very quickly the free shipping..
    but you can find these flash at Arrow for instance, they just need 20€ min order.
    I guess you already have those, but for example,, coincell holders etc are not really cheaper at aliexpress etc..
    Time to do some stock for stuff you need perhaps 🙂



  • @scalz yes, it is oshpark- I usually use them as the quality is exceptional. And typically I only need 3-4 pcbs anyway.
    Unfortunately, I do not have oven and do not use smd stencil, which means the process is very long and manual. A lot of hot air fan work under the magnifying glass, but given this is not a board with too many components, it works.

    You should get some commission from Arrow. I have just placed my order for eeprom and some parts ;))



  • Good job! Looking forward for a assembled version for buying. (NRF, of course 😀 )



  • @scalz I ordered some boards and components which are on the way, but I can't find the source code anywhere?



  • @scalz - I forgot to burn a bootloader onto a blank atmega328p tqfl. Can I burn it using your pogo pads? The only problem is that it my Adruino ISP is running at 5V. I do not have radio soldered. I am not going to damage anything connecting 5V to VCC3?


  • Hardware Contributor

    @alexsh1 pogopads are there for this. But SI7021, and others sensors are not 5v tolerant 😬 You'll need to use a regulator, and perhaps get a cheap 3v/5v programmer

    @Carywin source code depends what you need. you can also use some examples from MySensors website. when i'll get more time (actually busy), i'll upload mine (need to check if it needs some polishing) or some examples.



  • @scalz I did manage with 5V. Just de-soldered SI7021 and uploaded DualOptiboot. Other components are 5V tolerant. Having said that, I recall I did upload a different bootloader at 5V to Sensebender Micro (without nrf24l01+) without damaging SI7021.

    R22 has to be changed for 330 Ohm as 1.5k was way too dark and not visible. I like bright LEDs you know :-))


  • Hardware Contributor

    @alexsh1 i can see the led with 1k5 😆 i'm using it only for debug on my side. But you're right, if you want more brightness. just be careful to not drain too much if you're using a coincell 😉



  • @scalz I am with you on the battery. I completely switched it off on another node running on 2032. The node is reporting very hour and has got about 4uA consumption while sleeping. 🙂 Probably will stay alive for a few years. However, when debugging, I like bright LEDs.

    By the way, I tested the node - OPT3001 and SI7021 are working fine. Cannot test LHI968 as I still do not have some resistors. I am very satisfied. The only issue is that assembling the board is very tedious - but it is compensated by its size


  • Hardware Contributor

    @alexsh1 i'm very glad to hear that 👍 I'll try to upload an example for PIR pinchange with my helper lib for blindtime etc asap



  • @scalz I know you are currently developing a similar board on SAMD. Do you have any problems with atmega328p memory? Unfortunately, with signing and a few sensors, I'm running out of memory. On your node, I can have PIR, light, temp/hum and reed. I may struggle to combine all of them under 32kb with signing. Given that I have dualoptiboot (1.5k less) for OTA, it does not help either.

    I can see your PIR setup is complex. What is it you are trying to achieve?


  • Hardware Contributor

    @alexsh1 my next board won't be for SAMD.
    I need to check my code and what's the compil results, i don't remember exactly. but that was tight, 90% perhaps, i usually don't want to go above..
    What do you mean by PIR setup is complex?



  • @scalz I can see you created MyPirHelper.h - not sure what your trying to achieve. Could you explain maybe a bit more?


  • Hardware Contributor

    @alexsh1 this is a lib for helping to use PIR, could be integrated in nodemanager though, but i generally prefer to keep hands on my code, also because C code is usually more memory optimized.
    So this is for handling PIR like some controllers ic do, and pinchange, with weak functions for users functions etc.
    How looks my flow:

    /* *******************************************************************************************************************
     * PIR Sensor State Machine
     * 
     * Flow : sensitivity of pir sensor for noisy environment, limits tx, power saving..
     * 1) NODE_SETUP  : settle for PIR_SETTLE_TIME. Then 2)
     * 2) PIR_START   : Wait/sleep for the first pulse. Then 3)
     * 3) PIR_SCAN    : If One trigger, wait/sleep for PIR_DEFAULT_PULSES during the PIR_DEFAULT_WINDOWTIME. 
     *                  If so, the motion is validated. Then 4)
     *                  Else 2)
     * 4) PIR_CANCEL  : PIR is disabled for PIR_DEFAULT_CANCELTIME. After, this period it reports new changed state 
     *                  If LOW, then 5)
     *                  Else 4)
     * 5) PIR_IS_BLIND: Keep PIR sensor insensitive for PIR_DEFAULT_BLINDTIME before 2)
     * 
     * ******************************************************************************************************************** */
    


  • @scalz this is exactly what I do not understand. For me PIR is very simple - 1 or 0, HIGH or LOW. Why treating it differently? Maybe this is very Noobs, but this is how I treat my PIRs. I may introduce 10-30 secs delay for it to settle or 30sec sleep after it has been triggered (I do not want to have extra PIR messages to my GW and controller)


  • Hardware Contributor

    @alexsh1
    sure PIR state is 0 or 1. I'm not changing anything to this. But you can fine tune this.

    Do you mean you'll update each time there is a CHANGE ?? No intermediate state ??
    If so, you'll waste a lot of power in useless radio TX, mcu processing, depending on days and traffic. and your batteries won't last for long!

    When there are people for an hour in same room, do you update each time it triggers? That can be a lot of waste!
    Also why not allowing a blindtime before redecting?
    In days with lot of traffic at home for example. If you already know (or the controllers could adjust this dynamically too by custom commands) that a room will be busy. It's useless and will consumes power again, to send 0 if it will retrigger in just a few seconds.

    So i've done sort of helper for creating intermediate states with timeouts and counters, with user defines etc.



  • I would only update each time there is a first HIGH. Then the node goes to unconditional sleep for 30-60 sec - there is no need to send HIGH again or LOW. After 1 min the status in Domoticz for the PIR is cleared (LOW) and the PIR is ready to send another "HIGH" if triggered.

    Can Domoticz really adjust PIRs dynamically?
    There is blockly stript, which helps to process "HIGH" from a PIR, but I'm not aware how this can done dynamically.

    Clearly, you approached this as a programmer. I have a much more simplified approach. Maybe because I'm noobs when it comes to PIRs

    @scalz said in 💬 MyMultisensors:

    @alexsh1
    sure PIR state is 0 or 1. I'm not changing anything to this. But you can fine tune this.

    Do you mean you'll update each time there is a CHANGE ?? No intermediate state ??
    If so, you'll waste a lot of power in useless radio TX, mcu processing, depending on days and traffic. and your batteries won't last for long!

    When there are people for an hour in same room, do you update each time it triggers? That can be a lot of waste!
    Also why not allowing a blindtime before redecting?
    In days with lot of traffic at home for example. If you already know (or the controllers could adjust this dynamically too by custom commands) that a room will be busy. It's useless and will consumes power again, to send 0 if it will retrigger in just a few seconds.

    So i've done sort of helper for creating intermediate states with timeouts and counters, with user defines etc.



  • @alexsh1
    My domoticz installation does not resets Pirs after a minute or whenever. Are you using the PIR lua scripts or any other?
    By default it doesn't do such thing.


  • Hardware Contributor

    @alexsh1 i have this option too (ctrl clearing pir state) i thought it could depend on the controller used, so i've tried to make something independant. And i like adding features like setting triggers max for a motion etc. But i agree, your way works too 😉



  • @Sergio-Rius either you have to use lua or there is a much simpler way to do it in Domoticz. Change type to "motion sensor" and then you have an option "off delay". Setup it to 60 seconds and PIR sensor will be off in 60 seconds. Very useful option and yes it is not enabled by default.0_1497139322273_IMG_5170.PNG



  • @scalz can your controller adjust PIRs dynamically?
    What controller are you using please?


  • Hardware Contributor

    @alexsh1 i just said i have same option as you in my controller 🙂 My controller is jeedom (french ctrlr)
    I've not done it yet (missing time), but i would use some script and scenario if i would like to dynamically adjust this vs some parameters.



  • @scalz How are you dealing with PIR? It is connected to D6 and D7, but sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME); can only be used with D2 and D3 or I am mistaken? Maybe you can share your motion sketch please?


  • Hardware Contributor

    @alexsh1 I'm using pinchange interrupts. It is not supported in Mysensors out of box regarding sleep, if i remember, i made some change to my functions, but the lib has changed a bit. that would need i check the code and i have no time for the moment, and don't want to release something not up to date. will take a look later, don't know when yet.

    But if that can help, below is some parts of code, for enabling your irqs, and the interrupts routine. I think if you're using sleep from MySensors, it will return -1 if triggered by the pinchange, that's all. you'll just need to handle that in your sketch.

    ISR (PCINT1_vect) 
    {
      if (digitalRead(AMBIANT_LIGHT_PIN)) 
        irqLight = false;  
      else 
        irqLight = true; 
    }  
    
    ISR (PCINT2_vect) 
    {
      if((PIND & (1 << PIND6)) == 0x40 ) {  
    	  myPirSensor.pirhCount++;  
    		myPirSensor.irqPir = true;  
    	}
      if((PIND & (1 << PIND7)) == 0x80 ) {  
    	  myPirSensor.pirlCount++;  
    		myPirSensor.irqPir = true;  
    	}        
    } 
    
    /* ======================================================================
    Function: pirIntEnable
    Purpose : Enable pin change for PIR interrupt
    Input   : -
    Output  : -
    Comments:  
    ====================================================================== */ 
    void pirIntEnable() 
    {
      // Enable pin change for D6, D7
      PCMSK2 |= bit (PCINT22);  
      PCMSK2 |= bit (PCINT23);  
      PCIFR  |= bit (PCIF2);   // clear any outstanding interrupts
      PCICR  |= bit (PCIE2);   // enable pin change interrupts for D0 to D7 
    }
    /* ======================================================================
    Function: pirIntDisable
    Purpose : Disable pin change for PIR interrupt
    Input   : -
    Output  : -
    Comments:  
    ====================================================================== */ 
    void pirIntDisable() 
    {
      // Disable pin change for D6, D7
      PCICR  ^= bit (PCIE2);   // disable pin change interrupts for D0 to D7 
    }
    /* ======================================================================
    Function: lightIntEnable
    Purpose : Enable pin change for OPT3001 interrupt
    Input   : -
    Output  : -
    Comments:  
    ====================================================================== */ 
    void lightIntDisable() 
    {
      PCMSK1 |= bit (PCINT9);  
      PCIFR  |= bit (PCIF1);   // clear any outstanding interrupts
      PCICR  |= bit (PCIE1);   // enable pin change interrupts for A0 to A5   
    }
    /* ======================================================================
    Function: Light_IntDisable
    Purpose : Disable pin change for OPT3001 interrupt
    Input   : -
    Output  : -
    Comments:  
    ====================================================================== */ 
    void lightIntDisable() 
    {
      PCICR  ^= bit (PCIE1);   // disable pin change interrupts 
    }
    


  • @scalz said in 💬 MyMultisensors:

    Thank you for sharing it.
    I must admit, it does look Chinese to me. I have never come across pinchange interrupts so have to dive in to understand it.



  • My sensor is now fully completed with all sensors and flash. I decided to go for 2450 battery

    0_1498299022820_IMG_5438.JPG

    0_1498299079412_IMG_5440.JPG



Suggested Topics

1
Online

11.4k
Users

11.1k
Topics

112.7k
Posts