Working with Multiple Sensors and Arduino

Let’s start by using an Arduino Nano on an Expansion Board to monitor the indoor gardening environment.  We will measure light intensity, ambient temperature, relative humidity, nutrient/water temperature.

There are a lot of nice tutorials online covering the use of Arduino Uno and nearly any sensor or peripheral device you can find.  Most tutorials focus on using an Arduino Uno (or variant) and a single sensor or peripheral.

Welcome to Section 1:  Multiple Sensors, of my series, The DIY Smart Garden System.

Working with Multiple Sensors

Arduino Nano on an Expansion Boardimg_20150809_175140174

In my experience, the problem with using multiple sensors and peripheral devices are compatibility issues and then time management.  When selecting the type of sensor or component I’ve considered its availability, low-cost, and reasonable accuracy.

  • The BH1750 is a sensor module for measuring light intensity in lux values.
  • The DHT module can measure both ambient temperature and relative humidity.
  • The Dallas Temperature Probe is suitable for measuring the nutrient/water temperature.




Section 1:  Multiple Sensors

  • Arduino Nano
  • Expansion Board
  • Light Intensity BH1750 sensor
  • DHT sensor
  • Dallas Temperature Probe DS18x20

Additional bits and pieces


  • resistor 4.7k
  • 20-40 ribbon female to female, pull-apart, rainbow-colored wires
  • female wire headers: 1,2,3,4,6
  • USB mini cord
  • Soldering iron and solder


In an effort to make the project more plug and play, use the Arduino Nano on an expansion board and customize the wiring for the peripheral devices.  Keep it simple using common wiring colors, keep it modular so connections can be made with ease, keep your project sustainable; a part can be replaced rather than the entire system.  *The  wire connectors that come with prototyping starter kits makes it easy to create your own custom wiring connections. The wires are easy to solder when a more permanent connection is needed.  I make custom wiring harnesses for neater, cleaner, and more easily connectable modules.

The datasheet for the sensor or device will identify the resources needed by each component.  All of the following will need a positive and negative connection:

*Use the rainbow-colored wires to select colors that correspond to the connections needed.  Select the appropriate wiring header to combine the proper configuration.

Download and install libraries:


Before we start working on the source-code for this project, we need to make sure we are ready.  You should have the Arduino IDE installed and be familiar with installing libraries.  Personally, I have found Atmel’s Visual Studio to be more useful for managing large projects than using the Arduino IDE as a standalone development environment.

Include needed libraries:

#include <DHT.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <BH1750/BH1750.h>

#include "TimeMan.h"
#include "CoreSensors.h"

In my article, Why Arduino when you can Pi?, I explain that after trying many different timer and time management libraries I felt they were either too much or not enough of what I was wanting in my timers.  A set of timers that are easy to set, keep track of their own state, and each have their own trigger flags (“TimeMan.h”).

/* Timers */
//Timer Object = { (type), (interval in millis), ready, triggered, timestamp, (pointer to next object)
Timer Timer_txData = { TIMER_TX_DATA, 30000UL, true, false, 0, NULL };
Timer Timer_Save_Settings = { TIMER_SAVE_SETTINGS, 3600000UL, true, false, 0, &Timer_txData };
Timer Timer_Sensor_Read = { TIMER_SENSOR_READINGS, 7000UL, true, false, 0, &Timer_Save_Settings };
Timer Timer_rxData = { TIMER_RX_DATA, 6000UL, true, false, 0, &Timer_Sensor_Read };


Next:  Programming Time Management


As I receive feedback from you, I will update these sections, so don’t be afraid to comment or send me your questions directly.

Other articles:

Please share with friends and follow to receive a notification when I publish a new article.