A question regarding sound sensors.

Hello I am looking to incorporate a few sound sensors into my project but had a question before I got started.

First, the particular model of sensor I am using does not appear to be analog, it only has three pins (vcc, gnd, and out), but I need to use three different sensors (one for left, one for right, and one for center) to determine which direction a servo should turn. But, being that the sensors are digital, I need to do a digital to analog conversion so as not to get a false positive on the other two sensors when one is triggered.

Sorry this is a bit of a basic question, but I suppose in short, how do I do a digital to analog conversion? I've down ADC, but I'm not sure how to do the opposite. Also, being that the sensors are digital by default, would digital to analog even work (like measuring volume), or would it still always output at a higher signal? Thanks!

Also, from what I gather, this would require the use of PWM, if I'm not mistaken, I'm just also not sure what that would entail.

CatDadJynx: First, the particular model of sensor

Yes. We need that to answer the question.

Sorry, I couldn't find the actual model number but here's a link

https://m.newegg.com/products/2A7-00D0-00067

you did find the part number, but you did not spot it

google Sound Detection Sensor Module FC-04

the name, and the number on the module

I was looking for MPN ( manufacturer part number ) or UPC ( universal product code ) but Sound Detection Sensor Module FC-04 works fine

Oh alright, sorry. I got mine from some Chinese supplier in a lot of a bunch of others (not that I don't want to support those who's work it is, just didn't know what I was getting into starting out). Managed to figure out what most of them are but some aren't labelled, wasn't sure if the one I found in the link was labelled right either. I verified everything else was the same as far as components, though. Thanks!

Nevermind, now I am seeing the need for additional hardware to do DAC, other than on the Due and one or two other boards. I thought there may have just been some way that the PWM worked so that you could just convert it to a larger value, but it makes sense you can't given that the PWM can only produce square waves, so the resolution just isn't there. Now I'm just kicking myself for not getting analog sensors in the first place and having to wait another god-knows-how-long to get them again.

Edit: Also, on that note, what is the practical application of using PWM then, anyway? If a digital signal would produce a signal either on or off then wouldn't that equate to the same thing if you just kept toggling it in a line in your code? Or is the PWM to simplify that (so you don't have to reinvent the wheel or have to change more lines of code)? Sorry, just curious.

Edit again: Sorry, now that I see the function of PWM is for being able to adjust the frequency within a the range of 0 to 255.

PWM is used in servos. pulse width determines angle of servo. analog information is modulated on the width of the digital pulse,

Oh alright, yeah I forgot servos use PWM as well, I just didn't understand how as I just used the servo library (and didn't do the work myself, obviously), but that's certainly good to know, thanks!

Actually, sorry to ask about this in the wrong forum (just bunny trailed a bit and I try not to make any more threads than I have to so I'm not cluttering up the forums), but while we're on the topic...

Another part of my project is to eventually incorporate a PID controller connected to an inclinometer and servo motors, on its own board but connected to what I'm using, for a pair of bipedal legs. Im still pretty far off yet, I'm just starting school here soon to help supplement some of that in understanding the math behind PID controllers, how to make and use them, etc. (as well as plenty of other things, of course), I'm just looking at long term planning... and in this case you would more than likely need to have the PID and servo PWM directly communicating I would think, right?

Also, do you think the PWM and PID would be quick enough to react for that sort of application (given arduinos are 8 bit, as opposed to a 32+ bit controller)?

Sorry, I know that I am setting my sights high for my experience level, I'm just taking more gradual steps to get there, I'm just asking because I don't want to go too far down one road only to find I can't do it and I've heard things regarding limitations for this sort of application, plus at least if I did attempt it I'd like to get as much of an idea as I can how it might work.

Any Arduino is suitable for a simple balancing robot.

As you add functions, like maybe navigation, you may find you need a "supervisor" to tell the Arduino which way to go.