Shop OBEX P1 Docs P2 Docs Learn Events
Cmos digital input with nmos — Parallax Forums

Cmos digital input with nmos

loojadeloojade Posts: 30
edited 2008-03-09 11:14 in General Discussion
Hallo everybody,

In a my project I check RPM of 3 shaft by falling edge detection (SX28 port RB.0, RB.1 and RB.2).
I try to simulate input by a 555 chip like following:

to RB.0 TTl frequency 100 Hz - duty cycle 1/40 (1= 5volt, 39=0volt)
to RB.1 TTl frequency 110 Hz - duty cycle 1/40 (1= 5volt, 39=0volt)
to RB.2 TTl frequency 15 Hz - duty cycle 1/10 (1= 5volt, 9=0volt)

Connecting IC 555 to SX28 directly everything is ok.
Unfortunally the RPM pulse come from inductive sensor that gives 0-12 volt range pulse.
Basically to adapt the voltage range I used a interface circuit based on NMOS (see pictures)

immagine.jpg

R = 2.2 Kohm

But with this interface the SX doesn't work. Simply is like the input is low.
Any idea to resolve my problem??? I think that this interface is very base, so actually I cannot understand why it doesn't work.

Thanks in advace for any reply.

Comments

  • BeanBean Posts: 8,129
    edited 2008-03-08 15:31
    Just put a 22K resistor in series with the sesnor output (0 to 12V) to the RB port pin.

    The SX has protection diodes that will not allow the input to go above about 5.7V. The 22K will limit the current to the protection diode so it doesn't get damaged.

    I do this all the time with RS232 serial data.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    www.iElectronicDesigns.com

    ·
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2008-03-08 15:33
    What is the part number on the NMOS trnasistor?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • Sens-a-DatSens-a-Dat Posts: 44
    edited 2008-03-08 15:36
    A couple thoughts:

    Each NMOS has a threshold voltage by which the component will permit current to pass through it or not. Below that threshold voltage, the output to Port B should be 5V. Above the threshold voltage, the "switch" will turn on and the voltage to Port B is basically at zero potential (ground). I was just looking at the threshold voltage for a 2N6755, and it is 3.128V. So, one must exceed this voltage for the Port B to go to ground. Also, there is a safe limit between the Gate-Source voltage which should not be exceeded. These are some things you likely already know.

    How about using a resistor-divider? See the attached JPG file. It contains a 20K and 10K resistor in series. If the 10K is connected to ground and 12V to the 20K resistor, then the voltage at the connection of the 20K-10K resistors when the 12V signal is present will be approximately 4V [noparse][[/noparse]= 12V times 10/(10+20)]. You might need to increase the resistor values so you do not exceed the current limitations of the source device's output.

    Gary
    129 x 181 - 7K
  • loojadeloojade Posts: 30
    edited 2008-03-08 18:32
    Bean (Hitt Consulting) said...
    Just put a 22K resistor in series with the sesnor output (0 to 12V) to the RB port pin.

    The SX has protection diodes that will not allow the input to go above about 5.7V. The 22K will limit the current to the protection diode so it doesn't get damaged.

    I do this all the time with RS232 serial data.

    Bean.

    Thanks... it is very easy to do turn.gif

    Unfortunally I can do this only for 2 of 3 input. The 3°-one come from bike engine so I prefer yous a MOS solution to avoid any electronic interference and current absorbing.

    TO Beau Schwabe:
    The MOS is IRF540
  • loojadeloojade Posts: 30
    edited 2008-03-08 18:49
    Sens-a-Dat said...
    A couple thoughts:

    Each NMOS has a threshold voltage by which the component will permit current to pass through it or not. Below that threshold voltage, the output to Port B should be 5V. Above the threshold voltage, the "switch" will turn on and the voltage to Port B is basically at zero potential (ground). I was just looking at the threshold voltage for a 2N6755, and it is 3.128V. So, one must exceed this voltage for the Port B to go to ground. Also, there is a safe limit between the Gate-Source voltage which should not be exceeded. These are some things you likely already know.

    How about using a resistor-divider? See the attached JPG file. It contains a 20K and 10K resistor in series. If the 10K is connected to ground and 12V to the 20K resistor, then the voltage at the connection of the 20K-10K resistors when the 12V signal is present will be approximately 4V [noparse][[/noparse]= 12V times 10/(10+20)]. You might need to increase the resistor values so you do not exceed the current limitations of the source device's output.

    Gary

    SORRY MOS is IRF530


    With my first configuration, If I put (manually) gate voltage to 5 volt on drain of the MOS there is (about) 0 volt and if I put Gate voltage to 0 on drain I have 5 volts. Statically everything work well. When I drive the MOS with 100 Hz pulse signal the SX dosn't work.

    Basically I cannot use a resistor divider because consumtion (in terms of current) is too much and also because I want to keep separate the SX electronic from engine pulse elettronic.

    One more thing:
    I also used a opto isulation (led-photoBJT) instead of MOS, but the problem still same. If I connect the TTL pulse signal everything is perfect. When I use opto isulation the system doesn't work.

    Question:
    On SX program I fixed edge detection on falling edge.
    Basically the duty cycle of pulse is 1/40, this mean for exmple:
    100Hz
    pulse width: 0.01 sec
    High voltage: 0.25mSec
    low voltage: 9.75 mSec

    When I connect the MOS the Duty cycle is the opposite: 40/1
    May be it's necessary fix not falling edge but the opposite?????
    It should be right anyway... but....
  • Sens-a-DatSens-a-Dat Posts: 44
    edited 2008-03-08 20:33
    As for now, I do not know what the problem is. If anything comes to me, I will certainly write.

    I pulled up the IRF530 datasheet. The ON time (turn-on delay and rise time) is stated to be a maximum of 80nS, which is extremely short compared to your ON time of 0.25mS. Thus, the IRF530 response time is more than adequate.

    Do you have an oscilloscope to check on the wave form and voltage of the incoming signal? I am not saying this is the problem, but I tend to look at this when I am puzzled by why something may not be working when I think it should. At times it does lead me to see what I failed to realize.

    I put a SPICE-model circuit together of your design, and I see only a demand of 12pA of current to drive the gate. I knew it was very low, but wanted to check on this, anyway.

    To be sure I understood your first correctly, you were driving the IRF530 with the 555 timer, correct? If so, can you post the design here? I would like to understand what pin is driving the IRF530.
  • loojadeloojade Posts: 30
    edited 2008-03-08 21:29
    Now I'm not in my house (I stay in Qatar for MotoGP) and actually I'm simulating the pulse signal by a CUBLOC 280 (by a PWM output).
    signal is 0-5 volt.
    I already check the response timing of IRF530 too. As you write here the response is more than adequate.
    Unfortunally I have not a oscilloscope to check the wave form.
  • loojadeloojade Posts: 30
    edited 2008-03-08 22:07
    May be depend on some setting in SX because with two different circuit the problem is the same.

    In the first circuit the opto isulation is TLP504A, R1=330ohm, R2=2.2Kohm Pulse IN o-5 volt
    In the second (as I write before) MOS is IRF530 and R4=2.2Kohm.

    If I drive the interface circuit with a 15Hz signal (duty 50%) come to work well.
    755 x 615 - 204K
  • loojadeloojade Posts: 30
    edited 2008-03-09 11:14
    I have solved!!!
    Using the MOS I have replaced the resistor with 1Kohm. Actually I don't know why now it works... but anyway the I got it!!!

    Thanks for your help
Sign In or Register to comment.