top of page
Search

Week 5: Vroom Vroom Motor Time

  • Writer: Laura Wong
    Laura Wong
  • Feb 10, 2022
  • 4 min read

Updated: Feb 11, 2022

This week we met up a bunch to iron out some details before our mini demo for the profs next week. We wanted to put together all the little bits we had done separately so they can get a better idea of our project as a whole and so we had to really grind it out...


Mechanical

The mechanical work this week was much lighter than the previous weeks with assembly still being performed. See some pics below for an update on our assembly progress:

ree

ree


ree

Also, Shanika was able to re-3D print some of the parts holding up the motors as the previous ones were accidentally broken upon assembly 😥. BUT the new ones were awesome with so much support in the places that broke last time.


We also got around to redesigning our water tank. An alternative we considered was 3D printing the tank using resin but after looking into it we found out it would be $50 for just one tank! This was pushing us a bit close to our budget for the term. The second idea was to 3D print the majority of the tank using our normal filament, and then carving out the final tank wall with acrylic and slapping it on with some glue. We're hoping that this will work as we won't have to carve out the intricate zig-zag shape we had prior that led to most of our leaks.


Electrical

Battery

In terms of software and electrical we got to finally testing out the scary task of the batteries. Due to the fact that the lightweight 12V battery we wanted was out of stock at RobotShop we had to order two 6V batteries and attach them in series to get 12V for the motors. This was a bit scary for us because we didn't really know how to wire them... without like killing ourselves so it took a lot of courage on our part to do this next task... SO YAY US!

After some pep talks we finally connected them in series and checked their voltage with a multimeter one of our friends let us borrow. Thankfully it measured 12V, woot woot we did it!

However, we weren't done yet, we had to connect it to our DC-DC converter to get the voltage down from 12V to 9V, as our motors required 12V but our Arduino needed to be powered by 9V. After looking up the datasheet of our buck converter we figured out that the 3 pins were Vin, GND and Vout from left to right. Wiring wise this meant that we had to connect the red cable from the battery to Vin and the black cable from the battery to GND on the buck converter, and Vout would have a voltage of 9V - which we would ideally connect to our Arduino. After plugging everything in (minus the Arduino in case we accidentally fried it), we probed the lines on the converter and got 12V and 9V! It worked!!


Motors and Motor Drive

Now that we got our batteries working alongside our buck converter it was time to fully test out our motors using their motor drive (H-bridge) and the Arduino. Another big task for the team because this meant a lot of the high power devices were going to be attached all at once 😣. After another quick pep talk, we were on our way. We found some tutorials online to help us wire our motors to the motor drive, and to our surprise, we actually only needed one motor drive for both wheel motors! This meant we could save the other for another project or had a spare in case things went bad. Anyways, after wiring up one motor using the following pinout of our H-bridge below, we were on our way:

ree

We coded up a short program to constantly turn the motor in one direction and were on our way. We decided to start with only one motor because we wanted to make sure it would work before testing out two... and to our surprise it worked on the first try! With one motor working, we decided to hook up our second motor on the opposite side of the H-bridge with a mirror imaged wiring technique. We also decided that it was time to power the Arduino using the battery, this meant plugging in the 9V from the DC-DC converter to Vin on Arduino... Watch the video below for the results:

Here's another video showing some of the wiring:



Software

With all our components now working, we went on to try and merge all our sensor validation code with our finite state machine framework from the first week. Additionally, we decided that to keep our code clean we'd make each of our sensors their own library, and simply include each library into our main finite state machine. This would isolate the sensor code from the bulk of the program, keeping it clean, easy to understand and debug in the future. It took us a while to clean-up our sensor validation code, but after a couple of hours we had each of the libraries implemented. Each one containing the pins required for each sensor, static global variables to be used internally in each library, some accessor functions to manipulate these static variables, functions to read the sensor data, as well as functions to act upon certain values and perform certain tasks (e.g. determine if moisture levels are too low and return a variable, turn the motors clockwise, turn the motors counterclockwise, turn the motors off, etc.)


With this framework in place, we started to integrate it into our main framework, starting first with setting up all our sensors within the setup() function of our finite state machine.


Other

We anticipate we will be starting full system assembly with the electrical components very soon so stay tuned!



 
 
 

Comments


© 2022

bottom of page