# 12. Mechanical and Machine Design¶

View group assingment here

Note: If regex is not loading properly, do refresh the page :)

## Overview¶

This week, I was tasked with learning how to use Stepper motors, and implement the logic for Panorama. As I was will be making an Omni-wheel robot for my final project, I feel that learning this is important to completing my final project as well (as I focused on servo motors for Output devices).

What I did for the week

1. prepare skeleton code to move stepper using Arduino IDE
2. meet up with Jon to figure out values to move the stepper accordingly
3. test and assemble the project

## Steppers¶

Stepper motors use a cogged wheel and activating electromagnets to rotate the wheel one ‘step’ at a time.

Each HIGH pulse sent energizes the coil, attracting the teeth closest to the cogged wheel and driving the motor one step forward.

Reference: lastminuteengineer

## Figure out values to move the motor accordingly¶

Taking a look at the stepper driver, I was using a model called the TB6600 with NEMA 17 steppers. NEMA 17 steppers, as refered to RepRap’s guide online, states that the step angle is roughly 1.8 degrees. To take panorama effectively, the motor needs to move at a relatively slow pace, hence I decided to use 1/8 step on the stepper driver. This means that to rotate a full rotation, I will need to send 800 low to high pulses to TB6600.

The exact formula is illustrated as below

$360^{\circ} = {number\;of\;steps} * 1.8^{\circ} * {microstep\;resolution}$
${number\; of\; steps} = 360^{\circ}/ (1.8^{\circ} * 1/8) = 800\;steps$

From these 800 steps, we will need to calculate how long it can travel. After assembling the project, I drew a small indicator and put 800 steps to see how far it travels. I did this measurement 10 times to get an average of about 38mm, taking into consideration of human error.

Index Distance travelled (mm)
1 38.3
2 38.2
3 37.9
4 37.8
5 38.1
6 38.0
7 37.8
8 37.6
9 38.4
10 38.0
Mean 38.01

With that, we can calculate the required steps to travel a required distance using the formula below

${number\;of\;steps} = floor({input\;distance\; in\; mm} * (800 / 38))$

I then did a test to ensure when I enter 38mm, it indeed moves by 360degrees.

## Implementing the rest of the control + circuits¶

Fortunately, I have exposed many pins in my microcontroller done in week 6. I hooked up the following according to the circuit diagram above to complete the implementations.

1. Limit Switch to go to zero position
2. Push button to zero Panorama Machine

Considering the various options of motion control, I decided to use Bang Bang motion as we just need a constant speed to move from start to end to complete the panorama. There is also no benefit for more sophisticated approach as the motion is only in 1 direction.

I then integrated the relevant electronics as well as automation to complete the project!

## Results¶

Do view the results in our group project page.

## Files¶

Last update: November 15, 2022