Wifi Hydroponics Meter


1,913

Founded in 2005, Atlas Scientific specializes in building laboratory grade sensing equipment for ...

In this project, we will be making a wifi capable meter that measures pH, conductivity, and temperature using the Adafruit feather Huzzah Esp8266 module and sensors from Atlas Scientific. The data is uploaded to the ThingSpeak platform where monitoring and analysis can be performed. Additionally, the mobile application ThingView will be used to view sensor data.

MATERIALS

(The kit includes all the necessary components needed to build this meter. Some benefits of getting the kit: overall lower cost, no soldering required and the holes on the enclosure are pre-made. The option is also available to purchase the individual components which are listed below)

TOOLS

With the wifi hydroponics meter kit, only a Phillips-head screwdriver and glue gun with glue stick are required for assembly.

Otherwise, the following tools are needed to build the meter: drill, drill bits, drywall cutter bits, files, Phillips-head screwdriver, benchtop vise/clamp, band saw, glue gun and glue stick, soldering iron and solder, digital caliper, ruler.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Calibrate Sensors and Set to I2C Mode

1) Download and install Termite Emulator. It is a free RS232 terminal where serial commands can be entered and the circuit responses can be viewed.

2) Open termite. Click on the "Settings" tab, a new window called "Serial port settings" will be opened.

3) In "Serial port settings", make the following changes: select "Append CR" and set the baud rate to 9600. Make a note of the currently available com ports by clicking on the drop-down menu next to "Port". For example, COM3 and COM9 are listed. Click on the "ok" tab and close termite.

4) Connect the Adafruit module to your computer. Open termite and click on the "Settings" tab. Go to the "port" drop-down menu to view the newly available ports. For example: In addition to COM3 and COM9, there is now COM13. Select COM13, click on the "ok" tab and close termite. COM13 will be used for the Adafruit module.

5) Each sensor is calibrated separately. Assemble the Adafruit feather, carrier board, and pH sensor as shown in the wiring diagram above. Open termite and as a test send the command i which will return the device information. It is normal to receive an error response on the first try. Simply resend the command. Enabled continuous readings if it was not done. To do this send the command c,1 which will output a reading every second.

6) Calibrate the pH sensor. Refer to the following pH calibration procedure

7) Set the pH sensor to I2C mode: Once the calibration has been completed, send the command i2c,99 which will which set the protocol to I2C with device address 99.

8) Change the pH sensor to the EC. Keep the same Adafruit module and carrier board. Send the i command as a test and enable continuous readings with command c,1 if necessary.

9) Calibrate EC Sensor: Refer to the following EC calibration procedure

10) Set EC circuit to I2C: Once the calibration has been completed, send the command i2c,100 which will which set the protocol to I2C with device address 100.

11) Change the EC to the RTD sensor. Keep the same Adafruit module and carrier board. Send the i command as a test. Calibration of the RTD sensor is not required but verify that it is reading appropriately.

12) Set RTD circuit to I2C: Send the command i2c,102 which will set the protocol to I2C with device address 102.

Step 2: Prepare Enclosure

Safety: Remember to take care when handling tools/machinery and to wear proper safety gear such as goggles, gloves, and respirators.

There are two options that can be used to prepare the enclosure. These are by template or by dimensions.

Cut openings for BNC connectors and USB port (using the template)

1) Download and print the template from the following link: Wifi Hydroponics Meter Template. Cut out the templates from the paper.

2) Secure the front template onto the enclosure using tape. Be sure to align it properly with the edges.

3) Hold the enclosure in place with a clamp or vise. Drill pilot holes and then use a 12.7mm (1/2") drill bit to make the three circular openings.

4) Secure the back template onto the enclosure using tape. Be sure to align it properly with the edges.

5) Hold the enclosure in place with a clamp or vise. Drill a 3.2mm (1/8") pilot hole and then use the 3.2mm (1/8") drywall cutting bit to remove the material. File to appropriate size.

Cut openings for BNC connectors and USB port (using the dimensions)

1) Using the dimensions provided above, mark center points for the BNC holes (case front) and the outline for the USB port (case back).

2) Hold the enclosure in place with a clamp or vise. Drill pilot holes and then use a 12.7mm (1/2") drill bit to make the three circular openings.

3) For the USB port, drill a 3.2mm (1/8") pilot hole and then use the 3.2mm (1/8") drywall cutting bit to remove the material. File to appropriate size.

Step 3: Install Electronics in Housing

1) Apply some hot glue to the flange of the female side of the 90 degrees micro USB adapter.

2) Add the adapter to the enclosure. Be sure to orient it correctly so that it can plug into the Adafruit module.

3) Connect two jumper wires as shown. These are used to breakout the GND and 3V pins from one side of the breadboard to the other. Mount the Adafruit module onto the board.

4) Remove the patch that covers the sticky foam on the board's underside.

5) Plug the Adafruit module into the micro USB adapter.

6) Press the breadboard down firmly to secure.

7) Add the three carrier boards to the enclosure using the nuts to hold them in place.

Step 4: Wire Electronics Together

1) Plug the EZO RTD circuit into the non-isolated carrier board while the EZO pH and EC goes into the isolated boards.

2) Connect the components as shown in the wiring diagram above.

Isolation

The sensitivity of the pH and EC circuits give them their accuracy but also makes them susceptible to interference from other electronics including other sensors. The isolated carrier boards offer the necessary protection.

Temperature Compensation

Changes in temperature have an impact on pH and conductivity and by compensating for it, we are ensuring that our readings are what they supposed to be at that specific temperature. This meter has automatic temperature compensation where the readings from the RTD temp sensor are used to compensate the other two parameters (pH and conductivity/salinity).

Datasheets

Circuits: EZO pH, EZO EC, EZO RTD

Probes: pH, K1.0 conductivity, pt-1000

Step 5: Finalize Assembly

After the wiring has been completed:

1) Insert the rubber gasket into the lip of the enclosure's cover.

2) Put on the cover using the provided screws.

3) Connect the probes to their respective BNC connector.

Step 6: Create ThingSpeak Account

ThingSpeak is an IoT platform that allows users to collect, store and analyze data remotely. It is integrated with MATLAB/MathWorks which helps with data visualizations and analysis. Data are stored within the fields in what are known as channels. Each channel has eight fields. Data from eight different sensors, for example, can be logged. We will only be using three of the fields.

For more information, refer to the following: ThingSpeak website, ThingSpeak Q&A

1) Go to the ThingSpeak website.

2) Click on "Sign Up". A page is opened to create a MathWorks account. Enter credentials and click "Continue". If you already have a MathWorks account click on "Sign In".

3) An email will be sent for verification. Once confirmed, return to the Thingspeak page and click "Continue"

4) Create a User ID and Password. Check the "Online Services Agreement" box and click "Continue"

5) On the sign-up successful page, click"OK"

6) Finally, there will be a pop-menu asking about the intended usage. Select your option and click "OK"

Step 7: Create a ThingSpeak Channel for Data Upload

1) Select "New Channel"

2a) Fill in description. To keep it simple we will just fill a few areas.

Enter Name as "Atlas Sensors",

Check the box and enter Field 1 as "pH",

Check the box and enter Field 2 as "EC (μS/cm)"

Check the box and enter Field 3 as "Temp (°C)"

2b) Click on "Save Channel". A dashboard will open with three charts. Each chart can then be edited individually.

3a) Add some numerical displays to show the pH, EC and temp readings. To do this select "Add Widgets" then "Numerical Display" and click on "Next". Fill in the required information and click "Create". Repeat this for the three fields.

3b) Finally, drag the widgets and place them side by side with the corresponding graphs.

Step 8: Pre- Programming Requirements

Wifi Login and ThingSpeak Credentials
1) Have the service set identifier (SSID)/ name and password for your wifi network on hand.

2) In order to upload data to ThingSpeak, the Channel ID and Write API Key are needed. Go to your ThingSpeak account. In the "Atlas Sensors" channel, click on "API Keys" and note the "Channel ID" and "Write API Key".

Libraries

The code for this project makes use of customized libraries and header files. They need to be added to the Arduino IDE before the code can be used. The IDE can be downloaded from this LINK.

1) Add ESP8266 library

In the IDE go to File -> Preferences -> Additional Boards Manager URLs. Enter the URL (http://arduino.esp8266.com/stable/package_esp8266com_index.json) and click "OK".

In the IDE go to Sketch -> Include library -> Manage libraries. In the search bar of the Library Manager enter "esp8266". Look for the package titled "ESP8266". Select the package and click on install.

2) Add ESP8266 Wifi library

In the IDE go to Sketch -> Include library -> Manage libraries. In the search bar of the Library Manager enter "esp8266wifi". Look for the package titled "ESP8266WiFi". It may or may not be installed. If not, select the package and click on install.

3) Add ThingSpeak library

Download the zip file, ThingSpeak-1.5.0 onto your computer. In the IDE go to Sketch -> Include library -> Add .ZIP Library. Locate the zip file and select to add.

4) Add EZO_I2C library

Download the zip file, EZO_I2c_lib onto your computer. In the IDE go to Sketch -> Include library -> Add .ZIP Library. Locate the zip file and select to add.

Step 9: Load Program Onto Adafruit Module

1) Connect the wifi meter to the computer through USB.

In the Arduino IDE:

- Go to Tools -> Board -> select "Adafruit HUZZAH ESP8266".

- Tools -> Flash size -> select "4M (3M SPIFFS)"

- Tools -> CPU Frequency -> select "80MHz"

- Tools -> Upload Speed -> select "115200"

- Tools -> Port -> select the port where the Adafruit module is connected

2) Access the sample code from the following: Wifi Hydroponics Meter Code. Copy the code onto the IDE work panel.

3) In the code, add your wifi name, password, ThingSpeak channel ID and ThingSpeak write API key.

4) Compile and upload the code. Messages, as well as sensor data, can be viewed on the serial monitor. To open the serial monitor, go to Tools -> Serial Monitor or press Ctrl+Shift+M on your keyboard. Set the baud rate to 9600 and select "Carriage return".

Data should now be uploading to ThingSpeak.

Note: The upload rate is set to every 15 seconds. The adjustment for a longer upload period can be made within the wifi hydroponics meter code. However, less than 15 seconds may result in errors with no data upload.

Step 10: Mount Meter to Hydroponics Setup and Monitor/Analyze Data on ThingSpeak

The meter was installed on our hydroponics testbed where we are growing corn.

The computer screenshot shows data from the sensor in both graphical and numerical format.

Step 11: Install ThingView App on Mobile Device

The ThingView app is available for free or purchased download on Andriod or IOS. It will allow the user to view the sensor data on mobile devices. To access ThingSpeak through the app the "Channel ID" and "Write API Key" are needed.

On your mobile device, go to the app store. Search for "ThingView". Download and install "ThingView - ThingSpeak viewer".

1) Open the app. Choose the icon to add a channel.

2) Enter "Channel ID", uncheck the "Public" box and enter the write API key. Click "Search"

3) The channel titled "Atlas Sensors" should show up. Click "Done". The channel has been added.

4) On the app's home page, select "Atlas Sensors"

5) View data.

Be the First to Share

    Recommendations

    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    Discussions