Go Down

Topic: arduino with indepent adc input port (Read 214 times) previous topic - next topic

parksplit

Hello, i really like arduino, specially arduino UNO R3, i have always wanted to make a plc board using arduino uno, mainly with more digital inputs and just 2 adc inputs, but the problem is that i can´t do it with arduino uno because all ADC port (A0..A5) are digital or analog, that port can´t be both of them(for example A0,A1 and A2 are digital inputs, A4 and A5 analog inputs), that ´s why i dicided to use pics, 16f886, it has independent ADC inputs, but i really want to try using an arduino board, so is there an arduino board that has indenpendent ADC inputs or some kind of variety of atmega 328, thanks in advance  :)

steve_mcdonald

One solution is to use a port expander such as the MCP23017 or 23s17 (I2C or SPI versions). With the MCP23017 you can expand the available digital io ports to 16*8 (128) ports (theoretically).  There is a retail io shield for UNO or it's fairly trivial to expand using the device itself.   

Juraj

read the last paragraph here https://www.arduino.cc/en/Tutorial/AnalogInputPins
You can't write an Arduino sketch if you didn't learn programming. Not the language, but the concepts of programming - algorithms and data types.

sterretje

#3
Sep 19, 2018, 07:53 am Last Edit: Sep 19, 2018, 07:53 am by sterretje
Yes, you can use A0 and A1 and A2 as analog inputs and A4 and A5 as digital inputs (or outputs). What makes you think that you can't?

An Arduino Nano has two additional analog inputs (A6 and A7); those pins can't be used as digital input or digital output.
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

GolamMostafa

#4
Sep 19, 2018, 08:48 am Last Edit: Sep 19, 2018, 09:31 am by GolamMostafa
Hello, i really like arduino, specially arduino UNO R3, i have always wanted to make a plc board using arduino uno, mainly with more digital inputs and just 2 adc inputs, but the problem is that i can´t do it with arduino uno because all ADC port (A0..A5) are digital or analog, that port can´t be both of them(for example A0,A1 and A2 are digital inputs, A4 and A5 analog inputs),
By default, A0-A5 are digital IO pins for the pc0-pc5 IO lines of Port-C Register. They can be used as --

1.  A0-A5 as digital IO lines.
2.  A0-A5 as analog channels for the internal ADC of the MCU.
3.  A0-A3 as digital IO lines and A4-A5 as analog channels.
4.  A0-A1 as digital IO lines, A2-A3 as analog channels and A4-A5 as SDA-SCL lines of I2C Bus.

In summary, A0-A5 lines can be used as digital IO lines, analog channels, I2C Bus, and in all permissible combinations.

parksplit

#5
Sep 19, 2018, 04:56 pm Last Edit: Sep 19, 2018, 04:57 pm by parksplit
Thanks for your replies, i really confused things, you all were right it is possible to use A0..A5 as digital or analog at the same time:

Here is a video demostration, sorry for the mess i just made it fast because of time:


https://www.youtube.com/watch?v=epYucYhFINg&feature=youtu.be


which make me do another question but  i think is for another post or topic, in video everytime i press digital input button (A3 as digital input) analog read shown in lcd changes like if it was some kind of noise, btw it sows number like 9000, it is because i didn´t clear lcd, and why it stays in 1017 analog read, shoudn´t it be 1023?

Juraj

Thanks for your replies, i really confused things, you all were right it is possible to use A0..A5 as digital or analog at the same time:

Here is a video demostration, sorry for the mess i just made it fast because of time:


https://www.youtube.com/watch?v=epYucYhFINg&feature=youtu.be


which make me do another question but  i think is for another post or topic, in video everytime i press digital input button (A3 as digital input) analog read shown in lcd changes like if it was some kind of noise, btw it sows number like 9000, it is because i didn´t clear lcd, and why it stays in 1017 analog read, shoudn´t it be 1023?

see my comment #2
You can't write an Arduino sketch if you didn't learn programming. Not the language, but the concepts of programming - algorithms and data types.

parksplit

#7
Sep 19, 2018, 05:54 pm Last Edit: Sep 19, 2018, 05:57 pm by parksplit
Thanks Juraj, i´ll have to add some restriction reading analog when pressing digital input A0..A3, as it says:


"...to add a short delay before using analogRead() to read other analog pins."

sterretje

I don't know what is connected to your analog pins; I don't do videos.

But you are aware that if it's a matter of reading a HIGH/LOW signal, you can use digitalread?
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

parksplit

A4 and A5, each of them havea 10k potentiometer

Go Up