Push button intercept

Hi all,

I have a system with what is supposed to be a +12V supply, push button and then a bell (Bell.png I think, I cannot see the back of the PCB on which the transformer, bell, switch are mounted). When I measure the potential difference I actually get ~+9.9V.

What I want to do is notify a MCU (probably a nano to start with, later being replaced with a ATTINY85@5V with power regulator) when the button is pressed. I think the second image (MCU.png) should do this, but I just want to check as it’s been a long time since I’ve done anything like this.

Thoughts, comments and improvements are very much welcome.

No. Look at the 15K resistor. Assume that zero current goes into the Arduino input. (It takes nano-Amps, so close enough to zero for most purposes.) Switch the switch to 12V (or whatever.) What is the voltage on the Arduino’s end of the resistor? It is also 12V, which is above the Arduino’s limit.

It looks like you’re trying to make a voltage divider. If you connect the 10k resistor to the Arduino’s end of the 15K, then you have a useful voltage divider.

Then you should add some protection to the Arduino’s input, to take care of over- and -under-voltage spikes. A 12V bell is likely to give spikes of 24V or more when it is switched. A BAT54S diode pack can connect to the power rails to make sure that input never goes above 5V or below 0V. A Zener diode of 5.5V or so will also be a suitable protection. If the wires to the switch are long or go outdoors then you need to consider lightning protection too.


What is that diode for I wonder?


OK, the 10k is in the wrong place, should be from the Arduino input to ground to form the voltage divider.

Even so, the 15k would limit current to the clamp diode of the Arduino to the allowable 1 mA, but it would make more sense to make it 47k and another 47k to ground.

You actually need the resistor to ground to make sure it is pulled properly low with that peculiar diode in place! I hope they don’t think that diode is in some way limiting impulses. :astonished:

You know I looked at the 10k link and moved to from the MCU side to where it is now on the diagram after I drew it. Clearly over thinking it.

For the diode to protect the MCU would a 1n4007 be acceptable? As I know I have them.

Thanks for your help really appreciated.

Yes, the switch is outside. I think the wire runs are only around 1m and lightning density is pretty low in this part of the world so I'm not too worried about it. (It's an existing doorbell install I want a wireless alert upstairs).

If it's "only" a wireless doorbell extender then there may be cheaper and better ways than using an Arduino, but it's a good learning exercise that can be expanded to other functions in the future.

The BAT54S is a package that contains two schottky diodes. They are useful for input protection because the shottky turn-on voltage is lower than a conventional diode.

However, thinking about it some more, with that large of a resistor on the input, you could get away with just the Arduino's internal protection diodes, as Paul suggested. No additional components required.

I'm sure there are cheaper and better ways, but I'm using it as an attiny85 learning tool.

I've hit a snag:

Tried powering an arduino nano off of the transformer.

With the sketch loaded it should flash tx ever 1 second, or almost continuously depending on it a pin is high or low.

This works powering off of a 12v battery supply. But with the transformer I didn't get any flashes, just the power led.

Tried to push the reset button and burnt myself on the power led!

Anyone got any thoughts, constant current PSU? I'd find that quite surprising.

The doorbells usually work on AC power, not DC, so the AC 12V might show as 9.9V. There is usually only a transformer from mains, not a rectifuing power supply.

The voltage divider is connected wrong (as mentioned by Paul__B)

Should be S2---15K---MCUinput---10K---GND to get 0-4.8V at the input.

The divider's 15K will also protect for up to 15V overvoltage.