{"id":82,"date":"2024-10-23T17:31:44","date_gmt":"2024-10-23T21:31:44","guid":{"rendered":"https:\/\/wp.stgeorges.bc.ca\/matthewa\/?p=82"},"modified":"2025-06-01T01:06:02","modified_gmt":"2025-06-01T05:06:02","slug":"blog-2-arduino-dc-motors","status":"publish","type":"post","link":"https:\/\/wp.stgeorges.bc.ca\/matthewa\/2024\/10\/23\/blog-2-arduino-dc-motors\/","title":{"rendered":"Blog 2: Arduino &#8211; DC Motors"},"content":{"rendered":"\n<h2 class=\"wp-block-heading has-text-align-center\">Welcome to my second blog!<\/h2>\n\n\n\n<div class=\"wp-block-media-text is-stacked-on-mobile\"><figure class=\"wp-block-media-text__media\"><img loading=\"lazy\" decoding=\"async\" width=\"766\" height=\"1024\" src=\"https:\/\/wp.stgeorges.bc.ca\/matthewa\/wp-content\/uploads\/sites\/7\/2024\/10\/IMG_4547-min-1-766x1024.jpg\" alt=\"\" class=\"wp-image-63 size-full\" srcset=\"https:\/\/wp.stgeorges.bc.ca\/matthewa\/wp-content\/uploads\/sites\/7\/2024\/10\/IMG_4547-min-1-766x1024.jpg 766w, https:\/\/wp.stgeorges.bc.ca\/matthewa\/wp-content\/uploads\/sites\/7\/2024\/10\/IMG_4547-min-1-224x300.jpg 224w, https:\/\/wp.stgeorges.bc.ca\/matthewa\/wp-content\/uploads\/sites\/7\/2024\/10\/IMG_4547-min-1-768x1027.jpg 768w, https:\/\/wp.stgeorges.bc.ca\/matthewa\/wp-content\/uploads\/sites\/7\/2024\/10\/IMG_4547-min-1-1149x1536.jpg 1149w, https:\/\/wp.stgeorges.bc.ca\/matthewa\/wp-content\/uploads\/sites\/7\/2024\/10\/IMG_4547-min-1-1532x2048.jpg 1532w, https:\/\/wp.stgeorges.bc.ca\/matthewa\/wp-content\/uploads\/sites\/7\/2024\/10\/IMG_4547-min-1-scaled.jpg 1915w\" sizes=\"auto, (max-width: 766px) 100vw, 766px\" \/><\/figure><div class=\"wp-block-media-text__content\">\n<p class=\"wp-block-paragraph\">For my second project of the year, I have a version of Project 9 from the Arduino Uno Starter Kit. I originally had way bigger hopes for this, combining it with my third blog (upcoming) to somehow create a remote-controlled car. Unfortunately, due to time constraints, I wasn&#8217;t able to make that possible. However, I have modified the booklet version of this project to include 2 motors that are connected in parallel with a diode.<\/p>\n<\/div><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Components:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; Breadboard                                           &#8211;  Arduino Uno<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; Jumper Wires                                       &#8211; 2 DC Motors<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; Transistor                                              &#8211; Diode<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; 2 battery snaps                                    &#8211; Pushbutton<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; Resistor                                                 &#8211; USB cable<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; 9V Battery                                             &#8211; 2 Wooden wheels (in the kit)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; Wooden base<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"445\" src=\"https:\/\/wp.stgeorges.bc.ca\/matthewa\/wp-content\/uploads\/sites\/7\/2024\/10\/Screenshot-2024-10-22-at-9.56.31\u202fpm-1-1024x445.png\" alt=\"\" class=\"wp-image-67\" srcset=\"https:\/\/wp.stgeorges.bc.ca\/matthewa\/wp-content\/uploads\/sites\/7\/2024\/10\/Screenshot-2024-10-22-at-9.56.31\u202fpm-1-1024x445.png 1024w, https:\/\/wp.stgeorges.bc.ca\/matthewa\/wp-content\/uploads\/sites\/7\/2024\/10\/Screenshot-2024-10-22-at-9.56.31\u202fpm-1-300x130.png 300w, https:\/\/wp.stgeorges.bc.ca\/matthewa\/wp-content\/uploads\/sites\/7\/2024\/10\/Screenshot-2024-10-22-at-9.56.31\u202fpm-1-768x334.png 768w, https:\/\/wp.stgeorges.bc.ca\/matthewa\/wp-content\/uploads\/sites\/7\/2024\/10\/Screenshot-2024-10-22-at-9.56.31\u202fpm-1.png 1219w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">This is a diagram of said project that I got from the book, where you can see how both the 9V battery and the 5V power source from the Arduino Uno circuit powers the 2 motors (the circuit is connected to my computer). I modified this by adding a second DC motor in parallel.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"445\" src=\"https:\/\/wp.stgeorges.bc.ca\/matthewa\/wp-content\/uploads\/sites\/7\/2024\/10\/Screenshot-2024-10-22-at-9.56.31\u202fpm-2-1024x445.png\" alt=\"\" class=\"wp-image-68\" srcset=\"https:\/\/wp.stgeorges.bc.ca\/matthewa\/wp-content\/uploads\/sites\/7\/2024\/10\/Screenshot-2024-10-22-at-9.56.31\u202fpm-2-1024x445.png 1024w, https:\/\/wp.stgeorges.bc.ca\/matthewa\/wp-content\/uploads\/sites\/7\/2024\/10\/Screenshot-2024-10-22-at-9.56.31\u202fpm-2-300x130.png 300w, https:\/\/wp.stgeorges.bc.ca\/matthewa\/wp-content\/uploads\/sites\/7\/2024\/10\/Screenshot-2024-10-22-at-9.56.31\u202fpm-2-768x334.png 768w, https:\/\/wp.stgeorges.bc.ca\/matthewa\/wp-content\/uploads\/sites\/7\/2024\/10\/Screenshot-2024-10-22-at-9.56.31\u202fpm-2.png 1219w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">As you can see drawn in red, this is exactly how I added the second DC motor in parallel to modify the motor. The preliminary reason why I wanted to add a second motor was for another wheel that was supposed to be for my remote-controlled car. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This is the code I used to run the circuit. I first declare the variables and then use void setup to as the name suggests, set up the code. This string of code only runs once. I then proceed to use void loop to make the code run indefinitely, where I put the code that makes the motors run when the button is pressed, and where the code that stops the motors is put.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"706\" height=\"759\" src=\"https:\/\/wp.stgeorges.bc.ca\/matthewa\/wp-content\/uploads\/sites\/7\/2024\/10\/Screenshot-2024-10-27-at-8.09.30\u202fpm.png\" alt=\"\" class=\"wp-image-122\" srcset=\"https:\/\/wp.stgeorges.bc.ca\/matthewa\/wp-content\/uploads\/sites\/7\/2024\/10\/Screenshot-2024-10-27-at-8.09.30\u202fpm.png 706w, https:\/\/wp.stgeorges.bc.ca\/matthewa\/wp-content\/uploads\/sites\/7\/2024\/10\/Screenshot-2024-10-27-at-8.09.30\u202fpm-279x300.png 279w\" sizes=\"auto, (max-width: 706px) 100vw, 706px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">I have zero previous experience with Arduino in the past, however I feel like I have learned the basics of coding with Arduino but I personally struggled with the circuits the most. My understanding of the transistors is still shallow and I hope by using more Arduino parts in the future I can learn to use Arduino at a higher level.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you want to see a video of the DC Motors working, you can view that <a href=\"https:\/\/drive.google.com\/file\/d\/1XQq-6aVdThT5SwfAmoVg2Yjn3Uq16dzN\/view?usp=sharinghttps:\/\/drive.google.com\/file\/d\/1XQq-6aVdThT5SwfAmoVg2Yjn3Uq16dzN\/view?usp=sharing\" data-type=\"link\" data-id=\"https:\/\/drive.google.com\/file\/d\/1XQq-6aVdThT5SwfAmoVg2Yjn3Uq16dzN\/view?usp=sharinghttps:\/\/drive.google.com\/file\/d\/1XQq-6aVdThT5SwfAmoVg2Yjn3Uq16dzN\/view?usp=sharing\">here.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Welcome to my second blog! For my second project of the year, I have a version of Project 9 from the Arduino Uno Starter Kit. I originally had way bigger hopes for this, combining it with my third blog (upcoming) to somehow create a remote-controlled car. Unfortunately, due to time constraints, I wasn&#8217;t able to [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-82","post","type-post","status-publish","format-standard","hentry","category-fusion-demonstration"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/wp.stgeorges.bc.ca\/matthewa\/wp-json\/wp\/v2\/posts\/82","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.stgeorges.bc.ca\/matthewa\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.stgeorges.bc.ca\/matthewa\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.stgeorges.bc.ca\/matthewa\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.stgeorges.bc.ca\/matthewa\/wp-json\/wp\/v2\/comments?post=82"}],"version-history":[{"count":3,"href":"https:\/\/wp.stgeorges.bc.ca\/matthewa\/wp-json\/wp\/v2\/posts\/82\/revisions"}],"predecessor-version":[{"id":121,"href":"https:\/\/wp.stgeorges.bc.ca\/matthewa\/wp-json\/wp\/v2\/posts\/82\/revisions\/121"}],"wp:attachment":[{"href":"https:\/\/wp.stgeorges.bc.ca\/matthewa\/wp-json\/wp\/v2\/media?parent=82"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.stgeorges.bc.ca\/matthewa\/wp-json\/wp\/v2\/categories?post=82"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.stgeorges.bc.ca\/matthewa\/wp-json\/wp\/v2\/tags?post=82"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}