Arduino: getting 24 analog inputs from 6 pins

Discussion in 'The Projects Forum' started by Phaedo, Sep 4, 2013.

  1. Phaedo

    Thread Starter New Member

    Sep 4, 2013
    13
    0
    So I am making something using my arduino uno. The problem is that I need 24 analog inputs and the uno only has 6! This is what I came up with:

    [​IMG]

    If the switches being on or off represents the digital outputs of the Arduino being high or low and the two top power sources represent the analog output from the device that I want to go into the Arduino, I can control which analog output the input is received from. Thus, hopefully, I will get 24 inputs, 6 parallel * 4 serial , the count to 4 will be controlled by 4 of the Arduino's digital out or, if I'm short of pins, two and some logic gates.

    Would this work? I can see from the simulation that the voltage changes from the voltage that the bulb receives compared to what goes into the receiver of the transistor. Is there a way to remedy this. Thanks in advance!
     
  2. blueroomelectronics

    AAC Fanatic!

    Jul 22, 2007
    1,758
    98
    Why not use a handful of CMOS CD4051, a one of eight selector IC.
     
    Phaedo likes this.
  3. MelbMike

    New Member

    Sep 4, 2013
    4
    1
    You could use a few shift registers - you daisy chain them together, so you can make as many outputs as you like
     
    Phaedo likes this.
  4. mcgyvr

    AAC Fanatic!

    Oct 15, 2009
    4,769
    969
    Phaedo likes this.
  5. Phaedo

    Thread Starter New Member

    Sep 4, 2013
    13
    0
    I had a look at the data sheet but I can't make much sense of it. What are the advantages of this over the below link.

    Would this work? This is my favourite solution so far. What sort of clock speed would I be able to squeeze out of the arduino? The pwm can only reach 490hz, do you reckon using a digital out as the clock instead of a pwm and just running with the arduino clock speed im getting of 4.5Khz. What about an external clock. It is doing audio stuff so the faster the better really.

    Thanks, I would but this is more expensive and I always feel a bit like I've cheated if I get a shield!
     
  6. blueroomelectronics

    AAC Fanatic!

    Jul 22, 2007
    1,758
    98
    The CD4051 is a analog switch, like a rotary switch with 8 to 1 selected by 3 bits ABC.

    The shift register is for adding more digital outputs not analog inputs.
     
  7. mcgyvr

    AAC Fanatic!

    Oct 15, 2009
    4,769
    969
    So.. just use the same parts and build it yourself..
     
  8. Phaedo

    Thread Starter New Member

    Sep 4, 2013
    13
    0
    This seems like exactly what I was looking for, thanks! I realise now that I could have read that on the data sheet:

    Sorry and thanks for you having to do that, I was just intimidated by it at first.

    That would still probably be more expensive than the CD4051 for what I want to do but thanks anyway!

    By the way, out of curiosity, what sort of circuit is behind an analog multiplexer?
     
  9. crutschow

    Expert

    Mar 14, 2008
    13,001
    3,229
    It consists of a P-MOSFET AND N-MOSFET in parallel for the analog switch. These are controlled by the digital input. A simple schematic is shown here.
     
  10. strantor

    AAC Fanatic!

    Oct 3, 2010
    4,302
    1,988
    It can go higher, up to 16khz IIRC. Google how to do it.
     
  11. Phaedo

    Thread Starter New Member

    Sep 4, 2013
    13
    0
Loading...