Download Print this page

Waveshare ST3215 Servo Manual

30kg serial bus servo high precision and torque with programmable 360 degrees magnetic encoder two-way feedback servo/motor mode switchable

Advertisement

Quick Links

S T 3 2 1 5 S e r v o
O v e r v i e w
A s a h i g h - t o r q u e p r o g r a m m a b l e s e r i a l b u s s e r v o , i t i s e q u i p p e d
w i t h a 3 6 0 ° h i g h - p r e c i s i o n m a g n e t i c e n c o d e r , w h i c h c a n r e a l i z e
3 6 0 - d e g r e e a b s o l u t e a n g l e c o n t r o l . W i t h t h e p r o g r a m t o c o n t r o l ,
a n y a n g l e s c a n b e s e t a s t h e m i d d l e o f t h e p o s i t i o n , a n d i t c a n
a l s o b e s w i t c h e d t o t h e c o n t i n u o u s l y r o t a t i n g m o t o r o r s t e p p e r
m o t o r m o d e . T h e b u i l t - i n a c c e l e r a t i o n s t a r t - s t o p f u n c t i o n m a k e s
t h e a c t i o n s o f t e r . T h e r e a r e t w o i n t e r f a c e s o n e a c h s e r v o , w h i c h
c a n b e u s e d i n s e r i e s . I n t h e o r y , 2 5 3 b u s s e r v o s c a n b e c o n t r o l l e d a t t h e s a m e t i m e , a n d
e a c h s e r v o c a n o b t a i n i t s o w n c u r r e n t a n g l e , l o a d , v o l t a g e , m o d e , a n d s o o n . I t i s s u i t a b l e
f o r r o b o t p r o j e c t s , s u c h a s r o b o t i c a r m s , h e x a p o d w a l k e r s , h u m a n o i d r o b o t s , w h e e l e d
r o b o t s a n d s o o n , w h i c h r e q u i r e r e a l - t i m e f e e d b a c k f o r c l o s e d - l o o p c o n t r o l .
A t t h e s a m e t i m e , w e p r o v i d e a n o p e n - s o u r c e 1 2 - D O F r o b o t d o g m o d e l f o r t h i s s e r v o . Y o u
c a n d o w n l o a d t h e m o d e l a n d p r o j e c t f i l e s o f t h e o p e n - s o u r c e s t r u c t u r e i n
S p e c i f i c a t i o n
I n p u t V o l t a g e : 6 - 1 2 . 6 V
M e c h a n i c a l L i m i t e d A n g l e : N o L i m i t
R o t a t i n g A n g l e : 3 6 0 ° ( s e r v o m o d e a n g l e c o n t r o l ) / m o t o r m o d e c o n t i n u o u s r o t a t i o n
B a u d r a t e : 1 M b p s
G e a r : h i g h p r e c i s i o n m e t a l g e a r
I d l i n g S p e e d : 0 . 2 2 2 s e c / 6 0 °
P o s S e n s o r R e s o l u t i o n : 3 6 0 ° / 4 0 9 6
I D R a n g e : 0 - 2 5 3
F e e d b a c k : P o s i t i o n , L o a d , S p e e d , I n p u t V o l t a g e
I d l i n g C u r r e n t : 1 8 0 m A
S t a l l i n g C u r r e n t : 2 . 7 A
D i m e n s i o n : 4 5 . 2 2 m m x 3 5 m m x 2 4 . 7 2 m m
F e a t u r e
U p t o 2 5 3 s e r v o s c a n b e c o n n e c t e d i n s e r i e s a t t h e s a m e t i m e ( r e q u i r e s f u l l p o w e r ) , a l s o
c a n o b t a i n f e e d b a c k i n f o r m a t i o n f r o m e a c h s e r v o .
3 6 0 ° m a g n e t i c e n c o d e r , l a r g e r a n g l e c o n t r o l r a n g e .
H i g h p r e c i s i o n , t h e a n g l e c o n t r o l a c c u r a c y r e a c h e s 3 6 0 ° / 4 0 9 6 .
A n y a n g l e s c a n b e s e t a s t h e m i d d l e o f t h e p o s i t i o n , w h i c h i s c o n v e n i e n t f o r a s s e m b l y .
A c c e l e r a t i o n s t a r t a n d s t o p f u n c t i o n , t h e m o v e m e n t e f f e c t i s s o f t e r .
C o m p a c t s t r u c t u r e d e s i g n a n d t h e p r o d u c t a p p e a r a n c e i s m o r e b e a u t i f u l .
6 - 1 2 . 6 V W i d e - v o l t a g e i n p u t , i t c a n d i r e c t l y s u p p l y p o w e r w i t h 2 s o r 3 s l i t h i u m b a t t e r y .
H i g h t o r q u e , u p t o 3 0 k g . c m @ 1 2 V .
T h e w o r k i n g m o d e c a n b e s e t b y t h e p r o g r a m : s e r v o a n g l e c o n t r o l / m o t o r m o d e l c a n b e
r o t a t e d c o n t i n u o u s l y .
H o w t o U s e t h e H a r d w a r e
Y o u c a n u s e o u r
I f y o u w a n t t o u s e t h e b u s s e r v o i n y o u r o w n p r o j e c t , y o u c a n r e f e r t o t h e f o l l o w i n g
s c h e m a t i c d i a g r a m :
B u s s e r v o d r i v e c i r c u i t s c h e m a t i c
H o w t o U s e t h e S o f t w a r e
W e p r o v i d e S T 3 2 1 5 - c o m p a t i b l e s e r v o d e m o f o r
D r i v e r
t o d o w n l o a d
f o l l o w i n g s t e p s :
I n s t a l l A r d u i n o I D E
Y o u c a n d i r e c t l y c l i c k t h i s
C h o o s e t h e A r d u i n o I D E s u i t a b l e f o r y o u r s y s t e m .
R u n t h e i n s t a l l a t i o n p a c k a g e .
C l i c k o n I A g r e e .
C h e c k I n s t a l l U S B d r i v e r a n d A s s o c i a t e . i n o f i l e s , t h e n c l i c k N e x t .
S e l e c t t h e i n s t a l l a t i o n p a t h o f A r d u i n o I D E , t h e n c l i c k I n s t a l l .
W a i t f o r t h e i n s t a l l a t i o n t o c o m p l e t e .
I n s t a l l t h e r e q u i r e d d r i v e r s .
C l i c k t o i n s t a l l .
C l i c k t o i n s t a l l .
C l i c k t o i n s t a l l .
A r d u i n o I D E i n s t a l l a t i o n i s c o m p l e t e .
I n s t a l l A r d u i n o C o r e f o r t h e E S P 3 2
R u n A r d u i n o I D E , c l i c k F i l e .
C l i c k o n P r e f e r e n c e s .
F i l l
h t t p s : / / d l . e s p r e s s i f . c o m / d l / p a c k a g e _ e s p 3 2 _ i n d e x . j s o n
U R L s a n d c l i c k O K .
R e s t a r t t h e I D E , c l i c k T o o l s > B o a r d > B o a r d s M a n a g e r t o o p e n t h e B o a r d s M a n a g e r .
F i l l i n E S P 3 2 a n d c l i c k I n s t a l l . [ N o t e : E S P 3 2 v e r s i o n 1 . 0 . 6 n e e d s t o b e i n s t a l l e d h e r e . ]
W a i t f o r t h e i n s t a l l a t i o n t o c o m p l e t e .
A f t e r i n s t a l l a t i o n , y o u c a n u s e A r d u i n o I D E t o d e v e l o p E S P 3 2 .
D o w n l o a d t h e P r o g r a m & I n s t a l l D e p e n d e n c y L i b r a r i e s
P l e a s e i n s t a l l t h e f o l l o w i n g l i b r a r i e s t h r o u g h M a n a g e L i b r a r i e s :
A d a f r u i t S S D 1 3 0 6
A d a f r u i t N e o P i x e l
C l i c k T o o l s > M a n a g e L i b r a r i e s t o o p e n t h e l i b r a r y m a n a g e r .
E n t e r t h e l i b r a r i e s t h a t n e e d t o b e i n s t a l l e d t h r o u g h t h e l i b r a r y m a n a g e r i n t h e s e a r c h
b o x , a n d i n s t a l l :
A d a f r u i t S S D 1 3 0 6
A d a f r u i t N e o P i x e l
C l i c k " U p d a t e " , a n d i f t h e r e i s n o " U p d a t e " , p l e a s e c l i c k " I n s t a l l " f o r t h e n e w e s t v e r s i o n .
D o w n l o a d t h e b u s s e r v o l i b r a r y a n d t h e A r d u i n o p r o g r a m f o r t h e s e r v o d r i v e r b o a r d :
S e r v o D r i v e r S T O p e n S o u r c e P r o g r a m ( A r d u i n o )
A f t e r d o w n l o a d i n g , u n z i p i t a n d y o u c a n g e t t h e p r o d u c t p r o g r a m .
C o p y t h e S C S e r v o f o l d e r t o \ D o c u m e n t s \ A r d u i n o \ l i b r a r i e s a f t e r d e c o m p r e s s i o n , a n d
i n s t a l l t h e m f o r c o n t r o l l i n g t h e s e r v o .
U p l o a d t h e P r o g r a m t o R o b o t
D o u b l e c l i c k t o r u n S E R V O D R I V E R W I T H E S P 3 2 S T / S e r v o D r i v e r S T / S e r v o D r i v e r S T . i n o .
C l i c k T o o l s > P o r t t o r e m e m b e r t h e e x i s t i n g C O M P o r t , n o n e e d t o c l i c k i t .
T h e C O M d i s p l a y e d h e r e i s d i f f e r e n t f o r d i f f e r e n t c o m p u t e r s , r e m e m b e r t h i s C O M .
C o n n e c t t h e d r i v e r b o a r d a n d c o m p u t e r .
C l i c k T o o l s > P o r t , c l i c k o n t h i s n e w C O M .
T h e n e w l y - a p p e a r i n g C O M i s d i f f e r e n t f o r d i f f e r e n t c o m p u t e r s , c l i c k i t .
C l i c k T o o l s > B o a r d s : > E S P 3 2 A r d u i n o > E S P 3 2 D e v M o d u l e a n d s e l e c t E S P 3 2 D e v
M o d u l e .
O t h e r s e t t i n g s a r e a s f o l l o w s :
Upload Speed: "921600"
CPU Frequency: "240MHz(WiFi/BT)"
Flash Frequency: "80MHz"
Flash Mode: "QIO"
Flash Size: "4MB(32Mb)"
'''Partition Scheme: "Huge APP(3MB No OTA/1MB SPIFFS)"
PSRAM: "Disabled"'''
C l i c k " U p l o a d " i n t h e u p p e r l e f t c o r n e r t o u p l o a d t h e p r o g r a m .
N o t e t h a t t h e a u t o m a t i c d o w n l o a d i n g c i r c u i t w i l l f a i l w h e n W A V E G O u s e s t h e s e r i a l p o r t
t o c o n n e c t w i t h t h e R a s p b e r r y P i . Y o u n e e d t o d i s c o n n e c t t h e s e r i a l p o r t f r o m t h e
R a s p b e r r y P i b e f o r e u p l o a d i n g t h e p r o g r a m t o W A V E G O .
W a i t f o r u p l o a d i n g t h e p r o g r a m .
A f t e r d i s p l a y i n g " L e a v i n g . . . H a r d r e s e t t i n g v i a R T S p i n . . . " , i t m e a n s t h a t t h e u p l o a d h a s
b e e n s u c c e s s f u l .
P r o d u c t U s a g e T u t o r i a l
T h e f o l l o w i n g t u t o r i a l u s e s
y o u n e e d t o u s e i t i n y o u r o w n p r o j e c t , y o u c a n r e f e r t o t h e s a m p l e p r o g r a m a n d t h e
s e r v o d r i v e c i r c u i t s c h e m a t i c
T h e f a c t o r y d e f a u l t I D o f t h e s e r v o i s 1 . A m o n g t h e s e r v o s c o n n e c t e d t o t h e s a m e s e r v o
d r i v e b o a r d , t h e s a m e I D c a n o n l y c o r r e s p o n d t o o n e s e r v o , a n d t h e r e c a n n o t b e m o r e
t h a n o n e s e r v o w i t h t h e s a m e I D i n t h e o n e c o n t r o l c i r c u i t . W h e n y o u s e t t h e I D f o r t h e
s e r v o , t r y t o e n s u r e t h a t o n l y o n e s e r v o w h o s e I D i s t o b e c h a n g e d i s c o n n e c t e d t o t h e
d r i v e r b o a r d . A f t e r t h e I D i s c h a n g e d , i t w i l l b e p e r m a n e n t l y s a v e d i n t h e s e r v o a n d w i l l
n o t b e l o s t e v e n i f t h e p o w e r i s o f f .
F i r s t o f a l l , y o u n e e d t o s e t a n i n d e p e n d e n t I D f o r e a c h s e r v o . W h e n s e t t i n g a n I D f o r
o n e s e r v o , t h e d r i v e r b o a r d s h o u l d n o t b e c o n n e c t e d t o o t h e r s e r v o s .
A f t e r c o n n e c t i n g t h e S T 3 2 1 5 s e r v o t o t h e d r i v e r b o a r d , t h e D C i n t e r f a c e ( 5 . 5 * 2 . 1 m m ) o n
t h e b o a r d w i l l p r o v i d e 6 - 1 2 . 6 V f o r i t . ( 1 2 V i s r e c o m m e n d e d . ) I f y o u u s e a l a r g e n u m b e r
o f s e r v o s , y o u m u s t p r o v i d e e n o u g h c u r r e n t s f o r i t .
A f t e r t h e d r i v e r b o a r d i s p o w e r e d o n , a W i F i h o t s p o t w i l l b e c r e a t e d b y d e f a u l t . T h e
d e f a u l t h o t s p o t n a m e i s E S P 3 2 _ D E V , a n d i t s p a s s w o r d i s 1 2 3 4 5 6 7 8 . P l e a s e c o n n e c t t o
t h i s h o t s p o t w i t h y o u r p h o n e .
A f t e r c o n n e c t i n g t o t h e h o t s p o t i s s u e d b y t h e s e r v o d r i v e r b o a r d , i t i s r e c o m m e n d e d t o
u s e G o o g l e C h r o m e t o a c c e s s t h e a d d r e s s 1 9 2 . 1 6 8 . 4 . 1 . N o t e d t h a t t h e p h o n e w i l l f a i l t o
v e r i f y t h e s e r v e r w i t h p i n g a f t e r c o n n e c t i n g t h e W i F i , s o i t m a y a u t o m a t i c a l l y s w i t c h t o
t h e o t h e r k n o w n W i F i . I n t h i s c a s e , y o u s h o u l d c o n n e c t E S P 3 2 _ D E V a g a i n , a n d t h e
p h o n e w i l l n o t c o n n e c t t o o t h e r W i F i a u t o m a t i c a l l y a f t e r t h e r e c o n n e c t i o n i s s u c c e s s f u l .
T h e d r i v e r b o a r d w i l l a u t o m a t i c a l l y s c a n t h e s e r v o I D ( 0 - 2 0 ) w h e n i t i s p o w e r e d o n ( i n
o r d e r t o s a v e t h e b o o t t i m e ) . I f y o u r s e r v o I D i s m o r e t h a n 2 0 , y o u m u s t c h a n g e t h e
M A X _ I D v a l u e i n S e r v o D r i v e r S T . i n o a n d u p l o a d i t t o t h e d r i v e r b o a r d a g a i n .
I f t h e s e r v o i s c o n n e c t e d a f t e r t h e d r i v e r b o a r d i s p o w e r e d o n , y o u n e e d t o c l i c k
S e a r c h i n g
o n t h e m o b i l e b r o w s e r p a g e t o s c a n a g a i n .
A c t i v e I D
i s t h e c u r r e n t l y s e l e c t e d s e r v o I D n u m b e r ,
b e s e t , a d j u s t t h e v a l u e o f
S e t N e w I D
W h e n t h e I D s o f a l l s e r v o s a r e s e t , y o u c a n c o n n e c t t h e m a l l . I f y o u d o n o t r e s t a r t t h e
d e v i c e , y o u n e e d t o c l i c k
I D
s h o w s a l l I D n u m b e r s o f s e r v o s c u r r e n t l y c o n n e c t e d t o t h e s e r v o d r i v e r b o a r d .
A c t i v e I D
T h e c u r r e n t l y s e l e c t e d s e r v o I D n u m b e r , a n d t h e s u b s e q u e n t o p e r a t i o n s a r e
a l l c o n t r o l l i n g t h i s
Y o u c a n s e l e c t t h e
M i d d l e
k e y , y o u c a n t u r n t h e s e r v o t o t h e m i d d l e p o s i t i o n , t h e p o s i t i o n r a n g e o f t h e
s e r v o i s 0 - 4 0 9 5 , a n d t h e m i d d l e p o s i t i o n i s 2 0 4 7 .
S t o p
k e y , t h e d e f a u l t p r o g r a m w i l l n o t l e t t h e s e r v o m o v e a l l t h e t i m e . I f t h e s e r v o
c a n n o t b e s t o p p e d a f t e r t h e s e c o n d a r y d e v e l o p m e n t , y o u c a n p r e s s t h e
h a u l t t h e s e r v o m o v e m e n t .
R e l e a s e
k e y , p r e s s i t a n d t h e s e r v o w i l l c l o s e t o r q u e l o c k ( T o r q u e O f f ) , t h e n y o u c a n
t u r n t h e s e r v o b y h a n d .
T o r q u e
k e y , a f t e r p r e s s i n g t h e s e r v o , t h e s e r v o w i l l t u r n o n t h e t o r q u e l o c k ( T o r q u e O n ) ,
a t t h i s t i m e , t h e s e r v o w i l l m a i n t a i n t h e s p e c i f i e d p o s i t i o n w i t h f o r c e .
P o s i t i o n +
k e y , a f t e r p r e s s i n g t h e s e r v o , t h e s e r v o w i l l s t a r t t o r o t a t e c l o c k w i s e . W h e n
t h e s e r v o i s i n t h e s e r v o m o d e , i t w i l l n o t c o n t i n u e t o r o t a t e a f t e r t u r n i n g t o t h e 4 0 9 5
p o s i t i o n .
P o s i t i o n -
k e y , a f t e r p r e s s i n g t h e s e r v o , t h e s e r v o w i l l s t a r t t o r o t a t e c o u n t e r c l o c k w i s e .
W h e n t h e s e r v o i s i n t h e s e r v o m o d e , i t w i l l n o t c o n t i n u e t o r o t a t e a f t e r t u r n i n g t o t h e 0
p o s i t i o n .
S p e e d +
a n d
S T s e r i e s s e r v o s i s a b o u t 3 0 7 3 . T h e s p e e d i s t h e n u m b e r o f s t e p s p e r s e c o n d , 5 0
s t e p s / s e c ≈ 0 . 7 3 2 R P M .
S e t M i d d l e P o s i t i o n
p r e s s e d , t h e s e r v o w i l l s e t t h e c u r r e n t p o s i t i o n t o t h e m i d d l e p o s i t i o n ( 2 0 4 7 ) .
S e t S e r v o M o d e
p e r f o r m e d i n t h e s e r v o m o d e , t h e s e t t i n g w i l l b e p e r m a n e n t l y s a v e d a n d w i l l n o t b e l o s t
e v e n i f t h e p o w e r i s t u r n e d o f f .
S e t M o t o r M o d e
c o n t i n u o u s l y 3 0 , 0 0 0 s t e p s . I f y o u p r e s s i t c o n t i n u o u s l y , t h e m o t o r w i l l k e e p r o t a t i n g . T h i s
m o d e c a n c o n t r o l t h e r e l a t i v e a n g l e w i t h i n ± 7 c i r c l e s a n d t h e n u m b e r o f c i r c l e s w i l l n o t
b e s a v e d w h e n p o w e r i s o f f , b u t t h e s t e p p e r m o t o r m o d e s e t t i n g s w i l l b e p e r m a n e n t l y
s a v e d e v e n i f p o w e r i s o f f .
S t a r t S e r i a l F o r w a r d i n g
y o u c a n d i r e c t l y c o n t r o l t h e s e r v o a n d g e t t h e f e e d b a c k o f t h e s e r v o w i t h t h e t y p e C
i n t e r f a c e o n t h e b o a r d . T h i s f u n c t i o n i s u s e d t o d e b u g t h e s e r v o .
N o r m a l
k e y , s e t t h e s e r v o d r i v e r b o a r d t o n o r m a l m o d e , i n t h i s m o d e , i t w i l l n o t s e n d o r
r e c e i v e a n y i n f o r m a t i o n v i a E S P - N O W .
L e a d e r
k e y , s e t t h e s e r v o d r i v e r b o a r d a s t h e h o s t , i n t h i s m o d e , t h e d r i v e r b o a r d
c o n t i n u o u s l y s e n d s t h e I D , p o s i t i o n , a n d s p e e d o f t h e c u r r e n t
d r i v e r b o a r d o f t h e c o n t r o l l e d s l a v e t h r o u g h t h e E S P - N O W p r o t o c o l . A f t e r t h e s e r v o
d r i v e r b o a r d i s t u r n e d o n , t h e
t h i s d e v e l o p m e n t b o a r d , w h i c h i s u n i q u e , s u c h a s M A C : 0 8 3 A F 2 9 3 5 F A 8 . T h e p r e m i s e
o f E S P - N O W c o m m u n i c a t i o n i s t o g e t t h e M A C a d d r e s s o f t h e s l a v e , p l e a s e w r i t e d o w n
t h e a d d r e s s , a n d f i l l i t i n t h e b r o a d c a s t A d d r e s s [ ] = { 0 x 0 8 , 0 x 3 A , 0 x F 2 , 0 x 9 3 , 0 x 5 F ,
0 x A 8 } o f S e r v o D r i v e r S T . i n o , t h e n u p l o a d i t t o t h e d r i v e r o f t h e h o s t a n d t h e f u n c t i o n i s
e n a b l e d .
F o l l o w e r
k e y , s e t t h e s e r v o d r i v e b o a r d a s t h e s l a v e , a f t e r c h a n g i n g t h e M A C a d d r e s s o f
t h e s l a v e i n t h e p r o g r a m o f t h e h o s t , i t c a n a c t u n d e r t h e r e m o t e c o n t r o l o f t h e h o s t .
R a i n b o w O N
R G B l i g h t s .
S e c o n d a r y D e v e l o p m e n t T u t o r i a l
S e r v o i n i t i a l i z a t i o n
E a c h p r o g r a m f o r c o n t r o l l i n g t h e s e r v o n e e d s t o i n i t i a l i z e s e r v o b e f o r e i t c a n b e u s e d .
#include
<SCServo.h>
SMS_STS st;
void
setup(){
Serial1.begin(1000000);
ther devices, you can also choose a custom serial port
// Serial1.begin(1000000, SERIAL_8N1, RX, TX); // custom serial port
st.pSerial = &Serial1;
while(!Serial1) {}
}
C h a n g e s e r v o I D
I n t h e s e r v o s c o n n e c t e d i n s e r i e s , e a c h I D c o r r e s p o n d s t o o n l y o n e s e r v o , o t h e r w i s e t h e
i n f o r m a t i o n f e d b a c k b y t h e s e r v o s c a n n o t b e o b t a i n e d n o r m a l l y . W h e n c h a n g i n g t h e s e r v o
I D , p l e a s e t r y t o e n s u r e t h a t t h e d r i v e r b o a r d i s c o n n e c t e d t o o n l y o n e s e r v o , a n d t h e I D
w i l l b e p e r m a n e n t l y s a v e d i n t h e s e r v o .
#include
<SCServo.h>
SMS_STS st;
int
ID_ChangeFrom = 1;
ult is 1
int
ID_Changeto = 2;
void
setup(){
Serial1.begin(1000000);
st.pSerial = &Serial1;
while(!Serial1) {}
st.unLockEprom(ID_ChangeFrom);
st.writeByte(ID_ChangeFrom, SMS_STS_ID,
st.LockEprom(ID_Changeto);
}
void
loop(){
}
P i n g
U s e d t o t e s t w h e t h e r a s e r v o i s c o n n e c t e d n o r m a l l y .
#include
<SCServo.h>
SMS_STS st;
int
TEST_ID = 3;
void
setup()
{
Serial.begin(115200);
Serial1.begin(1000000, SERIAL_8N1, RX, TX);
st.pSerial = &Serial1;
while(!Serial1) {}
}
void
loop()
{
int
ID = st.Ping(TEST_ID);
if(ID!=-1){
Serial.print("Servo
Serial.println(ID, DEC);
delay(100);
}else{
Serial.println("Ping servo ID
delay(2000);
}
}
w r i t e l o c a t i o n
C a n b e u s e d t o c o n t r o l t h e r o t a t i o n o f i n d i v i d u a l s e r v o s .
#include
<SCServo.h>
SMS_STS st;
void
setup()
{
Serial1.begin(1000000);
st.pSerial = &Serial1;
while(!Serial1) {}
}
void
loop()
{
st.WritePos(1, 1000, 1500, 50);
o the position of 1000 at a speed of 1500 and start and stop the acceleratio
n of 50.
delay(754);//[(P1-P0)/V]*1000+100
st.WritePos(1, 20, 1500, 50);
the position 20 at a speed of 1500 and start and stop the acceleration at 5
0.
delay(754);//[(P1-P0)/V]*1000+100
}
S y n c h r o n o u s w r i t e
C a n b e u s e d t o c o n t r o l m u l t i p l e s e r v o s a t t h e s a m e t i m e ( t u r n t o d i f f e r e n t p o s i t i o n s a n d
d i f f e r e n t s p e e d s ) .
#include
<SCServo.h>
SMS_STS st;
// the uart used to control servos.
// GPIO 18 - S_RXD, GPIO 19 - S_TXD, as default.
#define S_RXD 18
#define S_TXD 19
byte ID[2];
s16 Position[2];
u16 Speed[2];
byte ACC[2];
void
setup()
{
Serial1.begin(1000000, SERIAL_8N1, S_RXD, S_TXD);
st.pSerial = &Serial1;
delay(1000);
ID[0] = 1;
ID[1] = 2;
Speed[0] = 3400;
Speed[1] = 3400;
ACC[0] = 50;
ACC[1] = 50;
}
void
loop()
{
Position[0] = 3000;
Position[1] = 3000;
st.SyncWritePosEx(ID, 2, Position, Speed,
0, acc=50, move to position=3000.
delay(2000);
Position[0] = 100;
Position[1] = 100;
st.SyncWritePosEx(ID, 2, Position, Speed,
0, acc=50, move to position=100.
delay(2000);
}
G e t s e r v o i n f o r m a t i o n f e e d b a c k .
#define S_RXD 18
#define S_TXD 19
#include
<SCServo.h>
SMS_STS sms_sts;
void
setup()
{
Serial1.begin(1000000, SERIAL_8N1, S_RXD, S_TXD);
Serial.begin(115200);
sms_sts.pSerial = &Serial1;
delay(1000);
}
void
loop()
{
int
Pos;
int
Speed;
int
Load;
int
Voltage;
int
Temper;
int
Move;
int
Current;
if(sms_sts.FeedBack(1)!=-1){
Pos = sms_sts.ReadPos(-1);
Speed = sms_sts.ReadSpeed(-1);
Load = sms_sts.ReadLoad(-1);
Voltage = sms_sts.ReadVoltage(-1);
Temper = sms_sts.ReadTemper(-1);
Move = sms_sts.ReadMove(-1);
Current = sms_sts.ReadCurrent(-1);
Serial.print("Position:");
Serial.println(Pos);
Serial.print("Speed:");
Serial.println(Speed);
Serial.print("Load:");
Serial.println(Load);
Serial.print("Voltage:");
Serial.println(Voltage);
Serial.print("Temper:");
Serial.println(Temper);
Serial.print("Move:");
Serial.println(Move);
Serial.print("Current:");
Serial.println(Current);
delay(10);
}else{
Serial.println("FeedBack
delay(500);
}
Pos = sms_sts.ReadPos(1);
if(Pos!=-1){
Serial.print("Servo
Serial.println(Pos, DEC);
delay(10);
}else{
Serial.println("read position
delay(500);
}
Voltage = sms_sts.ReadVoltage(1);
if(Voltage!=-1){
Serial.print("Servo
Serial.println(Voltage, DEC);
delay(10);
}else{
Serial.println("read Voltage
delay(500);
}
Temper = sms_sts.ReadTemper(1);
if(Temper!=-1){
Serial.print("Servo
Serial.println(Temper, DEC);
delay(10);
}else{
Serial.println("read temperature
delay(500);
}
Speed = sms_sts.ReadSpeed(1);
if(Speed!=-1){
Serial.print("Servo
Serial.println(Speed, DEC);
delay(10);
}else{
Serial.println("read Speed
delay(500);
}
Load = sms_sts.ReadLoad(1);
if(Load!=-1){
Serial.print("Servo
Serial.println(Load, DEC);
delay(10);
}else{
Serial.println("read Load
delay(500);
}
Current = sms_sts.ReadCurrent(1);
if(Current!=-1){
Serial.print("Servo
Serial.println(Current, DEC);
delay(10);
}else{
Serial.println("read Current
delay(500);
}
Move = sms_sts.ReadMove(1);
if(Move!=-1){
Serial.print("Servo
Serial.println(Move, DEC);
delay(10);
}else{
Serial.println("read Move
delay(500);
}
Serial.println();
}
R e s o u r c e
3 D M o d u l e
S T 3 2 1 5 S e r v o S T E P M o d u l e
S e r v o D r i v e r S t e p M o d u l e
2 D D r a w i n g
2 D D r a w i n g
D o c u m e n t
S c h e m a t i c
U s e r M a n u a l
D e m o
D e m o
S o f t w a r e
A r d u i n o I D E
O p e n S o u r c e S t r u c t u r e
1 2 D O F R O B O T I C D O G S T E P M O D E L
1 2 D O F R o b o t i c D o g F u s i o n 3 6 0 P r o j e c t
1 2 D O F R O B O T I C D O G C r e o 5 . 0 P r o j e c t
4 5 R P M
S e r v o D r i v e r
.
o p e n - s o u r c e p r o g r a m ( A r d u i n o )
l i n k
s e r v o d r i v e r
f o r s e c o n d a r y d e v e l o p m e n t .
I D t o S e t
b u t t o n t o s e t t h e s e r v o I D
S t a r t S e a r c h i n g
A c t i v e I D
s e r v o .
A c t i v e I D
s e r v o v i a t h e
S p e e d -
a r e u s e d t o s e t t h e s p e e d o f t h e s e r v o . T h e m a x i m u m s e t t i n g f o r
k e y , n o m a t t e r w h a t p o s i t i o n t h e c u r r e n t s e r v o i s i n , w h e n t h i s k e y i s
k e y , s e t t h e s e r v o t o s e r v o m o d e , 3 6 0 ° a b s o l u t e a n g l e c o n t r o l c a n b e
k e y , s e t t h e s e r v o t o s t e p p e r m o t o r m o d e , t h e s e r v o c a n r o t a t e
b u t t o n , s e t t h e s e r v o d r i v e r b o a r d t o s e r i a l f o r w a r d i n g m o d e ,
M A C :
a n d
R a i n b o w O F F
k e y s a r e u s e d t o t u r n o n a n d o f f t h e r a i n b o w e f f e c t o f
//Initialize the serial port, if you use ESP32 and o
// Change the original servo ID, and the factory defa
// new ID
// EPROM-SAFE is locked
// Servo ID to test
ID:");
err");
position:");
Voltage:");
temperature:");
Speed:");
Load:");
Current:");
Move:");
@ 1 2 V
t o c o n t r o l t h e b u s s e r v o .
S e r v o D r i v e r
t o d o w n l o a d t h e A r d u i n o I D E f r o m
b y d e f a u l t t o e x p l a i n h o w t o u s e t h e s e r v o , i f
t h r o u g h
I D t o S e t +
A c t i v e I D
t o s c a n a l l s e r v o s .
I D t o S e t +
o n t h e f i r s t l i n e o f t h e s c r e e n i s t h e M A C a d d r e s s o f
//Unlock EPROM-SAFE
ID_Changeto);//Change ID
error!");
// Control the servo with ID 1 to rotate t
// Control the servo with ID 1 to rotate to
ACC);//servo(ID1/ID2) speed=340
ACC);//servo(ID1/ID2) speed=340
err");
err");
err");
err");
err");
err");
err");
S T 3 2 1 5 S e r v o
T T L b u s s e r v o i n t e r f a c e
, y o u c a n u s e i t a t
t o c o n t r o l t h e S T s e r i e s s e r v o s , t h e
A r d u i n o . c c
i n A d d i t i o n a l B o a r d s M a n a g e r
I D t o S e t
i s t h e n e w I D n u m b e r t o
a n d
I D t o S e t -
a s
I D t o S e t
.
a n d
I D t o S e t -
A c t i v e I D
// custom serial port
# R e s o u r c e
.
S e r v o
.
b u s
S t a r t
, a n d p r e s s t h e
b u t t o n s .
S t o p
k e y t o
s e r v o t o t h e

Advertisement

loading
Need help?

Need help?

Do you have a question about the ST3215 Servo and is the answer not in the manual?

Questions and answers