Mechatronics

Controls and Power:

We used the Arduino Uno and the Sabertooth motor controls for the controls of our three 131-motors and one Servo motor. The motor drivers were powered by an external wall power source to achieve the 12V needed to drive our motors at the match conditions. The servo and encoder were powered by the Arduino.  Only one of the three 131-motors was powered by position control. The others used physical stops and time delays to achieve the desired motion. 

 

Coding Outline:

Our code had to progress through a several steps:

  1. Opening and closing the claw to grab the bottle.
  2. Driving the arm to the launcher while the claw remained closed.
  3. Opening and closing the claw to release the bottle.
  4. Returning the arm to the initial position.
  5. Retracting the launcher while securing the release.
  6. Releasing (the fun part)

To step through these processes, the motors were initially set to 2.5V to produce as little movement as possible. Then we progressed from one step to the next with careful time delays measured during testing. To simply the code, the launcher and release had a separate code from the claw and arm. At the end of each code was an infinite while loop. That allowed us to run the motion once, and we could hit the reset to demonstrate the motion again. 

Claw:
 We modified the built in servo code to run the servo that opened and closed the claw.  We determined that we needed to open the claw to 155 degrees for best use.  To start the code we opened the claw with a delay so that the operator could load the recyclable into the claw.  Then to claw closed and maintained the fully closed position to keep the recyclable in the claw.  Once the arm moved to the shooter loading position the claw opened and later closed to resume its initial position.

Arm:

The arm was coded to move to the loading position and back to the initial picking position once the bottle was unloaded.

Launcher: 

The motor for the launcher was the only motor ran with position control. Originally, we were not aware of the motor driver's ability to except the servo library code. We used the standard analogWrite() to define the motor speed and direction. For the encoder, a source code from http://www.hobbytronics.co.uk/arduino-tutorial6-rotary-encoder was modified to use the A channel signal to check every time the amplitude of the wave changed. The final revolution, or number of wave changes, to be set to produce the number of turns on the 50-tooth gear. The exact value for 2 full turns was not determined due to complications with motors, encoders, motor controllers and arduino. Thanks to the help of Dr. Deshpande's lab group who worked with us prior to the demonstration, we learned of the servo library and setting on the motor controller. Due to the simplicity of the code and a more precise '2.5 Volts', we chose to modify the code in the available time. 

Release:

The release motor was programmed to move in the reverse direction first to allow it to gain momentum while moving in the forward direction so that the required force to release the launcher was obtained.