Simple question about magnetic door sensors



  • Hi everyone simple question here

    When building a door sensor using the door /push button sketch does it matter if you use a NO or NC switch or is either ok?

    Also im thinking if you wire two NC door switches together you can detect if two doors next too each other have been opened am i right on this?


  • Mod

    @sharpy if the node is battery powered, NO or NC can make a big difference. Which one is best depends on if the door is usually open or closed.

    Yes, with two NC in series you could detect that one of the doors is open. You would not know which door though, and if one of the doors was left opened you would not be able to detect if the other door is open or closed.



  • @sharpy Either will work, the Lo/Hi which triggers the interrupt state you define in the sketch.
    For a battery powered node however you want minimal consumption for the majority condition, eg - If the door is normally shut, a NC contact will be preferable since in the open state is not sinking power, whereas a NO contact would conduct until the door is opened.
    The two door query is presumably two switches tied to a common on one end, the other ends to 2 separate interrupts - Yes it will work.
    If it is a radio node however, there is usually only 1 interrupt spare, but you can search on here for are a few clever solutions for X switches on a common interrupt to identify which switch caused the event.



  • Ok sounds good too me I will order the parts and give it a try

    reading the doc on how too build it says use a pro mini will i be ok using a nano? can you use any board with any sketch?

    i think i will try too wire two sensors too independent pins it sounds simple enought



  • @sharpy Pro-mini is generally suggested as it is more suited to battery applications with not having the additional power drain of the onboard usb converter.



  • @zboblamont i will get my hands on some pro minis and give it another try i did get it too work with a nano now im trying too combine my temp dht22 with a door sensor but also want too power a different door node from battery so will move too the lower powered pro mini as you recommend thanks for that

    Combining sketch / adding multiple sensors is what i need too learn now



  • @sharpy You can either switch out the usually poor voltage regulator and destroy the power LED yourself, or buy one already optimised (Moteino etc..) for the move to battery power, an embarassment of information persists here and elsewhere on how to do it.
    I'm too old and less skilled for such fine work so opted to buy ready optimised as had the cash, two AA batteries on my gas meter node last between one and two years, so the world is your mollusc.
    Combining sketches is easy, understanding where you screwed up requires patience, reading up from the wealth of info here, and when your head explodes, there are plenty of kind souls here with massive knowledge to get you back on your feet for the next fall... It's always simple once you've done it, baby steps, read, try, learn.
    First lesson may be to ditch the DHT22, I still have mine in a drawer gathering dust, I suspect most do... 😉



  • @zboblamont

    "Moteino etc.."

    Thanks for the recommendation i will have look into this i have not heard of them yet and might save the work as you said

    "two AA batteries on my gas meter node last between one and two years"

    I would be happy with anything anywhere near too that

    " First lesson may be to ditch the DHT22"

    Why would you recommend this i have read there are better alternatives (lower power & faster refreshing)



  • @sharpy Moteino is just one of several brands of low power Arduino and other devices you can find on Google, commonly with onboard radio, expensive until parts and your time are factored in. Plenty of experienced guys on here have also developed their own variants, so loads to read up on before deciding what best suits yourself if tinkering doesn't attract.

    DHT22 is an early device, there are many other more faster and efficient devices, many of which feature in the forums for you to read up on.

    I ditched humidity in favour of 12 one-wire devices on ethernet cable installed between floors, the temp of all the rooms and spaces was more important, and are still reporting every 5 minutes almost 2 years later.
    Perhaps also give thought to the radio for aesthetics and structure - no problems here with 433 MHz through concrete and brick, but has a screw on antenna which looks a little industrial.



  • @zboblamont

    "Moteino is just one of several brands of low power Arduino"

    By using a pro mini and following the advice of removing both the LEDs and the power regulator using standard radio and a door contact sensor or something could you still expect 2xAA too power the device for a year?

    Or do you need to move too a board like you recommended too achieve that length



  • @sharpy Theoretically it can be done for the processor for sure, but you will hit problems with radio which is less amenable to low voltage.
    You only really need remove the power LED for the pro-mini as that runs continuously, removing the VR requires external voltage source and control, tinkering with the processor speed and fuses (google here if unfamiliar) enables the processor to run down to very low volts with restricted performance, all well documented here and elsewhere, but as previously commented, radio may prove the greater problem. 😉
    My selected 16MHz 3.3v Arduinos stretched available performance to the limits, and no regrets, 100% reliable all the way down to sucking the batteries dry.
    You may be better skilled than I to try, info aplenty here to assist from those who've been there and done that...


Log in to reply
 

Suggested Topics

  • 87
  • 2
  • 6
  • 8
  • 5
  • 1

1
Online

11.4k
Users

11.1k
Topics

112.7k
Posts