{"id":7961,"date":"2023-10-09T08:06:56","date_gmt":"2023-10-09T07:06:56","guid":{"rendered":"https:\/\/dronesonen.usn.no\/?p=7961"},"modified":"2023-10-09T08:17:17","modified_gmt":"2023-10-09T07:17:17","slug":"hydroplant-subsystems-week-7","status":"publish","type":"post","link":"https:\/\/dronesonen.usn.no\/?p=7961","title":{"rendered":"Hydroplant Subsystems &#8211; Week 7"},"content":{"rendered":"\n<div class=\"wp-block-group alignwide is-vertical is-layout-flex wp-container-core-group-is-layout-fe9cc265 wp-block-group-is-layout-flex\">\n<p>This week, we&#8217;ve been busy testing and fine-tuning our dynamic system. Our motivation is (maybe) at an all-time high as we&#8217;ve successfully tackled challenges and made significant strides.<\/p>\n\n\n\n<p>Highlights include GUI enhancements, a user-friendly testing node, and progress on the plant mover logic. We&#8217;ve even dealt with unexpected hiccups, like MQTT library quirks and mechanical issues.<\/p>\n\n\n\n<p>Stay with us as we share our journey of innovation in the world of Smart Plant Movement.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Shahin Ostadahmadi<\/h2>\n\n\n\n<p>This week have been more testing and debugging. We feel that the way we have setup the system is quite good, and making tests and adding functionalities goes fast. All the work of making the system more dynamic than we had planned pays off now. Our group is quite motivated to work with the project and It helps to keep up the motivation when we get things to work. As project leader, Im happy that the motivation is so high, our group worked together last week as a team to make the system work with the servos and no body went home before it was done. Its motivating all of us. We are excited to move forward with the project and finally see the result of all the work<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Logic controller, plant mover, and plant information node<\/h3>\n\n\n\n<p>I implemented the GUI functionalities for plant information node and plant mover node. This is also done dynamically; so when a node for a particular node notifies that it has plantmover, or plant information node, the GUI will make the visual elements appear when they are active and the \u201capply\u201d buttons will be able to send commands to the right node through MQTT connection. When you change a floor from the dropdown menu; the logic controllers will also change to the actuators and logic controllers to a particular floor and the visual elements will appear for the respective floor.<\/p>\n\n\n\n<p>Both GUI and library<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-65-1024x576.png\" alt=\"\" class=\"wp-image-7962\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-65-1024x576.png 1024w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-65-300x169.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-65-768x432.png 768w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-65-1536x864.png 1536w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-65.png 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>You can see when the \u201cPlant Mover\u201d is chosen from the dropdown menu, the right visual elements is showing. I also added some extra constrains; since out plants can only move forward, you will always be able to choose the field \u201cTo\u201d larger than field \u201cFrom\u201d, and all the \u201cillegal\u201d options is hidden so the operator can\u2019t choose wrong at any time.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-66-1024x576.png\" alt=\"\" class=\"wp-image-7963\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-66-1024x576.png 1024w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-66-300x169.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-66-768x432.png 768w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-66-1536x864.png 1536w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-66.png 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Release file application<\/h3>\n\n\n\n<p>This week I made the first release for our GUI application; other group members can download the application on the their own computer and test the part of the system at any time. We will also setup a computer to run the GUI all the time for testing. However, I ran into some problems with release file because of the MQTT library; since MQTT is not one of the built in the Qt Quick library, I had to add the library manually, and I found out that the binary files was different for release and debug mode. I had to had to compile the MQTT library for release mode and add it to Qt Creator environment again. The problem was solved.<\/p>\n\n\n\n<p><strong>Test setup<\/strong><\/p>\n\n\n\n<p>I also setup some of the test setup with Theo as you can see in the picture, we used some time to find some proper materials that is good enough for the testing purpose and also calibrating so the \u201cbumps\u201d actually toggle the switch that is mounted on the servo station. As you can see in the video under Aditi\u2019s part, they will be used with the servo to make switches toggle while they are moving from one place to another. Since the mechanical part is not included in Smart Systems, we will not design anything our self. The mechanical students in Hydroplant making 3D printed solution for this.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"868\" height=\"207\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-67.png\" alt=\"\" class=\"wp-image-7964\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-67.png 868w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-67-300x72.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-67-768x183.png 768w\" sizes=\"auto, (max-width: 868px) 100vw, 868px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Commits<\/h3>\n\n\n\n<p><a href=\"https:\/\/github.com\/hydroplantno\/library\/commit\/8725b2fa8c2c2b561675ee2c97181f3adc04e4d0\">https:\/\/github.com\/hydroplantno\/library\/commit\/8725b2fa8c2c2b561675ee2c97181f3adc04e4d0<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/hydroplantno\/gui-node\/commit\/bb4a27dcb7507e8226834915f1189a5cbf4ff106#diff-827967244365cf10e650672f730f2cfdd477fc8e4018224fd22a1fa1f9919050\">https:\/\/github.com\/hydroplantno\/gui-node\/commit\/bb4a27dcb7507e8226834915f1189a5cbf4ff106#diff-827967244365cf10e650672f730f2cfdd477fc8e4018224fd22a1fa1f9919050<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/hydroplantno\/gui-node\/commit\/8ba4230ea7b1ed2ceb8580af02a57d4dbf73c915\">https:\/\/github.com\/hydroplantno\/gui-node\/commit\/8ba4230ea7b1ed2ceb8580af02a57d4dbf73c915<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/hydroplantno\/gui-node\/commit\/20e05840fe699831a73306488a7fcae2ac9f6d24\">https:\/\/github.com\/hydroplantno\/gui-node\/commit\/20e05840fe699831a73306488a7fcae2ac9f6d24<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Oscar Melby<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Master-controller<\/h3>\n\n\n\n<p>Rewrote GUI command handling a tiny bit to be more readable. Next week will hopefully go towards handling \u201cplant mover states\u201d and maybe start on the algorithm for moving a plant holder from a place to another, which sounds much easier than it is. This is because we can have empty places, and can only move the plant holder one way. Which means we might need to do multiple actions in the correct order, to be able to move the plant holder we actually want to move. When moving these holders they will also be in different stages depending on how grown they are, which master-controller needs to keep track of.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Testing node<\/h3>\n\n\n\n<p>Shahin had made a simple testing node which connects to the MQTT broker for testing. Purpose of this node is to easily be able to subscribe and publish messages to chosen topics, as this is a hassle to do manually, and will save us time in the future. This way we can listen to and send messages directly to whoever to see if everything is working as planned before implementing the logic into master-controller or the GUI.<\/p>\n\n\n\n<p>The node is working, but didn\u2019t manage get it like I completely wanted, but will hopefully be \u201cdone\u201d next week. It should be as user-friendly as possible, and if given no input it will use the previous setting.<\/p>\n\n\n\n<p>The node is not a part of our initial requirements, but will accelerate debugging and development going further.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Plant mover<\/h3>\n\n\n\n<p>Worked together with Aditi on implementing the configuration startup for the plant mover. Met a lot of problems while doing this, some we thought were mechanical others were software\/logic issues. We should probably mount a LED to the output of the switch so we can physically see that we should be able to read a HIGH signal. We got it to work eventually, but hardcoded to count up to 12 stages, which is actually the opposite of what we want. Chose to do it this way since we don\u2019t have enough interrupts, but might be able to just read the last end switch from a normal pin going forward, since SHOULD only happen once during setup \ud83d\ude4f<\/p>\n\n\n\n<p>Turns out the interrupts are so fast that when the switch lets go and jumps back to its LOW state, the interrupt picks up on the shaking within the switch to multiple HIGHs, so we had to add a 300 ms delay. If a switch goes to HIGH within 300 ms after being HIGH, we ignore it as this is most likely the switch just shaking. Also had issues with MQTT dropping the connection while moving the \u201cplant mover\u201d, so we have to \u201cping\u201d while moving it, so we can send the configuration message to master-controller after counting up all the places which exists.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Commits<\/h3>\n\n\n\n<p><a href=\"https:\/\/github.com\/hydroplantno\/master-controller\/commit\/8fa7d17a33a9b35b3613d8d41c47ee1167866850\">https:\/\/github.com\/hydroplantno\/master-controller\/commit\/8fa7d17a33a9b35b3613d8d41c47ee1167866850<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/hydroplantno\/testing-node\/commit\/4bf1742f90d7d7a656e217eae253d9019dea31f1\">https:\/\/github.com\/hydroplantno\/testing-node\/commit\/4bf1742f90d7d7a656e217eae253d9019dea31f1<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/hydroplantno\/testing-node\/commit\/e1eba40aa9316678118f1d5858473f020a7e64d0\">https:\/\/github.com\/hydroplantno\/testing-node\/commit\/e1eba40aa9316678118f1d5858473f020a7e64d0<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/hydroplantno\/plant-information-node\/commit\/5c85ed7c6b4b2fe634f1473a76a3de8d9c37439f\">https:\/\/github.com\/hydroplantno\/plant-information-node\/commit\/5c85ed7c6b4b2fe634f1473a76a3de8d9c37439f<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Aditi Deshpande<\/h2>\n\n\n\n<p>After the presentation on Monday, the others in the group set up the switches on the mover, one on the front of the stepper motor and one on the end. There was a slight problem in that the Arduino Uno has only 2 interrupt digital pins, and we need 3, but we figured that the front switch and the row switch( the switch on the mover) could be interrupt pins, and we could program it such that it would stop automatically stop after counting 12 switches for now.<\/p>\n\n\n\n<p>On Tuesday we tried to connect the switches and programmed the mover to move in accordance, we encountered some problems on the way but we changed the settings of the stepper motor and both the movers in the plant mover controller and plant information node worked pretty smoothly. On Thursday I worked more on the calibrate function where I wanted it to go backwards and forwards to the end while counting the amount of plant holders. Ivan and I worked on this and we got it to go forward and backward and it would stop while it met the end switch, as I programmed the end switch and the front switch to be an interrupt.<\/p>\n\n\n\n<p>On Friday Oscar and I switched it up (yes, that was a pun) into making the row switch as an interrupt, and after facing many(many !!!) problems like the switch sending too many signals at once, and the switch being activated whilst moving backward we got it to count all the rows, and we also got it to settle itself in the middle after being done, so the entirety of the calibrate function was done. In the end, we also added communication, so after the mover calibrates it sends the master controller a message that contains the amount of rows present in the system. Here is a small demo of the calibrate function:<\/p>\n\n\n\n<figure class=\"wp-block-video\"><video controls src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/VID_20231006_164721.mp4\"><\/video><\/figure>\n\n\n\n<ol class=\"wp-block-list\" start=\"1\">\n<li>The entire code of calibrate function<\/li>\n<\/ol>\n\n\n\n<p><a href=\"https:\/\/github.com\/hydroplantno\/plant-information-node\/commit\/39278d0e9a0a543dd490cfaa84a7fc4b811c45c8\">https:\/\/github.com\/hydroplantno\/plant-information-node\/commit\/39278d0e9a0a543dd490cfaa84a7fc4b811c45c8<\/a><\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"2\">\n<li>The lesser prototype: <a href=\"https:\/\/github.com\/hydroplantno\/plant-information-node\/commit\/bd588a2da887a00a1adf570e1ca1d06b87fe17a9\">https:\/\/github.com\/hydroplantno\/plant-information-node\/commit\/bd588a2da887a00a1adf570e1ca1d06b87fe17a9<\/a><\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Theo Magnor<\/h2>\n\n\n\n<p>This week i have spent time visualising the function moveRowFromTo(), this function is responible for moving the plant rows from one location to another. The function consists of multiple functions like moveToRow() which moves the unit to a specific row, detach() and attach() which will grab and let go of a row in order to move it. After i had visualised the logic, i started coding, and came up with something that i think will work, but i have to do some testing and more fine tuning before i can know for sure.<\/p>\n\n\n\n<p>Diagram:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"506\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-68-1024x506.png\" alt=\"\" class=\"wp-image-7968\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-68-1024x506.png 1024w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-68-300x148.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-68-768x379.png 768w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-68.png 1371w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Code for the different functions mentioned above:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>void PlantMoverController::moveToRow(int targetSwitch){\n    if (targetSwitch &lt; m_currentSwitch){\n        my_stepper-&gt;moveBackward(10);\n        if (row_switch == true) {\n            m_currentSwitch -1;\n            if (targetSwitch == m_currentSwitch){\n                \/\/ send recept\n            }\n        }\n    }\n    if (targetSwitch &gt; m_currentSwitch){\n        my_stepper-&gt;moveForward(10);\n        if (row_switch == true) {\n            m_currentSwitch +1;\n            if (targetSwitch == m_currentSwitch){\n                \/\/ send recept\n            }\n        }\n    }\n}\n\n void PlantMoverController::moveRowFromTo(int from, int to){\n    moveToRow(from);\n    attach();\n    moveToRow(to);\n    detach();\n    \/\/ stop and send recipt\n }\n\nvoid PlantMoverController::attach(){\n    my_stepper-&gt;moveBackward(10); \/\/ making way for the arm\n    raiseArm();\n    my_stepper-&gt;moveForward(10); \/\/ moving towards plant row\n\n    if (attach_switch == true) {\n        \/\/ stop and send recipt\n    }\n}\n\nvoid PlantMoverController::detach(){\n    my_stepper-&gt;moveBackward(10); \/\/ making way for the arm\n    lowerArm();\n    \/\/ stop and send recipt\n}\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Ivan Bergmann Maronsson<\/h2>\n\n\n\n<p>This week I didn\u2019t work so much on the PCB aspects, but rather focused on getting the test benches up, with the help of Aditi, Oscar, Shahin, and Theo. Where certain parts of the system can be tested individually and easily. And I tidied up most of the cables and wiring around the exciting system. Then I helped the others when it came to testing the plant mover node, where certain switches had to be mounted and connected, from one end of the of the system to the other.<\/p>\n\n\n\n<p>Climate Node:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"1024\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-69-768x1024.png\" alt=\"\" class=\"wp-image-7969\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-69-768x1024.png 768w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-69-225x300.png 225w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-69-1152x1536.png 1152w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-69.png 1500w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/figure>\n\n\n\n<p>Plant Information &amp; Plant Mover Node:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"1024\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-70-768x1024.png\" alt=\"\" class=\"wp-image-7970\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-70-768x1024.png 768w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-70-225x300.png 225w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-70-1152x1536.png 1152w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-70.png 1500w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/figure>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>This week, we&#8217;ve been busy testing and fine-tuning our dynamic system. Our motivation is (maybe) at an all-time high as we&#8217;ve successfully tackled challenges and made significant strides. Highlights include GUI enhancements, a user-friendly testing node, and progress on the plant mover logic. We&#8217;ve even dealt with unexpected hiccups, like MQTT library quirks and mechanical [&hellip;]<\/p>\n","protected":false},"author":99,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[99],"class_list":["post-7961","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-hydroplant"],"_links":{"self":[{"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/posts\/7961","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/users\/99"}],"replies":[{"embeddable":true,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7961"}],"version-history":[{"count":3,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/posts\/7961\/revisions"}],"predecessor-version":[{"id":7975,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/posts\/7961\/revisions\/7975"}],"wp:attachment":[{"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7961"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7961"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7961"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}