{"id":11116,"date":"2025-10-05T18:42:17","date_gmt":"2025-10-05T17:42:17","guid":{"rendered":"https:\/\/dronesonen.usn.no\/?p=11116"},"modified":"2025-10-05T18:42:17","modified_gmt":"2025-10-05T17:42:17","slug":"autobalance-week-5","status":"publish","type":"post","link":"https:\/\/dronesonen.usn.no\/?p=11116","title":{"rendered":"AutoBalance: Week 5"},"content":{"rendered":"\n<p><br><strong>Meron:<\/strong><\/p>\n\n\n\n<p>This week I received the 3 D printed parts that I designed earlier in SolidWorks. I have now started the process of assembling the components physically in the workshop. The work has included preparing the chassis and wheels parts as well as beginning the mounting process. In addition, I have made adjustments by adding necessary materials from the workshop and carrying out tasks such as drilling holes to ensure proper fitting and alignments. These steps are essential for moving from the digital model to a functional physical prototype which will later be ready for integration with the electronic systems developed by the data engineering team.<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"355\" height=\"501\" data-id=\"11118\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2025\/10\/image-3.png\" alt=\"\" class=\"wp-image-11118\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2025\/10\/image-3.png 355w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2025\/10\/image-3-213x300.png 213w\" sizes=\"auto, (max-width: 355px) 100vw, 355px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"288\" height=\"494\" data-id=\"11119\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2025\/10\/image-1-1.png\" alt=\"\" class=\"wp-image-11119\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2025\/10\/image-1-1.png 288w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2025\/10\/image-1-1-175x300.png 175w\" sizes=\"auto, (max-width: 288px) 100vw, 288px\" \/><\/figure>\n<\/figure>\n\n\n\n<p><strong>Salim:<\/strong><\/p>\n\n\n\n<p>I was tasked to work on the connection for the controlsystem for the motorcycle movment. I decided to use the micro:bit mobile app and bluetooth to send control signal wirelessly. I connected the micro:bit to pc with USB. Then, using MakeCode Python, I created a program that displays F on the micro:bit when the motorcycle moves forward, triggered by pressing button A on the moblie app. When button B is pressed, the motorcycle moves backward and B is shown on the display. This solution removes the need for manual activation.<\/p>\n\n\n\n<p>I also imported the Bluetooth library to enable wireless communication. Here is a simple code i used:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\nimport bluetooth\n\n#Start Bluetooth connection\nbluetooth.startUartService()\n\n#Reads data\ndef message_received():\n    msg = bluetooth.uartReadUntil(\"\\\\n\")\n    if not msg:\n        return\n\n    if msg == \"A\":\n        basic.show_letter(\"F\")\n        bluetooth.uartWriteString(\"FORWARDS\")\n    elif msg == \"B\":\n        basic.show_letter(\"B\")\n        bluetooth.uartWriteString(\"BACKWARDS\")\n    else:\n        basic.show_letter(\"S\")\n        bluetooth.uartWriteString(\"STOP\")\n\nbluetooth.onUartDataReceived(serial.delimiters(Delimiters.NewLine), message_received)\n\n#Show that micro bit is ready\nbasic.show_letter(\"READY\")\n<\/code><\/pre>\n\n\n\n<p>This code looks for messages sent from the phone. We experienced issues with the Bluetooth connection. There were too many verification steps required before data packets could be transmitted, which caused the system to only work manually and not via Bluetooth. We will investigate a better and more reliable solution next week.<\/p>\n\n\n\n<p><strong>Mohammed A:<\/strong><\/p>\n\n\n\n<p>I have 3D moduled bike for fase 1 as a backup, and ready to print if anything goes wrong if the original has any problem. The idea of design like lego so that it can be easly build, part change, or additional build. \u201cThe picture is on the way\u201d I have written new requrements for the fase 2 that have been mention in the beginning of the report.<\/p>\n\n\n\n<p><strong>Muhammed \u00d8:<\/strong><\/p>\n\n\n\n<p>This week i worked on the assembly of the electronic components in the system and a simple code to rotate the motor in both directions using the buttons on the Micro bit microcontroller, this was done to ensure that the system was assembled correctly and to check if all the components are working, which they were. The code was written in MakeCode Python, the way the code works is that it turns on enabe A which is a pin on the motor driver card that enabels for the motor to spin. the pin is also used to choose the speed at which the motor spins at<\/p>\n\n\n\n<p>The code that i made is a simple code that does not choose the speed of the motors just verifies that the connection is right and all of the electronic componets works as they should.<\/p>\n\n\n\n<p>this is the code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from microbit import *\nimport utime\n\nIN1 = pin0\nIN2 = pin1\nENA = pin8\n\ndef motor_forward():\n    ENA.write_digital(1)   # sl\u00e5 p\u00e5 enable\n    IN1.write_digital(1)\n    IN2.write_digital(0)\n\ndef motor_backward():\n    ENA.write_digital(1)\n    IN1.write_digital(0)\n    IN2.write_digital(1)\n\ndef motor_stop():\n    ENA.write_digital(0)\n    IN1.write_digital(0)\n    IN2.write_digital(0)\n\nwhile True:\n    if button_a.is_pressed():\n        motor_forward()\n        display.show(\"F\")\n    elif button_b.is_pressed():\n        motor_backward()\n        display.show(\"B\")\n    else:\n        motor_stop()\n        display.show(\"-\")\n    utime.sleep(0.1)\n\n<\/code><\/pre>\n\n\n\n<p>this is the wiring diagram for the MVP<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"591\" height=\"199\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2025\/10\/Untitled-Diagram.drawio.png\" alt=\"\" class=\"wp-image-11120\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2025\/10\/Untitled-Diagram.drawio.png 591w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2025\/10\/Untitled-Diagram.drawio-300x101.png 300w\" sizes=\"auto, (max-width: 591px) 100vw, 591px\" \/><\/figure>\n\n\n\n<p>i forgot to take pictures of the finished circut but i have taken a video of the finished circuit in working condition:<\/p>\n\n\n\n<figure class=\"wp-block-video\"><video controls src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2025\/10\/6B448A3D-302F-475F-91B1-50A82D0595AA.mov\"><\/video><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Meron: This week I received the 3 D printed parts that I designed earlier in SolidWorks. I have now started the process of assembling the components physically in the workshop. The work has included preparing the chassis and wheels parts as well as beginning the mounting process. In addition, I have made adjustments by adding [&hellip;]<\/p>\n","protected":false},"author":112,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-11116","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/posts\/11116","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\/112"}],"replies":[{"embeddable":true,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11116"}],"version-history":[{"count":1,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/posts\/11116\/revisions"}],"predecessor-version":[{"id":11122,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/posts\/11116\/revisions\/11122"}],"wp:attachment":[{"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11116"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11116"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11116"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}