Author Topic: [SOLVED] Need a simple passive circuit to resist changes in voltage  (Read 3090 times)

0 Members and 1 Guest are viewing this topic.

Offline SlowBro

  • Regular Contributor
  • *
  • Posts: 133
  • Country: us
I'm building a power control circuit for a Raspberry Pi that uses a CD4043 latch, and I think I should be resisting static/noise on the inputs (especially the reset input) to prevent accidental power-offs, but I also need to be able to send it deliberate power-off commands. I can't work out how to create a simple circuit using caps/inductors/chokes/resistors/transistors. Please assist.

The concern came because while the circuit does function it's intermittent. I may just have a bad solder joint but I realized that even if that's the case I should filter out noise.

Requirements:
* Momentary button to turn on the Pi
* Noise cannot accidentally turn on or off the Pi; need at least 100ms of press time to activate the latch set input
* Must be able to power the Pi on either battery or 5V USB wall power, which would not be grounded

I'm testing various configurations in Falstad. If I use a choke on the input, applying the switch gives an immediate 5V to the latch. If I put a cap and resistor to ground it still gives an immediate 5V. So I'm lost. Maybe I need some kind of FET/cap/resistor combo? Please assist.
« Last Edit: April 24, 2017, 09:04:23 pm by SlowBro »
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 13171
  • Country: gb
  • 0999
Re: Need a simple passive circuit to resist changes in voltage
« Reply #1 on: April 24, 2017, 06:35:45 pm »
Before you go any further.

Check that all the inputs to the CD4043 are either set to high or low and will never float. Ensure you've used sufficient supply decoupling. The capacitors should be as close to the supply pins of the CD4043 as possible.

Please post a schematic.
 
The following users thanked this post: SlowBro

Offline SlowBro

  • Regular Contributor
  • *
  • Posts: 133
  • Country: us
Re: Need a simple passive circuit to resist changes in voltage
« Reply #2 on: April 24, 2017, 06:50:47 pm »
At the moment I have no caps across the supply pins but even if that's the cause I believe I should be filtering out noise. Don't want spurious dropouts due to noise on the reset line.

Schematic I'll have to draw up tomorrow; Would a KiCad be sufficient or do you need a Falstad simulation?
 

Offline SlowBro

  • Regular Contributor
  • *
  • Posts: 133
  • Country: us
Re: Need a simple passive circuit to resist changes in voltage
« Reply #3 on: April 24, 2017, 06:52:49 pm »
Oh and yes, all inputs and outputs are pulled low with 1M resistors.
 

Offline SlowBro

  • Regular Contributor
  • *
  • Posts: 133
  • Country: us
Re: Need a simple passive circuit to resist changes in voltage
« Reply #4 on: April 24, 2017, 08:51:01 pm »
And Bingo was his name-oh. Resistor inline, capacitor to ground, resistor to ground, requires the button to be held for 100ms. The FET and resistor on the right represent the latch.
« Last Edit: April 24, 2017, 08:58:52 pm by SlowBro »
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 13171
  • Country: gb
  • 0999
Re: Need a simple passive circuit to resist changes in voltage
« Reply #5 on: April 24, 2017, 10:09:00 pm »
And Bingo was his name-oh. Resistor inline, capacitor to ground, resistor to ground, requires the button to be held for 100ms. The FET and resistor on the right represent the latch.
Bad idea. The input of the CD4043 now only ever reaches 2.5V, which is below the minimum of 3.5V for a guaranteed high. The slowly changing slow could also create problems but I haven't read the datasheet in great detail so can't tell for sure.
https://www.intersil.com/content/dam/Intersil/documents/cd40/cd4043bms-44bms.pdf
 
The following users thanked this post: SlowBro

Offline SlowBro

  • Regular Contributor
  • *
  • Posts: 133
  • Country: us
Re: Need a simple passive circuit to resist changes in voltage
« Reply #6 on: April 24, 2017, 10:28:29 pm »
Good catch. Tweaked based on your input so that it takes about 160ms to reach 3.7V. I can tweak the values if I need more or less time.

The slowly changing slow could also create problems but I haven't read the datasheet in great detail so can't tell for sure.

Uhh.. the slowly charging slow? By the way this is the latch I'm using.
http://www.ti.com/lit/ds/symlink/cd4043b.pdf

If there are issues with ramping up the input I can insert a comparator.
 

Offline SlowBro

  • Regular Contributor
  • *
  • Posts: 133
  • Country: us
Re: [SOLVED] Need a simple passive circuit to resist changes in voltage
« Reply #7 on: April 26, 2017, 02:05:30 am »
What size cap across the latch supply pins?
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 13171
  • Country: gb
  • 0999
Re: Need a simple passive circuit to resist changes in voltage
« Reply #8 on: April 26, 2017, 07:42:44 am »


Good catch. Tweaked based on your input so that it takes about 160ms to reach 3.7V. I can tweak the values if I need more or less time.

The slowly changing slow could also create problems but I haven't read the datasheet in great detail so can't tell for sure.

Uhh.. the slowly charging slow? By the way this is the latch I'm using.
http://www.ti.com/lit/ds/symlink/cd4043b.pdf

If there are issues with ramping up the input I can insert a comparator.
Looking at the data sheet, no maximum rise/fall time for the inputs is specified. Try it with your circuit and see.

What size cap across the latch supply pins?
It's not critical. A supply decoupling capacitor absorbs transient spikes of excess voltage and supplies the circuit during short troughs. 100nF will do but you'll see circuits with values ranging from 10nF to 10µF, often several values connected in parallel. Generally bigger is better but larger capacitors have poorer high frequency characteristics and can cause stability issues with some low drop-out regulators.
 
The following users thanked this post: SlowBro

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Re: [SOLVED] Need a simple passive circuit to resist changes in voltage
« Reply #9 on: April 26, 2017, 10:26:55 am »
Some thoughts -

1) In general any input to CMOS logic, unless its a Schmidt trigger input or a sampled
comparator input should not be a slow risetime input as that can cause meta-stable
behavior in the internal logic and/or oscillate due to external parasitic feedback due to
C coupling or power supply transients due to high current because there are paths from
Vdd to Vss thru N and P CMOS devices simultaneously on.


http://preserve.lehigh.edu/cgi/viewcontent.cgi?article=1082&context=etd


2) You are using 1 M ohm R's to set CMOS pin logic levels. Leakage when hot, depending
on part and vendor, can cause offsets and false logic levels. Also noise marging is diminished.
As well a 1 M ohm node is hiz Z very susceptible to parasitic C coupling, use a lower value
calculate dof leakage and allowable logic level limits.


Using a LPF followed by a comparator with hysteresis excellent solution.



Regards, Dana.
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer
 
The following users thanked this post: SlowBro

Offline SlowBro

  • Regular Contributor
  • *
  • Posts: 133
  • Country: us
Re: [SOLVED] Need a simple passive circuit to resist changes in voltage
« Reply #10 on: April 26, 2017, 06:03:35 pm »
Dana I'm struggling to understand what you're saying (still somewhat of a n00b) but I think the solution you're calling for is this, am I right? I added the comparator inline and now I get a nice sharp square on signal. Well it's an op-amp; Falstad has a comparator but I can't get it to work. In real life I'll use a purpose-built comparator.

I am using high ohm resistors when possible because battery life is a concern. Don't want pull-downs draining me. Since it's DC currents I should not be terribly concerned with impedance or coupling. (Right?)
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 13171
  • Country: gb
  • 0999
Re: [SOLVED] Need a simple passive circuit to resist changes in voltage
« Reply #11 on: April 26, 2017, 06:11:04 pm »
Dana I'm struggling to understand what you're saying (still somewhat of a n00b) but I think the solution you're calling for is this, am I right? I added the comparator inline and now I get a nice sharp square on signal. Well it's an op-amp; Falstad has a comparator but I can't get it to work. In real life I'll use a purpose-built comparator.

I am using high ohm resistors when possible because battery life is a concern. Don't want pull-downs draining me. Since it's DC currents I should not be terribly concerned with impedance or coupling. (Right?)
Yes, that sort of thing will work.

Perhaps you couldn't get it to work because the comparator has an open collector output and therefore requires a pull-up resistor?

Another alternative is the 74HC14 (single/dual gate packages are available in SMT) but it's inverting so the 10M resistor would have to go to 5V and the switch to 0V.

Anyway, it wouldn't surprise me if the whole design can be simplified. If you post the schematic, I might be able to suggest how.
 
The following users thanked this post: SlowBro

Offline SlowBro

  • Regular Contributor
  • *
  • Posts: 133
  • Country: us
Re: [SOLVED] Need a simple passive circuit to resist changes in voltage
« Reply #12 on: April 26, 2017, 07:22:25 pm »
Oh I've not tested this new tweak so I can't say if it doesn't work. [Edit: Oops. You were talking about the Falstad comparator.]

What I have on physical board at the moment is just a switchbutton pulsing into the set input on the latch, which may or may not have some kind of soldering issue. I'd share the larger schematic but it has several unrelated items and would be more confusing. Still want to see it? [Edit again: Sorry, that request must have also had to do with the Falstad. OK will post it soon.]

The 74HC14 looks interesting, as if it is a dedicated purpose-built version of what I'd pieced together with an opamp, and looks to be what Dana was talking about.
« Last Edit: April 26, 2017, 08:52:57 pm by SlowBro »
 

Offline SlowBro

  • Regular Contributor
  • *
  • Posts: 133
  • Country: us
Re: [SOLVED] Need a simple passive circuit to resist changes in voltage
« Reply #13 on: April 26, 2017, 09:20:54 pm »
You are correct about the Falstad comparator. It requires the output be pulled high to operate. Schematic.
« Last Edit: April 26, 2017, 09:23:55 pm by SlowBro »
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 13171
  • Country: gb
  • 0999
Re: [SOLVED] Need a simple passive circuit to resist changes in voltage
« Reply #14 on: April 26, 2017, 10:14:47 pm »
How many latches are you using?

What about just making your own RS flip-flop from Schmitt trigger NAND gates?

The CD4093 & 74HC132 have the Schmitt trigger function built-in. If you build latch with it, then it can respond to slowly changing signals with no need for another IC.
 
The following users thanked this post: SlowBro

Offline rdl

  • Super Contributor
  • ***
  • Posts: 2674
  • Country: us
Re: [SOLVED] Need a simple passive circuit to resist changes in voltage
« Reply #15 on: April 26, 2017, 10:24:26 pm »
I read the thread and don't see why a simple debounced momentary push button won't work.

Quote
Requirements:
* Momentary button to turn on the Pi
* Noise cannot accidentally turn on or off the Pi; need at least 100ms of press time to activate the latch set input
* Must be able to power the Pi on either battery or 5V USB wall power, which would not be grounded

Seems like a Schmitt trigger gate and a small amount of other parts should do it.
I must be not understanding the problem.
 
The following users thanked this post: SlowBro

Offline SlowBro

  • Regular Contributor
  • *
  • Posts: 133
  • Country: us
Re: [SOLVED] Need a simple passive circuit to resist changes in voltage
« Reply #16 on: April 26, 2017, 11:18:11 pm »
Hero999 I'm using the other three latches in the IC for something else so to implement your solution would require two chips anyway. (Two quad NAND packages vs a CD4043 and probably an LP339). It seems like six of one and half a dozen of the other. Your option seems simpler though. I like having options.

rdl not sure how that could work? Wouldn't a Schmitt trigger immediately respond to any very short, high signals? And as the button is released it would then turn back off the Pi. Latch is needed to hold the Pi on. The Pi can later send a GPIO signal to turn itself off. Unless I'm just missing something.

It's also quite possible I'm over-engineering this :popcorn:
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 13171
  • Country: gb
  • 0999
Re: [SOLVED] Need a simple passive circuit to resist changes in voltage
« Reply #17 on: April 27, 2017, 07:56:47 am »
Why can't it all be done with the Pi?

Failing that. How about using another, very simple, MCU?
 

Offline SlowBro

  • Regular Contributor
  • *
  • Posts: 133
  • Country: us
Re: [SOLVED] Need a simple passive circuit to resist changes in voltage
« Reply #18 on: April 27, 2017, 11:20:44 am »
Long story as short as I can, Pi uses ~50mA when "off" and my power budget is less than a mA, with less than 100uA being ideal. There is no sleep mode on any of the cheap Linux boards. I'm on disposable battery power.

An MCU -- I started down that path when I said hey I can just use a latch. Should be simpler. I think I'd still want to filter noise from the power button (yes? No?), which is the point of this thread. So comparators or Shmitts and an RC circuit on the inputs. [Edit: or in software... hmm... out of curiosity I'm trying it now.]

I may revisit an MCU but this is almost fully complete. That can be plan B. I'm trying to build a product to bring to market so in somewhat of a hurry as well.
« Last Edit: April 27, 2017, 12:48:04 pm by SlowBro »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf