Connect with us

Analog Multiplexer

Discussion in 'Microcontrollers, Programming and IoT' started by sasindu1997, Jan 13, 2020.

Scroll to continue with content
  1. sasindu1997

    sasindu1997

    7
    0
    Jan 13, 2020
    I tried to get analog values of each LDRs throught a multiplexer,but the problem is i couldn't get what i need,it always give me the same value(1023) when i was changed the light intensive,please help me guys,,i will attach the code and protues filre..Thankyou...!
     

    Attached Files:

  2. Harald Kapp

    Harald Kapp Moderator Moderator

    9,639
    2,014
    Nov 17, 2011
    Please show us a schematic of your circuit and how it is connected to the voltages to be measured.. Hard to guess what you did there - and I do not have proteus to read your data.
     
  3. sasindu1997

    sasindu1997

    7
    0
    Jan 13, 2020
    I tried to get analog values of each LDRs throught a multiplexer,but the problem is i couldn't get what i need,it always give me the same value(1023) when i was changed the light intensive,please help me guys,,i will attach the code and protues file.simply what my need is to get read many LDR readings using with less number of pins in arduino uno.Before make the circuit,I draw the schematic diagram in protues 8.Thank you ..
     

    Attached Files:

  4. Harald Kapp

    Harald Kapp Moderator Moderator

    9,639
    2,014
    Nov 17, 2011
    What is the actual measurement of the voltage at the input of the multiplexer (pins 6, 7, 8 and 9)? These voltages need to be in the range 0 V ... Vcc (Vcc of the arduino).
    Are you sure the assignment

    #define muxln 0

    is correct? The example here uses

    int analogPin = A3; // potentiometer wiper (middle terminal) connected to analog pin 3
    // outside leads to ground and +5V

    which would be A0 (instead of A3) in your case. (Sorry if that's a not so intelligent question, just judging from similarity, I'm not that particularly familiar with arduino code).
    You alsi state in your code:

    Serial.print("Values from 4067");

    Bit the same reeference as above has a note:

    **The default analogRead() resolution for these boards is 10 bits, for compatibility. You need to use analogReadResolution() to change it to 12 bits.
     
  5. sasindu1997

    sasindu1997

    7
    0
    Jan 13, 2020
    Actual measurements of 6,7,8,9 pins are in between 0-5v .I think code is ok.
    Just ignore the print (values from 4067),what my requirement is to only read LDR values..
     
  6. Harald Kapp

    Harald Kapp Moderator Moderator

    9,639
    2,014
    Nov 17, 2011
    And what is the output voltage of the multiplexer / input voltage of the arduino?
     
    sasindu1997 likes this.
  7. Harald Kapp

    Harald Kapp Moderator Moderator

    9,639
    2,014
    Nov 17, 2011
    The reference also states:
    It may therefore be advisable (not necessarily required) to explicitly set the analog pin of the arduino as input:
    Code:
    pinMode(muxln, INPUT);
    in the setup routine of your code.
     
  8. sasindu1997

    sasindu1997

    7
    0
    Jan 13, 2020
    There is no output voltage displayed for multiplexer as well as there is no specified voltage for arduino uno board
     
  9. sasindu1997

    sasindu1997

    7
    0
    Jan 13, 2020
    Did not see any changes bro
     
  10. Harald Kapp

    Harald Kapp Moderator Moderator

    9,639
    2,014
    Nov 17, 2011
    No wonder the analogread() delivers constant values (although I'd have expected something around 0 for no input voltaeg to the arduino.

    Just to make sure: The multiplexer is connected to 5 V power supply? The schematic doesn't show such a connection (but this is often taken as implicit and not drawn).
     
    sasindu1997 likes this.
  11. sasindu1997

    sasindu1997

    7
    0
    Jan 13, 2020
     
  12. Harald Kapp

    Harald Kapp Moderator Moderator

    9,639
    2,014
    Nov 17, 2011
    I'm not asking about proteus, I'm asking about your actual breadboard. Do you have Gnd and Vcc connected to the 74HC4067?

    Or is this only a simulation? If so, then what actual values do you use for the LDRs' resistances?
    Check that the 74HC4067 is connected to the correct power rails in proteus. This is a feature not shown on the schematic, it uses implicit connection. See this discussion.
    Also your arduino seem to be floating, tehre are no connetcions to GND and Vcc either.
     
  13. sasindu1997

    sasindu1997

    7
    0
    Jan 13, 2020
    This is only a simulation.
    LDR resistances Dark 1M
    Light level max 500 ohms

    I read above discussion also..thankyou for it and i gave 5v and 10v to mux..now the case was changed.In both two voltages,program give 0000 values
     
  14. Harald Kapp

    Harald Kapp Moderator Moderator

    9,639
    2,014
    Nov 17, 2011
    At 500 Ω for the LDR the output of the LDR/R resistive divider is only 2.5 V (max value, trimmer at max. value). That should show as 2.5 V at the input and at the output of the multiplexer. If not, check the power supply to the mux.
     
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

-