Embedded Code
![](https://static.wixstatic.com/media/0a1fba_249d02ba32b84e92814335efadffcce1.png/v1/fill/w_731,h_288,al_c,q_85,enc_avif,quality_auto/0a1fba_249d02ba32b84e92814335efadffcce1.png)
The embedded code is currently optimized to start-up a capacitive-start induction motor (one of our members had it lying around at home). Now, for a quick aside about a CSIR motor. A capacitive start motor is generally one phase and applying a sinusoidal voltage to this one phase results in a cancelling of two torques. This ends up stalling the motor, which pulls a significant amount of current. Not to mention, the rotor doesn’t turn, making the motor useless. However, temporarily running a voltage through a secondary winding provides a net torque, and after a certain amount of time.
In this implementation of embedded code, we have created an inverter digitally. Using the half-bridge module, we are able to output a voltage as a function of the duty factor, following a generic buck converter topology. However, we are attempting to drive an AC motor, we need to time-vary the duty factor to mimic a sine wave. This particular motor needs 60Hz, and assuming a sampling factor of 10kHz, we needed to sample a sine look up table at a certain increment.
The increment is characterized by :
This makes sense; the number of times we want to sample would in a period would be the ratio of the sampling frequency and the sine wave frequency. In our code, we have a sine value look up table of 2000 values, and thus our increment is characterized by this ratio and the number of samples in a period. Note that different phases can be easily implemented just by having different starting sample indices. For example, if we wanted three phases, one duty factor would be indexed at 0, another at 2000/3 ≈ 667 and 2*2000/3 ≈ 1333. To keep up the same frequency they would be kept at the same increment. In our implementation this increment is 2000 / (100000 kHz/60 khz) = 12. This provides beautiful, perfectly sinusoidal waves at 60Hz, as you can see below. This sine wave also ends up driving our motor, which a video in the results section shows. Note that we also had to drive another sine wave 180° out-of-phase to allow the current in the motor to reverse. To control the speed, all we would do is have to scale the duty factor’s amplitude, which is correlated to the rotor frequency, following Volts-Hertz motor control theory.
Our code (and the rest of the documentaion for the project) can be found in our Git repository.
![](https://static.wixstatic.com/media/0a1fba_8eb1f8f532f04d108f9de27dddde68f5.png/v1/fill/w_349,h_75,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/0a1fba_8eb1f8f532f04d108f9de27dddde68f5.png)
![V/Hz Control](https://static.wixstatic.com/media/0a1fba_cd9400aefbb44b3b99cf57e0f3170bda.gif/v1/fill/w_518,h_666,al_c,pstr/0a1fba_cd9400aefbb44b3b99cf57e0f3170bda.gif)
Graphic from UMN. (http://www.ece.umn.edu/users/riaz/animations/vf3.gif)