SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
By bea5017
#194158
Guys,

I am looking for a little expert analysis of my frustrating situation.

I am monitoring the state of 4 separate IR photo diode sensors, through a single 4 channel op amp then ADC with an Inverting Schmitt trigger to be read by the arduino MEGA on pins 13,12,11,10. All seems well except.. that when one specific sensor (#3 sensor to be exact) is tripped, the "AREF" LED lights up on the MEGA. the other sensors work, but do not Light up the "AREF" LED as #3 does.


My question is why would the "AREF" LED light up with one, but not the other sensors are tripped, when all 4 sensors are wired up the exact same way?

Should this concern me that #3 sensor is not wired correctly?

What causes the "AREF" LED to light up in the first place?

I am worried that the MEGA is damaged in some way possibly....

Thought/Suggestions?

-Ben
User avatar
By phalanx
#194159
I assume you are talking about the LED that has an "L" next to it in the silk screen?
megaschematic.png
Have a look at the snapshot of the schematic I posted, in particular I/O pin 13. You can click it to make it larger. You will see that there is an Op Amp configured as a buffer driving an LED based on the state of the I/O line going to pin 13 (pin 26 on the mcu). Whenever your Schmitt trigger outputs high, the op amp turns on the LED. This has nothing to do with AREF so you should be fine.

Other than the LED lighting up, is the signal otherwise functioning properly in your code?

-Bill
You do not have the required permissions to view the files attached to this post.
By bea5017
#194161
Bill, You are correct. I mistook the "L" as an arrow to "AREF". I feel like a fool... such small writting....

I knew pin 13 had a led attached, but thought it shouldn't light up because pin 13 was declared an input, however you informed me my thinking was incorrect.

The signal from the sensors works (sometimes). It will be stable and functioning properly then intermittently all 4 sensors will start freaking out and oscillating. I believe I need to redesign the op-amp circuit that comes before schmitt trigger.

Another Issue, and one thing I cannot seem to figure out is that sensor #1 will "Stick on". none of the other 3 sensors seem to behave like this. very mysterious. they are all wired the same to the same quad IC's (op-amp, Schmitt trigger).

(I know there is not much you can do without me providing a Schematic)
User avatar
By phalanx
#194164
I'd wager that the oscillations you are seeing are from having an input into your op amps that is right around the threshold of your transition point. What you should consider is replacing the op amps with comparators and add hysteresis to the system to eliminate the oscillations. There is a good description of this condition and how to implement hysteresis with comparators in this PDF from TI: http://www.ti.com/lit/ug/tidu020a/tidu020a.pdf

Like you thought, I don't have enough info to help with the "stuck on" condition!

-Bill
By bea5017
#194165
Bill, I will take your advice and order some comparator chips. Hopefully that does the trick.

FYI
The photo diode sensors are being used to measure the speed of a metal rod approx 2" long & moving at 50m/s velocity.

basically I need the sensors to trip on/off and react as quickly as possible to get most accurate results. Also a 4 channel chip would be required as space is tight on my pcb board.

Are there any chips you can recommend for such an application? I am not very familiar with selecting comparators so anything to get me pointed at an appropriate solution would be much appreciated.

Are there any special specs I should be concerned about for my application?

I realize this is just a brief description but I wanted to give you a little bit more information on my project.
By bea5017
#194168
What would be the appropriate "output type" for my application?

after some additional filtering my option seems to be (CMOS, Push-Pull, TTL) thoughts?

I am assuming general purpose wold be the correct "type"
User avatar
By phalanx
#194170
CMOS would be by first choice for an output type but any of the 3 you listed are fine. You don't want open collector, open drain, or differential types for your application.

General purpose as a comparator type is perfectly fine here.

-Bill
By bea5017
#194187
-Bill

After some filtering while trying to select a comparator, I am left with 2 choices of the same IC (see attached .png)

I am not quite sure about which "type" to use. "precision with latch" or "precision with reference". or how either option would effect my sensors.

I am thinking precision with reference would be the way to go, however i am not 100% sure.

Thoughts?

How would the "with reference" effect my application if at all.

Do you think this comparator would be appropriate for my project or can I do better?


EDIT: just found this general purpose chip from same mfgr. Difference is that it is ttl output, not a cmos. but i think it meets my requirements in every other way.

http://www.mouser.com/Search/ProductDet ... -MAX908CPD

I am confused about the difference between ttl and cmos and specificcally how it would effect my photodiode circuit.

Is this a better option than the 2 shown in the attached picture?

-Ben
You do not have the required permissions to view the files attached to this post.
User avatar
By phalanx
#194193
I think that's a typo on Mouser's end and it should read reference instead of latch. They are the same part with different temperature ranges per the Maxim datasheet.

Here is a really simplified description of CMOS vs. TTL. It has to do with the way the part is constructed. Older TTL parts used bipolar transistors which drew more current than newer CMOS models that are built using mosfets. There are small signaling level differences between the two as well which needs to be accounted for in some cases. Lots of modern parts are compatible with both. The MCU on your Arduino is a CMOS part but shouldn't have any problems reading TTL inputs either.

I think you narrowed down your options a little farther than necessary but the two in the picture and the one in the link should work fine in your application. Just remember you have to design in hysteresis to reduce the oscillation you are seeing at light levels close to the switchover point.

-Bill
User avatar
By phalanx
#194211
Is your Schmitt trigger sitting between your op-amp and the Arduino? If that's the case, you can eliminate the trigger because the comparator can direct drive the Arduino's I/O pin.

-Bill