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.

[SOLVED] How to reduce op amp clamp Vout to 0V?

Status
Not open for further replies.
Hi,

Best mention, I might change C5 from 47uF to 220uF for longer fully-on duration until it falls below Vclamp (~510mV) and eventually drains to nothing, so in analog would to try to add fast charge and fast discharge buttons with slow charge and slow discharge buttons by switching in and out two different source/sink resistors,...

Italicized text: I realized that's a stupid/redundant idea. Fast charge and fast discharge would be better implemented as a fully-on/fully-off option via e.g. a single pushbutton latch.
 

For future reference. I will show you two cases of solutions, one more capable (below) but more complex than
the other.

This design takes some minimal coding, I suspect 50 lines max. It is a single chip design, excepting the MOSFET,
LED, and R's are off chip. Most of chip resources were not used, see right hand window resources used/left.

Board would be $ 10, the IDE (PSOC Creator) and Compiler free.



Click on pic to see the description notes of how it works.

1601558681138.png



I am curious if my modulation scheme would produce a "clean" artifact free looking brightness control so
I am going to test it out in a day or two for my own satisfaction.

You can set the decay delay and period easily using code on timer for the delay and decay ramp.


Next I will show you a very simple approach using Atmel/Arduino visual coding, I use it when I need
a quick "jig" for test purposes or simple control.
 
  • Like
Reactions: d123

    d123

    Points: 2
    Helpful Answer Positive Rating
Hi Dana,

Thanks for taking the time to put together a better version. I'll have a proper/detailed look at your solutions tomorrow because I'm running out of phone battery, unfortunately. Thanks, look forward to it.
 

Here is the simpler solution using mBlock (free) to program an Arduino Nano board.

Board costs ~ $ 3 - $5, you need it + pin headers + USB cable.

1601572714115.png



1601572742917.png


This approach you program by dragging blocks out of program window (2'ond window from left above) into third window
and configure them. Like in set pin function block set its pin number. Once you are done mBlock generates Arduino code,
basically C code, for you and programs part. That code is show on right. It uses Arduino programmer, so you have to install
Arduino IDE as well. Thats freeware.

So the above code basically looks for either a up or down button, and correspondingly sets a PWM duty cycle to control
brightness. If no button activity, after a time you set, then LED is ramped down over a time you set for that task. I have not
checked code in actual application but looks ~ right to me. I set delay no activity at 1 minute and ramp down time to 6 min,
thats all programmable.

Unlike prior design example this approach "hides" processor hardware from you and has you code at a high level. You
sacrifice in depth control but correspondingly its faster way of getting simple projects done. Debugging is done by sending
messages to a terminal session you start. Its a crude way, Unlike PSOC solution where you set breakpoint on lines of code
and can examine memory etc...

Note you can buy board with headers installed or not. If you can do fine soldering the latter is cheaper board. But a bit of
a hassle.

Also this approach does not have a current source feeding LEDs, so if LED supply varies a lot the brightness of course will
change with supply V variation You can use A/D on part to create a control loop to monitor current. But if LED supply is fairly
stable not needed.

If you are only at 25 mA in LED current you do not need external MOSFET as used in prior design.


Regards, Dana.
--- Updated ---

One last item, if you can use the Nano board and turn it into a
programmer for ATTINY chips, like the ATTINY85 parts. The 8
pin dip shown here. It also will run the mBlock code.

1601577976350.png


Regards, Dana.
--- Updated ---

Note, both designs have much more accurate timing than solutions using
bulk caps to create timing. T and V affect their timing greatly, like the 555 timer
as an example. The Nano has a xtal on it, so its timing is << 1% error, the PSOC,
not using a xtal, is +/- 2% if I recall correctly. The ATTINY85 is on the same order.


Regards, Dana.
 
Last edited:
  • Like
Reactions: d123

    d123

    Points: 2
    Helpful Answer Positive Rating
Hi Dana,

Many thanks for showing less-parts, lower Iq (I would assume, much lower), more accurate solutions.

The PSOC one looks so small, really neat solution - the devil is in the detail as it needs the code written...

The Arduino Nano/MBlock one is easier to parse - the code looks a tiny bit like the Python 'set GPIO', 'if/while/etc.' code I saw (copy/pasted from different websites); the drag'n'drop feature is nice - I gave up trying to get a stepper motor to work with copy/pasted Python code for a Pi-style device as I couldn't get the code to work, it was far quicker (and far too large a circuit to bother putting on a PCB) with digital/logic ICs and LM293s. Turning an LED on and off is easy, beyond that, the code seems very hard to get right, tutorials are hit-and-miss, and so going fully-digital can be offputting to a beginner, so the MBlock software seems a great starting point, thanks.

Hope the PSOC modulation brightness test goes well if you do it.

Very nice solutions, thank you.
 

The mod scheme seems fine. I have to confirm the ramp and
shutoff. LEDs nowadays can glow with just uA of current. I used
a bipolar versus mosfet in current sink. I think a MOSFET would
be better on shutoff than a bipolar. The PWM output pin is configed
as open drain, so it either grounds the transistor base or allows the
current loop to set the 25 mA max current. When that output grounds
it does not go all the way to ground, and a bipolar will still produce some
collector current. Solution might be to parallel a couple of pins to get the
grounding/shutoff of bipolar as close to 0V as possible.

Anyways seems to work.



Regards, Dana.
 
  • Like
Reactions: d123

    d123

    Points: 2
    Helpful Answer Positive Rating
Hi Dana,

Nice to know it's operational, thanks for full description. I seem to recollect that the first breadboard 'have-a-quick-look' attempt had an NPN 2N2222A (TO-18) and I swapped it for an NMOS ZVN4206A (TO-92) for the reason you described - nice to know the cause as I was unsure of what was going on on my board.

Just so I can feel sick with envy ;), can you find out what stand-by Iq the version you are doing has, if not inconvenient to you?

Thanks.
 

If the LED is off, we could put processor to sleep, and wake it on
a key press. Hibernate current spec, at 85 C, is 15 uA. 2 uA at
room temp.

There is an excellent ap note on this topic




Regards, Dana.
--- Updated ---

Hi Dana,

Nice to know it's operational, thanks for full description. I seem to recollect that the first breadboard 'have-a-quick-look' attempt had an NPN 2N2222A (TO-18) and I swapped it for an NMOS ZVN4206A (TO-92) for the reason you described - nice to know the cause as I was unsure of what was going on on my board.

Just so I can feel sick with envy ;), can you find out what stand-by Iq the version you are doing has, if not inconvenient to you?

Thanks.

Did some further checking, all is fine using a bipolar npn vs MOSFET.

Regards, Dana.
 
Last edited:
  • Like
Reactions: d123

    d123

    Points: 2
    Helpful Answer Positive Rating
Hi,

Sorry to keep asking questions about this circuit, I would like to complete it now that I have started. I now see how much that the C5 capacitor is the weak(est) point of the circuit - it will always 'ghost' charge up bit by bit and the LEDs will sooner or later glow unless a mechanical switch is used between the battery and the circuit.

...Unless..., I want to try to add a very large value resistor at the C5 junction to attempt to drain as much current as goes into the capacitor to maintain a balance/level of ~5 to ~10mV there. NPN slow sink drains C5 node to 5mV, NPN fast off drains C5 node to 10mV. Never done that before, what would be a rule-of-thumb resistor value to drain leakage current and not interfere with normal circuit operation - 10M, 100M, 1G?

I added a fast ON and a fast OFF button by adding a parallel current source and sink. It works, needs fine tuning once/if I can prevent C5 'ghost' charging.

I changed R21 from 1k to 22k - temporarily, I hope - to time how long it took the capacitor to charge enough for the LEDs to float back on.

With 100uF as C5, feedback voltage of 220mV, after just over 3hours 30minutes of connecting the battery (and not pressing any buttons), C5 node had risen from 5mV to 80mV. As a linear estimate, it would only take ~9 hours 45 minutes until the LEDs dimly glow again. Very bad circuit, besides high Iq...

_____________________________________________________________________

In the schematic, after the 3h30mins had elapsed, node A measured 80mV, as stated above. Node B measured 15mV and node C measured 10mV - Where is that voltage at the PNPs and diode junctions coming from/developing from, please? Do I need to refer to the respective collector cut-off current fields from the BJT datasheets, if so how would I use that to get the 10mV and 15mV?

Precision Clamp for torch v6c schematic ABC notes.JPG


The breadboard (discrepancies between schematic and breadboard: two 2N2907As instead of one NSS40300 dual package as I don't have a second NSS40300 on an adapter board, two 10mm white LEDs and one 5mm white LED instead of three 10mm white LEDs as third 10mm LED has pins too short to fit into the breadboard):

Precision Clamp for torch v6c breadboard.JPG



As an aside, I see that the DMM I'm using, when connected to the C5 node, drains the capacitor voltage faster than should actually take place. I suppose placing a buffer OA between C5 and the DMM positive probe will stop that from happening?
Thanks.
--- Updated ---

Hi again,

I've tried to calculate the drain resistor I think would work to keep the capacitor from ghost charging with the - I think - 25mV coming from the PNP current sources via the diodes D1 and D2 inot the C5 node. Please don't - or do - laugh too much if my method is all wrong to begin with :) ...
I suspect my application of the formula for iC - which appears to be identical to the one for calculating inrush current for capacitative loads - may be a 'wonky' use of it here, but still, drowning men clutch at straws, and so on.

· Node B and node C: 10mV + 15mV = 25mV leakage voltage into capacitor C5.
· 80mV - 5mV = 75mV
· 3 hours 32 minutes 38 seconds = 12,758 seconds
· 0.075 volts/12,758 seconds = 0.000005878664 volts/second

iC = Capacitance * (DVc/dt)
= 0.000100F * (0.000005878664 volts/1 second)
= 0.0000000005878664 amps

Drain resistor needed = 0.025 volts/0.0000000005878664 amps
= 42,526,669 Ohms


Does that look possible/probable: that to drain as much current out of the capacitor C5 as goes in (when no buttons are pressed to charge it deliberately via either current source) and that wouldn't interfere with normal circuit operation, a 42.5 Megaohm resistor would be the minimum required from the C5 node to ground?

Thanks.
 
Last edited:

Hi,

Instead of the complicated input circuit.....did you think about using an Opamp integrator circuit?

Klaus
 
  • Like
Reactions: d123

    d123

    Points: 2
    Helpful Answer Positive Rating
Hi Klaus,

Hi,

Instead of the complicated input circuit.....did you think about using an Opamp integrator circuit?

Klaus

Actually, no, I hadn't and that's a good idea. I assume it draws less power and is far less messy than sources and sinks and a capacitor. Not sure how it would look, in truth, but haven't had time to try to think how to fit it in to circuit.

Misgivings about integrator circuits:
Would it require an inverting amplifier + integrator for positive input = positive output?
Would it need a reset (MOSFET around integrator capacitor)?
Wouldn't it need limiting if PB ON pressed for too long?
Aside - could it still have on, off, and adjustable on and off options?

The drain resistor idea didn't work, so after another three ideas/attempts, latest version seems to work properly, at the expense of an additional 320uA - Iq now 500uA... Good for a 1970's device, maybe...
Vout at first buffer after C5, when LEDs are fully off, stayed at 30.9mV for 30 minutes, and appears to fall when temperature rises. Further, longer testing and observation will no doubt prove to me it doesn't stay off/doesn't drain leakage charge into C5 over long periods of time when on stand-by.
Tiny, tiny flash when connecting battery has returned, so will just accept it as it is barely perceptible.
Stubborn idiot I am when a mechanical on/off switch would be the easiest, and lowest power, solution...

_20201004_221554.JPG


Thanks for suggesting integrator.
 

Hi,

(...If I habitually edit my posts during this period where I can see I currently have and in the near future will have lots of different questions/doubts and appreciate the input of other members who know what they are doing, I will deliberately lose more points than I gain for frequent posting/any threads I create or posts I write, and in this way: a) not gain an - IMHO - undeserved reputation ranking or b) look like I'm trying to game the system, etc. Seems like a good approach to me.)

Going back to the integrator idea. The word 'misgivings' applied more to my ability to correctly implement one beyond clumsy trial and error* than the idea of replacing source/sinks with an integrator (that's a super idea), not only that e.g. fast on and slow off options might be very hard to implement with an integrator. And one more is that it would need a negative supply, I guess.
* e.g. I understand it's easy for integrators to saturate.

I envision what you meant with e.g. a combination of these two circuits, maybe? p433: A.4.8 Integrator with Electronic Reset and p435 A.4.10 Noninverting Integrator.

Noninverting Integrator and Electronic Reset Integrator schematics from Op Amps For Everyone.jpg


I just love 'Op Amps for Everyone', shame my copy is not digitized in a way that makes it easy to navigate, and I think there's a chapter missing. I've read the whole thing from beginning to end, and re-read several parts more than once - shame I still don't understand or retain most of the information therein by the looks of my bungling approach to circuit design... I've attached it as it's old but a 'must read' for those interested. Stuff about integrators is pages 429 to page 436 in my version.
 

Attachments

  • op_amps_everyone.pdf
    2 MB · Views: 132
Last edited:

Hi,

not only that e.g. fast on and slow off options might be very hard to implement with an integrator.
Why do you think it´s difficult?
A pushbutton and a high ohmic resistor for slow (ON or OFF)
A pushbutton and a low ohmic resistor for fast (ON or OFF)
It can´t be more simple.

Klaus
--- Updated ---

You don´t need the RESET option in the given circuit.
instead of V_IN and the R next to it:
* place a pushbutton (to GND) in series with a high value resistor for "slow ON"
* place a pushbutton (to VCC) in series with a low value resistor for "fast OFF"

Klaus
 
Last edited:
  • Like
Reactions: d123

    d123

    Points: 2
    Helpful Answer Positive Rating
Just for the heck of it I did a basic design, attached some comments on a video.


If you want to look at the project I can post it, you extract it to a location on your drive, open
its folder, double click file ending in ".cywrk" and the ide will open so you can peruse the project.

Note you have to install PSOC Creator IDE before you do the open above.


Left hand window, double click the topdesign.cysch file, that will show you HW used. Right
hand window will show HW used/left for chip overall. Double click the main.c file and you
can look at the code. Thats also in left hand window, the project explorer window. Click
on some of the other Design Wide resources in that window to see rest of part config
wizards and tools.

So all you would use is is the small board and external NPN of NMOSFET, some R's, buttons
(or use chip capsense capability that does buttons, sliders, ....with GPIO pins).

Regards, Dana.
 
Last edited:
So $10 board looks like -

1602242484681.png


Actual size much smaller.

This design gives you -

1) One board + external NPN or MOSFET plus a couple R's
2) Two buttons, up, down, external or use onchip capsense and pads on a PCB
3) Accurate current into LED, insensitive from one led to another
4) Basically high PSRR of led drive V to its current change, eg. no appreciable affect
of power supply V change to led current
5) Accurate timing, the delay period and ramp up/dwn times
6) Glitch free power up
7) Sleep mode for low power (my example does not implement that, got lazy)
8) Only used ~ 10% of boards resources, much left to do other stuff/enhancements.
9) Resolution step size of brightness change is 12 bits

You had added two button up, two down, to get fast/slow change in LED brightness.
Additional code could accomplish this with just one button up one down by sensing
length of time pushed and accelerating the ramp up/dwn rates. I did not code that
into example. Not difficult problem.

One last note, when you finish design you sanp off programmer/debug part of board.
Now you have a programmer board for other cypress parts, or you use it in a design.
But that small board part has very little I/O as you can see. And you can't debug in
the normal sense as that board has to use a bootloader design, so debug firmware
eliminated. But you can debug the old way, eg. send debug info out via UART.


Regards, Dana.
 
Last edited:
  • Like
Reactions: d123

    d123

    Points: 2
    Helpful Answer Positive Rating
Hi Dana,

Thanks, that is great of you. A turnkey solution for a person with no idea of MCUs, that's great. Yes, I would like to delve into that, to get a notion of how to do that in code. Proviso is that I have to borrow electricity right now every day or two and don't want to annoy the people who let me do necessary and some computer stuff at their place, and I would like to complete what I have in hand first, please. (Feeling overwhelmed with stressful situation of no electricity at new home and limited resources personally, so please understand - not ungrateful, just very hard to do 'normal life' right now...)

I'll go looking at what you've done over the course of the next week, and once again, thank you.
 

May the force be with you.

Regards, Dana.
 
One other thing, eye is logarithmic in response, maybe in coding consider doing this -



Regards, Dana.
 
  • Like
Reactions: d123

    d123

    Points: 2
    Helpful Answer Positive Rating
Hi Dana,

Thanks. Yes, I remembered human perception is not a good measurement tool, to phrase it that way. And, the DMM shows a steady rise and fall when I press the slow charge and discharge buttons but it feels rather different to my eyes. I'll read what you've linked to during/after dinner.
--- Updated ---

I'll add this as an update as it's unrelated to your post.

Get the (pardon my English, but it's the only honest adjective) s**tfest of a shutdown circuit I came up with :LOL: - it actually works unglitchily, unbelievably. It draws >900uA :unsure:, maybe the ~300uA of the LM4041 isn't so bad after all...

Useless for this circuit, but fun to think through and put together, at least. Would be useful if Iq were e.g. 5mA or 10mA.

Haven't drawn complete schematic, just a functional block schematic. Have a good laugh at it, I am.

_20201011_192026.JPG
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top