Go Down

### Topic: do i need to use a schmitt trigger here? (Read 4254 times)previous topic - next topic

#### bill2009

##### Mar 25, 2011, 02:43 pm
i'm reading a signal that will take any of several values in the 0-3.3v range and i've used up all my analog inputs.

i'd be satisfied to know when the signal goes to 3.3 so in principle i could just hook it up and hope for the best but i seem to recall that giving the avr's sloppy inputs on digital pins is not a good idea.  should i use a schmitt trigger gate to clean up the signal?  any suggestions on a commonly available part?

i already have an lm358 type op-amp in the signal path so if there is a way to use that or something like it that would be great.

i've googled til i'm blue in the face but i can't tell if i'm overthinking this or what common practice would be.

#### GaryP

#1
##### Mar 25, 2011, 02:53 pm
Not enough information for the answer.

What kind of asignal you are expecting? High frequency or something between 0 to 100hz, what? And when it should be triggered, if signal is anything between 0 to 3.3V, is 0.01V enough?

What? Where? How often? It's friday! That cool!

Cheers,
Kari

The only law for me; Ohms Law: U=R*I       P=U*I
Note to self: "Damn! Why don't you just fix it!!!"

#### bill2009

#2
##### Mar 25, 2011, 03:13 pm
thanks, sorry for the imprecision.  the input signal is a cyclic stairstep series of values changing maybe 200 hz e.g 0v, 1v, 2.06v, 3.15v then back to 0 and repeating.  because i know the sequence i can accept any trigger point as long as i know which it is.  now that i look at it the 0v is probably the solidest signal.

first question: is it in fact a bad idea to just feed this to a digital pin?

#### elandd2011

#3
##### Mar 25, 2011, 03:48 pm
Hi
If you need only know if the signal is over one level (3  volts for example),of course yo can use one S.Trigger.One very affordable is SN74LS13 and you can use a pot. in the input for make some adjust
just in case

#### Magician

#4
##### Mar 25, 2011, 04:08 pm
You can put lm358 in comparator mode, with output attached to arduino digital input (directly if OP
powered with +5V), apply input signal on one input and connect second one to the pot. In this case, varying pot "set" point you will change "trigger" level.

#### bill2009

#5
##### Mar 25, 2011, 04:23 pmLast Edit: Mar 25, 2011, 04:25 pm by bill2009 Reason: 1
ok good, i must have some 74ls.. chips around.

i also will try this op-amp circuit with like 5:1 amplification and see if that keeps everything except the 0's safely in high territory:

@magician - thanks, the circuit above must be like using a pot.

#### MarkT

#6
##### Mar 25, 2011, 05:27 pm
From your description it sounds like the 1->0 transistion can only happen at one place in your waveform, so use that as a trigger.  The AVR input pins have some hysteresis if I remember correctly so that should help (unless too much noise).

Another approach is using analog multiplexing to free-up some analog input pins.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

#### graynomad

#7
##### Mar 25, 2011, 05:48 pm
If you use a proper comparator you won't need any resistors because you can compare against the 3v3 supply.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

#### MarkT

#8
##### Mar 25, 2011, 05:50 pm
Quote
If you use a proper comparator you won't need any resistors because you can compare against the 3v3 supply.

But the levels listed above are all below 3.3V...
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

#### bill2009

#9
##### Mar 25, 2011, 06:06 pm
Quote
If you use a proper comparator you won't need any resistors because you can compare against the 3v3 supply.

my supply is 5v.  the 3v is just the highest voltage in the circuit i'm examining.

#### bill2009

#10
##### Mar 25, 2011, 06:13 pm
Quote
From your description it sounds like the 1->0 transistion can only happen at one place in your waveform, so use that as a trigger.  The AVR input pins have some hysteresis if I remember correctly so that should help (unless too much noise).

if the op-amp circuit works i'll be hoping to push that 1v up to as close to vcc as it will go so yes, i'll trigger there.

#### bill2009

#11
##### Mar 26, 2011, 12:30 am
Quote
if the op-amp circuit works i'll be hoping to push that 1v up to as close to vcc as it will go so yes, i'll trigger there.

very nice - with a 2k and 10k resistor the op-amp circuit pulls everything except the 0v just about up to +V.

now back to the software drawing board.

#### GaryP

#12
##### Mar 26, 2011, 07:36 am
Great.

Where is that signal coming from?

Cheers,
Kari
The only law for me; Ohms Law: U=R*I       P=U*I
Note to self: "Damn! Why don't you just fix it!!!"

#### bill2009

#13
##### Mar 26, 2011, 09:10 pmLast Edit: Mar 26, 2011, 09:12 pm by bill2009 Reason: 1
Quote
Where is that signal coming from?

it's one of the inputs to a multiplexed LCD from a clock.  They use these stairstep waveforms that gyrate around each other to control the voltages across the individual segments.  There are 4 backplanes and 8 segment signals all changing every 5ms.  I only need one of the backplanes to synchronize with since they are predictable and repetitive. One of the digits (the leading "1") is only ever wholly on or off so i'm using this trick to catch one backplane and that leading segment.  That leaves me 6 analog pins to get the 3 other digits at 2 per digit.

it's a crazy way to tell the time but i'm enjoying playing with it and, hey - I've learned that the avr adc's are quite low impedance and how to use an op-amp comparator!

There's some pictures of the clock here http://arduino.cc/forum/index.php/topic,51464.0.html

#### GaryP

#14
##### Mar 27, 2011, 08:52 am
Ok!

Cheers,
Kari
The only law for me; Ohms Law: U=R*I       P=U*I
Note to self: "Damn! Why don't you just fix it!!!"

Go Up