Simple door counter

Posted on
  • I am not sure if it's worth sharing, but I recently ordered a few reed relays and could not resist finally using them. I attached them to the espruino and now count the times my front door is opened/closed. Bad pictures are here:­91859/posts/QCkhyHBH92B

    I might add a little sound system to that in the future, e.g. activated after BTN1 is pressed (30 secs later) as a simple door alarm.

  • Thanks - those reed switches are a good idea! With setDeepSleep(1) that would run off a battery for years.

    I guess you could do something like turning on a light if you open the door and it's dark...

    For sound, Espruino's now got the Waveform output so you could have some kind of recorded sound played if you wanted too :)

  • Thx for the idea with deepSleep - never looked at that. I will have a more detailed look at this later today, but what would happen if I have the HC-05 bluetooth module soldered on. Can I still connect to it while espruino is in deep sleep?

    I am using bluetooth right now to read the counter values. What would also work is that BTN1 wakes espruino from deep sleep, then if connected over bluetooth serial, it would stay on.

  • At the moment Espruino can't wake from deep sleep via Bluetooth - well, it can - but you'll miss the first character that you type. I guess that may not be such a big issue though?

    However that's not so useful really - the Bluetooth draws so much more power than Espruino that it's not really worth worrying about putting Espruino into Deep Sleep :)

  • K, that means the bluetooth module that I soldered onto espruino is always on - it does not count as "peripheral" then.

    I looked at the waveform pages, this is pretty sick (=cool). I'd love to try that out, but it does not really mention how to connect a microphone and loudspeaker - and especially which. Could you post links to ebay for the perfect choice that's guaranteed to work?

    Also one quick question: doing something like a "change on clap" - e.g. clap or shout in front of the mic and take that as a trigger to run a js function should be trivial, right? It seems it's very similar to the audio in example.

    If that's the case, I'd have some ideas for changing some NeoPixel / RGB123 8x8 board animation with the clap of hands. Audio input/output is one of the things I've not really explored, so I am very interested. Ha - also reporting the sound level continously to Xively would be nice.

  • Yes, it's always on - however you can put it into lower power modes I believe. There's a post on it here, but I don't know if anyone has tried it.

    For speakers, try here:
    Personally I'd just use an old PC speaker with a capacitor in series with it. It's not very loud, but for anything much louder you'd need to attach a transistor to get a bit more power.

    Responding to something like a clap is a bit more tricky because it requires going through the sound sample by sample (which is slow on Espruino). However you could do like is mentioned in the 'Input' section here:

    If you use E.variance, you can tell if there's a certain volume of sound during that buffer full of sound samples quite quickly. It's worth a try...

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Simple door counter

Posted by Avatar for hansamann @hansamann