Author Topic: PWM pulse as reset signal to prevent an accidental reset  (Read 1542 times)

0 Members and 1 Guest are viewing this topic.

Offline littlebootTopic starter

  • Regular Contributor
  • *
  • Posts: 54
  • Country: us
PWM pulse as reset signal to prevent an accidental reset
« on: March 12, 2018, 01:08:51 pm »
Hello,

I need to build a reset circuit that only triggers when a PWM signal is present at the input for an x amount of time.

I was thinking about using a high pass filter (Fc = 1Khz) to pass a pwm signal (1ms on 1ms off = 500hz) that charges a capacitor followed by a schmitt trigger that will pull the reset low when the capacitor is charged to the trigger voltage.

But I'm unable to create this circuit in LTspice.
I tried the following:
#Only the highpass filter that charges a cap. Not he expected results, I don't see the voltage rising over the capacitor??? Can someone explain what I’m missing?
#tried to get the Schmitt trigger to work, using a sinus as input and checking if the output changes when it reaches the voltage I put on the other pin of the Schmitt trigger pin. This also does not work ?
I can't find any information about the Schmitt trigger part from the ltspice library so I don't know for sure how to connect it (can someone point me to de documentation, I can't find it anywhere)
I attached my ltspice simulation, please help me fix it.
Or maybe there is a better way of doing what I'm trying to accomplice, if you know a better solution please tell me. (maybe a dedicated cheap IC)

Best regards Littleboot
 

Offline MatthewEveritt

  • Supporter
  • ****
  • Posts: 136
  • Country: gb
Re: PWM pulse as reset signal to prevent an accidental reset
« Reply #1 on: March 12, 2018, 01:58:41 pm »
The low pass filter removes the DC component of the input, so to build up a voltage you need to rectify it. A simple diode will do just fine.

It looks like you were trying to use the com port on the schmitt trigger to set the threshold, this isn't what it's for. It's a ground reference, so should be connected to the same ground as the final transistor. To set the threshold you need to bias the input.

Please see the attached simulation - I think it's doing what you want now.
 
The following users thanked this post: littleboot

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13137
Re: PWM pulse as reset signal to prevent an accidental reset
« Reply #2 on: March 12, 2018, 02:33:38 pm »
As Matthew just pointed out, LTspice digital symbols don't work that way.  The bottom corner pin on the input side of all the logic symbols is Common, and is usually Gnd by default.  However the default threshold is 0.5V as the digital symbols default to using a 1V high level unless you override it, which isn't at all representative of 3.3V CMOS logic, so you need to set the Schmitt trigger threshold, hysteresis and output logic levels by adding instance parameters to the gate. 

If you want to bias it manually, use a comparator IC with positive feedback to set the hysteresis.  If you use an open collector one, you could eliminate the transistor.

Also your filter circuit wont give a clean output pulse from your pulsetrain envelope, and Matthew's variation only gives 0.85V swing, with a low level of 1V, a peak high of 1.85V and a ripple trough of 1.65V.  I don't like  your chances of getting that to work reliably with any logic family that has a Schmitt trigger threshold of approximately Vcc/2.

IMHO You'll need a charge pump, and as the drive only has a 3.3V swing it will need to be a two stage one to compensate for its diode Vf losses if you want it to provide a rail to rail signal to the Schmitt trigger or comparator.  See attached

 
The following users thanked this post: littleboot

Offline littlebootTopic starter

  • Regular Contributor
  • *
  • Posts: 54
  • Country: us
Re: PWM pulse as reset signal to prevent an accidental reset
« Reply #3 on: March 12, 2018, 03:44:24 pm »
Hello Thank you so much for your answer, the simulation you provided does exactly what I need.
But I'm still wondering: Were did you find wich parameters you can use with this part: "Vt=1.65, Vh=0.2 Vhigh=3.3" or any other part in LTspice?
I'm really unable to find were you got this information from, and I feel stupid for having to ask you this...

I don't want to be rude but there is one thing I don't like about your solution, it uses alot of components :/
If anybody else knows a solution that uses less components please reply,
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13137
Re: PWM pulse as reset signal to prevent an accidental reset
« Reply #4 on: March 12, 2018, 04:24:48 pm »
The SCHMITT symbol instance parameters are documented in the 'A. Special Functions' section of the LTspice help file.  As I have no idea what logic family you are using, I guessed at a hysterisis of 0.4V between input thresholds so set Vh=0.2 which is a bit more than the minimum hysteresis for a 74HC Schmitt input  @3.3V Vcc.

Change A1's 'Value' line to:
Code: [Select]
Vt=1.65, Vh={hyst/2} Vhigh=3.3and add a:
Code: [Select]
.step param hyst list 0.3 0.82 1.2if you want to step the hysteresis through the minimum, typical and maximum for a typical 74HC part, or modify the list for whatever logic you are using.   You may also want to parametrise Vt and add another .step command for it.

It does have a lot of parts, but hey can all be cheap 'jellybean' ones.  Substitute a comparator with an open drain or open collector output, and you could cut it down to one chip, two diodes, two capacitors and six resistors to implement a  single stage charge pump and precision Schmitt with its threshold and hysteresis set by the resistors.
« Last Edit: March 13, 2018, 09:38:07 am by Ian.M »
 
The following users thanked this post: littleboot

Offline littlebootTopic starter

  • Regular Contributor
  • *
  • Posts: 54
  • Country: us
Re: PWM pulse as reset signal to prevent an accidental reset
« Reply #5 on: March 13, 2018, 07:42:23 am »
Thank you very much for your clear explanation, I will have a go at it today and report back :-+
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13137
Re: PWM pulse as reset signal to prevent an accidental reset
« Reply #6 on: March 13, 2018, 09:58:20 am »
I forgot the diodes in the minimal comparator version.  However I've saved a resistor - its now down to five.  See attached sim.


If you can stand a programmable part, use a PIC10F200, and write code to detect N cycles of the desired PWM frequency +/- 20% and fake the open drain by setting the PORT bit low and controlling the TRIS bit.   MicrochipDirect's programming service is very affordable - the result is a SOT23-6  dedicated reset controller for under $0.40 with no added components needed if you use the internal weak pullup for the open  drain output.
 
The following users thanked this post: littleboot

Offline littlebootTopic starter

  • Regular Contributor
  • *
  • Posts: 54
  • Country: us
Re: PWM pulse as reset signal to prevent an accidental reset
« Reply #7 on: March 13, 2018, 12:38:50 pm »
Hi, thank you for all your help.
I'm pleased to report that I came up with an almost identical circuit before I read your latest post (really  :scared: ) See attached simulation.

I also build the circuit in real life and it works perfectly, so it will be included in my schematic.
Also thanks for the tip about the preprogrammed PIC, that is really cheap and will probably come in handy for future projects.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13137
Re: PWM pulse as reset signal to prevent an accidental reset
« Reply #8 on: March 13, 2018, 05:12:29 pm »
So you are going with the simple single stage charge pump into a Schmitt input logic gate.   The only caution there is the gate's hysteresis - if it isn't a lot greater than the ripple on C2, you will get one or more runt pulses at the leading edge of the reset pulse.  The trailing edge will be clean even if there is only a little hysteresis because without the PWM running there is no ripple, only Vcc rail noise, and a clean trailing edge may be sufficient.

The only fly in the ointment for a PIC as a custom chip solution is that you need to develop the required firmware and upload it to MicrochipDirect before they can ship you preprogrammed parts, and each time you upload a new firmware version, there's a $30 setup fee.  Therefore its unsuitable for very small volume production. Goto MicrochipDirect, open their programming service cost estimator and run the numbers to be certain but IMHO the break-even point vs doing the programming in-house for most projrcts is likely to be somewhere between 100 and a full reel.

Obviously, that also means you have to have 100% confidence you've got the firmware fully debugged, as if you are taking advantage of factory pre-programmed PICs to simplify your boards by leaving out ICSP connections, reprogramming existing stock you have already purchased will be $EXPEN$IVE$.

If I was prototyping such a custom reset controller, or even going for small volume, I wouldn't actually use a PIC10F200 unless I wanted a challenge as there's no point trying to save a fraction of a dollar on hardware per item on under about 10K units if it will seriously increase development costs, so using a more capable PIC is more cost effective. I'd probably start with a PIC12F683 or one of the newer PIC12F1xxx parts, so I could use a CCP module to timestamp the input edges for ease of determining the frequency. 

Also, unfortunately, MicrochipDirect don't support community firmware projects, which is unfortunate as it means you cant create an open-source firmware and set it up so others can order chips preprogrammed with it direct from MicrochipDirect.
« Last Edit: March 13, 2018, 05:28:16 pm by Ian.M »
 
The following users thanked this post: littleboot


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf