Connect with us

External Circuit attached with PIC16F877

Discussion in 'Microcontrollers, Programming and IoT' started by Nirav, Aug 27, 2014.

  1. Nirav

    Nirav

    8
    1
    Aug 26, 2014
    Dear Friends,

    I am working on PIC16F877 project. I am using ADC and taking the signal from sensor and giving it to analog pin.
    I am preparing the circuit in which I am considering the four point given below.

    1. When sensor is short, at that time I am getting 0mV and I can declare that Sensor is fail in program.
    2. When sensor is open, at that time I will get some noise from atmosphere and I will reduce it to 0mV by resistor so that I can declare it as sensor is fail.
    3. When accidentally, I will get over voltage (any voltage > +5) at analog pin, I will reduce it to approx 5 V by using the zener diode connected to pin and ground and by sensing the +5V at pin I can declare that sensor giving over voltage.
    4.When accidentally, I will get reverse voltage (any voltage < 0 or any negative voltage) at analog pin, I will reduce it to zero voltage through zener diode and Controller will sense 0 voltage so at that case I can declare in my program that sensor is fail.

    When sensor is working normally, at that time I will get voltage 0-5V and I want to give it to analog pin without any voltage drop or minimum voltage drop.

    I have prepared a circuit, attached in file but it is not working properly.

    Please suggest me that how can I solve it.

    Thank you,
     

    Attached Files:

  2. Harald Kapp

    Harald Kapp Moderator Moderator

    9,134
    1,843
    Nov 17, 2011
    What are the values of R1 and R2?
    What kind of sensor are you using?
    A 5.1V zener will start conducting at less than 5.1V (see datsheet). A more robust solution is a diode from the input to Vcc (Anode to input, cathode to Vcc).

    Depending on the value of R2 you may even not need R1 and the diode at all. The analog input pin of the µC should have an internal protection circuit. As long as R2 limits the currrent (see datasheet of the µC for the max. value), no harm will be done to the µC for either voltages >5V or voltages <0V.
     
    KrisBlueNZ likes this.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-