# Execution Plan
### Deadlines
#### External
- Spark challenge Apr 25th
- Less than two weeks
#### Internal
- PCB design deadline: This Sunday (17th)
- Prototype system deadline: Mid next week
### Servo Control
- Given angle, convert to PWM duty cycle
- Set CCR register
- Map to 0 to 100% duty cycle
- Could use DAC instead for more resolution if necessary
- Updates between duty cycles have set
- Fixed clock frequency, so velocity of servo is controlled by step difference (or could vary PSC/ARR to change the frequency instead(can we do this?))
- Data Pinouts:
- TIM2_CH2: PA1, AF2 SERVO #1
- TIM2_CH3: PA2, AF2, SERVO #2
- TIM2_CH4: PA3, AF2, SERVO #3
- TIM3_CH4: PB1, AF1, SERVO #4
- TIM3_CH1: PB4, AF1, SERVO #5
- TIM3_CH2: PB5, AF1, SERVO #6 (gripper)
### Read Potentiometers
- Use ADC to generate values between 0-4096 from 0-3.3V analog signal
- Value above/below 2048 increments axis value by $\pm$ 0.01m
- Data Pinouts:
- 2 Joysticks (one axis will be unused):
- X-axis, PC0, ADC_IN10
- Y-axis, PC1, ADC_IN11
- Z-axis, PC2, ADC_IN12
- 3 Potentiometers (10kohm pots):
- Wrist-roll, PC3, ADC_IN13
- Wrist-pitch, PC4, ADC_IN14
- Gripper, PC5, ADC_IN15
### Read PIR sensor interrupts
- Positive edge triggers should increment score
- Use GPIO interrupt (input to PC10)
### Kinematics
- Convert [0,4096] XYZ to [-90,90]
- IK is basically a 3 link planar arm on a turntable
- [Planar 3 link IK- pg 5](https://www.seas.upenn.edu/~meam520/notes/planarkinematics.pdf)
- Polar coordinates are probably easier

### PCB Design
- Arm has basic circuit with all servos connected in parallel and data pins connected to micro
- 5V, 2A rated power supply, with barrel jack connector (**2.1mm ID and 5.5mm OD center positive**)
- GND, DATA (3.3v), and HIGH (5V)
- Jumper wires from servo are female, so need male header pins on the board
- Add:
- Holes for mounting joysticks (not soldered), connected via jumper cables similar to servos
- Pots are mounted through hole with header pins
-
- wire e-stop (already purchased) through hot wire
- LCD display?
- Could do a through hole solder mount
- Electrical stuff to add from [PCB Guidelines](https://engineering.purdue.edu/ece362/lecture/20-module.4.pcb.tim.final.pdf)
- Minimum trace width based on current
- Decoupling capacitors

- test pads, and pin headers
- separate grounds of servos and of the micro
- Trace inductance: short and wid
- Trace impedance: traces wide
- minimize signal reflection by 135 turns intead of 90 deg turns (no right angles)
### Game / LCD
- Display score
- Display time left
### Music / MIDI
- Play "No Time for Caution" until 1 min remaining
- Then play "Eye of the Tiger"
{"metaMigratedAt":"2023-06-16T23:07:44.152Z","metaMigratedFrom":"Content","title":"Execution Plan","breaks":true,"contributors":"[{\"id\":\"0e4442ed-9b54-44ac-a13b-730bdb88da6a\",\"add\":3779,\"del\":876},{\"id\":\"05ffd732-d70b-45f6-bc56-f30e1c332c68\",\"add\":16,\"del\":0}]"}