Requesting a quick help pls :)

Discussion in 'Embedded Systems and Microcontrollers' started by Uridan, Jun 11, 2009.

  1. Uridan

    Thread Starter Member

    Jun 11, 2009
    11
    0
    Hi

    I am new here and I have a wired problem that I need to solve.

    I have a pressure and a humidity sensor that give a voltage output analogue range from 4.7V - 0V.

    I am using an AT89C51 micro controller and the ADC input accepts a voltage with the a range of 2.55V - 0V (FF - 00).

    When I connect the sensor's Vref pin with the ADC, the voltage at the ADC port will be the voltage of the Vref of the sensor. Now since the 89C51 accepts not more then 2.55V for conversion, I must reduce that 4.7V to 2.55V or less.

    I did a voltage division to reduce the 4.7V to 2.0V but when I connect that 2V with the ADC, the ADC will give 5V wrt ground ignoring the 2V and will give wrong readings (obviously).

    This is really confusing me and I cant seem to find any solution for it since I dont know what I am doing wrong.

    How can I convert the 4.7V of the sensor to digital when the ADC is accepts only a max of 2.55V.

    Any help would be greatly appreciated right now.

    Thanks
    Regards
    Ed
     
  2. bertus

    Administrator

    Apr 5, 2008
    15,645
    2,344
    Hello,

    Can you post a schematic of how you connected the ADC input?

    Greetings,
    Bertus
     
  3. Uridan

    Thread Starter Member

    Jun 11, 2009
    11
    0
    Hi Bertus,

    This is the way I am connecting both sensors. From the Vref of each sensor I am doing a voltage divider by using two resistors in series between the Vref of the sensor and ground.

    The ADC is connected between the two resistors.

    The resisitors used are 98K each that gives a ration of 0.5 difference.

    Ed
     
  4. bertus

    Administrator

    Apr 5, 2008
    15,645
    2,344
    Hello,

    What ADC do you use in combination with the controller?
    What are the types of sensor you are using (datasheet) ?
    The schematic is not very clear, as it shown not the connection to the ADC itself.

    Greetings,
    Bertus
     
  5. Uridan

    Thread Starter Member

    Jun 11, 2009
    11
    0
    The 89C51 has an internal 10Bit ADC, and uses an 8 channels in total (Port 1). So i am connecting the voltage from between the resistors to P1.X depending on the channel programmed. In this case Pins P1.2 and P1.3 are used from the Microcontroller.

    The sensors used are the HIH-4000 and the MPX5100, datasheet provided.
     
  6. bertus

    Administrator

    Apr 5, 2008
    15,645
    2,344
    Hello,

    The main problem with the sensors is that they can not give much current.
    Use a buffer amplifier afther each sensor then the resistor voltage divider (two equal resistors). to the ADC input.

    Greetings,
    Bertus
     
  7. Uridan

    Thread Starter Member

    Jun 11, 2009
    11
    0
    Hmm, thought so.

    Can you provide some examples with the buffer amplifier??

    Do I have to use the LM358 or can I apply a single transistor such as the 2N3904?

    Thanks
    Ed
     
  8. bertus

    Administrator

    Apr 5, 2008
    15,645
    2,344
    Hello,

    You can use a good quality opamp and connect it this way :

    [​IMG]

    Greetings,
    Bertus
     
  9. Uridan

    Thread Starter Member

    Jun 11, 2009
    11
    0
    Thanks bertus for all the help.

    Last question. I am not familiar with op amps, can you provide me with a good quiality op amp name. Is the LM358 good for such applications? since its adual operational op amp I can connect both sensors with just one LM358 right ?

    Thanks

    Ed
     
  10. Uridan

    Thread Starter Member

    Jun 11, 2009
    11
    0
    I just tried it with an op amp and still the Voltage at the ADC input is remaining 5V... I don't know what is wrong anymore.
     
  11. bertus

    Administrator

    Apr 5, 2008
    15,645
    2,344
    Hello,

    Did you measure the output of the sensors?

    Greetings,
    Bertus
     
  12. RiJoRI

    Well-Known Member

    Aug 15, 2007
    536
    26
    I'd start by replacing the sensor with a pot, and test the op-amp/Vdiv circuit. Set the pot output to 0, 1, 2, 3, and 4 volts, and see if the circuit gives you approximately 0, 0.5, 1, 1.5, and 2 volts. (BTW, how are you testing your sensors?)

    Once I was happy with the divider circuit, I'd connect the output to the micro, run the same test, and see what the micro produces.

    I'd then verify the outputs of the sensors, then try connecting everything together.

    --Rich
     
  13. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    Have you configured the microcontroller to make that pin into an output? That might explain why is it forcing the pin to +5v.
     
Loading...