Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Get analog values of LDRs through a 74HC4067 multiplexer

Status
Not open for further replies.

Sasindu1997

New Member
I tried to get analog values of each LDRs through 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...!
 

Attachments

  • 74HC4067.rar
    21.7 KB · Views: 214
I have no idea what specific system you are using? I do not recognise the attachment types, other than the text file.

Does the analog input pin need some configuration before you can read analog (rather than digital) values from it?
eg. If it's still in digital mode or set as a "high" output, it could give that effect.

Every MCU I've ever used needs the analog inputs configuring before they can be read properly.


You also usually have to allow a short delay, a few microseconds possibly, between changing an analog channel selection and starting an A to D conversion, to allow the voltage at the input of the ADC to settle.


Edit - possibly look at the analogReference() and analogReadResolution() functions for setting up the analog input?
 
Last edited:
Thank you guys for the consideration and sorry for the interruption.,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.I will attach the schematic diagram as PDF.Thank you again..!
 

Attachments

  • 74HC4067 schematic diagram.PDF
    37.2 KB · Views: 248
  • CODE.pdf
    61.2 KB · Views: 220
What voltage is the Arduino running on?
What voltage is the 4067 running on?
What is the input voltage range of the Arduino analog input?

ak
 
Unless I just do not understand simulations, you need to connect Vcc and GND on the 74HC4067. Those need to go to the +5 and GND from the UNO.



It is small, but I would change your line:

float voltage = ((sigValue + 0.5) / 1024.0 * 4.85);

to:

float voltage = sigValue * (4.85 / 1024.0);

(I get what you are trying to do with the 0.5) but read through this thread https://www.electro-tech-online.com...1023-is-just-plain-wrong.132570/#post-1172605

I didn't go through the schematic and code thoroughly, but that is what stuck out for me.
 
Last edited:
I connect the mux to 10v,when you see diagram,you can understand there is no vin or gnd pin 4067

Take a look at the data sheet for the 74HC4067, which is the chip in your simulation. Look at the SSOP24 for example, pins 12 and 24.
Your schematic does not show 10V anywhere. If the resistor ladders that feed the ADC pins are at 10V (that voltage is not marked), you may end up exceeding the 5V maximum on the UNO.

Take a look at this tutorial there are examples of doing something like what you are trying to do
 
Last edited:
,when you see diagram,you can understand there is no vin or gnd pin 4067
A common feature of many schematic capture programs is that the power and ground pins of digital logic circuits are not displayed. In older designs with tons of logic gates, this eliminated a huge amount of power connections running everywhere that made it difficult to see the signal flow patterns. Despite being able to handle analog signals, all CMOS 4000 series components are considered digital logic parts.

ak
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top