Go Down

Topic: Limited analog inputs (multiplexing?) (Read 1 time) previous topic - next topic


I have a project with which I want to use a graphical display (based on the KS0108 and the GLCD library) to be able to display multiple information. The problem is that I need multiple analog inputs (at least 2) and the KS0108 requires 5 analog inputs to function and the Arduino Uno only has 6.

Time is not critical so I could use only one analog input but sample analog values from that input in a round-robin fashion, maybe using a multiplexer and some digital outputs.

Does anybody has an example of doing such a thing? Although I am an electrical engineer, I haven't done electronics since almost 20 years and I need some help.

Thank you.



I think that the easiest solution might be to use an Arduino Mega in place of the UNO.  That will give you a lot more pins to work with, including 16 analog inputs.
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp



johnwasser I forgot to mention that the Arduino Mega was not an option. Thanks for the reply though.


Or go with an external DAC, like microchip MCP3208, 8 channel 12-bit DAC with easy to use SPI interface.
Lot cheaper than buying a whole Mega just for analog ports.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.


Two suggestions:

1. The KS0108 GLCD library needs 13 pins, but the documentation says you can change the pin assignments in the configuration file. So change the configuration file to use more digital I/O pins and fewer analog input pins. If you are not reading data from the serial port then you can use pin 0 as either R_W or D_I.


2. Use a GLCD based on the ST7920 chip instead, then you can interface to it using just 2 wires instead of 13. This simplifies the wiring as well as saving pins.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.


Thanks, I will certainly look into those options.


A multiplex board like below might be of use.

Google forum search: Use Google Search box in upper right side of this page.
Why I like my 2005 Rio Yellow Honda S2000  https://www.youtube.com/watch?v=pWjMvrkUqX0


Yes, that would solve my problem. Thanks.


A plain old CD4066 would give 2 channels with one control connection. Use one of the gates as an inverter and you have a 1 wire 2 input analog switch, I would however use voltage followers to drive the transmission  gates as they do have a small dc resistance. This is a "Best Practices" kind of engineering thing, Or If you do that you will have less trouble later and it provides a layer of protection for the processor.

--> WA7EMS <--
"The solution of every problem is another problem." -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard


Another approach (which will slow down the interface) is to use a shift-register like the 595 to
drive the data bus of the controller - that only needs 3 pins instead of 8, so the total pin count
is reduced by 5, freeing up analog inputs.   Of course the driver software/library for the controller
would need adapting.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131