You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • As @LawrenceGrif says, I guess the best bet is to figure out if the doorbell is using mains voltage first... And also if it's AC voltage or not.

    If it isn't mains

    Then everything's easy. You may still want to use a relay module to drive the doorbell (if the voltage is DC then you could use a FET, as it'll be a lot smaller).

    To get a signal into Espruino you might be able to use a few resistors as a potential divider to convert the higher voltage down to 3.3v, however an easy and very safe way to do it would be to use an optocoupler/optoisolator. I'll post up more info if it turns out you can use this, but it's basically a light and a light sensor in a small package. You connect the light up to the alarm's power, and the sensor up to Espruino. That way there's no electrical connection between the two systems, but you can still tell when the alarm is pressed.

    You might also be able to power Espruino straight from the door bell's power supply...

    If it is mains voltage

    You'd need the relay module, or an SSR (solid state relay - you might be able to find a smaller one of those).

    But to sense the door bell button being pressed, you could make yourself an optoisolator... Get a small light that can be powered from the mains (maybe a neon bulb?), put a light sensor like an LDR or photodiode next to it, and tape them both together so no light can get in. It'll be a nice, safe, easy way of sensing mains voltages :)

    Also you probably want to stick a capacitor across the light sensor - because the mains is AC the voltage would be going up and down 50-60 times a second (and the light level at twice that). If you add the capacitor you can smooth all that out and can then do a simple setWatch like you wanted :)

About

Avatar for Gordon @Gordon started