Go Down

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

michou

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.


johnwasser

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: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e


michou

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

CrossRoads

Or go with an external DAC, like microchip MCP3208, 8 channel 12-bit DAC with easy to use SPI interface.
http://www.digikey.com/product-search/en/integrated-circuits-ics/data-acquisition-analog-to-digital-converters-adc/2556291?k=mcp3208
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.

dc42

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.

or

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.

michou

Thanks, I will certainly look into those options.

zoomkat

A multiplex board like below might be of use.

https://www.sparkfun.com/products/9056
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

michou

Yes, that would solve my problem. Thanks.

Docedison

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.

Bob
--> 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

MarkT

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 won't respond to messages, use the forum please ]

Go Up