Operating the Electronics

(Week 3)

Many of the electronics in this project are from past senior design projects. This milestone tests each electronic piece to evaluate its functionality. Each tested electronic is shown below and is supplied with a video or picture displaying its functionality.

Table of Contents

Arduino Mega Board

The Arduino Mega is a microcontroller board with digital input/output pins, analog input pins, a USB connection, I2C connections, and a reset button. The team was able to successfully connect to the Mega board. 

Coding/Circuit Set Up

The Arduino Mega is connected to the computer through a USB cable. The green light seen on the board displays the Mega powered on successfully. When opening the Arduino IDE coding program, select the COM port that connects to the Mega to upload code to the board. 

Ph, EC, Temp sensors working

Circuit Diagram Via Atlas Scientific 

EC, pH, and Temperature Circuit Boards/Probes

The EC (green), pH (red), and temperature (black) sensors are connected to their respective circuit boards, which are powered through a Whiteboard device connected to a Raspberry Pi. Each circuit board displays a blue light when connected. The Raspberry Pi will be replaced with an Arduino Mega and a new, Arduino-friendly Whiteboard will be purchased.  Without the Arduino Whiteboard, we cannot connect the sensors to the Arduino board, but each piece worked when using a temporary Raspberry Pi.  

Coding/Circuit Set Up

When the code is uploaded and each probe is placed into the water bin, all three sensors registered values that were expected. The display screen below shows each board taking new readings and outputting them to the user. 

Below are the Arduino code files for the sensors:

pH Sensor Sample Code (I2C)
EC Sensor Sample Code (I2C)
Temperature Sensor Sample Code (I2C)
CO2 Board Getting Readings.MOV
CO2 Sensor W Battery Readings.MOV

CO2 Sensor 

The CO2 sensor is connected directly to the Arduino Mega board. This device was not accurate, providing the team with readings of CO2 as high as 9500 ppm (which is above the 420 ppm level that was expected). Efforts to recalibrate and change the code for the sensor were made, but it could not be fixed. The team is currently looking into purchasing a new CO2 sensor.

Coding/Circuit Set Up

The CO2 sensor has three connection wires: power (red), ground (black), and an analog input (blue). When wiring to an Arduino, the code is set up to connect the blue wire to analog pin A0. This can be changed in the code if needed. The sensor has a three-minute warm-up phase and will display readings in the Serial Monitor in Arduino IDE. An image of CO2 readings was taken after these three minutes, yet the results were still higher than expected. This sensor was likely damaged and needs to be replaced. 

Below is the Arduino code file for the sensor:

CO2 Sensor Sample Code (I2C)
Humidity Temp Sensor Working.mov

Humidity/Temperature Sensor Board

The humidity and temperature sensor is connected directly to the Arduino Board. Once the code was running, this sensor returned the expected temperature and humidity values.

Coding/Circuit Set Up

The humidity and temperature sensor has four connections to an Arduino board: power (Vin to 5V), ground (GND to GND), a SCL connection (SCL to digital pin 21), and a SDA connection (SDA to digital pin 20). When wired and the code is uploaded, open the Serial Monitor in Arduino IDE to view the relative humidity and temperature of the room. Both values were in an acceptable range for the room the team tested in. 

Below is the Arduino code file for the sensor:

Humidity Sensor Sample Code (I2C)
Blue Peristaltic Working.mov
Green Peristaltic Working.mov
Yellow Peristaltic Working.MOV

Circuit Diagram Via Atlas Scientific 

Peristaltic Pumps

The peristaltic pumps will be used to move a specific amount of pH formula and/or nutrient solution into the tank when needed. The pumps are connected to a wall outlet and an Arduino board. Once the code was running, the pumps moved the testing water into and out of the tank at accurate amounts. 

Coding/Circuit Set Up

The pumps have two different connections: a power connection and a wired connection to a microcontroller. The power connection is plug-in operational. The wired connection includes five wires. Four are used to connect to the microcontroller using I2C. When wired and coded, open the Serial Monitor in Arduino IDE. A list of commands can be used to operate the pump by typing in the command window. The commands are included in the code file. 

Below is the Arduino code file for the pumps:

Peristaltic Pump Sample Code (I2C)
Water Pump Working.mov

Water Pump

The water pump will move the water from the tank to the pipe holding the plants. 

Coding/Circuit Set Up

The pump is plug-in operational and will either be connected to the microcontroller with a relay or directly plugged into a 120V outlet as the pump is to run continuously in the system. 

There is no code for the pump at this moment. 

LED Lights

The project has two LED lights to supply plants with a sunlight replacement.  

Coding/Circuit Set Up

These lights are plug-in operational. The light connection wire will be altered so the lights can be connected to a relay and controlled by the microcontroller. 

There is no code for the lights at this moment. 

Relay1 Working.MOV
Relay2 W Multimeter.MOV

Relays

Relays are switches that open or close a circuit connection by using an electronic component without mechanical operation. Relays are mainly used to convert a small electrical input into a high-current output, or vice versa. The relays will allow the projects' high voltage/current components to be connected and controlled by the microcontroller. These components are the lights, water pump, and fan. Two of the four relays were able to be manually operated by the team. 

Coding/Circuit Set Up

To test the relays, a battery pack was connected to one side of the relay and the switch within the relay was manually opened and closed. When closed, the relay made a clicking sound and a red light turned on. A multimeter was connected to view the relay's switch opening and closing. 

Below is an example of how to wire the relay:

Which Components Work?

Do the items work?

Further Testing

Some electronics for the hydroponics system were tested at a later time due to getting the items at a later date. When acquired, the components were tested using the Arduino Mega and the associated I2C functioning code. Below are the tested components.

New Whiteboard with Sensors.MOV

Connecting the Whiteboard to the Arduino Mega Via Atlas Scientific 

Arduino Whiteboard

With the new Arduino Whiteboard, the EC (green), pH (red), and temperature (black) sensors can be connected to the Arduino Mega board. The whiteboard allowed each sensor and probe to successfully connect to the Arduino Mega, displaying a blue light

Coding/Circuit Set Up

When the code is uploaded and each probe is placed into the water bin, all three sensors display values that were expected. Each sensor displays its readings in the Arduino IDE Serial Monitor. 

The Arduino code files can be found above in the EC, pH, and Temperature Sensors/Probes.

Fan Video.mov

Fan

A fan will be connected to the hydroponics system to move air in and out of the system. This will filter out oxygen gas and filter in CO2 while helping regulate the temperature and humidity of the system. 

Coding/Circuit Set Up

The fan is plug-in operational. The fan connection wire will be altered so the fan can be connected to a relay and controlled by the microcontroller. 

There is no code for the fan at this moment. 

Co2, Temp, and Humidity Video.mov

New CO2/Temperature/Humidity Sensor

The CO2, temperature, and humidity sensor is connected directly to the Arduino Board. Once the code was running, this sensor returned the expected CO2, temperature, and humidity values.

Coding/Circuit Set Up

The CO2, temperature, and humidity sensor has four connections to an Arduino board: power (red wire to 5V), ground (black wire to GND), a SCL connection (yellow wire to digital pin 21), and a SDA connection (blue wire to digital pin 20). When wired and the code is uploaded, open the Serial Monitor in Arduino IDE to view the CO2, relative humidity, and temperature of the room. All values were in an acceptable range for the room the team tested in. 

Below is the Arduino code file for the sensor:

CO2, Temperature, and Humidity Sensor Sample Code (I2C)
LCD Working.mov

LCD Screen

The LCD screen will display the sensor readings taken within the system. The LCD is connected directly to the Arduino Board using an I2C connection

Coding/Circuit Set Up

The LCD Screen has four connections to an Arduino board: a VCC (power), GND, SDA, and SCL. When wired and the code is uploaded, messages should display on the LCD Screen. The backlight of the LCD screen may be too bright to see the messages. If so, take a small screwdriver to turn the blue potentiometer on the back of the LCD. This will increase and decrease the brightness of the backlight. Adjust the backlight until the message is viewable on the LCD Screen.

 Below is the Arduino code file for the LCD:

Code for LCD