Engineering, Gardening

Backyard Gardening #9: 2019 July Week #4 | #Harvest

Progress

Made a video of the backyard garden for the first time as a story.

SmartGarden Progress

Just out of curiosity, measured the resistance of eggplants and tomato plants. When it is between the edge of a egg plant leaf and stem, the resistance value is about 2MOhm.

Old leaf doesn’t have moisture and it looks like the equivalent resistance of the old leaf is very high (i.e. open circuit). Small and young leaf have less resistance. Depending on the nutrition of the plant, the resistance seems to change.

I can use the tomato as a current limiting resistor to turn on a LED.

Engineering, Gardening

Backyard Gardening #8: 2019 July Week #3 | #SmartGarden #Recycle

Weekly Progress

Tomato started growing more as the temperature in Oregon started going up.

There are six eggplants and each plant now has a bunch of flowers. At the same time, they attract snails 😛


New Crops

Green onions. Bought green onions at a grocery store and kept them in a glass of water. Changed water every morning for two weeks and each has enough roots now. So, it was time to plant them outside.


Harvest

Eggplants

Eggplants

SmartGarden Progress

SmartGarden device now is equipped with GPS sensor (Amazon Link) to keep track of real time information – GPS coordinates can be recorded as well. As the device has an USB charger block to power the Arduino microcontroller (Amazon Link) and other sensors, this became a portable device to check out brightness from the light sensor (Amazon Link).

The picture below shows the Analog Three-way meter and my own SmartGarden device.

LCD display shows Time and converted voltage by Light Sensor
SmartGarden Device with bell peppers
Engineering, Gardening

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

Introduction

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

Programming

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.

Testing

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

LED Desk Lamp has 4 light brightness levels

Video

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

Next

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

Engineering, Gardening

Smart Gardening #5: LCD Display

Now, it is time to program a LCD display with Arduino Micro. This can be used to monitor sensor data (Sensor information), date and weather.

LCD Display.png

Components used in this post

LCD device and programming reference: Sunfounder Wikipage

This LCD has 4 lines (rows) and 20 characters (columns).

Each character position is set by lcd.setCursor(row, column)

We can use a lcd.print(“”) function to print out a message.

If we want to print out a mixture of characters and variables (ex: numbers), lcd.println(variable, DEC) can be called.

Live Demo of LCD Display showing elapsed time

For time and date information, a real time clock (RTC) or GPS module can be used.

Next, start programming a sensor module.

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!

smart_gardening_prototype_ver1.png

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: https://store.arduino.cc/usa/arduino-micro

arduino_micro_spec
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

Components:

uC_and_sensors.png

  1. Define Arduino Micro Pinout

arduino_micro_pinout_ver1.PNG

2. LCD Display to microcontroller

3. Light Sensor Module

4. Moisture Sensor

5. Pressure, Temp + Humidity Sensor

6. Prototype Board

Soldering:

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.

img_4668
Running 5V Power Rail horizontally through Arduino pins

img_4669
Wiring and Soldering completed

img_4670
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

three-way-meter-data.PNG

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.

arduino_smart_gardening_part1.PNG

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.

block_diagram_ver1

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.

Engineering, Gardening

Smart Gardening #1: Study Data Science in Analog Way

EA033CA9-77A7-48AE-A55D-43606AA63FAB.jpeg

Three-way Meter which can be purchased at Amazon can let us measure (1) Moisture, (2) Light, and (3) pH of soil without any battery. Not sure about accuracy. I would like to use this analog meter as a starting point for smart gardening.

When it’s sunny, luminance level when up to 750.

When it’s sunny

From here on,  I would like to improve the backyard gardening system by taking measurements using my engineering skills and gardening experience and help grow plants efficiently and effectively.

Let’s start the journey begin.

Here is a picture of strawberries from the garden. This is the third year since I started growing strawberries. The number of strawberries is growing exponentially this year.

IMG_4276.JPG

Engineering

Engineering: Matlab Cheat sheet

Table of Contents

  1. General
    1. Student Account is cheaper
    2. Clear commands in Command Window = clc
    3. Clear variables in Workspace
      1. Clear all variables = clear all
      2. Clear variable a only = clear a
  2. Plot
  3. GUI
  4. File IO
  5. Waveform Generation
    1. Generate zeros
      • zeros([M , N ]) – M by N matrix of zeros
        • zeros ([1, 400])
    2. Generate ones
      • ones([1, 240 ])
    3. Combine waveforms (concatenate arrays)
      • cat( DIM, A, B)
        • Example: cat (2, y1, y2)
    4. Make a waveform into complex format
      • a = hilbert(y)
      • I_channel = real(a)
      • Q_channel = imag(a)