Sei sulla pagina 1di 317

ω

ω
τ

τ = rF
Force

Radius
ω

⎛ 12 deg ⎞ ⎛ 60 sec ⎞ ⎛ 1 rev ⎞ 2 revs


ω =⎜ ⋅ ⋅ = = 2 RPM
⎝ sec ⎟⎠ ⎜⎝ 1min ⎟⎠ ⎜⎝ 360 deg ⎟⎠ min

ω τ
ω τ
τ
θτθτ
θτθ

W
P=
t
Pmechanical = 0.1047τω

Pmechanical = 0.0007396τω

Pelectrical = VI

Pmotor = (V − IRm )( I − I o )

τω

(V − IRm )( I − I o ) = τω = Pmechanical

η
Poutput
η=
Pinput

Poutput Pmechanical τω
η= = =
Pinput Pelectrical VI

Pmechanical (V − IRm )( I − I o ) ⎛ V − IRm ⎞ ⎛ I − I o ⎞


η= = =⎜
Pelectrical VI ⎝ V ⎟⎠ ⎜⎝ I ⎟⎠
⎛ 0.278 N ⎞ ⎛ 0.0254 m ⎞
τ = KT ( I − I o ) ⋅ ⎜ ⋅
⎝ 1 oz ⎟⎠ ⎜⎝ 1 in ⎟⎠
= 0.0070612 KT ( I − I o )

ω
τω

(V − Va )( I − I o ) = τω

(V − Va )( I − I o ) = {0.0070612 KT ( I − I o )} ⋅
⎧ ⎛ 1min ⎞ ⎛ 2π ⎞⎫
⎨ KV (V − Va ) ⋅ ⎜⎝ ⎟⎠ ⋅ ⎜⎝ ⎟⎬
⎩ 60 sec revolution ⎠ ⎭

1 = 0.000739447 K T KV

K T KV = 1352.36
Nw − Nt
Step  angle = 360° ×
Nw Nt
period
θ θ
θ

θ
θ
dia
va = La + Raia + vb
dt

d 2θ dθ
τ=J +B
dt 2 dt

τ
θ

θ
θ

dθ ( t )
− 4θ ( t ) = t
dt

⎧ dθ ( t ) ⎫
L⎨ ⎬ = s L {θ ( t )} − θ ( 0 )
⎩ dt ⎭

L { 4θ ( t )} = 4 L {θ ( t )}

1
L {t } =
s2

1
s L {θ ( t )} − θ ( 0 ) − 4 L {θ ( t )} =
s2

1
+ θ (0)
L {θ ( t )} =
2
s
s−4
1
1 1 θ ( 0 ) + 16
L {θ ( t )} = − 2 − +
4 s 16 s s−4

{ }
L−1 L {θ ( t )} = θ ( t )

⎧ 1 ⎫ t
L−1 ⎨− 2 ⎬ = −
⎩ 4s ⎭ 4

⎧ 1 ⎫ 1
L−1 ⎨− ⎬=−
⎩ 16 s ⎭ 16

⎧ 1 ⎫
⎪θ ( 0 ) + 16 ⎪ ⎛ 1 ⎞ 4t
L ⎨ ⎬ = ⎜⎝ θ ( 0 ) + ⎟⎠ e
−1

⎪ s − 4 ⎪ 16
⎩ ⎭

⎛ 1⎞ t 1
θ (t ) = ⎜ θ ( 0 ) + ⎟ e4 t − −
⎝ 16 ⎠ 4 16

1
1
s

n!
tn
s n +1

1
eat
s−a

a
sin(at)
s + a2
2
s
cos(at)
s2 + a2

df ( t )
sL{f(t)} – f(0)
dt

L { f ( t )}
t

∫ f (γ ) dγ
0 s

θ
θ
Y (s) = H (s) B(s) = H (s)G (s) A(s)

A(s) = X (s) − Y (s)

Y ( s ) = H ( s ) G ( s ) ⎡⎣ X ( s ) − Y ( s ) ⎤⎦

Y ( s ) ⎡⎣1 + H ( s ) G ( s ) ⎤⎦ = H ( s ) G ( s ) X ( s )

Y (s) H (s)G (s)


=
X (s) 1 + H (s)G (s)

θ θ

dia
va = La + Raia + vb
dt

d 2θ dθ
τ=J +D
dt 2 dt

τ = K t ia


= K v vb
dt
Va ( s ) = sLa I a ( s ) + Ra I a ( s ) + Vb ( s )

τ ( s ) = s 2 Jθ ( s ) + sBθ ( s )

τ ( s) = Kt Ia ( s )

sθ ( s ) = K vVb ( s )

θ (s) Kt
=
Va ( s ) ⎛K ⎞
JLa s 3 + ( JRa + BLa ) s 2 + ⎜ t + Ra B⎟ s
⎝ Kv ⎠

θ (s) C (s) M (s)


=
R(s) 1 + C (s) M (s)
⎛ ⎛K ⎞ ⎞
C ( s ) ⎜ JLa s 3 + ( JRa + BLa ) s 2 + ⎜ t + Ra B⎟ s ⎟
θ (s) ⎝ ⎝ Kv ⎠ ⎠
=
R(s) ⎛ ⎛ K ⎞ ⎞
C ( s ) ⎜ JLa s 3 + ( JRa + BLa ) s 2 + ⎜ t + Ra B⎟ s ⎟ + 1
⎝ ⎝ Kv ⎠ ⎠

t
d  e (t )
c ( t ) = K p e ( t ) + K i ∫ f (γ ) dγ + K d
0
dt

Ki
C (s) = K p + + sK d
s

⎛ Ki ⎞⎛ ⎛K ⎞ ⎞
⎜⎝ K p + + sK d ⎟ ⎜ JLa s 3 + ( JRa + BLa ) s 2 + ⎜ t + Ra B⎟ s ⎟
θ (s) s ⎠⎝ ⎝ Kv ⎠ ⎠
=
R(s) ⎛ Ki ⎞⎛ ⎛K ⎞ ⎞
⎜⎝ K p + + sK d ⎟ ⎜ JLa s 3 + ( JRa + BLa ) s 2 + ⎜ t + Ra B ⎟ s ⎟ + 1
s ⎠⎝ ⎝ Kv ⎠ ⎠
120 f
ns =
p
 

power  able  to  do  work ( real  power )


PF =
total  power  supplied  to  motor

power  able  to  do  work ( real  power )


PF =
3·total  power  supplied  to  motor

Real  Power = 3 ( 0.75 )( 6 A )( 200V ) = 1559W


ns − n
s=
ns
τω

τωτ ω

ωω
ω o No
=
ω i Ni

τω

τ o ω i No
= =
τ i ω o Ni

Poweroutput τ oω o
ηgear = =
Powerinput τ iω i

τ ω

⎛τ ω ⎞⎛τ ω ⎞ τ ω
ηsystem = ηmotor ⋅ ηgear = ⎜ i i ⎟ ⎜ o o ⎟ = o o
⎝ VI ⎠ ⎝ τ iω i ⎠ VI
`

ββ
ββ
a
γ
τ.

o o
distance 2τ
vs = = = 2τ f
time 1/ f

τ
o o

vs − v
s=
vs
C for
Dummies
x

x
/* This sketch sets the voltage of Pin 13 high and low.
This causes the LED connected to the pin to blink. */

// Assign a name to Pin 13


int led_pin = 13;

// At startup, configure Pin 13 to serve as output


void setup() {
pinMode(led_pin, OUTPUT);
}

// Repeatedly change the voltage of Pin 13


void loop() {
digitalWrite(led_pin, HIGH); // set the pin voltage high
delay(1000); // delay one second
digitalWrite(led_pin, LOW); // set the pin voltage low
delay(1000); // delay one second
}
int
main

setup()

loop() setup

HIGH LOW
int HIGH
LOW

pinMode(int pin_num,
int mode_type) INPUT OUTPUT INPUT_PULLUP
digitalRead(int pin_num) HIGH LOW

digitalWrite HIGH
(int pin_num, LOW
int level)
delay(int time)

delayMicroseconds
(int time)
millis()

micros()

analogReference
(int ref_type)
analogRead()
analogWrite
(int pin_num,
int duty_cycle)

INPUT HIGH LOW digitalRead

INPUT_PULLUP HIGH

OUTPUT digitalWrite

pinMode
INPUT OUTPUT

pinMode(10, OUTPUT);

pinMode INPUT INPUT_PULLUP digitalRead int


INPUT digitalRead HIGH
LOW INPUT_PULLUP digitalRead
HIGH LOW
pinMode OUTPUT digitalWrite

HIGH digitalWrite

res = digitalRead(7);
digitalWrite(8, res);
loop
setup

digitalWrite
delay
delayMicroseconds
HIGH LOW
delay

delay(1000);

delay
delay

delayMicro-
seconds delay
delayMicroseconds(500)

loop loop

millis micros

millis HIGH
LOW HIGH

if (millis() < 5000)


digitalWrite(13, HIGH);
else if (millis() < 10000)
digitalWrite(13, LOW);
else
digitalWrite(13, HIGH);

micros

analogReference analogRead
analogReference

DEFAULT

INTERNAL1V1

INTERNAL2V56

EXTERNAL

analogReference EXTERNAL

digitalRead analogRead
digitalRead analogRead int

int analogRead

analogRead

analog_v = analogRead(A5);

digitalRead digitalWrite

digital_v = digitalRead(A5);

INPUT
pinMode OUTPUT INPUT_PULLUP

analogWrite
analogWrite

analogWrite

analogWrite

analogWrite

/* This sketch produces a pulse-width modulation (PWM) signal


whose duty-cycle switches between 0%, 25%, 50%, and 75%. */

// Assign a name to Pin 13


int pwm_pin = 13;

// Configure Pin 13 as an output pin


void setup() {
pinMode(pwm_pin, OUTPUT);
}

// Switch the duty-cycle between 25% and 75%


void loop() {
analogWrite(pwm_pin, 0); // set duty cycle to 0%
delay(1000); // delay one second
analogWrite(pwm_pin, 64); // set duty cycle to 25%
delay(1000); // delay one second
analogWrite(pwm_pin, 128); // set duty cycle to 50%
delay(1000); // delay one second
analogWrite(pwm_pin, 192); // set duty cycle to 75%
delay(1000); // delay one second
}

setup OUTPUT loop analogWrite


analogWrite
/* This sketch controls a brushed motor. It drives it in the
forward direction at 75% duty cycle and halts. Then it
drives it in reverse at 75% duty cycle and halts. */

// Assign names to motor control pins


int dir_a = 12;
int pwm_a = 3;
int brake_a = 9;

// Configure the motor control pins in output mode


void setup() {
pinMode(dir_a, OUTPUT);
pinMode(pwm_a, OUTPUT);
pinMode(brake_a, OUTPUT);
}

// Deliver power to the motor


void loop() {

// Drive the motor forward at 75% duty cycle


digitalWrite(brake_a, LOW);
digitalWrite(dir_a, HIGH);
analogWrite(pwm_a, 192);
delay(2000);

// Halt the motor for a second


digitalWrite(brake_a, HIGH);
delay(1000);

// Drive the motor in reverse at 75% duty cycle


digitalWrite(brake_a, LOW);
digitalWrite(dir_a, LOW);
analogWrite(pwm_a, 192);
delay(2000);

// Halt the motor for a second


digitalWrite(brake_a, HIGH);
delay(1000);
}
#include <Stepper.h>

Stepper(int steps_per_rev, Stepper


int pin1, int pin2)
Stepper(int steps_per_rev, Stepper
int pin1, int pin2,
int pin3, int pin4)
setSpeed(int rpm)
step(int steps)
setup loop
Stepper setup
Stepper int float Stepper
Stepper Stepper

Stepper
loop

Stepper s = Stepper(200, 6, 5);


...
loop() {
...
s.step(1);
...
}

Stepper
Stepper s
setSpeed step
step loop s step step
s

Stepper

int
Stepper setSpeed

setSpeed

step

Stepper
/*
This sketch controls a bipolar stepper motor,
stepping ten times in the forward direction and
ten times in the reverse direction.
The steps/revolution is set to 200 (1.8 deg/step)
and the speed is set to 10 RPM.
*/

#include <Stepper.h>

// Set the pin numbers


int pwm_a = 3;
int pwm_b = 11;
int dir_a = 12;
int dir_b = 13;

// Create a stepper object


Stepper s = Stepper(200, dir_a, dir_b);

void setup() {

// Set speed to 10 revs/min


s.setSpeed(10);

// Make sure the two H Bridges are always on


pinMode(pwm_a, OUTPUT);
pinMode(pwm_b, OUTPUT);
digitalWrite(pwm_a, HIGH);
digitalWrite(pwm_b, HIGH);
}

void loop() {

// Ten steps in the forward direction


s.step(10);
delay(1000);

// Ten steps in the reverse direction


s.step(-10);
delay(1000);
}

#include <Servo.h>

Stepper
Servo

attach(int pin)
attach(int pin, int min,
int max)
attached()
detach()

write(int angle)
writeMicroseconds(int time)

read()

Servo
Servo

Servo sv;

Servo
attach

attach

attach

sv

sv.attach(8, 900, 2100);

Servo
write writeMicroseconds write

writeMicroseconds
/*
This sketch controls a hobbyist servomotor.
It rotates the shaft 180 degrees forward and 180 degrees back.
*/

#include <Servo.h>

Servo sv; // Servo object


int angle; // servo's angular position

void setup() {

// Attach the Servo object to Pin 6


sv.attach(6, 800, 2200);
}

void loop() {

// Rotate from 0 to 180 degrees


for(angle = 0; angle < 180; angle += 1) {
sv.write(angle);
delay(10);
}

// Rotate from 180 to 0 degrees


for(angle = 180; angle >= 1; angle -=1) {
sv.write(angle);
delay(10);
}
}

attach
Stepper
setSpeed step

Servo
2+2
4 print Hello world
Hello world
sudo apt-get install python-dev python-pip
sudo pip install -U RPIO

import RPIO

setmode(int num_mode)
setup(int pin, int mode)
setup(int pin, int mode,
int res_mode)
output(int pin, int level) RPIO.HIGH RPIO.LOW
int input(int pin)
cleanup()
add_interrupt_callback
(int pin, callback_func,
edge='both',
pull_up_down=RPIO.PUD_OFF,
threaded_callback=False
debounce_timeout_ms=None)
wait_for_interrupts
(threaded=False,
poll_timeout=1)
del_interrupt_callback
(int pin)

RPIO.BOARD

RPIO.BCM
setMode
RPIO.BCM

RPIO.setmode(RPIO.BCM)

setup
RPIO.IN RPIO.OUT

RPIO.setup(24, RPIO.OUT)

output
RPIO.HIGH
RPIO.LOW
input

input

setup input output

"""
This code repeatedly checks the logic level of in_pin.
If the level is low, out_pin is set high and the reading continues.
If the level is high, the script completes.
"""

import RPIO

# Set input pins


in_pin = 17;
out_pin = 24;

# Specify use of BCM pin numbering


RPIO.setmode(RPIO.BCM)
# Configure pin directions
RPIO.setup(in_pin, RPIO.IN)
RPIO.setup(out_pin, RPIO.OUT)

# Wait for in_pin to reach low voltage


while(RPIO.input(in_pin) == RPIO.LOW):
RPIO.output(out_pin, RPIO.HIGH)

# Return pins to default state


RPIO.cleanup()

while

setup pull_up_down

RPIO.PUD_UP

RPIO.PUD_DOWN

RPIO.PUD_OFF

RPIO.setup(17, RPIO.IN, pull_up_down=RPIO.PID_UP)

cleanup

add_interrupt_callback
rising

falling

both

RPIO.PUD_UP

RPIO.PUD_DOWN

RPIO.PUD_OFF

true

false

"""
This code sets up interrupt handling for Pin 17.
A change in the logic level executes a callback
that prints a message.
"""

import RPIO

def edge_detector(pin_num, rising_edge):


if rising_edge:
print("Rising edge detected on Pin %s" % pin_num)
else:
print("Falling edge detected on Pin %s" % pin_num)

# Define input pin


in_pin = 17

# Specify use of BCM pin numbering


RPIO.setmode(RPIO.BCM)
# Configure pin direction
RPIO.setup(in_pin, RPIO.IN)

# Configure interrupt handling for rising and falling edges


RPIO.add_interrupt_callback(in_pin, edge_detector, edge='both')
RPIO.wait_for_interrupts()

# Return pin to default state


RPIO.del_interrupt_callback(in_pin)
RPIO.cleanup()

add_interrupt_callback wait_for_interrupts

threaded TRUE

RPIO.wait_for_interrupts(threaded=TRUE)

del_interrupt_callback
setup(pulse_incr_us=10,
delay_hw=0)
init_channel(int dma_channel,
subcycle_time_us=20000)
add_channel_pulse
(int dma_channel, int pin,
int start, int width)
clear_channel
(int dma_channel)
clear_channel_gpio
(int dma_channel, int pin)
cleanup()

setup

PWM.DELAY_VIA_PWM PWM.
DELAY_VIA_PCM

setup init_channel

add_channel_pulse

start
width

start
PWM.add_channel_pulse(0, 18, 0, 1000)
PWM.add_channel_pulse(0, 18, 8000, 1000)

clear_channel clear_channel_
gpio cleanup

"""
This code generates a pulse-width modulation (PWM)
for Pin 18 whose pulses have a width of 1ms.
"""

import RPIO.PWM as PWM


import time

# Define PWM pin


pwm_pin = 18

# Initialize DMA and set pulse width resolution


PWM.setup(1)

# Initialize DMA channel 0


PWM.init_channel(0)

# Set pulse width to 1000us = 1ms


PWM.add_channel_pulse(0, pwm_pin, 0, 1000)

time.sleep(10)

# Clear DMA channel and return pins to default settings


PWM.clear_channel(0)
PWM.cleanup()

Using hardware: PWM


PW increments: 1us
Initializing channel 0...
add_channel_pulse: channel=0, start=0, width=1000
init_gpio 18

sleep
sleep(10)
Servo

set_servo(int pin, int width)

stop_servo(int pin)

PWM.setup
PWM.init_channel

set_servo stop_servo

"""
This code controls a servomotor, rotating from
the minimum to maximum angle and back.
"""

import RPIO.PWM as PWM


import time

# Define control pin and pulse widths


servo_pin = 18
min_width = 700
max_width = 2300

# Create servo object


servo = PWM.Servo()

# Set the angle to the minimum angle and wait


servo.set_servo(servo_pin, min_width)
time.sleep(1)

# Rotate shaft to maximum angle


for angle in xrange(min_width, max_width, 100):
servo.set_servo(servo_pin, angle)
time.sleep(0.25)
# Rotate shaft to minimum angle
for angle in xrange(max_width, min_width, -100):
servo.set_servo(servo_pin, angle)
time.sleep(0.5)

# Stop delivering PWM to servo


servo.stop_servo(servo_pin)

set_servo time.sleep
RRB2
forward(seconds=0,
speed=0.5)
reverse(seconds=0,
speed=0.5)
left(seconds=0,
speed=0.5)
right(seconds=0,
speed=0.5)
stop()
set_motors
(float left_pwm,
int left_dir,
float right_pwm,
int right_dir)

speed

set_motors

RRB2

RRB2.
RIGHT_DIR_PIN

RRB2

"""
This program controls two brushless DC motors:
Forward for five seconds, backwards for four seconds,
right for three seconds, and left for two seconds.
"""
import rrb2

# Create RRB2 object


robot = rrb2.RRB2()

# Rotate forward for five seconds


robot.forward(seconds=5, speed=1.0)

# Rotate backward for four seconds


robot.reverse(seconds=4, speed=0.8)

# Turn left for three seconds


robot.left(seconds=3, speed=0.6)

# Turn right for two seconds


robot.right(seconds=2, speed=0.4)

# Stop motor
robot.stop()

RRB2
RRB2 revision

setMotors
RRB2
setMotors

"""
This program controls a stepper motor by
energizing its phases in a given sequence.
"""

import rrb2
import time

# Create RRB2 object


robot = rrb2.RRB2()
# Set number of repetitions and step delay
num_reps = 10
step_delay = 0.4

# Repeat the energizing sequence num_reps times


for x in range(0, num_reps):

robot.set_motors(1.0, 1, 0.0, 0)
time.sleep(step_delay)

robot.set_motors(0.0, 0, 1.0, 1)
time.sleep(step_delay)

robot.set_motors(1.0, 0, 0.0, 0)
time.sleep(step_delay)

robot.set_motors(0.0, 1, 1.0, 0)
time.sleep(step_delay)

# Stop motor
robot.stop()

Servo setServo stopServo


RRB2
set_motors
ssh root@192.168.7.2

scp data.txt root@192.168.7.2:/root

scp root@192.168.7.2:/root/data.txt /home/matt

sudo apt-get update


sudo apt-get install build-essential python-dev python-setuptools
sudo apt-get install python-pip python-smbus –y
sudo pip install Adafruit_BBIO

python

python test.py
setup(string pin, int mode)
output(string pin, int level) HIGH LOW
int input(string pin)
cleanup()
wait_for_edge(string pin,
int event)
add_event_detect(string pin,
int event)
event_detected(string pin)
name name

setup
GPIO.IN GPIO.OUT
"P8_12" "GPIO1_12"

GPIO.setup("P8_14", GPIO.OUT)

GPIO.setup("GPIO0_26", GPIO.OUT)

output
GPIO.HIGH
GPIO.LOW
input
input
input

setup input output

"""
This script repeatedly checks a pin's logic level.
If the logic level is low, a second pin is set high.
If the logic level is high, the loop terminates.
"""

import Adafruit_BBIO.GPIO as GPIO

# Assign names
input_pin = "P8_16";
output_pin = "P8_18";

# Set pin directions


GPIO.setup(input_pin, GPIO.IN)
GPIO.setup(output_pin, GPIO.OUT)

# Wait for input_pin to reach low voltage


while(GPIO.input(input_pin) == GPIO.LOW):
GPIO.output(output_pin, GPIO.HIGH)

# Return pins to default state


GPIO.cleanup()

while

cleanup

while

wait_for_edge

wait_for_edge(string pin, int event)

wait_for_edge

GPIO.RISING

GPIO.FALLING

GPIO.BOTH

wait_for_edge("P8_18", GPIO.FALLING)

add_event_detect
event_detected wait_for_edge

event_detected
add_event_detect event_detected
add_event_detect("GPIO1_23", GPIO.FALLING)
while(condition == True):
...perform other tasks...
if(event_detected("GPIO1_23")):
...respond to the falling edge...

add_event_detect event_detected

add_event_detect

add_event_detect(string pin, int event, callback=func, bouncetime=time)

add_event_detect
bouncetime
add_event_detect
event_callback

"""
This code configures a callback that responds
to changes to the logic level for Pin P8_18.
"""

import Adafruit_BBIO.GPIO as GPIO


import time

def event_callback(pin):
print("The event was received by Pin %s." % pin)

# Define pin to be tested


test_pin = "P8_18";

# Set pin direction


GPIO.setup(test_pin, GPIO.IN)

# Configure a callback to be executed


GPIO.add_event_detect(test_pin, GPIO.BOTH, event_callback)
# Delay for ten seconds
time.sleep(10)

# Return pin to default state


GPIO.cleanup()

event_callback

The event was received by Pin P8_18.

time.sleep

start(string pin, float duty,


freq=freq, polarity=pol)
set_duty_cycle(string pin,
float duty)
set_frequency(string pin,
float freq)
stop(string pin)
cleanup()

start
float

GPIO.start("P8_18", 25)

start
start

GPIO.start("P8_18", 10, 50)

start

start set_duty_cycle set_frequency


start

"""
This code generates a pulse-width modulation (PWM) signal
for Pin P8_19 with a 40% duty cycle and a frequency of 50 Hz.
"""

import Adafruit_BBIO.PWM as PWM


import time

# Define PWM pin


pwm_pin = "P8_19"

# Set duty cycle to 40%, frequency to 50 Hz


PWM.start(pwm_pin, 40, 50)
# Delay for ten seconds
time.sleep(10)

# Halt PWM and return pin to initial settings


PWM.stop(pwm_pin)
PWM.cleanup()
python setupDMCC.py install

getMotorCurrent(int board,
int motor)
getMotorDir(int board,
int motor)
getMotorVoltage(int board,
int motor)
getQEI(int board, int motor)

getQEIDir(int board,
int motor)
getTargetPos(int board,
int motor)
getTargetVel(int board,
int motor)
setMotor(int board,
int motor, int power)
setPIDConstants(int board,
int motor, int posOrVel,
float P, float I, float D)
setTargetPos(int board,
int motor, int pos)
setMotor

setMotor(0, 1, 5000)

"""
This drives a motor forward at full speed for 5 seconds, stops,
drives the motor backward at half-speed, and stops.
"""

import DMCC as DMCC


import time

# Drive motor forward


setMotor(0, 1, 10000)
time.sleep(5)

# Stop
setMotor(0, 1, 0)
time.sleep(3)

# Drive motor backward


setMotor(0, 1, -5000)
time.sleep(10)

# Stop
setMotor(0, 1, 0)
time.sleep(3)

setMotor
QG
I=
t switch

65 nC
I= = 0.13A
500 ns
⎡ I I ⎤
2 ⎢ 2QG + qbs (max) + Qls + Cbs (leak) ⎥
C≥ ⎣
f f ⎦
Vcc − V f − VLS − VMin
VA − VP VB − VP VC − VP
+ + =0
RP RP RP

VA + VB + VC − 3VP = 0

VA + VB + VC
VP =
3
dI B
VB − VO = I B RB + LB + BEMFB
dt

dI C
VC − VO = I C RC + LC + BEMFC
dt

dI C
VB − VO = − I C RC − LC − BEMFC
dt
= − (VC − VO )

VB + VC
VO =
2

VA − VO = BEMFA

VO = VA − BEMFA

VB + VC
VO =
2

VO = VA − BEMFA

VA + VB + VC
VP =
3
2VA − VB − VC
BEMFA =
2

2
VP − VA = − BEMFA
3
J1 J2 J3 J4
1 1 1 1
2 2 2 +ZC_A 2
3 3 3 +ZC_B 3
+AREF 4 4 +ZC_C 4
4
+D_GND 5 ++3.3V 5 +ZC_P 5
+CTRL_AH 5 ++5V
6 6 6 6
+CTRL_AL 7
+CTRL_BH
7 7
8 8 8
+CTRL_BL 9
+CTRL_CH GND
10
+CTRL_CL

J5 J6
+MTR_VA
1 ++12V
1
2 2
+MTR_VB 3 +MTR_PWR 3
+MTR_VC
4
+HE_A 5
+HE_B 6
+HE_C GND
7
++3.3V 8

GND
++12V +D1 MTR_PWR

++5V Q1
+UF4007
U1 + C1 R1
VDD
VCC

5.6uF 4.7 IRFR7446-DPAK


+CTRL_AH HIN VB R2
+CTRL_AL LIN HO 10k
+
SD VS +MTR_VA
Q2
NC1 LO
R3
NC2 NC4
4.7 IRFR7446-DPAK
COM
VSS

NC3 NC5 R4
10k
IR2110S

GND GND
R19 R13
+MTR_VA
10k 10k
R20 R14
+ZC_P +MTR_VB
10k 10k
R21 R15
+MTR_VC
10k 10k
R16+ +C4 R17+ +C5 R18+ +C6
+ZC_C +ZC_B +ZC_A
+100 +100 +100
1k+ 1k+ 1k+
pF pF pF

GND
VMOT

IA
AH BH CH

IB IC

AL BL CL
2t t
1 rev = 6 t
CTRL_AH HIGH

CTRL_AL HIGH

CTRL_BH HIGH

CTRL_BL HIGH

CTRL_CH HIGH

CTRL_CL HIGH

ω
ω

1 rev ⎛ ω goal rev ⎞ ⎛ 1min ⎞


=
6t sec ⎜⎝ 1min ⎟⎠ ⎜⎝ 60 sec ⎟⎠
10
t=
ω goal
analogWrite
/* This sketch controls a BLDC by applying voltage to the
six switches on the ESC Shield discussed in Chapter 12 */

// Assign names to the pins


int i, t, va, vp;
int old_time, zc_interval;
int ctrl_ah = 13;
int ctrl_al = 12;
int ctrl_bh = 11;
int ctrl_bl = 10;
int ctrl_ch = 9;
int ctrl_cl = 8;
int zc_a = 0;
int zc_b = 1;
int zc_c = 2;
int zc_p = 3;

int time_goal = 50;

void setup() {

// Bring rotor to a known initial position


for (i=0; i<255; i+=5){
analogWrite(ctrl_ah, i);
analogWrite(ctrl_bl, i);
analogWrite(ctrl_cl, i);
delay(60);
}

// Set initial timing value


old_time = millis();

// Start turning the rotor slowly


for (t=500; t>200; t-=50) {
rotate(t);
}
t = 200;
}

void loop() {

// Check for zero-crossing


vp = analogRead(zc_p);
va = analogRead(zc_a);
if((vp - va < 10) || (va - vp < 10)) {
zc_interval = millis() - old_time;
old_time = millis();
if(zc_interval - time_goal > 50) {
t -= 25;
}
else if(time_goal - zc_interval > 50) {
t += 25;
}
}

// Rotate the BLDC


rotate(t);
}

// Rotate the motor at the given value of t


void rotate(int t) {
digitalWrite(ctrl_ah, HIGH);
digitalWrite(ctrl_al, LOW);
digitalWrite(ctrl_bh, LOW);
digitalWrite(ctrl_bl, HIGH);
digitalWrite(ctrl_ch, LOW);
digitalWrite(ctrl_cl, LOW);
delay(t);

digitalWrite(ctrl_ah, HIGH);
digitalWrite(ctrl_al, LOW);
digitalWrite(ctrl_bh, LOW);
digitalWrite(ctrl_bl, LOW);
digitalWrite(ctrl_ch, LOW);
digitalWrite(ctrl_cl, HIGH);
delay(t);

digitalWrite(ctrl_ah, LOW);
digitalWrite(ctrl_al, LOW);
digitalWrite(ctrl_bh, HIGH);
digitalWrite(ctrl_bl, LOW);
digitalWrite(ctrl_ch, LOW);
digitalWrite(ctrl_cl, HIGH);
delay(t);

digitalWrite(ctrl_ah, LOW);
digitalWrite(ctrl_al, HIGH);
digitalWrite(ctrl_bh, HIGH);
digitalWrite(ctrl_bl, LOW);
digitalWrite(ctrl_ch, LOW);
digitalWrite(ctrl_cl, LOW);
delay(t);

digitalWrite(ctrl_ah, LOW);
digitalWrite(ctrl_al, HIGH);
digitalWrite(ctrl_bh, LOW);
digitalWrite(ctrl_bl, LOW);
digitalWrite(ctrl_ch, HIGH);
digitalWrite(ctrl_cl, LOW);
delay(t);

digitalWrite(ctrl_ah, LOW);
digitalWrite(ctrl_al, LOW);
digitalWrite(ctrl_bh, LOW);
digitalWrite(ctrl_bl, HIGH);
digitalWrite(ctrl_ch, HIGH);
digitalWrite(ctrl_cl, LOW);
delay(t);
}

setup

rotate

loop vp
va
t
P = 1.31 pd 4ω 3

ω
v0
freestream (unaffected) air

ve ve
downwash downwash

⎛v −v ⎞
F = m⎜ e 0 ⎟
⎝ t ⎠
dm
F= ( ve − v0 ) = m ( ve − v0 )
dt

ρρ

Cylinder volume = / r 2h

m = ρπ r 2 h

⎛ h⎞
change = ρπ r 2 ⎜ ⎟
⎝t⎠

m = ρπ r 2 ve
(
F = m ( ve − v0 ) = ρπ r 2 ve ( ve − v0 ) = ρπ r 2 ve 2 − ve v0 )

ρπ ( 0.0254 d )
2

F=
4
( ve2 − vev0 ) = ( 5.067 ⋅ 10 −4 ) ρ d 2 ( ve2 − vev0 )

( ) (
F = 6.207 ⋅ 10 −4 d 2 ve 2 − ve v0 )

x
pitch =
rotation

dx d ( pitch ⋅ rotation ) d ( rotation )


ve = = = pitch ⋅ = pitch ⋅ ω
dt dt dt

⎛ 0.0254m ⎞ ⎛ 1min ⎞
ve = p ⋅ ⎜
⎝ in
⎟⎠ ⋅ ω ⋅ ⎜⎝ ( −4
⎟ = 4.233 ⋅ 10 pω
60 sec ⎠
)
( ) (
F = 2.628 ⋅ 10 −7 d 2 ⎡⎣ 4.233 ⋅ 10 −4 )( pω ) 2
− pω v0 ⎤⎦

1.5
⎛ ⎞
( ) (
F = 2.628 ⋅ 10 −7 d 2 ⎡⎣ 4.233 ⋅ 10 −4 )( pω ) 2
− pω v0 ⎤⎦ ⎜
d
⎝ 3.29546 p ⎟⎠
385 mm
272.24 mm (15.16 in)
(10.72 in)

272.24 mm
(10.72 in)
Quadcopter

ESC ESC

Flight
Transmitter Receiver
Controller
User
ESC ESC
Aileron (Channel 1)/
Flap (Channel 6) Elevator (Channel 2)

Gear
(Channel 5)

Throttle (Channel 3)/


Rudder (Channel 4)
Signal pins

Positive voltage

Negative voltage
STM32F103 microcontroller

Connections
Receiver to ESCs
connection

Flexi port Main port


PC connection
ESC 1
RC
Receiver ESC 2

ESC 3
STM32F103
Microcontroller
ESC 4
MPU6000
ESC 5
Gyroscope/
Accelerometer ESC 6

Flash
USB
Memory
End rings
Bearing
Shaft

Conductor
Windings

Magnets
A

C B

B C

Rotor

Stator
Receive at least one of a user
input or vehicle information. 1405

Select one of a plurality of


available flux modes using at
1410
least one of the user input or
the vehicle information.

Calculate a control signal using


the selected flux mode to
1415
control a motor of an electric
vehicle.
Stator

Rotor

Rotor slots
Rotor teeth

Air gap
Stator teeth

Stator slots
1st Layer Slot
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
Upper A1 A1 B4 B4 A1 A1 A2 A2 C1 C1 A2 A2
Lower A1 A1 A1 B4 B4 B4 A1 A1 A1 A2 A2 A2 C1 C1 C1 A2 A2 A2

Slot
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
Upper C1 C1 C2 C2 B3 B3 C2 C2 B3 B3 B4 B4
Lower C1 C1 C1 C2 C2 C2 B3 B3 B3 C2 C2 C2 B3 B3 B3 B4 B4 B4

2nd Layer (in bold & italics)


Slot
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
Upper A1 A1 C3 C3 C3 C4 C4 C4 B4 B4 B1 B1 B1 A1 A1 A2 A2 C4 C4 C4 C1 C1 B1 B1 B1 B2 B2 B2 A2 A2
Lower A1 A1 A1 C3 C3 C4 C4 B4 B4 B4 B1 B1 A1 A1 A1 A2 A2 A2 C4 C4 C1 C1 C1 B1 B1 B2 B2 A2 A2 A2

Slot
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
Upper A3 A3 A3 C1 C1 C2 C2 B2 B2 B2 B3 B3 A3 A3 A3 A4 A4 A4 C2 C2 C3 C3 C3 B3 B3 B4 B4 A4 A4 A4
Lower A3 A3 C1 C1 C1 C2 C2 C2 B2 B2 B3 B3 B3 A3 A3 A4 A4 C2 C2 C2 C3 C3 B3 B3 B3 B4 B4 B4 A4 A4
Vehicle 1335
Stability
Control
1331 Gear Mode
Selection Selection 1300
Sensor Sensor 1333

1306 1304
1321 1307 1309
905 903 601
Control
Inverter Motor
1315 Module
607
1301 Torque
ESS 1101 Tran/Diff
Controller

1317 Control Inverter Motor


Module
909 603
911 605
1319 1311 1313
1323
1305 1303

Brake Accelerator
Sensor Sensor

1325 Steering 1327


Sensor
1329
210 Laminated
Discs

212 Bars

214 Slugs

220 Bolt

222 Plate
236 Hole 224 Nut
230 Collar
240 Holes

234 Fin
232 Collet

238 Hole
Rotation
(input)

Induced
N Current S
(output)

Brushes

Slip rings

τω

Poutput Pelectrical VI
η= = =
Pinput Pmechanical τω
V
C
G Generator

L1

C1 C2
G Generator
V
ns p
f =
120

alternator
Rotor

Stator

Current-carrying
wire

Permanent
magnets

Rotor Field coils

Stator

Armature
windings
ω
τ
single-phase motors, 89, 103
capacitor-start motor, brushed motors, DC
104-105 motors, 38
shaded-pole motor, of digital servomotors, 76
105-106
split-phase motors,
103-104
single-phase power, 90
classifying, 284
synchronous polyphase
magnetos, 284-285 motors, 89, 100 PRU-ICSS, 198
self-excited generators, doubly excited SGX530 3D graphics engine,
285-286 synchronous motors, 101 198
permanent magnet Sitara Cortex-A8 processing
asynchronous polyphase synchronous motors, code, 197
motors, 89, 96 101-102
current and torque, 97 synchronous reluctance
Force Law, 28
motors, 102-103
electromagnetic
induction, 96 three-phase power, 90-91
squirrel-cage rotors, 97-98 universal motors, 109-110
wound rotors, 98-100 See
controls, 106
eddy-current drives,
106-107
variable-frequency drive
(VFD), 107-108
BeagleBone Black (BBB), 200
VFD harmonic distortion,
GPIO (general-purpose input/
108-109
output) pins, 201 measuring, 17
EV conversion, 265
polyphase motors, 89, 91
power factor, 94-95
rotating magnetic fields, RPIO, 180
92-94
stators, 91-92
synchronous speed, 94
Raspberry Pi, 173-174
ARM1176 processing core,
173-174
Arduino Mega. See Arduino
VideoCore IV graphics
Mega
processing core, 174
ATmega2560, 148-149 resistance of the armature, 21
circuitry, 146-147
microcontrollers, 147-148
AM3359, 197
stepper motor controls,
PRU-ICSS, 198
stepper libraries, 162-164 current and torque, 97 SGX530 3D graphics
electromagnetic induction, 96 engine, 198
squirrel-cage rotors, 97-98 Sitara Cortex-A8
Arduino Motor Shield. See wound rotors, 98-100 processing code, 197
Arduino Motor Shield circuit boards, 196-197
ATmega2560, 148-149 Debian operating system,
circuitry, 146-147 199-200
microcontrollers, 147-148 DMCC (Dual Motor Controller
programming, 149 Cape), 207-209

analogRead, 155-156 communication, 209

analogWrite, 156-158 motor controls, 211-212

digital I/O, 154-155 PWM generation, 209-210

global variables, 153 BLDC (brushless DC motor), switching circuitry, 210


48-49 GPIO (general-purpose input/
loop(), 153
output) pins
preparing the
environment, 149-152 configuring, 202-203

setup(), 153 event handling, 203-205


DC motors, 51-52
sketch functions, 153-154 programming, 198
EV conversion, 266-267
using environments, Adafruit-BBIO module, 200
lithium-ion batteries, 52
152-153 GPIO (general-purpose
lithium-iron-phosphate (LFP) input/output) pins,
servomotor controls, 166 batteries, 267 201-205
Servo library, 166-167 nickel-cadmium batteries, 52 PWM generation, 205-207
stepper motor controls, 162 quadcopter, 258-259 Revision C, 196
rechargeable battery types,
51-52
brushed motors, 161-162
L298P dual H bridge
connections, 159-160
power, 159 See
SHWDC (shunt-wound
DC) motors, 38 back-EMFs, 22-23
SWDC (series-wound) electrical losses, 21-22
motors, 37-38
controlling, 46-49
mechanical commutation,
ESCs (electronic speed
35-36
controls), 234
general control, 234-235
interfacing through
Arduino, 235-239 DC motors, 42
inrunner motor, 44 controlling, 46-49
outrunner motors, 44-45 outrunner motors, 44-45
structure of, 42-44 structure of, 42-44
reducing, 44

single-phase motors, AC
motors, 104-105

Transrapid Maglev System,


136-137
PM (permanent magnet)
Yaskawa SGLG, 135-136
stepper motors and inrunner
motors, 57
VR (variable reluctance)
steppers versus PM
steppers, 59

BeagleBone Black (BBB),


196-197
Raspberry Pi, 172-173
Arduino Motor Shield, GPIO (general-purpose input/
161-162 output) pins, BeagleBone
Arduino Mega, 146-147 Black (BBB), 202-203
DC motors, 34-35
control circuitry, brushed PWM, servomotors, Raspberry
advantages/
motors, 39-42 Pi, 182-184
disadvantages, 38
DC motors, 31
control circuitry, 39-42
electrical switches, 31-32
inrunner motor, 44
PMDC motors, 36-37
rotational speed, 29
torque, 28-29
asynchronous polyphase voltage, 29
motors, AC motors, 97
DC motors, 28-29
efficiency, 25

header connections, 229-231


brushless motors, DC motors,
46-49 MOSFETs
batteries, 51-52 (metal-oxide-semiconductor
servomotors, 78, 167-168
brushed motors, 10, 34-35 field-effect transistors), 231
block diagrams, 83-84
advantages/ zero-crossing detection
Laplace transform, 81-83 disadvantages, 38 (ZCD), 232
modeling, 80 control circuitry, 39-42
open-loop and closed-loop mechanical commutation,
systems, 79 35-36
transfer functions, 83-85 PMDC motors, 36-37
stepper motors, 164-166 SHWDC (shunt-wound
DC) motors, 38
AC motors, 106 SWDC (series-wound) brushed motors, DC
eddy-current drives, motors, 37-38 motors, 38
106-107 brushless motors, 10, 42 of digital servomotors, 76
variable-frequency drive controlling, 46-49 Raspberry Pi, 171-172
(VFD), 107-108 inrunner motors, 44
VFD harmonic distortion, outrunner motors, 44-45
108-109 structure of, 42-44 BeagleBone Black (BBB)
PID control, servomotors, circuitry, 31 communication, 209
85-87 electrical switches, 31-32 motor controls, 211-212
stepper motors, 63-64 commutated motors, 10 PWM generation, 209-210
bipolar stepper control, current, 28-29 switching circuitry, 210
64-65
ESCs (electronic speed
unipolar stepper controls, controls), 49-50
65-67
EV conversion, 265
KT, 28-29
KT-KV, 30
full-step (one phase on)
KV, 29 mode, 68
PWM (pulse width full-step (two phases on)
modulation), 33-34 mode, 68-69
half-step mode, 69-70 MOSFETs (metal-oxide-
microstep mode, 71 BMW i3, 271 semiconductor
EV conversion, 264 field-effect transistors),
231
batteries, 266-267
signal pins, 236
controllers, 266
motors, 264-266
transmission, 267
BEC (battery eliminator
Nissan Leaf, 269-270
circuit), 50
Tesla Motors Model S,
BLDC (brushless DC
267-269
motor), 234
general control, 234-235
interfacing through
Arduino, 235-239
board layout, 232-233
DC motors, 31-32
mass flow rate, 245-246 considerations when
transistors, 32-33
selecting, 50
propeller pitch, 246-247
DC motors, 49-50
pushing air down, 244-245
designing schematics, 229
header connections,
229-231
MOSFETs (metal-oxide-
semiconductor
field-effect transistors),
231
zero-crossing detection
(ZCD), 232
MOSFET drivers, 222-224
batteries, 258-259 overview of design, 216-218
ESCs (electronic speed programmability, 51
controls), 256-258 quadcopters, 256-258
current, 25 flight controllers, 254-256 switching circuitry, 218-219
gears, 115 transmitters/receivers, bootstrap capacitors,
251-253 224-225
MOSFET switches,
219-222
zero-crossing detection
AC motors, 10-11
(ZCD), 225-229
DC motors, 10
board layout, 232-233
overview, 9-10
designing schematics AC motors, 265
header connections, batteries, 266-267
229-231
controllers, 266
DC motors, 265
motors, 264-266 PWM (pulse width AC generators, 279, 283-284
transmission, 267 modulation), 34 classifying, 284
switching, 51 magnetos, 284-285
self-excited generators,
285-286
DC generators, 279, 281-282
homopolar generators, 281
overview, 280-281
self-excited generators, 279
DMCC module, 211
Servo library, 166-167
stepper libraries, 162
See

Adafruit-BBIO module, 201


BeagleBone Black (BBB),
201-205
events/event handling,
203-205
backlash, 117 configuring, 202-203
bevel gears, 120-121 input and output pins,
contact ratio, 118 179-180
efficiency, 115 interrupts, 180-182
helical gears, 118-120 Raspberry Pi, 177-182
input gears, 114 RaspiRobot, 187
mechanical advantage, 115
quadcopters, 254-256
output gears, 114
pitch, 115-116
planetary gears, 123-124
power transmission, 114-115
rack and pinion gears,
121-122
spur gears, 117-118
vibration, 118
direction, 14 worm gears, 122-123
no-load current, 21

Raspberry Pi, 176-177

analog and digital servos, 76


PWM (pulse width
modulation), 75
rotary encoders, 76-77
magnetic rotary
encoders, 78
optical rotary encoders, 77 versus PM (permanent
magnet) stepper motors, 57

railguns, 141-142
structure of, 140-141

operations, 63
structure of, 62-63
Ch10/stepper.py—Control a
Stepper Motor, 191-192
case studies Ch11/callback.py—
Transrapid Maglev Responding to Events in a
System, 136-137 Callback, 204-205
Yaskawa SGLG, 135-136 Ch11/motor.py—Controlling a
structure of, 131-135 Motor with the DMCC, 212
iron-core LSM, 133 Ch11/pwm.py—Generating a
PWM Signal, 206-207
Servo library, 166-167 ironless LSM, 133-134
Ch11/test_input.py—
stepper libraries, 162-164 slotless LSM, 134-135
Checking a Pin’s Logic
speed, 132-133 Level, 202-203
Ch12/bldc.ino—BLDC
Control, 237-239

LINIMO train line, 138-140


structure of, 137-138

coilguns, 130-131 Ch9/blink—Causing an LED


how they work, 129-130 to Blink, 152 input and output pins, 179
samples, 130 Ch9/brushed.ino—Brushed
DC Motor Control, 161
Ch9/pwm.ino—Pulse Width
LINIMO train line, 138-140 Modulation, 157
structure of, 137-138 Ch9/servo.ino—Servomotor
Control, 168
Ch9/stepper.ino—Stepper
homopolar motors, 140 Motor Control, 165-166
railguns, 141-142 Ch10/brushed.py—Control
structure of, 140-141 Two Brushed DC Motors,
linear actuators, 128-129 189-190
coilguns, 130-131 Ch10/check_input.py—
how they work, 129-130 Checking a Pin’s Logic
Level, 179-180
samples, 130
Ch10/interrupt.py—
linear induction motors
Responding to Logic Level
(LIMs), 137
Changes, 181-182
LINIMO train line, 138-140
Ch10/pwm.py—Generating a
structure of, 137-138 PWM Signal, 184
linear synchronous Ch10/servo.py—Control a brushless motors, DC
motors, 131 Servomotor, 185-186 motors, 43
structure of, 131-135 electromagnets, 18-21
permanent magnets, 18
stepper motors. See stepper
ESCs (electronic speed motors
controls), 222-224 universal motors, AC motors,
designing schematics, 231 109-110
IR2110 high-side/low-side WRIMs (wound-rotor
drivers, 223-224 induction motors), 98

body diodes, 221-222


ESCs (electronic speed
angular speed, 17 controls), 219-222
power, 24 designing schematics, 231
torque, 16 selecting, 220
voltage, 24 H bridge, 41
weight, 14 IRFR7446, 221
operational parameters, 220

AC motors. See AC motors


considerations when
selecting, 5
EV conversion, 264-266
manufacturers, 265-266
external structures, 8
induction motors, Tesla,
268-269
inrunner motor, 42, 44
internal structures, 8-9
linear motors. See linear
motors
outrunner motors, 44-45 Debian operating system,
quadcopters, 248-250 BeagleBone Black (BBB),
servomotors. See servomotors 199-200
sinusoidal motors, 49 Raspbian, 175-176
hybrid (HY) steppers, 63
PM (permanent magnet)
stepper motors, 57-59
VR (variable reluctance)
steppers, 60-61

versus inrunner motor, 57


operations, 57-59
structure of, 56-57
Arduino Mega, 149
analogRead, 155-156
analogWrite, 156-158
digital I/O, 154-155
global variables, 153
loop(), 153
preparing the
environment, 149-152
setup(), 153
dual-motor drive and control
system, 275-277 sketch functions, 153-154
power factor, 94-95
flux controlled motor using environments,
rotating magnetic fields, 152-153
management, 272-273
92-94
induction motor lamination BeagleBone Black (BBB), 198
stators, 91-92
design, 273-275 Adafruit-BBIO module, 200
synchronous speed, 94
method for making efficient GPIO (general-purpose
rotors, 277-278 input/output) pins,
Arduino Motor Shield, 159 201-205
defined, 23 Raspberry Pi, 174
electrical power, 24 GPIO (general-purpose
measuring, 24 input/output) pins,
177-182
synchronous polyphase rotational power, 23-24
IDLE, 176-177
motors, 101-102 work, 23
Python, 176-177
Raspbian operating
system, 175-176
programming, 174
dynamics, 243-247 GPIO (general-purpose
mass flow rate, 245-246 input/output) pins,
propeller pitch, 246-247 177-182
constructing, 259-260
pushing air down, 244-245 IDLE, 176-177
electronics, 250
quadcopters, 243 Python, 176-177
batteries, 258-259
selecting for quadcopters, Raspbian operating
ESCs (electronic speed
247-248 system, 175-176
controls), 256-258
RaspiRobot, 186
flight controllers, 254-256
brushed DC motors,
transmitters/receivers,
189-190
251-253
L293DD Quadruple Half-H
frames, 242-243
Driver, 187-188
motors, 248-250
Python, 188-189
propellers, 243
stepper motors, 190-192
dynamics, 243-247
servomotors, 182
dynamics, mass flow rate,
configuring PWM, 182-184
245-246
controlling Servo, 185-186
dynamics, propeller pitch,
246-247
dynamics, pushing air operating systems, 175-176
down, 244-245
selecting, 247-248
brushed DC motors, 189-190
L293DD Quadruple Half-H
Driver, 187-188
Arduino Mega, 158 Python, 188-189
frequency, 34 stepper motors
hobbyist servomotors, 75 basics, 190-191
servomotors, Raspberry Pi, RRB2 class, 191-192
182-184

BeagleBone Black (BBB),


205-207
DMCC (Dual Motor Controller
Cape), BeagleBone Black
(BBB), 209-210 BCM2835, 173-174
ARM1176 processing core,
173-174
Raspberry Pi, 176-177
VideoCore IV graphics
RaspiRobot, 188-189
processing core, 174
RPI.GPIO, 177
circuit boards, 172-173
RPIO module, 177
disadvantages, 171-172
Model B+, 172-173
MOSFETs
(metal-oxide-semiconductor
magnetic rotary encoders, 78
field-effect transistors), 220
optical rotary encoders, 77
propellers, for quadcopters,
247-248
single-phase motors, AC
motors, 105-106

hybrid (HY) steppers, 62


squirrel-cage rotors, 97-98
wound rotors, asynchronous
polyphase motors, 98-100
See
controlling servomotors,
167-168
AC motors, 103
Servo library, 166-167
capacitor-start motor,
104-105
controlling, 78, 167-168 shaded-pole motor,
block diagrams, 83-84 105-106
Laplace transform, 81-83 split-phase motors, 103-104
modeling, 80
open-loop and closed-loop
systems, 79
transfer functions, 83-85
hobbyist servomotors, 74-75
analog and digital servos,
76
PWM (pulse width
modulation), 75
rotary encoders, 76-78
PID control, 85-87
Raspberry Pi, 182
configuring PWM, 182-184
controlling Servo, 185-186
controls, 63-64 linear synchronous motors,
bipolar stepper control, 131-135
64-65 iron-core LSM, 133
unipolar stepper controls, ironless LSM, 133-134
65-67 slotless LSM, 134-135
drive modes, 67-68 speed, 132-133
angular speed, 17 full-step (one phase on) PM (permanent magnet)
linear synchronous motors, mode, 68 stepper motors, 56-57
132-133 full-step (two phases on) VR (variable reluctance)
rotational speed, 29 mode, 68-69 steppers, 59-60
half-step mode, 69-70
single-phase motors, AC microstep mode, 71
motors, 103-104 hybrid (HY) steppers, 61-62
operations, 63
DMCC (Dual Motor Controller
structure of, 62-63 Cape), BeagleBone Black
PM (permanent magnet) (BBB), 210
stepper motors, 56 ESCs (electronic speed
operations, 57-59 controls), 218-219
structure of, 56-57 bootstrap capacitors,
RaspiRobot 224-225
basics, 190-191 MOSFET switches,
RRB2, 191-192 219-222

hybrid (HY) steppers, 62-63 VR (variable reluctance)


steppers, 59
polyphase motors, AC motors,
91-92 operations, 60-61
structure of, 59-60 doubly excited synchronous
motors, 101
permanent magnet
synchronous motors,
objects and classes, 163 101-102
Stepper functions, 163-164 synchronous reluctance
motors, 102-103

stepper libraries, 162-164


objects and classes, 163 BLDC (brushless DC motor),
42-44 synchronous polyphase
Stepper functions, 163-164
homopolar motors, 140-141 motors, 102-103
stepper motors, controlling,
164-166 hybrid (HY) steppers, 62-63
LIMs (linear induction
motors), 137-138
bipolar stepper control,
164-165
controlling, 164-166
AC motors, 107-108
harmonic distortion, 108-109

quadcopters, 251-253
dual-motor drive and control
system, 275-277
flux controlled motor
management, 272-273
induction motor lamination
DC motors, 29
design, 273-275
measuring, 24
method for making efficient
rotors, 277-278 three-phase power, 93

operations, 60-61
structure of, 59-60

AC motors, 90-91
voltage, 93

measuring, 14

arm wrestling, 15
asynchronous polyphase
motors, AC motors, 97
breakdown torque, 97 brushless motors, DC motors,
DC motors, 28-29 43
measuring, 16 PM (permanent magnet)
stepper motors, 58
pull-up torque, 97
zero-crossing detection
unit conversion, 16
(ZCD), 227-228
rotational work, 23

ESCs (electronic speed


controls), 225-229
designing schematics, 232
Other Books
YOU MIGHT LIKE!

ISBN: 9780789749840 ISBN: 9780789755988 ISBN: 9780789755476 ISBN: 9780789753861

ISBN: 9780789755735 ISBN: 9780789755384 ISBN: 9780789755261 ISBN: 9780789755001

SAVE 35%
Use discount code MAKER
Visit quepublishing.com
to learn more!
* Discount code MAKER is valid for a 35% discount off the list price of eligible titles purchased on
informit.com or quepublishing.com. Coupon not valid on book + eBook bundles. Discount code may
not be combined with any other offer and is not redeemable for cash. Offer subject to change.
9780134031347

Potrebbero piacerti anche