2

I am a beginner in the Arduino world. I made some basic projects of the book that comes with the starter kit (it's was borrowed by a friend of mine) and also I used a humidity, a temperature sensors and a LCD display.

I want to buy an Arduino Uno for measure room temperature, humidity, carbon monoxide, carbon dioxin and maybe a couple more variables. I will to use 4 sensors, 1 buzzer, 1 LCD display and 1 ESP8266 serial WIFI wireless module.

After this work I will add for functionalities but as I have a lot of components I am not sure if the Arduino Uno can supports them because it has a limited quantity of pins.

Do I need an Arduino with more pins? what if I use all these pins and I need more? Can the Arduino Uno be expanded with more pins?

As the Arduino Uno is a very small computer, can its processor support all these components and their operations?

8
  • 1
    That would depend on their unspecified details, but consider that the esp8266 is a substantially more capable computer than a classic arduino you might be better just using that. Aug 27, 2016 at 0:07
  • It would be best if you asked 1 question per post.
    – st2000
    Aug 27, 2016 at 15:08
  • You can increase pins using shift registers
    – Mero55
    Aug 27, 2016 at 21:15
  • 2
    Since the Uno has support for I2C and SPI, the exact number of pins isn't the limiting factor.
    – Nick Gammon
    Aug 28, 2016 at 7:12
  • 1
    Don't forget that you also have the 10digital and 1 analogue pins on the ESP8266(E), which is a 32 bit processor capable of running at 160MHz. Using it for WiFi to serial is like buying a Ferrari to nip 1/2 a mile to the shops once a week. Sep 29, 2016 at 12:06

4 Answers 4

3

An Uno has more than enough pins for the devices you described.

  • A DHT22 Relative Humidity and Temperature sensor needs only one digital pin for both variables.
  • An MQ-7 Carbon Monoxide sensor needs one analog pin.
  • An MG-811 Carbon Dioxide sensor needs one analog pin (and an amplifier).
  • A Piezo buzzer needs one PWM pin.
  • The LCD with a Hitachi interface needs four digital pins.
  • The ESP module needs two digital pins.

That's 7 digital pins, one of which needs to be a PWM pin, and 2 analog pins. I did not make any choices about best or cheapest devices, just ones I either knew about or could find quickly by searching. But with this pin requirement doesn't come close to exhausting the available pins on an Uno so there's plenty of capacity left unassigned for you to make other choices that might require different interfaces or more pins.

1

I think you want to know how many sensors 1 Arduino can support. But just in case, I am answering both interpretations of the title of your question:

  1. How many different types of sensors can an Arduino support?:

With the correct software and hardware, the Aruidno can interface with almost any kind of sensor. The exceptions include but are not limited to sensors which produce more data than an Arduino can process (such as a video camera) or sensors that require fast responses (such a time of flight laser distance sensors (LIDAR)).

  1. How many sensors can an Arduino support at the same time?:

This depends on what processor resources are needed. If the sensor needs the ADC there 6 channels on most Arduinos. If you need more, there are hardware solutions. But many here have suggested to simply add a 2nd Arduino.

To specifically address your laundry list:

room temperature

Thermistor connected to ADC. But most are not linear, so you will have to create a look up table.

humidity

I think there is a SPI module on the market to do this.

carbon monoxide

These sensors usually require an amplifier. And change with age & temperature. So a lot of software here as well as hardware.

carbon dioxin

Not sure about this one.

buzzer

Self osculating? Then you only need a logic output.

1 LCD display

Alpha & numeric? Most have 4 or 8 pin Hitachi interfaces. But you can look for a SPI or serial port LCD so as to conserve on Arduino pins.

ESP8266

This is just a serial device. You will need the Ardino's serial port.

I'll leave it up to you to make a detailed assessment of the necessary processor resources. Because you need to first pick out the specific hardware you will be using.

That's half the battle. The other half is verifying the libraries for all these sensors and communication devices will not interfere with one another. That I will leave up to you as it is not an easy task to wade through all the code for all the different libraries you will be using. And, again, until you pick out exactly what sensors and devices you will be using it is impossible to even start analyzing as we wouldn't know which libraries to look at.

3
  • This answer has been flagged as "not an answer". Can you please elaborate on the question asked? That is, "how many sensors can an Arduino support?". I see where you are going with this answer, but it is a bit tangential.
    – Nick Gammon
    Aug 27, 2016 at 22:40
  • I will try. But the question is broad. Since no one answered the question after almost a day, I thought to give it a try.
    – st2000
    Aug 27, 2016 at 23:23
  • I think it's worth adding that you can have many I2C devices connected to the Arduino's I2C bus, so it's a good option if you need one Arduino drive many sensors. Same for SPI, except for the "slave select" line. Aug 28, 2016 at 6:40
1

The question itself is a bit broad, but I'll try and provide some insight here.

The number of sensors that can be supported, and the number of pins they require, will depend on what sort of interface they use.

  • If your sensor has an analog interface, you will need an analog input pin for each sensor.
  • If your sensor has an I2C interface, you can have multiple devices sharing the same pins (a bus) provided that they have different I2C addresses (often configurable with jumpers on the device).
  • If your sensor has an SPI interface, you can have multiple devices using the same pins (a bus), except that each will need a chip select PIN connected to a digital I/O pin on your Arduino so that it can 'select' each device.
  • If your sensor has a serial interface, you can generally only have one device.

To add complexity to the problem, you can get expansion modules for the Arduino that will give you extra analog pins or other communication interfaces.

With the long list of sensors you have above, you may also be hard-pressed for program space, as most sensors will need code and/or libraries to interface with them. The Arduinos with more pins (such as the MEGA) also have more program space.

I would encourage you to do some further research on the sensors you want to use, and finding out what interface they use, and what Arduino libraries are available for them. This way, you can fully understand the requirements and limitations of any parts you want to use.

Further reading:

1

Look at the MUX Shield, I just used one to add 48 Inputs to a MEGA making it capable of having 98 Inputs or Outputs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.