Add analog pin to the Arduino Fio

Hi,

I am working on the arduino Fio but I need more analog channels (the 8 analog I/O are not enought). I want to add about 8 other analog inputs. Multiplexer seems really difficult to use, I found some I/O Expander such as (PCF8574), that seems easier to use but it is to add only digital inputs. I don't find I/O Expander to maximise analog inputs. Do you know if it is possible and if some exists ?

Thanks very much

but I need more analog channels (the 8 analog I/O are not enought).

The arduino does not have analogue inputs / outputs. It has analogue inputs or digital PWM outputs there are no analogue outputs.

Multiplexer seems really difficult to use

No it is not. http://playground.arduino.cc/learning/4051

Otherwise your only option is an external A/D and if you can't cope with multiplexing then you won't cope with that.

I found the 12-bit, 8 channel, SPI interface MCP3208 ADC pretty easy to use http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en010534

Hi,

Thank you very much for your answers.
I have bought the : Serial/Analog Mux/Demux - 74HC4052 and I have some trouble with the programming. I have connected the VCC to 3.3V on the Arduino Fio, the An and Bn to the analog pin A6 and A7 on the Arduino Fio, the Enable (E), the VEE, and the GND to the GND on the Arduino Fio and the address select S0, S1 to the digital pin 3 and 4 on the Arduino Fio. For the moment, I just have connected two sensors on A1 and B1, but I want to connect more after.

I have made this code but it’s not working.

// 74HC4052 multiplexer/demultiplexer

int sensor1 = A6;// where the multiplexer in/out port is connected
int sensor2 = A7;

void setup ()
{
Serial.begin (57600);
Serial.println (“Starting multiplexer test …”);
pinMode (3, OUTPUT); //digital pins 3 and 4
pinMode (4, OUTPUT);

} // end of setup

void loop ()
{

digitalWrite (3, HIGH); //
digitalWrite (4, LOW);// To read channels A1, B1
analogRead (sensor1);
Serial.print(sensor1, DEC);
analogRead (sensor2);
Serial.print(" ");
Serial.println(sensor2, DEC);

delay (1000);
} // end of loop

The results I have are :

Starting multiplexer test …
20 21
20 21
20 21
20 21
20 21
20 21
20 21
20 21

I don’t understand why… Do you know what I have to change ?

Thank you very much :slight_smile:

the An and Bn to the analog pin A6 and A7 on the Arduino Fio,

What pins on the multiplexer did you use for this? My data sheet calls them something else, 1Z at pin 13 and 2Z at pin 3. Pin 6 ~E must be connected to ground for the chip to work.

Please read the how to use this forum stick to find out how to post code correctly.

Sorry for the code… :blush:

Here is the datasheet for the multiplexer I use (74HC4052) :
http://www.farnell.com/datasheets/1633734.pdf
Look at p3 and p5.

And this is the Arduino Fio :
http://arduino.cc/en/Main/ArduinoBoardFio

Connections realized:
I have connected the An and Bn from the multiplexer to the analog pin A6 and A7 on the Arduino Fio.
I have connected the VCC (from the multiplexer) to 3.3V on the Arduino Fio, the Enable (E), the VEE, and the GND (from the multiplexer) to the GND on the Arduino Fio and the address select S0, S1 (from the multiplexer) to the digital pin 3 and 4 on the Arduino Fio. For the moment, I just have connected two sensors on the A1 and B1 on the multiplexer, but I would like to connect more after.

Thank you :slight_smile:

As I said in the last post:-

Pin 6 ~E must be connected to ground for the chip to work.