Creating a 5vdc DI from a 3 vdc flood alarm

I have a 3vdc flood alarm. When the flood alarm is activated it sounds a buzzer. When this buzzer goes off I would like to use it as a trigger to my Arduino Mega2560 via a digital input(DI).
My first thought was to hook a 20 gauge wire to the + side of the buzzer and connect the other end of the wire to a digital input on the mega 2650.
The sketch would simply do one thing if the DI is high and nothing if it is low.
The trick is however to condition the signal at the flood alarm to be +5vdc when it reaches the Mega 2650 DI.

Any suggestions?

Opto isolator?

image

Transistor inverter/amplifier:

Capture

1 Like

As i am new to creating projects of this sort, is it possible for you to give me a URL to a opto isolator that I can use in my project. I use Amazon for a lot of my electronic purchases but if you have a better site I am willing to check it out.

Thanks for answering my inquiry,

As i am new to creating projects of this sort, is it possible for you to give me a URL to a transistor, inverter/amplifier that I can use in my project. I use Amazon for a lot of my electronic purchases but if you have a better site I am willing to check it out.
[/quote]

Any of hundreds of different small, NPN, audio or switching transistors will work in that circuit. Typical examples are 2N3904, 2N2222, or salvage one out of a discarded toy with some electronics in it.

You do have to pay attention to lead identification!

In your sketch above what would be the source and value of Vcc?

I am not sure what you mean by β€œlead identification β€œ.

VCC is the working voltage of the processor you're using.
The Mega is a 5volt-logic Arduino, so VCC is the 5volt pin.

The pins of a transistor can be orientated differently, so pay attention to the datasheet of the transistor you're using. Google "2N3904 datasheet" if you use that transistor.
Leo..

Example of lead identification for 2N3904

Capture

Introduction to uses of 2N3904:

Thanks a lot.
I will work with what you have given me and see where I get.
Wayne

I just ordered a few types of the npn transistors including the 2N3904.
Thanks

You don't have an available analog input? That would be an easier solution.

I do have an available analog input.
How would I use it for this problem? I am used to using the digital inputs.
Thanks

2V on an analog input will return ~400 counts.
If the analog read is > 400 the buzzer is on, else the buzzer is off

I am trying to use a 0 to 8mVdc signal to trigger an Arduino mega 2650 digital input from low to high (0 to 5Vdc). This requires about a 500x increase. Is this possible?

With a simple analogRead() and a digitalWrite() you should be able to catch that. Especially if you use 1.1 V reference.

1 Like

So if the input is greater than 4mv you would declare that to be a HIGH and if less than 4mv it would be a LOW?

The textbook solution to that problem, is a comparator IC.

maybe try ATmega2560 differential modes with 20x gain?

Always have a bit of hysteresis to make it switch cleanly - eg go high at 5mV go low at 3mV .
You might just be able to do it with the internal 1.1v reference , but think I’d add an op amp to boost it say x10, or as said a comparator is a good option .
Check the performance of any op amp for offset/drift and being able to work near 0v

Never used differential mode on a 2560, but worth a look