Engineering, Gardening

Backyard Gardening #7: Light Sensor | #DIY and #Arduino


Previously, the smart gardening device was built as an alternative method to the analog three-way meter (amazon link) shown in the picture below.


Using Arduino Software on Windows OS.

The arduino module used in this project is Arduino Micro (Amazon Link).

The data of light sensor output to Arduino are voltage values. In general, when it is brighter, the resistance value of the light sensor becomes smaller. As an example, about 100 Ohm in the sun light and ~ 10M Ohm in darkness.

Arduino microcontroller is programmed so that the log from Arduino produces the voltage value at a node of the light sensor every second. This indicates the brightness captured by the sensor. The data will be shown on the Arduino console and 4-line LCD.


With LED Desk Lamp, Arduino and Light Sensor (Amazon Link).

LED Desk Lamp has 4 light brightness levels


As the desk lamp gets brighter, the voltage value goes down. This means that the resistance of the light sensor goes down.


Test this prototype outside and compare the results with the analog meter.

Engineering, Gardening

Smart Gardening #4: Power on 1st prototype board

Prototype Highlight:

Powered on prototype board successfully from USB power. LCD display was powered on at 5V. The light sensor has LED indicators showing power GOOD. Using a multimeter, measured 5V power pins on the prototype board and everything is okay so far.

Next step is start programming with Arduino!


Recap from last time:

Detailed Progress:

Arduino micro has operating voltage at 5V. I like this because most LCD displays need 5V not 3.3V. Te DC current per IO pin is 20mA at 5V and 50mA at 3.3V, which is adequate for most sensors. Reference:

Arduino Micro Specification

Today, I just powered on the prototype board ver 1 by a microUSB cable connected to a Desktop PC. The multimeter showed 4.96V on one of the sensor power supply pin.  This is because there is a on-board voltage regulator on Arduino micro board and the 5V pin may not be exactly 5V due to dropout voltage. If the dropout voltage was too big, this may cause the Arudino and other sensors unstable. So far, it doesn’t seem to be a problem.

Next Steps:

  • Start using Arudino IDE on Windows PC
  • Programming Arduino for LCD Display first
Engineering, Gardening

Smart Gardening #3: Wiring with microcontroller on Prototype Board

Now is time to connect all sensors. Let’s get hands dirty and start soldering on prototype board.

Recap from last time:

Smart Gardening #2: Concept Design by drawing Block Diagram



  1. Define Arduino Micro Pinout


2. LCD Display to microcontroller

3. Light Sensor Module

4. Moisture Sensor

5. Pressure, Temp + Humidity Sensor

6. Prototype Board


Soldering Tips

  • I like using un-used resistors to run wires on prototype board because I can hold it with the resistor while soldering – wire gets hot!!!
  • When soldering male headers, use 2-pin jumpers to hold it to avoid heat.

Running 5V Power Rail horizontally through Arduino pins

Wiring and Soldering completed

Back side of Prototype Board – took about 1 hour of soldering

Next steps

  • Time to hook up with PC and power on
  • Start Programming and test the sensors individually
Engineering, Gardening

Smart Gardening #2: Concept Design by drawing Block Diagram

Last time, we studied the fundamental data to collect by a commercial Three-way meter (last Smart Gardening blog post). So, let’s review it again and start a DIY concept design in a smarter by drawing a block diagram.

Recap: Three-Way Meter, weblink

This three-way meter device can measure three different type of data and display them on an analog meter with a switch. One good thing about it is a battery-free device.

  1. Light Sensor
  2. Moisture
  3. pH
  4. Analog Display


Here is a smarter way to measuring gardening data with Arduino. Arduino is a low-cost micro-controller which can control sensors electrically and monitor the live data.

This is a list of components as the first prototype. We would like to design this with very minimal knowledge of electronics.

  1. Arduino Micro: Arduino Micro with headers
  2. 4-line display: SunFounder IIC I2C TWI Serial 2004 20×4 LCD Module Shield
  3. Light Sensor: Digital Light Intensity Photosensitive Sensor Module
  4. Soil Moisture Sensor: DFROBOT Gravity: Analog Capacitive Soil Moisture Sensor- Corrosion Resistant
  5. Temperature and Humidity Sensor: BME280 I2C or SPI Barometric Pressure and Altitude Sensor

This time, I decided not to use pH meter because there is not a low cost pH meter and we don’t measure pH very often. However, I may be wrong, so I will try to include it in the next version. In addition, as the three-way meter is a battery free device, it is good to add a small solar panel to charge the device in the next version.


Engineers usually draw block diagrams to share ideas as a Proof-of-Concept prototype. Microsoft Visio is a good software tool including business flowcharts and electronics block diagram as part of the software package.

This block diagram is very simple, and it shows that Arduino Micro is the brain of this smart gardening prototype ver 1.


I2C is a standard bi-directional two-line communication between a micro-controller and sensor including SCL (Clock) and SDA (Data).

SPI is another standard three or four uni-directional wires including SCLK (clock), MISO (Master Input Slave Output), MOSI (Master Output Slave Input), and CS (Chip Select).

Analog voltage is the voltage level that the sensor outputs to a microcontroller, so microcontroller’s ADC (Analog to Digital Converter) can quantify the voltage level which is based on sensor’s quantity (ex: soil moisture level and light luminance).

Next, I would like to start wiring and soldering to connect all components.