Wiring
The electronics of this design was rather simple, we only had to wire up the servo motor with the Arduino. The wiring diagram is shown below:
Image from: ME350_Mechatronics_Handbook.pdf
Code
For our software, we adapted the existing Arduino Sweep code. The code is designed to move the gripper into a closed position to grab the bottle. It then waits 1 second to allow for the swinging motion. It then quickly opens back up to release the water bottle and pauses for 1.5 seconds to allow for the user to position themselves before gripping the water bottle.