Kyle Chuang | ME405 Mechatronics Portfolio
Lab0x08: Term Project Part 1

Summary

In this lab I worked with Enoch Nicholson to develop drivers for our two motors and encoders attached to our hardware. These will be crucial in order to ensure the motors will be able to actuate the pivoting platform accurately when trying to balance the ball.

  1. Motor Driver (m_driver.py): This driver establishes a class object that is used to create multiple driver objects. Once initialized, each object can call on methods within this driver which can enable the motor, disable the motor, set the duty cycle of the motor, check the state of the nFAULT pin, and a callback function. A callback function is necessary to stop the motors in the event of an error (nFAULT pin set to low) in the system.
  2. Encoder Driver (enc.py): This driver establishes a class object that is used to create multiple encoder objects. Once initialized, each object can call on methods to read from the encoder. These include update() which will constantly update the measured position of the encoder, get_position() which returns the current position read by the encoder, set_position() which resets the position of the motor to a specified input, and get_delta() which returns the difference between two encoder readings.

Source code can be found here: https://bitbucket.org/ewnichol/me405_shared_work/src/master/me405%20Lab%200x08/

Author
Kyle Chuang
Enoch Nicholson
Date
March 8,2021