{"id":3811,"date":"2019-10-25T08:40:42","date_gmt":"2019-10-25T07:40:42","guid":{"rendered":"http:\/\/dronesonen.usn.no\/?p=3811"},"modified":"2019-12-03T17:48:23","modified_gmt":"2019-12-03T16:48:23","slug":"week-43-group-6","status":"publish","type":"post","link":"https:\/\/dronesonen.usn.no\/?p=3811","title":{"rendered":"Week 43 Group 6"},"content":{"rendered":"\n<p>Electro: <\/p>\n\n\n\n<p><strong>Motors control<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li><strong>Introduction<\/strong><\/li><\/ol>\n\n\n\n<p>The tank driving system is only composed for two belts and in each belt,\nwe\u2019ve got one motor. Combining the two motors parameters we have the control to\ngo forward, backward and make turns in both sides. &nbsp;As we commented previously, we\u2019ll use 12 VDC\/330\nRPM motors. We can control the following motor parameters:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Speed<\/strong>: controlling the motor input voltage that we give. The input is a PWM signal. It\u2019s based in the average voltage and depends of the duty cycle. We can make that kind of control using a transistor.<\/li><li><\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"379\" height=\"304\" src=\"http:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-19.png\" alt=\"\" class=\"wp-image-3812\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-19.png 379w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-19-300x241.png 300w\" sizes=\"auto, (max-width: 379px) 100vw, 379px\" \/><\/figure>\n\n\n\n<p>Figure 1: Example of PWM signal depending of\nthe Duty Cycle<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Direction<\/strong>: inverting the current flow through the motor (change polarity). We can make it with the called H bridge circuit which has the motor in the middle.<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"462\" height=\"254\" src=\"http:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-20.png\" alt=\"\" class=\"wp-image-3813\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-20.png 462w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-20-300x165.png 300w\" sizes=\"auto, (max-width: 462px) 100vw, 462px\" \/><\/figure>\n\n\n\n<p>Figure 2: The H bridge connection<\/p>\n\n\n\n<p>The L298N Driver is the perfect one. It can control the two previous\nvariables together and it\u2019s compatible with Arduino world.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Technical part<\/strong><\/li><\/ul>\n\n\n\n<p>The driver can control up to two motors, A and B. &nbsp;It receives the orders from the board by the inputs.\nIn the inputs connections it has enable A and enable B with what we can control\nthe PWM signal (Speed). Also, it has in 1 and in 2 for the Motor A rotation\ndirection control. In the case of the motor B, in 3 and in 4 for the direction\ncontrol.<\/p>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td>\n  &nbsp;\n  <\/td><td>\n  IN\n  1\n  <\/td><td>\n  IN\n  2\n  <\/td><\/tr><tr><td>\n  <strong>Motor A<\/strong>\n  <\/td><td>\n  Forward\n  <\/td><td>\n  0\n  <\/td><td>\n  1\n  <\/td><\/tr><tr><td>\n  Backward\n  <\/td><td>\n  1\n  <\/td><td>\n  0\n  <\/td><\/tr><tr><td>\n  &nbsp;\n  <\/td><\/tr><tr><td>\n  &nbsp;\n  <\/td><td>\n  IN\n  3\n  <\/td><td>\n  IN\n  4\n  <\/td><\/tr><tr><td>\n  <strong>Motor B<\/strong>\n  <\/td><td>\n  Forward\n  <\/td><td>\n  0\n  <\/td><td>\n  1\n  <\/td><\/tr><tr><td>\n  Backward\n  <\/td><td>\n  1\n  <\/td><td>\n  0\n  <\/td><\/tr><\/tbody><\/table>\n\n\n\n<p>Figure 3: Motor direction table depending of\nthe inputs<\/p>\n\n\n\n<p>All the non-contemplated cases in the previous table will stop the\nmotor. Following with the outputs, to control the Motor A it has out 1 and out 2.\nIn case of the Motor B it has out 3 and out 4. The previous connections go\ndirectly to the motors. They give voltage and current depending of what we say\nto the driver.<\/p>\n\n\n\n<p>Finally, in terms of power, the driver has the Vcc pin input that can be\nsupplied between 5 to 35 V. Also, it has the GND pin and the +5V in\/out pin\nwhich you can receive or give power depending of the jumper configuration.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Driving modes<\/strong><\/li><\/ul>\n\n\n\n<p>The main objective of the project is to interact with the outside world.\nBut also, we know that the play station controller that we\u2019ll use it has a lot\nof configurable buttons. So, we though and decided the option to use a few\nbuttons for a few modes. However, we can divide the modes in manual and\nautonomous. <\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Manual\ncontrol<\/strong><\/li><\/ul>\n\n\n\n<p>The manual control is basically a Master-Slave communication between the\ncontroller and the board so we\u2019re going to have the full control in our hands.\nIn this mode, we need to configure the motors to work according to the orders\ngiven by the joysticks. Each joystick has two potentiometers, one for each\ncartesian coordinate. We need to say that in the following test we made the\nmotors full control with only one Joystick but maybe in the final prototype we\u2019ll\nchange it to two Joysticks, one for motor. <\/p>\n\n\n\n<p>The joystick produces an analog value for each coordinate, x and y. To give the motor correct order we need to read the analog value. We\u2019ve made a reading test with the Arduino Monitor Serie in each direction point and we fix the limits following the next picture.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"389\" height=\"297\" src=\"http:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-21.png\" alt=\"\" class=\"wp-image-3814\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-21.png 389w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-21-300x229.png 300w\" sizes=\"auto, (max-width: 389px) 100vw, 389px\" \/><\/figure>\n\n\n\n<p>Figure 4: Joystick potentiometer limits<\/p>\n\n\n\n<p>When we\u2019ve got the directions clear, the next step is to convert the analog\nvalues of the center point to each direction in the correct speed signal range\nwith the PWM. For example, from 550 to 1023 to 0-255.&nbsp; Following the previous step and the\npotentiometer limits we made a test program.<\/p>\n\n\n\n<p>The program has the possible 5 cases of the 5 joystick positions. We fix\na critic value for the analog reading to identify in what case we are. In every\ncase, we define how each motor work related of the movement that we want to do.\nWe\u2019ve programed the turning trajectory with the opposite rotation of the motors\nbut it\u2019s possible to do it with the speed also.<\/p>\n\n\n\n<p>(Add the video of the joystick\ndriving)<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Autonomous\ncontrol<\/strong><\/li><\/ul>\n\n\n\n<p>In this mode, the main objective is to teach our system with the\nbehavior that we want. It\u2019s more delicate and difficult than the previous one\nbecause we are going to give the full control to the system. <\/p>\n\n\n\n<p>The vehicle has 3 ultrasonic sensors and it\u2019ll have 2 infrared ones. We\u2019ll\nneed to program the brain (board) to receive that inputs and act correctly. The\nwork of the board after the input is known in which situation he is. Then only\nsay to the motors what to do with the direction and speed. For example, in the\ntest program that we made we\u2019ve only considered two cases, left ultrasonic\nsensor detection and right ultrasonic sensor detection. We\u2019ve programed our\nmotors to go forward until any obstacle detection. Then when the sensor gives\nthe critic distance value and depending on the side, the motors stop, wait and\nturn in the opposite direction of the detection. The previous example code was\na way to use what we have in the lab before start with the prototype. In which\nwe\u2019ll have more cases with possible combinations between sensors.<\/p>\n\n\n\n<p>(Add the video of the autonomous driving with the\nsensors)<\/p>\n\n\n\n<p>Furthermore, as is know in the programming world there are no limits and everything it\u2019s possible in part. For this, we\u2019ve thought that apart of the 100% autonomous driving, it could be interesting other autonomous modes. For example, a straight-ahead trajectory or a round trajectory or also a fire trajectory with some military tactics.<\/p>\n\n\n\n<p>Video: <\/p>\n\n\n\n<p><a href=\"https:\/\/drive.google.com\/file\/d\/1pIrinFUn5nRQLuh_Gi_A_eJaLSgCtq_C\/view?usp=sharing\">https:\/\/drive.google.com\/file\/d\/1pIrinFUn5nRQLuh_Gi_A_eJaLSgCtq_C\/view?usp=sharing<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Electro: Motors control Introduction The tank driving system is only composed for two belts and in each belt, we\u2019ve got one motor. Combining the two motors parameters we have the control to go forward, backward and make turns in both sides. &nbsp;As we commented previously, we\u2019ll use 12 VDC\/330 RPM motors. We can control the [&hellip;]<\/p>\n","protected":false},"author":69,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3811","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/posts\/3811","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\/69"}],"replies":[{"embeddable":true,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3811"}],"version-history":[{"count":1,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/posts\/3811\/revisions"}],"predecessor-version":[{"id":3815,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/posts\/3811\/revisions\/3815"}],"wp:attachment":[{"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3811"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3811"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3811"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}