Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Comparator not giving Vdd Output

Status
Not open for further replies.

hariharan_engineer

Newbie level 4
Joined
Dec 2, 2020
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
82
Hello All!
I am currently working on a Visible Light Communication Project. Following are the components that I am using at the Receiver Side:
  • BPW34, Osram PhotoDiode (Datasheet)
  • MCP602, Single Supply Dual CMOS Op-Amp from Microchip (Datasheet)
  • Passive Components: Resistors (Fixed and Variable), Capacitors
  • Arduino Uno
Requirements: Whatever the waveform/data transmitting, I need to decode the pattern at the receiver side. Good Precision is my priority than detecting at high speeds. I need my design to work up to a few kHz of Square Wave frequencies.

My Transmitter is a 5mm Red LED, connected to a 1kHz, 2.2V Square Wave(0V as reference) and is kept 4ft away from the receiver. I connected the photodiode, first to an Op-Amp, which I configured as a Transimpedance Amplifier(TIA, Current-to-Voltage Converter). Currently, the TIA works like a charm. (I referred to the design document from Texas Instruments) i.e., At 4 feet distance, the photodiode generates about 7.38uA of Photocurrent, which after passing via TIA converts into 2V (as per my calculation). Kindly refer to the circuit below,

1632741808889.png


Now, I am facing the issue with the MCP602 configured as Comparator.

I want my output like this,

PhotoDiode OutputTIA OutputComparator Output
7.38uA2V5V
0A0V0V

But, the comparator outputs square wave (as expected), but it’s only 1V in Amplitude. After revisiting the theory, I found out that one parameter was limiting the output voltage of my comparator, but, being a newbie to circuit designs, I wasn't able to find a solution to my problem. I kindly request someone to help me out to fix this issue.

Note:
  1. I came across MCP6022, which seems like it will solve my comparator issue. But, I was a bit sceptical and wasn't able to justify myself.
  2. 5V supply to this Op-Amp was provided from a 5V pin of Arduino.
  3. I want my TIA + Comparator within a single IC, so that I could develop a shield kind of thing. I got inspired by OpenVLC.
THANKS IN ADVANCE!!!
 

1) Check pin wiring, especially Vss pin of 602.

2) Scope variable gain control for vertical channel clicked to force attenuator
as control over V/div, not a variable setting ?

3) Scope probe connected to scope cal signal shows correct voltage ?


Regards, Dana.
 

Hi,
Your circuit differs much to the circuit in theTI application note:
* TI AN uses dual supply
* TI AN uses capacitors at each supply
* TI AN says "Operate within the linear output voltage swing (see A ol specification) to minimize non-linearity errors."

An Opamp has two supply pins. The Output is somewhere inbetween these supply rails, but the output never will meet these rails (unless externally driven). So the output voltage is always higher than 0V. Now you compare the Opamp output with 0V ... What do you expact to happen?

I recommend to go through some basic OPAMP tutorials (There even are videos)
and I recommend to use ciruit simulation tools like LTspice to play around without damaging devices.

Klaus
 

Your 602, with a 10K ohm load, will reach within ~ 20 mV of its rails.

1632760336928.png


W/O a 10K load it will go to rails within ~ Ileakage x Rdson, the leakage current
the net current of internal leakage of the output drivers and pin leakage.

Your bigger problem is what is offset of OpAmps,

1632760644494.png


So if you decide to stay single supply put a offset into NI pin of comparator
so you can insure it trips. Simple V divider off power supply pin or a Vref would do.
Do a worst case error analysis to insure working over all conditions. Maybe a Vdd / 2
V to set comparator trip would be max noise margin achievable. Of course this is
dependent on detector output.

So if TIA outputs 0 - 2V, set NI trip V to 1V, to get good noise margin.


Regards, Dana.
 
Last edited:

Hi,

'But, the comparator outputs square wave (as expected), but it’s only 1V in Amplitude. After revisiting the theory, I found out that one parameter was limiting the output voltage of my comparator, but, being a newbie to circuit designs, I wasn't able to find a solution to my problem. I kindly request someone to help me out to fix this issue.'

What does that mean in reality? Share the secret parameter, please.

I was curious so did a quick simulation with the Microchip MCP6021 Spice model in Tina, and fwiw - because it's only a simulation that lacks the finer details of your actual circuit - these are the results with GND as a trip threshold and 250mV as a trip threshold:

MCP6021 with and not with gnd as ref simulation.JPG


I wonder why the simulation does not do what your circuit does: 'the comparator outputs square wave (as expected), but it’s only 1V in Amplitude'. I was so curious about the 1V you get that before simulating I read about Arduino gpio as input impedance and it's supposedly in the Megaohm range so draws no current as that was my initial thought - that no current-limiting resistor might draw op amp full current and lower Vout from expected ~4.95 V to 1V, but apparently not. You haven't set your GPIO incorrectly or something, have you? Is the 1V only issue related to the GBW of the MCP602 at 1 kHz perhaps?

I'll add, a curious IC that might or might not be of interest to you, or the concept behind it, regarding your using ground as a trip threshold is the e.g. LM7705, it creates a ~ -250mV offset on the op amp ground pin, avoiding the need for a dual supply, especially helpful with low voltage devices, it might give you ideas that help to avoid a trimpot or similar horrors and what I suspect is an unwanted offset in the trip threshold.
 

Attachments

  • lm7705.pdf
    1.5 MB · Views: 90

Hi,

'But, the comparator outputs square wave (as expected), but it’s only 1V in Amplitude. After revisiting the theory, I found out that one parameter was limiting the output voltage of my comparator, but, being a newbie to circuit designs, I wasn't able to find a solution to my problem. I kindly request someone to help me out to fix this issue.'

What does that mean in reality? Share the secret parameter, please.

I was curious so did a quick simulation with the Microchip MCP6021 Spice model in Tina, and fwiw - because it's only a simulation that lacks the finer details of your actual circuit - these are the results with GND as a trip threshold and 250mV as a trip threshold:

View attachment 172115

I wonder why the simulation does not do what your circuit does: 'the comparator outputs square wave (as expected), but it’s only 1V in Amplitude'. I was so curious about the 1V you get that before simulating I read about Arduino gpio as input impedance and it's supposedly in the Megaohm range so draws no current as that was my initial thought - that no current-limiting resistor might draw op amp full current and lower Vout from expected ~4.95 V to 1V, but apparently not. You haven't set your GPIO incorrectly or something, have you? Is the 1V only issue related to the GBW of the MCP602 at 1 kHz perhaps?

I'll add, a curious IC that might or might not be of interest to you, or the concept behind it, regarding your using ground as a trip threshold is the e.g. LM7705, it creates a ~ -250mV offset on the op amp ground pin, avoiding the need for a dual supply, especially helpful with low voltage devices, it might give you ideas that help to avoid a trimpot or similar horrors and what I suspect is an unwanted offset in the trip threshold.
7705, makes one wonder why thats not in some jelly bean OpAmps/Comparators.....

Regards, Dana.
 
Hi again,

I used the design note you linked to to calculate for 7.38uA in to the TIA at 1kHz and 0 to 2V out and to calculate the minimum GBW needed of the op amp with the photodiode capacitance, etc. so as to simulate the circuit more 'realistically' and I never get 1V out of the 'comparator' - it either resolves to never triggering without a sizeable offset from the input offset voltage (with or without a -0.232V negative supply instead of just 0V on the OA ground pin) or goes from 0V to 4.9V for a 1k load with any minimal voltage divider on the inverting Vref (trip threshold) pin of the 'comparator'. I can see that the TIA output never falls below the ~2mV to ~3mV offset when low, which explains why in simulations it just won't trigger the 'comparator' with ground as a reference. No idea why your 'comparator' output is only 1V, I would have expected the op amp to either swing to the positive rail or to the negative rail, not a place inbetween and not even 2.5V. Even a 250R load only drags 'comparator' Vout down to around 4.6V.

As you don't say what RF and CF are in your circuit, I first used the values my calculations gave me: 271k and 587pF, and as can be seen, the result was not a balanced square wave - the reasons are obvious, so I changed CF by guesswork to get a balanced square wave. As can be seen, using the values from the design note for their circuit of 10kHz etc., (100k and 150pF) makes TIA out < 1V but doesn't affect the OA as comparator output swinging from rail to rail.

Attached is schematic and simulation results.

Can you elaborate more on the component values missing from your first post and schematic and what the hidden 'fixed and variable resistors and capacitors' are, and what the 'comparator' is connected to - if its output is connected to anything or nothing or to an Arduino GPIO configured as an input, please?

MCP602 TIA and comparator complete circuit simulation.JPG
 

Hello All! Thanks a lot for all your suggestions. I will go through one by one. Meanwhile, I have a some doubt on the same MCP602 Op-Amp. I tried Voltage Follower Expt. today, there also I am getting a Square Wave of 1V Amplitude(0V Ref), when the input is a 1kHz, 5V Square Wave. Any thoughts?
 

Hi,

Please:
* Show your exact and complete schematic (hand drawn is O.K.)
* show photos of the circuit and of the wiring

Klaus
 

You using code in uC to measure the waveform ? If so apply a known
DC V to ADC pin and measure that.

Regards, Dana.
 

You using code in uC to measure the waveform ?

Regards, Dana.
No, that plan to use uC to measure waveform will be on future.

For now, I just wanted to,
1. Transmit a Square Wave and Receive the same
2. Transmit a Character and try to decode at the receiver
and so on...
 

Hi,

No photos? No power supply? No capacitors at VCC??
How did you measure the 1V?

Klaus
 

In this early experimental stage, the op amp ought to have bipolar supplies (as is customary). Then your input volt levels are well inside the range of op amp response. Then either input can be greater or lesser than 0V. Output moves in the proper direction regardless which input is higher than the other.

If you must make a single-polarity supply, then consider adding slight positive bias voltage to both inputs in some manner.
 

Hi,

First, ' I tried Voltage Follower Expt. today, there also I am getting a Square Wave of 1V Amplitude(0V Ref), when the input is a 1kHz, 5V Square Wave. Any thoughts?'
- My first thought is what is a 0V Ref in a voltage follower... :unsure:? There are no spare input pins for a voltage reference in a voltage follower configuration. I assume you mean the square wave goes from 0V to 5V.

- My second thought is that it's pointless asking questions about circuits no-one can see or other questions that refer to schematics with components referred to in text but not included in pictures. Or giving results/values that change with each subsequent post. You have changed the input voltage of the square wave to the red led from 2.2V to 5V, I think :). Remember what you can see and assume others will understand, usually they can't - noone on any forum is a clairvoyant.

- My third thought is that 'expect' is not the same as 'see' and 'measure' in-circuit or in a simulation. In your first post you say that the TIA does output 2V, presumably your second schematic means this by the 'Result [expected]'. 'At the TIA output I expect 1 KHz square wave [0V - 2V]' - that wording leaves me unsure that you do get a 2V square wave at the output of the TIA when the 43uA is present at the input or you don't get it but want to.

- My fourth thought is that - based on the simulation I just did now, and the others from earlier today - if you want a 2V square wave out of that TIA and not a slow rising and falling, curvy RC shark's fin wave that may not even reach 2V at it's peak, I'd reduce the 3nF by an order of magnitude to 330pF.

- My fifth thought is, that from the simulations I did today, you should be able to increase the gain of the TIA to reach the presumably >3V or higher the Arduino input needs to see to sense an input high and improve the square wave rise and fall times if necessary (playing with the capacitor value), ditch the comparator idea completely and use the second op amp as a voltage follower/buffer instead, and you might not even need that second OA if you can shape a decent square wave out of the TIA. Don't Arduinos and so on have Schmitt Trigger inputs anyway?
 

No on Arduino Schmidt....
Hi,

First, ' I tried Voltage Follower Expt. today, there also I am getting a Square Wave of 1V Amplitude(0V Ref), when the input is a 1kHz, 5V Square Wave. Any thoughts?'
- My first thought is what is a 0V Ref in a voltage follower... :unsure:? There are no spare input pins for a voltage reference in a voltage follower configuration. I assume you mean the square wave goes from 0V to 5V.

- My second thought is that it's pointless asking questions about circuits no-one can see or other questions that refer to schematics with components referred to in text but not included in pictures. Or giving results/values that change with each subsequent post. You have changed the input voltage of the square wave to the red led from 2.2V to 5V, I think :). Remember what you can see and assume others will understand, usually they can't - noone on any forum is a clairvoyant.

- My third thought is that 'expect' is not the same as 'see' and 'measure' in-circuit or in a simulation. In your first post you say that the TIA does output 2V, presumably your second schematic means this by the 'Result [expected]'. 'At the TIA output I expect 1 KHz square wave [0V - 2V]' - that wording leaves me unsure that you do get a 2V square wave at the output of the TIA when the 43uA is present at the input or you don't get it but want to.

- My fourth thought is that - based on the simulation I just did now, and the others from earlier today - if you want a 2V square wave out of that TIA and not a slow rising and falling, curvy RC shark's fin wave that may not even reach 2V at it's peak, I'd reduce the 3nF by an order of magnitude to 330pF.

- My fifth thought is, that from the simulations I did today, you should be able to increase the gain of the TIA to reach the presumably >3V or higher the Arduino input needs to see to sense an input high and improve the square wave rise and fall times if necessary (playing with the capacitor value), ditch the comparator idea completely and use the second op amp as a voltage follower/buffer instead, and you might not even need that second OA if you can shape a decent square wave out of the TIA. Don't Arduinos and so on have Schmitt Trigger inputs anyway?

Did not realize there was Schmitt buffers on the GPIO pin input path, thanks for posting that faq -

1632857985478.png


Regards, Dana.
 

Hi,

"Arduino" uses several microcontrollers from several manufacturers. I assume some have schmitt trigger, some don't .
Thus I think one can not generally say "Arduino have schmitt triggers"

Better is to refer to the microcontroller datasheets.
* Atmel/Micrichip ATmega (various types)
* Espressiv ESPs
* STM32...
* MSP430
* several ARM core types
...and so on

Klaus
 

You should know that for negative feedback, both +/- inputs must be at the same level (virtual null) for linear mode during transition and beyond that it should reach the rail-rail output, if capable. Then your voltage gain becomes zero. (saturated)

Understand why @d123 choose a Vref of 5% full scale rather than 0V or ask if not understood.
 

Hi,

"Arduino" uses several microcontrollers from several manufacturers. I assume some have schmitt trigger, some don't .
Thus I think one can not generally say "Arduino have schmitt triggers"

Better is to refer to the microcontroller datasheets.
* Atmel/Micrichip ATmega (various types)
* Espressiv ESPs
* STM32...
* MSP430
* several ARM core types
...and so on

Klaus
UNO and Nano board (later version), do. Atmega328 (Nano V 3.0 and beyond).

The DUE with ATSAM3X8E ARM does.

The Mega 2560 does.

Addition, earlier Nano also, and others with ATmega48/V/88/V/168/V


Regards, Dana.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top