Hydroplant Subsystems – Last Blog


Enjoy the Hydroplant demo

Documentation for all our code and links are now available here:

Shahin Ostadahmadi

  • This week i have been testing the system over and over again. I have also tested nutrition controller and was able to detect most of the bugs. The software follows correct logic, but the test could not be finalized be cause of the valves; they do not open enough to get enough water flow, and this is problem because we have 3 reservoirs and we have to be able to correctly route the water flow. The new valves have arrived and we have to buy some connectors next week.
  • Implemented some new pages on GUI for future development with fictional data
  • Updated doxygen documentation for all the system parts i have worked with.
  • Updated the website to host all the documentations and GitHub links for our repositories.
  • Sat up the project room ready for demonstration with the team.

Since it is last week, i would like to summerize what i have worked with during the semester.

Development


1

GUI

Responsible for an interface to control the system manually through a graphical user interface. You can control actuators, logic controllers, see logging from the system, picture from plant scanner, and much more!


2

Micro controller library

The main Hydroplant library with built in communication protocols, task management, base classes for logic controllers and other classes for actuators and sensors.


3

Snap-on-command

Provides interface for taking picture, analyze pixels and send back the information to the commander. It provides also a page for streaming live video feed. It can also do both at the same time.


4

Nutrition controller

A centralized regulation box for regulating nutrition and pH level for all the stages in one place. It regulating each stage at a time and ensures to log each log data for each stage when regulating.

Hydroplant

Hydroplant Library

Introduction

The library offers tools for building scalable vertical farming systems, focusing on multiple floors. Key components include:

  1. Nodes: These are user-defined logic controllers like the Nutrition Controller, Plant Mover, and Plant Information Node.
  2. Core Functionalities: These include sensor reading (logging measurements at intervals), a PID regulator (maintaining target values with sensors and actuators), and defining actuators’ actions.
  3. Communication: The library uses MQTT for communication within the network. It allows devices to connect with a Master Controller, providing details about sensors, actuators, and logic controllers. Each entity gets dynamic addresses for commands, logs, and receipts.
  4. CommunicationHandler: This class handles entity initialization, network and MQTT setup, topic creation, and task management (like queuing and processing commands). It ensures continuous connectivity with the network and MQTT Broker.

Use cases

In the diagram bellow you can see how the Nutrition Controller uses the Library functionalities for nutrition regulation.


How Plant mover and information node uses the library

Hydroplant

GUI

Features

The application is designed using the Model-View-Controller (MVC) pattern. It includes a custom container that manages information about the system. This container dynamically creates and removes objects based on information from Master Controller. Additionally, this setup ensures that the state and information of objects are kept consistent and synchronized with the physical system.

The front-end uses this information to create visual elements for the user.

Custom container

All pages on GUI

The pages on Left, right and top is static, while the page in the middle is a swipe view where you can swipe between different pages. The log section is connected to the system and any node can log with different levels (INFO, WARNING; and ERROR). The GUI will also show different colors based on log level.

Floor control

The is the main page where the visual elements is dynamically allocated/deallocated based on information the GUI receives about the system from Master Controller. You can control and send commands to the connected controllers and actuators.

MQTT testing

This page is to send JSON messaged manually to a desired topic. It is mainly used for testing the system manually.

Image show

This page regularly fetches the last image from our image analyzer.

Plant overview

This screenshot illustrates a prototype GUI designed for displaying plant information. The interface showcases fictional data.

Configuration

This is also a prototype with fictional data for future development. It is designed to advance system configuration for many variables for different floors, stages, and regulators.

Reservoir overview

This is also a prototype with fictional data. Like the other pages, it follows the MVC (Model-View-Controller) pattern and can display data based on a model or container.

Hydroplant

Snap-on-command

Snap-on-command is a utility designed to interface with a camera device and perform specific actions based on MQTT commands.

It’s capable of capturing pictures, saving them locally, and optionally sending them to another location for further analysis. Moreover, it provides video feed endpoint for streaming and last image taken.

It analyzes the picture with pixel manipulation and decides which stage the plant should be, and sending back the information to the sender.

Oscar Melby

What was done this week

This week I’ve made some last changes to master-controller to make for a more interesting demo video. Such as handling receipts from plant-mover and queuing certain jobs when starting up. I’ve also updated and written more documentation which is now available here: https://hydroplant.no/docs/

I also set up static IP addresses for our camera and master-controller PIs on our new router. Noticed this after rebooting camera PI it had changed IP which is annoying when SSH’ing.

Also edited the demo video.

Commits

https://github.com/hydroplantno/master-controller/commit/67673437d09fac542175bcc7d11d58a6cf27a013

https://github.com/hydroplantno/master-controller/commit/70424b30f7371d8c3475eab689ca5de0f72bcf0a

Aditi Deshpande

Summing up everything I have done this semester:

This week, I have been touching up and perfecting the Plant Information Node. As you may remember from last week, I wanted to perfect the amount of steps the PIN was taking, as it was off by a little bit. So that was what I was focused upon this week. The plant mover sends the number of steps it takes to get to each switch (aka plant-holder) to the master controller. Instead of relaying that info from master to PIN, I just took it directly from Theo, which is not how it can be in the end, but I figure it is not hard to get that into place. So, this was what I got:

Steps and switch numbers

This first column represents the switch/row number, the second represents the number of steps the motor takes in absolute values, i.e. the amount of steps it takes to reach a row from all the way at the start. The last column shows the amount of steps it takes it relative to the previous switch. The last column was what I would be working with. The next thing I needed to figure out was to measure the physical distance between each row in the plant mover and the plant info node. This was what I got:

The distance is in cm

The only thing left to do was to divide the steps by the distance for plant mover, then I would have the steps needed to move one centimeter, and I could take the average of that:

Steps for 1 cm

As you can clearly see there was a problem. The ratios were way too different. Therefore, in addition to calculating the steps with the average, I calculated it for individual ratios for *each* place. There is maybe a better way to do this, but in my mind this made sense for now. So, I multiplied the distances from PIN with the average number of steps and the individual ratios. And this was the result:

Steps for PIN(in C++ the numbers are casted to ints)

So, I just needed to test this. The steps with the average didn’t work as well, and the individual ratios worked better but still not perfect. So, I tried to calibrate the distance and steps until we had something close to perfect. I ended up going with the individual ratios.

Dev branch commit number 1:

https://github.com/hydroplantno/plant-information-node/commit/9c7148aea87d291157f694c8ffe4312006643744

Dev branch commit number 2:

https://github.com/hydroplantno/plant-information-node/commit/4104c5902412c3f8e792dc57ca37c70b889cb5a5

Main branch(after pull request):

https://github.com/hydroplantno/plant-information-node/commit/cae930c01f0d9f941f5bdab9784a807fea45f492

Theo Magnor

After several weeks of coding, testing, and iteration, my journey in creating the logic for moving plant rows using a servo comes to an insightful conclusion.

Overview
My task in this project has been creating code for the plant mover, which is an essential part of the hydroplant system. The plant movers job is to move rows of plants from a to b, on command form the GUI or autonomy. It moves back and forth under the rows using a servo, and has a switch that is activated when it moves under each row, which is used to keep track of its current row. In the front and end of the plant movers movement range, there are two switches. These are used during calibration to tell the mover that it has reach the front and end.

When the plant mover starts, it goes right into calibration, this is a key part of the plant movers functionality, as the data it gathers is used during its movement. During calibration it counts the number of rows and the steps used to move to each of them, this data is sent to master controller and information node for later use.

After calibration, the mover goes into idle mode, waiting for instructions. When it receives instructions it will be through a command in the MQTT interface, the command will include the action the mover should take, this could be moving a row from 5 to 6. These values are stored and the correct switch case is initiated, running the function moveRowFromTo(from, to). When the function is done, a receipt will be sent back to master.

This diagram describes the logic of moving a row from a to b.

Arm switches and attach switch
The plant mover also has switches for detecting if the arm is raised or lowered, and if it is attached to a row. These would be used to give the master controller a better view of where in the process the mover is. Before calibration, the switches would also be used to check if the arm is lowered. Due to limited pins on the Arduino we needed a interface for reading multiple switch values to the Arduino. Ivan did make a shift register for this, which I tried to implement, but I could not get it to read multiple switches at the same time, which was essential for the logic to work. Due to this and limited time we decided to not use them for now, as the mover still can preform its main functionality without these switches.

What I have learned

Testing
Coding for a physical system has bean quite an adventure, unlike the predictable environment of digital space, the real world adds layers of complexity. This project was no exception, as the biggest hurdle wasn’t writing the code, but testing it with the plant rows, ensuring every movement was precise. In retrospect, testing was a tedious but essential part of the progress, shaping the path from a concept to a functioning system.

Communication
Communication is the foundation of group activities, it allows for coordinating actions, sharing information and achieving common goals. This is something I have been aware of for a long time, but in this project it was really shown to me the importance of communication, and how good communication is essential in complex projects that require integration of various components made by different team members. Effective communication ensures that all parts of the project are compatible and work together seamlessly. Projects can be stressful, but when team members communicate well, and build each other up, working together on the project becomes a joy. And with high morale and a strong team spirit, each setback becomes a learning opportunity, and every success is a shared victory, driving the project forward towards its ultimate goal.

Link to plant mover node on github:
https://github.com/hydroplantno/plant-mover-node

Ivan Bergmann Maronsson

This week:

This week I figured out that the JST connectors that I have added to my PCB are a bit larger than the JST connectors originally on the sensors/pumps. This is an oversight on my part. I should have paid more attention to the dimensions of the components that I already have, and the components I was ordering. This might cause some issues, but can and will be worked around.

The problem can be seen on the board below, where the white components, also known as JST Male Connectors, are slightly wider, than what the sensors and pumps have in our initial system.

I lengthened some cables as well so that tests were able to be done with the mix pumps in each container.
I also tested the SN74HC595n to see if the ICs worked like how I intended. This lead to a small panic, where the datasheet for the IC I was testing, was different than the datasheet for the component we received. After some time, I was able to deduce that, the datasheets were the same, just written differently. And connecting the ICs, gave the same results as when I simulated the IC.
I added my entire PCB design from ORCAD to GitHub.
Now we are currently waiting for the PCB after some delays, and should be coming this Monday.

Here are my PCB files for this project:

https://github.com/hydroplantno/Water-Node_1.0/commit/dc89af421357a03ab102549f051126413ff3136f


Leave a Reply