Things used in this project

Hardware components:
Pi 3 02
Raspberry Pi 3 Model B
OPTIONAL - Internet of Things - text messaging
×1
Ard nano
Arduino Nano R3
×2
Arduino Nano Expansion Shield
×2
DHT21/22 Temperature / Humidity sensor
may need a 10k resistor between Vcc/Data
×1
Photocell Module
×1
nRF24L01 2.4Ghz Wireless Radio Transceiver module
with or without SMA Antenna
×1
Dallas Temperature Sensor (for nutrient solution temperature)
probably needs a connector
×1
433MHz RF Transmitter & Receiver Modules
×1
set 3-5 pack of Wireless Controlled Outlets includes remote
×1
DFRobot LCD with buttons Shield for Arduino Uno
×1
Software apps and online services:
Ide web
Arduino IDE
Vs2015logo
Microsoft Visual Studio 2015
Hand tools and fabrication machines:
09507 01
Soldering iron (generic)

Schematics

Typical Growroom Environment
Intake and exhaust fans, grow lights, heaters, dehumidifiers, and pumps automatically controlled via wireless AC outlets
Hydro%20diagram%20final
common wirelessly controlled AC outlets
common wirelessly controlled AC outlets used in this project.
Fb42y24i8cw14s5.medium
hydroMazing Garden Controller and Monitoring System
Assembled and testing
Img 20151218 084100802 hdr%20(2)
hydroMazing prototype Web Interface
hydroMazing prototype Web Interface
Hydromazing%20live
hydroMazing Alert Notification
hydroMazing prototype web Interface for alert notifications.
Hydromazing%20alert

Code

Settings of objectsC/C++
The CoreSettings.h file contains many critical settings including the nRF network, the AC outlet remote switch codes, the Timer, Appliance, and Sensor object definitions used by the hydroMazing system.
/*
* @file CoreSettings.h
* Copyright (C) 2015 Cory J. Potter - All Rights Reserved
* You may use, distribute and modify this code under the
* terms of the LICENSE.txt
* NOT INTENDED FOR COMMERCIAL USE!
* You should have received a copy of the LICENSE.txt with
* this file. If not, please write to: <bitsandbots@gmail.com>
*/

#ifndef __CORESETTINGS_H__
#define __CORESETTINGS_H__

#ifdef ARDUINO

// RX_PIN 3 in use by Dallas Temperature Probe
#define RX_PIN 103
#define TONE_PIN 104
#define TX_PIN 8

// What is our address 1 or 2
uint8_t node_address = 1;
uint8_t totalNodes = 3;
unsigned long lastRxTimeStamp = 0;

const uint64_t nRFbaseAddress = 1034834473100;
uint8_t nRFaddress = 0; // 00 - 255

// NOTE: the "LL" at the end of the constant is "LongLong" type
// 1034834473185, 1034834473170
// const uint64_t tx_pipes[5] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL, 0xF0F0F0F141LL, 0xF0F0F0F1B0LL, 0xF0F0F0F1BBLL };
// const uint64_t rx_pipes[5] =  { 0xF0F0F0F22ALL, 0xF0F0F0F299LL, 0xF0F0F0F308LL, 0xF0F0F0F377LL, 0xF0F0F0F3E6LL };

// uint64_t tx_pipes[3] = { 0xF0F0F0F0E8LL, 0xF0F0F0F0E7LL, 0xF0F0F0F0E6LL };
// uint64_t rx_pipes[3] =  {0xF0F0F0F0E1LL, 0xF0F0F0F0E2LL, 0xF0F0F0F0E3LL };

uint64_t tx_pipes[3] =  { 0xF0F0F0F0F8LL, 0xF0F0F0F0F7LL, 0xF0F0F0F0F6LL };
uint64_t rx_pipes[3] =  { 0xF0F0F0F0F1LL, 0xF0F0F0F0F2LL, 0xF0F0F0F0F3LL };

/************************************************************************/
// Wirelessly Controlled Outlet Switches
/************************************************************************/
// ETEKCITY #1401
// unsigned long mySwitchOn[] = { 24, 1398067,1398211,1398531 };
// unsigned long mySwitchOff[] = { 24, 1398076,1398220,1398540 };
// ETEKCITY #1405
// unsigned long mySwitchOn[] = { 24,1135923,1136067,1136387 };
// unsigned long mySwitchOff[] = { 24,1135932,1136076,1136396 };
// ETEKCITY #1406
// unsigned long mySwitchOn[] = { 24,4281651,4281795,4282115 };
// unsigned long mySwitchOff[] = { 24,4281660,4281804,4282124 };
// ETEKCITY #1407
// unsigned long mySwitchOn[] = { 24,87347,87491,87811 };
// unsigned long mySwitchOff[] = { 24,87356,87500,87820 };
// ETEKCITY #1411
// unsigned long mySwitchOn[] = { 24,283955,284099,284419 };
// unsigned long mySwitchOff[] = { 24,283964,284108,284428 };
// ETEKCITY #1415
// unsigned long mySwitchOn[] = { 24,21811,21955,22275,23811,29955 };
// unsigned long mySwitchOff[] = { 24,21820,21964,22284,23820,29964 };
// ETEKCITY #1419
// unsigned long mySwitchOn[] = {24,333107,333251,333571,335107,341251};
// unsigned long mySwitchOff[] = {24,333116,333260,333580,335116,341260};
// ETEKCITY #0319
uint8_t totalSwitches = 5;
unsigned long mySwitchOn[] = {24,333107,333251,333571,335107,341251};
unsigned long mySwitchOff[] = {24,333116,333260,333580,335116,341260};

/************************************************************************/
/*	I2C Communications                                                  */
/************************************************************************/
const int MY_ADDRESS = 42;
const int SEND_TO_ADDRESS = 22;
/************************************************************************/
/*  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_Lcd 			= { TIMER_LCD, 12000UL, true, false, 0, &Timer_Log };
// Timer Timer_Lcd_Cycle 		= {	TIMER_LCD_CYCLE, 6000UL, true, false, 0, &Timer_Lcd };
// Timer Timer_Lcd_Scroller 	= { TIMER_LCD_SCROLLER, 500UL, true, false, 0, &Timer_Lcd_Cycle };
//Timer Timer_Ping			= { TIMER_SENSOR_READINGS, 10UL, true, false, 0, &Timer_Log };
//Timer Timer_Lite			= { TIMER_LITE, 180000UL, true, false, 0, &Timer_Ping };
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_Alerts			= { TIMER_ALERTS, 45000UL, true, false,  0, &Timer_Sensor_Read };
Timer Timer_rxData			= { TIMER_RX_DATA, 6000UL, true, false, 0, &Timer_Save_Settings };

/************************************************************************/
//  Initialize Appliances
/************************************************************************/
Appliance Appliance_Light_1		= {101, 1, APPLIANCE_LIGHT, DEFAULT_TIME, true, false, OFF, NULL };
// Appliance Appliance_Light_2		= {102, 0, APPLIANCE_LIGHT, DEFAULT_TIME, true, false, OFF, &Appliance_Light_1 };
// Appliance Appliance_Light_3		= {103, 0, APPLIANCE_LIGHT, DEFAULT_TIME, true, false, OFF, &Appliance_Light_2 };
Appliance Appliance_IntakeFan   = {104, 1, APPLIANCE_INTAKE_FAN, DEFAULT_TIME, true, false, OFF, &Appliance_Light_1 };
Appliance Appliance_ExhaustFan  = {103, 1, APPLIANCE_EXHAUST_FAN, DEFAULT_TIME, true, false, OFF, &Appliance_IntakeFan };
Appliance Appliance_Humidifier  = {102, 0, APPLIANCE_HUMIDIFIER, DEFAULT_TIME, true, false, OFF, &Appliance_ExhaustFan };
Appliance Appliance_Heater		= {101, 0, APPLIANCE_HEATER, DEFAULT_TIME, true, false, OFF, &Appliance_Humidifier };
//Appliance Appliance_AirPump		= {PIN4, 2, APPLIANCE_PUMP, DEFAULT_TIME, true, false, OFF,  &Appliance_Heater };
Appliance Appliance_FeedPump	= {105, 1, APPLIANCE_PUMP, DEFAULT_TIME, true, false, OFF,  &Appliance_Heater };
uint8_t totalAppliances = 6;

/************************************************************************/
// Initialize Sensors
/************************************************************************/
//Sensor: = { pin; node_address; SENSOR_TYPE; freq; minVal; maxVal; UL timestamp; float value; struct Sensor *next; }
// NULL for the first - We cannot point to an object hasn't been created yet.
Sensor Sensor_Photocell		= { PIN_A0, 1, SENSOR_PHOTO, 100, 50, 100, 0, 25, NULL };
Sensor Sensor_Temp			= { PIN7, 1, SENSOR_TEMPF, 50, 70, 80, 0, 75, &Sensor_Photocell };
Sensor Sensor_Humidity		= {PIN7, 1, SENSOR_HUMIDITY, 50, 40, 70, 0, 50, &Sensor_Temp };
Sensor Sensor_WaterTemp		= {PIN3_INT1, 1, SENSOR_WATER_TEMPF, 100, 50, 70, 0, 65, &Sensor_Humidity };
Sensor Sensor_Flow			= {PIN2_INT0, 2, SENSOR_FLOW, 100, 50, 50, 0, 75, &Sensor_WaterTemp };
//Sensor Sensor_Microphone	= {PIN_A1, 0, SENSOR_SOUND, 60, 10, 100, 0, 75, &Sensor_Flow };
//Sensor Sensor_Ultrasonic	= {PIN_A2, 0, SENSOR_ULTRASONIC, 60, 10, 100, 0, 75, &Sensor_Microphone };
//Sensor Sensor_PIR			= {PIN_A2, 0, SENSOR_PHOTO, 60, 10, 100, 0, 75, &Sensor_Microphone };
//Sensor Sensor_Moisture	= {PIN_A2, 0, SENSOR_MOISTURE, 60, 10, 100, 0, 75, &Sensor_Flow };
Sensor Sensor_Float			= {PIN_A2, 1, SENSOR_FLOAT, 100, 0, 1, 0, 1, &Sensor_Flow };
Sensor Sensor_Voltage		= {PIN1_TX, 1, SENSOR_VOLTAGE, 100, 0, 100, 0, 50, &Sensor_Float };
uint8_t totalSensors = 7;

/************************************************************************/
hydroMazing Garden Controller and Monitoring System
http://hydromazing.coreconduit.com/tech

Project logs

Raspberry Pi 3 Integration
Project log #1
On Sep 30, 2016 at 9:41 PM - 0 comments

At the advice of nearly every colleague, I've started working with the Raspberry Pi.  My reluctance to work with the pi stems from my desire to avoid tying any of my projects to the IoT (Internet of Things).  Nearly every IoT project requires a live Internet connection in order to even work!  Plants do not need the Internet to grow, and the Internet is not always available continuously everywhere in the  World.

With that said, Let's get back to the Raspberry Pi.  Over the years, I've been exposed to UNIX and then Linux environments through previous employers, so the Raspberry Pi's default Raspbian OS is familiar to me.  The challenge was to add communication with the nRF24L01 wireless radio transceivers that I've used for the hydroMazing Controller and the hydroMazing Monitor.  Using the amazing open-source libraries for RF24, I was able to port some of my Arduino C code to compile on the Raspberry Pi.  The biggest challenge I had was finding datatypes that both the Arduino and the Raspberry Pi would agree upon.  After much trial and error, I was able to get the program to write a few log files.  One for the sensors, appliances, and alerts.  Next, I wrote a Python script to read the directory for the alerts file and if it exists, read the file, parse out the pertinent information and then email or through SMS text the user.  Next, I wrote a PHP script to read the data object's from their respective files and display live on the Pi's Apache server.

Credits

12304022 10153676161523605 8007997367791050858 o
Cory Potter

Technical Craftsman specializing in bridging the gap between electronics and software engineering, with an alternative approach to problems.

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Biomed Shield for Arduino 101 Powered By Intel
Advanced
  • 269
  • 6

Work in progress

Allows students, educators, and hobbyists to learn about biomedicine by monitoring heart rate, temperature, and other physiological metrics.

Sweep 3D Scanner
Advanced
  • 2,041
  • 36

Work in progress

A complete hardware and software kit for creating full spherical 3D scans with a sweep scanning LiDAR sensor.

Sweep 3D Scanner

Team Scanse

Smart Monitoring System for Football Players
Advanced
  • 54
  • 2

Full instructions

This system identifies footballer's skills, performance & moves that are difficult to identify during play or training.

Caravaggio, a Drawing Machine
Advanced
  • 5,817
  • 40

Caravaggio is a drawing machine able to replicate a digital image using a pen and a continuous line.

Wolf: Search and  Rescue Multi-Terrain Robot
Advanced
  • 680
  • 10

Full instructions

Wolf is an IoT multi-terrain robot running on the Arduino 101 platform.

J.A.R.V.I.S. : A Virtual Home Assistant
Advanced
  • 108
  • 3

Full instructions

J.A.R.V.I.S. is a personal home automation assistant for controlling electrical home appliances integrated with an augmented reality app.

ProjectsCommunitiesContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login
Respect project
Feedback