Analog to Digital Conversion?

Status
Not open for further replies.

Lo Ryuken

Active member
I have a sensor which gives me values in the range of 200-900 using analogRead.

I really just need a digital signal; HIGH with sensor < 300, LOW if sensor > 300

I would just do this in software, but I need to hook up 50 of these sensors to the Teensy (I believe Teensy has 20 Analog inputs).

Is there is a simple-ish circuit that could help me do the conversion to digital? Once I have the digital signals, I can feed them to Teensy using a multiplexer (I believe).
 
Did you look for something like this? 74HC4051 - Datasheet - Arduino related page

Edit: ... and if you use the search function, you would stumble onto something like this:

schematic_ioexpand.png

Just a thread in this forum ... :cool:
 
Last edited:
You may multiplex the analog signals as well, no need to AD them.

With comparators this will be a lot more of time and expense because you need 50 comparators (and some passive parts) AND the multiplexer afterwards. So you may save the "pseudo" AD conversion and just use the multiplexers as they are designed for.
 
Last edited:
Normal method would be a comparator:
http://www.electronics-tutorials.ws/opamp/op-amp-comparator.html
https://en.wikipedia.org/wiki/Comparator

google image search 'op amp comparator' for a mix of example layouts

So you'd use one for each channel, and an adjustable resistor (or possibly a fixed resistor divider if exact tolerance was less important

Would also probably be possible to make a basic transistor with voltage divider and bias circuit that would produce a similar result, but suspect the cost saving on transistors vs op amps would be eaten by construction time by the time you've read 50 of them (see example transistor circuits to switch an LED on when a sensor is in the dark if looking at this option)

Analog multiplexors also exist, but will obviously be slower than just dumping a port worth of comparator inputs as digital.
https://www.sparkfun.com/products/9056
Depends on what the cost/time/development trade offs come in at.
 
Analog multiplexors also exist, but will obviously be slower than just dumping a port worth of comparator inputs as digital.
https://www.sparkfun.com/products/9056
Depends on what the cost/time/development trade offs come in at.
What's the problem with these? Because it's very complex to have a stable comparator circuit (you need stable reference voltage, good circuit design that the comparators won't oscillate and so on - and then you need the multiplexers as well ... So you've won nothing ... Again: in the Arduino PLayground the use of these muxers is recommended. So why not use them?
 
Last edited:
I agree, the 74HC4051 mux is probably the best path. Fast analog comparators are tough to use well.

The advantage comparators add is extreme speed. Reading analog inputs takes time, and some time is needed between switching the mux and starting analogRead(). Certain features like the timer input capture also only work with digital signals. Since Lo Ryuken didn't tell us much about this project, whether extreme speed is necessary is hard to know.

Since analogRead() is quite fast on Teensy 3.2 (looking at the OP, we don't even know which Teensy), and pretty reasonable even on Teensy 2.0, the analog mux approach is probably the best advice.
 
I agree, the 74HC4051 mux is probably the best path. Fast analog comparators are tough to use well.

The advantage comparators add is extreme speed. Reading analog inputs takes time, and some time is needed between switching the mux and starting analogRead(). Certain features like the timer input capture also only work with digital signals. Since Lo Ryuken didn't tell us much about this project, whether extreme speed is necessary is hard to know.

Since analogRead() is quite fast on Teensy 3.2 (looking at the OP, we don't even know which Teensy), and pretty reasonable even on Teensy 2.0, the analog mux approach is probably the best advice.

The inputs will be used in a musical instrument on a Teensy 3.2. I'll go with the analog mux approach and see how it fares.
 
Status
Not open for further replies.
Back
Top