Hydroplant Subsystems – Week 8


Welcome back, this week has been more testing and debugging. We all have together assembled new floor. Here is some pictures and videos from last week:

More pictures and video will come in the following weeks!

Shahin Ostadahmadi

This week has been more testing of the system, fixing some small errors and bugs. I have also discussed different solutions with Aditi, Theo, and Ivan for different problems. We have together tested plant-information-node. We also had some problem with one of our Relay Module, i tested with turning lights as we have tested before, but Ivan found the problem and we had to get a new Relay.

Testing Water-node

Made water-node ready for testing, creating objects and making some tests. After Ivan assembled all the electronics, we tested waterpumps, circulation pumps, and airpump for all the stages, and also looked for water leakages in our pipes. You can see the video above.

Snap on command

This week i have worked on this requirements:

  1. Must be able to capture images both day and night and send image data

I have implemented snap-on-command which 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 a video feed endpoint for streaming.

I have tested it and it works fine both for taking picture and streaming video. However, we ran into some hardware problems, we wanted to use one of our raspberry pi but, since we are using Ubuntu servers, we did not have an interface for raspberry pi camera. Next step is to find the right hardware to mount the camera to it.

New floor

We have started to build a new floor! This week we all have done mechanical work, we assembled part of the seecound floor together most of the friday. Pictures is above.

Commits

Only members of the organization can see these commits.

All commits for snap-on-command:

https://github.com/hydroplantno/snap-on-command/commits/main

Other commits:
https://github.com/hydroplantno/gui-node/commit/91dcf498f68e6f6a0cd4ce07a5a6c785bd88a700

https://github.com/hydroplantno/gui-node/commit/91dcf498f68e6f6a0cd4ce07a5a6c785bd88a700

https://github.com/hydroplantno/water-node/commit/261eb7730861ab36f7fc7e2d6f1ad72cbad1087c

https://github.com/hydroplantno/climate-node/commit/1c5b307e866b4faf051c434a454d7e5e6aac2ac3

https://github.com/hydroplantno/library/commit/e1de366693d46d3628c61a877470430337f51294

Oscar Melby

Testing node

Refactored testing node a bit to make it more readable and easy to work with. Still not completely how I want it, but good enough. Have been used a lot this week for testing the moving logic etc.

Master-controller

Debugged a bit regarding master-controller sending GUI topics twice, which would make the devices pop up multiple times in the GUI (add 1 entry per node restart). This was only an issue for the nodes which also sent logic controllers.

Also, fixed a bug which had to do with unique topics. If a node had a logic controller, it would give the wrong “unique id” which master-controller uses to keep track of states and such. This was due to logic controllers not being “stage-specific”, they were “global” for the whole node which would make the unique id wrong.

Made logging a bit better to read through afterwards when debugging.

Snap-on-command node

Shahin had implemented a video_feed and MQTT interaction with this node so he could turn the stream on and off via MQTT and also take pictures which gets saved locally. We tested a HQ camera for the Raspberry Pi, but turns out since we run Ubutnu ARM64 on our Pi we can’t interact with the PiCam (think it has to do with 32-bit and 64-bit pointers or something, essentially there is no driver for ARM64). We want to be able to run MongoDB and Docker, hence we use the Ubuntu distro. We then got started setting up a new Pi with Raspbian, but after a lot of tries gave up. Pi would post, but only for a few seconds before not giving any signal over HDMI. So we have yet to test the PiCam with Shahin’s code, but should be fairly straight-forward as it’s working on Shahin’s laptop using the built-in cam.

This week we tested everything we could test together and was really helpful to uncover bugs and other issues. We tested water circulation, water pumps, “plant moving configuration”, “plant mover moving” to specific stages and communication with GUI through master-controller.

Going forward we soon need to tackle the autonomy logic, I’ve already set up, tested some small parts and made this ready, but there is A LOT of logic we have to implement. This includes among other things: algorithm for moving plant holders (those in-front needs to move first, but only if ready, make place for new ones and keep track of everything), plant information logic (take pictures of plants, keep track of them and decide if they need to move or not), turning on and off lights depending on time of day (already implemented, but needs more testing), turning the water off before moving and also on again after moved (also need to wait before moving so the water has time to empty) and probably more things I’ve forgot.

Another thing we need to add is configuring through the GUI for specific sensors. Would also be neat to be able to skip the configuration part of plant mover, but this is a Z-requirement.

Commits

Only members of the organization can see these commits.

https://github.com/hydroplantno/master-controller/commit/7e28e9581e58ce022e1868ddb706b5ca530f46b0Connect your Github account

https://github.com/hydroplantno/testing-node/commit/56c22895b172bbc82cf09caa64e64024b6a49365Connect your Github account

Aditi Deshpande

On Wednesday I started working on the plantinformation.node.run() function. This function is a switch state function as the plant information node is a state machine. The updated state machine diagram is shown here, the cases in CAPITAL are the states in the function:

So I had some problems trying to figure out the logic so I tried testing it with Arduino buttons as switches and the physical element helped a lot in trying to code. The code worked fine with buttons but after testing it with the system on Thursday it did not work as planned. The mover was off by a lot. I figured this had something to do with the calibrate function, which stops a few stops before row 6 and registers the current switch as 6. But when it should go forward, it activates switch number 6 AGAIN as it has stopped before 6. So Shahin and I figured out that I should have a calculate state where I analyze whether the stepper should go forward or backward, and set the current switch backward by one when it has to move forward but do nothing while backward as the switch count is correct.

This helped but the mover was still off by one step. Shahin and I debugged and found out that after calibrating and placing itself in the middle, the row switch is never set to false, and of course, the go state registers this as the switch being activated when it is not. After doing this, the mover worked pretty well. We could get the master controller or the GUI to send a command and the mover moved to the right place.

On Friday, I set out to make the calibrate function also a state and make it the default state which sets the state to idle after being done. I got this to work not without encountering some problems( problems are very stubborn, they refuse to disappear :cry: ). I also helped the group in building the second floor, which Shahin has talked about. After this, I worked on testing the mover and counting the steps which is important. The mover worked perfectly sometimes, but suddenly it was off by one. I was really frustrated because if it is off by one the entire operation has failed because that offset will ruin the entire operation. I am trying different solutions now and my main goal in the coming week is to have a functioning prototype that works perfectly!!! Anyhoo, here is a video where the mover worked perfectly from the GUI command :

  1. latest update

https://github.com/hydroplantno/plant-information-node/commit/e1730fb1eee2bee87eb8051c9ad7a9971ec8fb94Connect your Github account

  1. First prototype

https://github.com/hydroplantno/plant-information-node/commit/0070854fd5fdd2fc5d284c0c6b5fbc6fef774779Connect your Github account

Theo Magnor

Aditi got the calibrate function working, so i have spent time working with her to understand and make the changes necessary for the function to work as intended on the plantMover. I also had some nasty problems with compiling that took way to long to fix. After the problems where resolved, i started testing the calibrate function and the moveToRow function, and making changes based on the tests. On friday we started building the second floor of the system, it felt good to do some physical work on the project as most of the work is done on the computer!

Next week:
Work on moveToRow function and communication with main controller, when the plantMover arrives at a row it should give receipt to the main controller.

Here is a commit showing the latest changes:
https://github.com/hydroplantno/plant-mover-node/commit/c6630c68ce43d495215ddf208e893729940a25c3Connect your Github account

Ivan Bergmann Maronsson

This week I finished up most of the wiring for all of the electronics on the first floor. And fixed certain problems that I overlooked, This being that I needed to implement “Flyback diodes” to all of the relays that we are using. Other then that, some cables where shortened, and most other cables where moved around so that they don’t look out of place. And “Name-tags” were added to most of the electrical plugs we use, so that it would be easier to recognize what, was given power.


Leave a Reply