Electronic – How to make a simple analog to digital converter

adc

I'm trying to hook up a sip-puff air pressure sensor (datasheet) which outputs 0v to 5v depending if the pressure is -ve (sipping) or +ve (puffing). I want to use it to drive a Bluetooth keyboard controller (info) to help a disabled person use an iPad. When pins on the Bluetooth controller are driven low, they send a key press – the idea being when you sip it sends key 'a' and when you puff it sends 'b'.

I need some help coming up with a simple circuit to interface the two, thus:

  • When the sensor output is 0v – V1 then drive pin 1 'a' low (sip)
  • When the sensor output is V1 – V2 then do nothing (dwell / dead zone)
  • When the sensor output is V2 – 5v then drive pin 2 'b' low (puff)

I'd also like a couple of trimming pots in the circuit to set V1 and V2. I have transistors and resistors to hand so it would be helpful if I can build using those, otherwise it's no problem to get other components if needed.

Thanks in advance for any pointers!

Best Answer

I'd say that is a classic task for comparators.

schematic

simulate this circuit – Schematic created using CircuitLab

Note that the resistors don't have the correct values you need, you will have to calculate them according to your needs.

Comparators will output "1" (supply voltage) if the + voltage is higher than the - voltage. Otherwise they will output "0".

So for this task you will need 2 comparators, one configured to look if the output is lower than V1, that's CMP1. And one that looks if the voltage is higher than V2, that's CMP2s job.

With the potentiometers you can vary the voltages V1 and V2.

For a task like that, I'd also use a hysteresis as signal outputs tend to be noisy and you probably don't want that near the voltage V1 or V2 the signal trips often because it's varying slightly around that point. So basically the hysteresis will serve as a debouncing.

There are comparators available which have a built in hysteresis, but you can add one with using just resistors to any comparator.

Using just transistors and resistors, you might as well be able to do that, but I'm really not good at those levels of electronics.