analog to digital with opamp and NAND inverter; LTspice ultraslow

Discussion in 'Digital Circuit Design' started by patpin, Aug 12, 2017.

  1. patpin

    Thread Starter Member

    Sep 15, 2012
    240
    18
    Hello, I am trying to sim a conversion of a analog signal as in .ASC included and LTSPICE gets ultraslow from about 25% on. Extrapolating the speed Ltspice progresses, it could take hours. Any idea?

    cranksensorV05  nt- inverterend OK.gif


    Mods Edit:
    Please upload the normal image file as 800x600 *.jpg or *.gif, so all our members can see the circuit.
     
  2. ericgibbs

    AAC Fanatic!

    Jan 29, 2010
    3,113
    531
    hi pp,
    It is that multi input NAND, try this it uses the NAND from LTSpice.

    E

    Also the original NAND was incorrectly connected try this.
     
    patpin likes this.
  3. eetech00

    Active Member

    Jun 8, 2013
    799
    145
    Hi

    See attached.

    Added params to A device.
    By default, the A device has no Rise/Fall time, or prop delay. This causes convergence issues.
    Also added param to specific logic voltage level, by default it is 1 volt.
     
    patpin likes this.
  4. patpin

    Thread Starter Member

    Sep 15, 2012
    240
    18
    Thanks you both for yr advise!!!! Fantastic to have a reply so fast and accurate!!!
     
  5. patpin

    Thread Starter Member

    Sep 15, 2012
    240
    18
    One more question. If I use a CD4001BD (QUAD NOR) as invertor and the input voltage on A and B is a sinus from 2.520 to 2.480V, will the real circuit effectively give 5V and 0V pulses at the NOT (A+B)?
    And what do I do with not used input and output pins.
    And do I add 10K in series at the inputs to protect the CMOS?
     
  6. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    6,889
    1,414
    Depends on the particular IC. In theory the trip point is half the supply voltage, but because of manufacturing tolerances it may be some way off that.
    Tie any unused input pins to either +ve rail or ground (no resistor needed). Leave unused output pins floating.
     
    patpin likes this.
  7. patpin

    Thread Starter Member

    Sep 15, 2012
    240
    18
    Thanks Alec_T !! I Guess putting an extra opAmp would resolve the possible problem.
    And do I add 10K in series at the used inputs to protect the CMOS?
     
  8. ericgibbs

    AAC Fanatic!

    Jan 29, 2010
    3,113
    531
    hi pp,
    The LM393 dual comparator is often used to used to square up a sine wave signal.

    E
     
    patpin likes this.
  9. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    6,889
    1,414
    Not normally done, unless you are anticipating input voltages that could be above or below the supply rails.
     
    patpin likes this.
  10. eetech00

    Active Member

    Jun 8, 2013
    799
    145
    Logic gates are not normally used that way. A comparator, like an LM393, would be better as it behaves as a 1 bit ADC;)
    Add some hysteresis to prevent oscillation for slow rise and fall times.
    Output pins can be left open. The unused input pins should be connected to +5 or ground to prevent spurious switching or oscillation from external noise.
    No..not really needed.
     
    Last edited: Aug 13, 2017
  11. patpin

    Thread Starter Member

    Sep 15, 2012
    240
    18
    I meant CD4001 as an inverter after the LM324 (or LM358) in order to have a smaller risetime. Expected frequency is 30-200Hz.
    The sinus is in fact a Hall sensor capturing a magnetic field (from a magnet). I use 9 volt because the other half of the LM358 is needing it, for another purpose.
    On the simulation of what I eventually planned to build this schematic (as included) looks good (checked from sinus of 10mV to one of 1V). Where did you advised to use the LM339 exactly. Instead of the CD4001?
     
    Last edited: Aug 13, 2017
  12. patpin

    Thread Starter Member

    Sep 15, 2012
    240
    18
    Thanks Eric, much simpler than what I projected!!
     
  13. eetech00

    Active Member

    Jun 8, 2013
    799
    145
    The LM393 would replace the opamp comparator you are using to drive the CD4001.

    What type of Hall sensor are you using? Do you have a part number?
     
    Last edited: Aug 13, 2017
  14. patpin

    Thread Starter Member

    Sep 15, 2012
    240
    18
    Honeywell SS495A1 Halsensor 4.5 - 10.5 V/DC
     
  15. eetech00

    Active Member

    Jun 8, 2013
    799
    145
    Hi

    Unless I've misunderstood the data on the datasheet, the sensor outputs a DC voltage in the range of 0.2v to (Vs-0.2v), depending on the polarity of the magnetic field. So if Vs is equal to 5v and the input is equal to +670 gauss, the output will be +4.8v (or +4.6v worst case).
     
  16. ericgibbs

    AAC Fanatic!

    Jan 29, 2010
    3,113
    531
    hi tech00,
    I am wondering if the OP has aligned his permanent magnet along the direction of rotation relative to the Hall sensor,?
    That is the only way I can see a full wave sinusoidal voltage swing +/- about +2.5V.
    E
     
  17. patpin

    Thread Starter Member

    Sep 15, 2012
    240
    18
    I have tried moving the magnet manually near the Hall. Without magnet I measure always 2.5V. When I am at 1cm of it I get 200mV less. More than anough to make my pulsed wave with the comparator and do the timing of the motor. Direction of magentic field was at 90° of the imprinted face of the Hall. When circuit is ready. I 'll post a Scope trace and a picture. Thanks to all!!!
     
    Last edited: Aug 14, 2017
  18. eetech00

    Active Member

    Jun 8, 2013
    799
    145
    Hi E

    Good question.
    From post#17, looks like the proximity of the magnet to the sensor is causing it to detect a negative Gauss?...output voltage is less than +2.5v.
     
  19. patpin

    Thread Starter Member

    Sep 15, 2012
    240
    18
    Hello, Have tried this sensor to make a current probe a year ago. When field changes fron North to South, so does the direction of the voltage change.
     
Loading...