Making analog voltage control digital output

I am working on a project where I want to have an analog voltage control whether or not a digital output is turned on or not. I know this is simple but I am struggling with this. Could you lead me in the right direction?
Thanks

Can you read an analog voltage and print it to the serial monitor?

-jim lee

What’s the range of DC voltage you need to monitor ?

What are the thresholds you want to switch at ?

What are you driving with the digital outputs ?

I am using a temperature sensor to control a speaker. So when the temperature sensor outputs 1V I want it to output a digital signal to the speaker. I am using a 9V battery to power this circuit.

Ok, that’s a good start.
Now’s probably a good time to sketch out a circuit (schematic) diagram.

Putting a digital output to a speaker isn’t going to do much. You need to generate a tone or other sound in software, or have an active device which generates the sound you want - and we have to control that.

I have the speaker hooked up to a 555 timer as well as a buffer and I am able to get the desired sound that I want, all I need is to figure out how to incorporate the temperature sensor to control the speaker through Arduino code. That is the part I am stuck on.

Something like this?

int value = analogRead(PinNum);
if (value>cutpoint) {
   soudSpeaker();
}

-jim lee

So what you need is to enable/disable the 555 - not the speaker.

So we get back to the circuit diagram.

You’ll use an Arduino output to control the 555 when needed.
Just put some code together to turn the sounder on and off - forget the analog in for now. Prove that one thing works.

Once that’s working you can code for the analog thresholds to trigger when needed.

Tie them together and you’re almost finished.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.