270r Final Project

From CSclasswiki
Jump to: navigation, search
Leaf Logo (My son Quinton designed this for me)

Proposal

Automated Indoor Garden - Raspberry Pi and Arduino

Overview

The goal of this project is to create an automated plant growing system. My project will contain six parts:

Part One: I will connect the 64-LED matrix to the Arduino and program it to make it display the leaf logo.
Part Two: Connect the temperature and humidity sensor to the Arduino using i2c communication.
Part Three: Have the results of the sensor display on the LED-matrix.
Part Four: Connect and communicate to the Analytical Surver Electrode, which is a Ph sensor, and the salinity sensor, which a friend created.
Part Five: Display on the LED-matrix on a web page or Twitter through the Raspberry Pi.
Part Six: Control a motor that dispenses water. (Unlikely, but would love to do this.)

My Plan

  1. Gather the necessary materials.
  2. Connect 64-LED matrix and write a sketch to control it.
  3. Learn i2c
  4. Link Raspberry Pi to Arduino
  5. Find the ids for the sensors for i2c
  6. Document progress by taking photos/videos and updating the wiki page.

The Project

Materials

  • Raspberry Pi
  • Arduino Mega 2560
  • 64-LED Matrix display
  • temperature and humidity sensor
  • Ph sensor
  • Salinity sensor
  • Breadboard
  • Wires
  • ...

Part One: 64-LED Matrix

Implemented leaf logo on the 8x8 Matrix controlled by the Arduino. The sketch (program to control the Arduino) and a photo are below.

Leaf8x8.JPG

Here is the Fritzing Diagram:

Fritzing Pins

Code

// LeafMatrix
// Wendy Joy
// Uses an Arduino to display a leaf graphic on an 8x8 Matrix

#include <LedControl.h>

int DIN 12;
int CS = 11;
int CLK = 10;
byte leaf[8] = {0x3B, 0x7C, 0xF6, 0xEE, 0xDE, 0xBC, 0xF8, 0x80};

LedControl lc=LedControl(DIN, CLK, CS, 0);

void setup() {
lc.shutdown (0, false);
lc.setIntensity (0, 15);
lc.clearDisplay(0);
}

void loop() {
printByte (leaf);
}


Part Two: Adding Temperature and Humidity Sensor

Implemented i2c where a Raspberry Pi is master and an Arduino is slave. The sketch (Arduino slave code) and Raspberry Pi code are below.

Fritzing Pins

Fritzing Pins

Fritzing Pins Fritzing Pins

Part Three: Display Sensor on 64-LED

Part Four: Adding Ph and Salinity Sensors

Part Five: Output Web/Twitter and the 8x8 Matrix

Part Six: Water Dispensing

Progress Log

April 26th 2020: Implemented leaf logo on the 8x8 Matrix controlled by the Arduino.

Images

References