{"id":7809,"date":"2023-10-01T12:34:41","date_gmt":"2023-10-01T11:34:41","guid":{"rendered":"https:\/\/dronesonen.usn.no\/?p=7809"},"modified":"2023-10-01T12:34:41","modified_gmt":"2023-10-01T11:34:41","slug":"group-4-week-6","status":"publish","type":"post","link":"https:\/\/dronesonen.usn.no\/?p=7809","title":{"rendered":"Group 4 &#8211; Week 6"},"content":{"rendered":"\n<p class=\"has-text-align-center\" style=\"font-size:1.5rem\">Hi Dronesonen! \ud83d\ude0a<\/p>\n\n\n\n<p class=\"has-text-align-center\">This week we have conducted the following efforts:<\/p>\n\n\n\n<p class=\"has-text-align-center has-large-font-size\"><strong>Discipline &#8211; Software:<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<p style=\"font-size:1.5rem\"><strong>Erik-Andre Hegna:<\/strong><\/p>\n\n\n\n<p>On monday I worked a lot with Hugo on trying to make the sensor less sensitive to noise, and getting a more stable reading. I used the code below to see how the sensor value reacted to stimuli, and it was very unstable. I then used a lot of time talking with other groups on how they had done it.<br>We got some good alternative ways to build the sensor, and new ways to test it. This resulted in a new sensor circuit and a lot better reading! <\/p>\n\n\n\n<p>On Wednesday the whole group worked on making the MVP and presentation ready for next Monday. That means connecting the radio transmitter and receiver to the microbit, reading sensor value, and making the motors work according to radio commands AND sensor values.<\/p>\n\n\n\n<p>Next week, I would like to implement more algorithms to the microbit (Now that we have the radio and the communication working between sensor and motor). It is now time to code!<\/p>\n\n\n\n<p class=\"has-text-align-center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/D8CgX40wGUV-KijeDKdVXdvVgKDmmumjHC3n5epMQ_aN1BHQwLJUY1gRkPDk7jlaPu-TFJjlHOFbcLu5qrJG7IOPtEt4KRpF7fyEc6NtUVmB_sikgOzwuF0zEHITjrmrARV6kHLcRb_h5Ow0_kmFmsc\" width=\"409\" height=\"421\"><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\" \/>\n\n\n\n<p style=\"font-size:1.5rem\"><strong>Lars Leganger:<\/strong><\/p>\n\n\n\n<p>This week we tested our MVP and made our presentation for the midway presentation.\u00a0I adjusted the receiver code, so my Microbit that sends the command to the car now also receives data from the sensors. It&#8217;s still some noise from the sensors so the argument for when to print what is not accurate yet.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"790\" height=\"614\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image.png\" alt=\"\" class=\"wp-image-7811\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image.png 790w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-300x233.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-768x597.png 768w\" sizes=\"auto, (max-width: 790px) 100vw, 790px\" \/><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\" \/>\n\n\n\n<p style=\"font-size:1.5rem\"><strong>Ask Lindbr\u00e5ten:<\/strong><\/p>\n\n\n\n<p>This week our goal was to complete the integrated test of our MVP. On Wednesday I met up with the group and began modifying the script for the Microbit, that\u2019s placed on the micromouse, so it could function as both a sender and receiver. Here\u2019s the modified script:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;Arduino.h&gt;\r\n#include &lt;NRF52_Radio_library.h&gt;\r\n\r\nNRF52_Radio MicrobitRadio = NRF52_Radio();\r\nFrameBuffer *myDataSendData;\r\nconst long interval = 1000; \/\/1000 ms\r\nconst int MSGSIZE = 2; \/\/max 32\r\nuint8_t msg&#091;MSGSIZE]; \/\/since global, it will init to all zero's.\r\nstatic long currentMillis = 0;\r\nconst int frequency = 7; \/\/2.407GHz Radio\r\nconst uint8_t group = 1;\r\n\r\nint MP1_1 = 12;\r\nint MP1_2 = 8; \/\/motor pin 8.\r\nint MP2_1 = 16;\r\nint MP2_2 = 0; \r\nint IR_receiver = 1;\r\nint IR_emitter = PIN_BUTTON_A; \/\/right side pin 8\r\nuint8_t analog_value = 0;\r\n\r\nvoid setup() {\r\n\r\n  pinMode(IR_receiver, INPUT);\r\n  pinMode(IR_emitter, OUTPUT);\r\n  pinMode(MP1_1, OUTPUT);\r\n  pinMode(MP1_2, OUTPUT);\r\n  pinMode(MP2_1, OUTPUT);\r\n  pinMode(MP2_2, OUTPUT);\r\n  Serial.begin(115200);\r\n\r\n  myDataSendData = new FrameBuffer();\r\n  myDataSendData-&gt;length = 5; \/\/3 (fixed) + MSGSIZE\r\n  myDataSendData-&gt;version = 12;\r\n  myDataSendData-&gt;group = group;\r\n  myDataSendData-&gt;protocol = 14;\r\n  \r\n  msg&#091;0] = myDataSendData-&gt;payload&#091;0];\r\n  msg&#091;1] = 0xFF;\r\n  \r\n  memcpy(myDataSendData-&gt;payload, &amp;msg, sizeof(uint8_t) * MSGSIZE); \r\n  \r\n  Serial.println(\"Micro:Bit V2b\");\r\n  Serial.print(\"Frequency: \");\r\n  Serial.print(frequency);\r\n  Serial.print(\" Length: \");\r\n  Serial.print(myDataSendData-&gt;length);\r\n  Serial.print(\" Version: \");\r\n  Serial.print(myDataSendData-&gt;version);\r\n  Serial.print(\" Group: \");\r\n  Serial.print(myDataSendData-&gt;group);\r\n  Serial.print(\" Protocol \");\r\n  Serial.println(myDataSendData-&gt;protocol);\r\n  \r\n  MicrobitRadio.enable();\r\n\r\n  MicrobitRadio.setFrequencyBand(frequency);\r\n  MicrobitRadio.setGroup(group);\r\n  \r\n  Serial.println(\"\");\r\n  Serial.println(\"READY\");\r\n  Serial.println(\"\");\r\n}\r\n\r\nvoid motorControl(uint8_t n);\r\nvoid stop();\r\nvoid driveForward();\r\nvoid leftRotate();\r\nvoid rightRotate();\r\nvoid reverse();\r\nvoid reactToMeasure(uint8_t a);\r\n\r\nvoid loop() { \r\n\r\n  digitalWrite(IR_emitter, HIGH);\r\n  analog_value = analogRead(IR_receiver);\r\n  myDataSendData-&gt;payload&#091;0] = analog_value;\r\n\r\n  if (millis() - currentMillis &gt;= interval){\r\n     Serial.println(\"Micro:Bit V2b sending: \");\r\n     Serial.println(analog_value);\r\n\r\n     MicrobitRadio.send(myDataSendData);\r\n     currentMillis = millis();\r\n  }\r\n\r\n  FrameBuffer* myData = MicrobitRadio.recv();\r\n  if (myData != NULL) {\r\n     motorControl(myData-&gt;payload&#091;0]);\r\n     delete myData;\r\n  }\r\n}\r\n\r\nvoid leftRotate(){\r\n  analogWrite(MP1_1, 180); \/\/accelerate the right wheel motor.\r\n  analogWrite(MP1_2, 0); \/\/set reverse pin for motor 1 to low.\r\n  analogWrite(MP2_1, 0); \/\/set acceleration pin for motor 2 to low. \r\n  analogWrite(MP2_2, 180); \/\/Reverse the left wheel or motor. \r\n} \r\nvoid driveForward(){\r\n  analogWrite(MP1_1, 180); \/\/accelerate both wheels. \r\n  analogWrite(MP1_2, 0);\r\n  analogWrite(MP2_1, 180);\r\n  analogWrite(MP2_2, 0);\r\n}\r\nvoid rightRotate(){\r\n  analogWrite(MP1_1, 0);\r\n  analogWrite(MP1_2, 180); \/\/Reverse the right wheel.\r\n  analogWrite(MP2_1, 180); \/\/accelerate the left wheel. \r\n  analogWrite(MP2_2, 0);\r\n}\r\nvoid stop(){\r\n  analogWrite(MP1_1, 0);\r\n  analogWrite(MP1_2, 0);\r\n  analogWrite(MP2_1, 0);\r\n  analogWrite(MP2_2, 0);\r\n}\r\nvoid reverse(){\r\n  analogWrite(MP1_1, 0);\r\n  analogWrite(MP1_2, 180);\r\n  analogWrite(MP2_1, 0);\r\n  analogWrite(MP2_2, 180);\r\n}\r\n\r\nvoid motorControl(uint8_t n){\r\n  switch(n){\r\n    case 1: \r\n    reactToMeasure(analog_value);\r\n    Serial.println(\"&lt;reactToMeasure was activated&gt;\");\r\n    break;\r\n    case 2: \r\n    leftRotate();\r\n    Serial.println(\"&lt;Left rotate was activated&gt;\");\r\n    break;\r\n    case 3: \r\n    rightRotate();\r\n    Serial.println(\"&lt;Right rotate was activated&gt;\");\r\n    break;\r\n    case 4:\r\n    stop();\r\n    Serial.println(\"&lt;Stop was activated&gt;\");\r\n    break;\r\n    case 5: \r\n    reverse();\r\n    Serial.println(\"&lt;Reverse was activated&gt;\");\r\n    case 6: \r\n    driveForward();\r\n    Serial.println(\"&lt;Drive forward was activated&gt;\");\r\n    default:\r\n    Serial.println(\"&lt;Invalid input&gt;\");\r\n  }\r\n}\r\n\r\nvoid reactToMeasure(uint8_t a){\r\n  if (a &gt;= 25 &amp;&amp; a &lt; 40){\r\n    stop();\r\n\r\n  } else if (a &gt;= 40){\r\n    reverse();\r\n\r\n  } else {\r\n    driveForward();\r\n  }\r\n}\r\n<\/code><\/pre>\n\n\n\n<p class=\"has-text-align-center has-medium-font-size\"><strong><em>Changes made:<\/em><\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Added the sender-functionalities of Steven\u2019s radio library.<\/li>\n\n\n\n<li>Passing analog-values, instead of either 0\u2019s or 1\u2019s, to the motor-pins to better control the motor-speed.<\/li>\n\n\n\n<li>Added IR-sensor measurements to the payload array of the data-packet to be forwarded to the other Microbit. This addition is necessary if we want to monitor and view essential information about the maze, including its clear paths and walls, as well as the mapping- and shortest-path calculation process. &nbsp;&nbsp;&nbsp;<\/li>\n\n\n\n<li>Added a \u2018reactToMeasure()\u2019 function that activates based on the forwarded byte from the other Microbit and utilizes an IR-measurement to conduct an appropriate action.<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-align-center has-medium-font-size\"><strong><em>Potential objectives for next week:<\/em><\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Incorporating measurements from 4 sensors (Filtering could potentially be needed&#8230;) <\/li>\n\n\n\n<li>Continue developing the algorithms from week 4:&nbsp;&nbsp;\n<ul class=\"wp-block-list\">\n<li>Combine and migrate them to Visual Studio Code.<\/li>\n\n\n\n<li>Implement IR \u2013 sensor measurements. &nbsp;&nbsp;<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\" \/>\n\n\n\n<p class=\"has-text-align-center has-large-font-size\"><strong>Discipline &#8211; Electrical:<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<p style=\"font-size:1.5rem\"><strong>Hugo Valery Mathis Masson-Benoit:<\/strong><\/p>\n\n\n\n<p>The objective for this week was to control the motors by using the data received by the sensors to complete the MVP. The information from the sensors weren\u2019t really good and had a lot of noise, this made them unusable. So, I tried to simplify the system, and ended up redoing it all. To simplify the system, I removed the VCC input for the emitter, to have it supplied directly by the Microbit. This way we can remove the MOSFET and directly control the IR emitter. I also put the bypass capacitor on for the MVP, to reduce the general noise. Now the capacitors are no longer an \u201coption\u201d, to have a good signal they are mandatory. Here is the new electrical design for the IR emitter:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"581\" height=\"484\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-1.png\" alt=\"\" class=\"wp-image-7812\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-1.png 581w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-1-300x250.png 300w\" sizes=\"auto, (max-width: 581px) 100vw, 581px\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center\"><strong><em>A picture of the sensors and the bypass capacitor on the MVP:<\/em><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"851\" height=\"628\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-2.png\" alt=\"\" class=\"wp-image-7813\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-2.png 851w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-2-300x221.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-2-768x567.png 768w\" sizes=\"auto, (max-width: 851px) 100vw, 851px\" \/><\/figure>\n\n\n\n<p>(I did not change anything about the IR receiver, it\u2019s the same design as before.)<\/p>\n\n\n\n<p>We also discovered that the 9 volts battery is quickly consumed, so we need to keep an eye on it when we try something with the prototype.<\/p>\n\n\n\n<p class=\"has-text-align-center has-medium-font-size\"><strong><em>Conclusion:<\/em><\/strong><\/p>\n\n\n\n<p>Now the Microbit is receiving usable data, and the software engineers were able to do some programming using it. It\u2019s a success.<\/p>\n\n\n\n<p class=\"has-text-align-center has-medium-font-size\"><strong><em>Objective for next week:<\/em><\/strong><\/p>\n\n\n\n<p>Connect four sensors to the prototype to make them communicate with the Microbit, and see if more components are needed.<strong><u><\/u><\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\" \/>\n\n\n\n<p style=\"font-size:1.5rem\"><strong>Jemima Niquen Tapia:<\/strong><\/p>\n\n\n\n<p>This week as I thought the only thing missing was the battery problem, that wasn\u2019t working well, I just did some research for making the sensor work better. So, having an amplified sign so using amplifiers, so it could be more accurate. As we changed the IR sensor circuit, we have good signs coming from the sensor it will be not needed at the moment.\u00a0I also studied for the presentation for Monday, some of us have met and have put in common the ideas and have split the slides. We have talked about what\u2019s the next step after the MVP prototype.\u00a0<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\" \/>\n\n\n\n<p class=\"has-text-align-center has-large-font-size\"><strong>Discipline &#8211; Mechanical:<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<p style=\"font-size:1.5rem\"><strong>Cesia Niquen Tapia:<\/strong><\/p>\n\n\n\n<p>This weekI\u2019ve been thinking about the traction on the wheels and alternative ways\u00a0 to help the problem. I also have assembled a provisional element so that the movement of the prototype is possible. This is provisional because as we said before the main idea is to print our own design which fits perfectly with our dimensions and bring balance and accuracy to the micromouse.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"538\" height=\"535\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-3.png\" alt=\"\" class=\"wp-image-7814\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-3.png 538w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-3-300x298.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-3-150x150.png 150w\" sizes=\"auto, (max-width: 538px) 100vw, 538px\" \/><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\" \/>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\" \/>\n\n\n\n<p class=\"has-text-align-center has-large-font-size\"><strong>A little<\/strong> <strong>bonus treat&#8230; <\/strong>\ud83d\ude0b\ud83c\udf6b<\/p>\n\n\n\n<p class=\"has-text-align-center\">Here&#8217;s a video showcasing our MVP!<\/p>\n\n\n\n<figure class=\"wp-block-video\"><video controls src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/IMG_1548.mov\"><\/video><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\" \/>\n\n\n\n<p class=\"has-text-align-center\" style=\"font-size:1.5rem\">This concludes our blog post for week 6, see you next week!\ud83d\ude0a<\/p>\n\n\n\n<p><em>Best regards<\/em>,<\/p>\n\n\n\n<p><em>Group 4<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi Dronesonen! \ud83d\ude0a This week we have conducted the following efforts: Discipline &#8211; Software: Erik-Andre Hegna: On monday I worked a lot with Hugo on trying to make the sensor less sensitive to noise, and getting a more stable reading. I used the code below to see how the sensor value reacted to stimuli, and [&hellip;]<\/p>\n","protected":false},"author":97,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7809","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/posts\/7809","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\/97"}],"replies":[{"embeddable":true,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7809"}],"version-history":[{"count":1,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/posts\/7809\/revisions"}],"predecessor-version":[{"id":7822,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/posts\/7809\/revisions\/7822"}],"wp:attachment":[{"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7809"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7809"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7809"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}