---
# System prepended metadata

title: Cuttlefish v5s

---

# Cuttlefish v5s




## Solution 1: Stepper Motor
### Library 
Accel Stepper


## Solution 2: Continuous Servo Motor
### Library
[ContinuousServo](https://github.com/akupila/ArduinoContinuousServo
)
How can I translate the sinusoidal waveform into continuous servo control signal?
1. Figure out the speed curve related to cnotrol pulse width
2. Contruct the mathematical expression of the control signal, sine wave, and the translation velocity
3. Implemnet the mathematical model on hardware
4. Test and tune, develop a way of controlling the servo

## 1. Speed - Control pulse width curve 
Reference: [Parallax datasheet](https://www.parallax.com/sites/default/files/downloads/900-00008-Continuous-Rotation-Servo-Documentation-v2.2.pdf)

![](https://i.imgur.com/rE54eav.png)

**Speed control region**: 1.425 ms ~ 1.575 ms (approx. linear relation)
**Speed Range**: -40 rpm ~ 40 rpm

## 2. Mathematical Expressionn of speed and signal
### Hardware
**gear**: d = 23 (mm), **M** = 0.5, **Z** = 44 (T)
**traslational length per rev**: 2 * pi * (23/2) = 72.2 (mm)
**traslational speed**: v (mm/ms) = 72.2(mm) * (RPM/60) / 1000

### Derivation

**PulseWidth to RPM**: RPM = (800/1.5) * PulseWidth - 800
**PulseWidth to Translational Speed**: v(mm/ms) = 72.2 * ((800/1.5) * PulseWidth - 800) / 6000

**Desired x-t porfile**: x(mm) = A(mm) * sin( f(ms^-1) * t(ns) )
**Desired v-t porfile**: v(mm/ms) = A * f * cos( f * t )
**Time to PulseWidth**: PulseWidth (us) = (6000 * ((Af/72.2)  * cos( f * t ) + 800)* 1.5 / 800 * 1000

### Problem
#### The control frequency is 5 times slower than the desired value

### Compensation region
- **tune up**:
