Pages: [1]   Go Down
Author Topic: Limited analog inputs (multiplexing?)  (Read 912 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 514
Posts: 31567
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes I did the multiplexing bit in this project:-
http://www.thebox.myzen.co.uk/Hardware/MIDI_Footsteps.html
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 180
Posts: 8108
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Grumpy_Mike
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 444
Posts: 23861
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

United Kingdom
Offline Offline
Tesla Member
***
Karma: 220
Posts: 6587
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

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.

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks, I will certainly look into those options.
Logged

0
Offline Offline
Tesla Member
***
Karma: 118
Posts: 8962
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

A multiplex board like below might be of use.

https://www.sparkfun.com/products/9056
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, that would solve my problem. Thanks.
Logged

Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 44
Posts: 2813
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

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

0
Offline Offline
Shannon Member
****
Karma: 162
Posts: 10523
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

[ I won't respond to messages, use the forum please ]

Pages: [1]   Go Up
Jump to: