No video

Raspberry Pi Pico Servo Motors via PWM

  Рет қаралды 29,594

Tinker Tech Trove

Tinker Tech Trove

Күн бұрын

In this video we take a look at a common micro servo motor and figure out how to drive it with a Raspberry Pi Pico and a PWM signal. The demo code is available on github at github.com/tin...
Comments and feedback always welcome.
Copyright free music from Stream Beats www.streambeat...

Пікірлер: 43
@rungeon83
@rungeon83 3 жыл бұрын
Tim these pico tutorials are gold!! Thank you!
@tinkertechtrove2910
@tinkertechtrove2910 3 жыл бұрын
Your welcome, glad they're helpful
@4ur3n
@4ur3n 2 жыл бұрын
HUGE LIKE, I tested another code and I thought my little servo was broken, but your code worked like a charm.
@alexandergames7843
@alexandergames7843 3 жыл бұрын
*Helpful information:* The reason you had to use expanded duty cycle values is that the sg90 servos are actually 120-degree servos. Most Chinese documentation is wrong. They do have a max rotation of 200 degrees but it requires a bigger range of duty cycles than what the documentation states. If you run the servos at 900us -2100us duty cycle you will get the 120 degrees. To measure this you can use the shell in Thonny to set the duty cycle to duty_ns(900000) and mark the location and then set the duty cycle to duty_ns(2100000). This will result in the 120degree rotation that the servo is actually meant for. I have found that for most of these servos a duty cycle of 600us and 2500us will result in the 180 degrees that we want.
@tinkertechtrove2910
@tinkertechtrove2910 3 жыл бұрын
That's good info, thanks!
@jayk806
@jayk806 2 жыл бұрын
What a great video. I learned so much about servos and the pico. Thanks for sharing this info!!! 😁
@eternaldoorman5228
@eternaldoorman5228 Жыл бұрын
It's a Pi co-processor, so you were right the first time, I reckon!
@glennpoirier8000
@glennpoirier8000 3 жыл бұрын
Hi Tim, Great video, working through my arduino kit with my new Pico. This and your stepper video have been really useful!
@tinkertechtrove2910
@tinkertechtrove2910 3 жыл бұрын
I'm glad they have been helpful :-)
@mohamedfarid7499
@mohamedfarid7499 2 жыл бұрын
thank you Mr.Tim , i use adafruit keypad hid library to stop and start the video using macro push bottom
@rahula3944
@rahula3944 2 жыл бұрын
really good explanation...
@qcasares
@qcasares 3 жыл бұрын
Really clear and simple explanation. EXCELLENT!
@TheUnofficialMaker
@TheUnofficialMaker 2 жыл бұрын
why did you use for _ in instead of: for i in range ? Also, why did you limit to 1024? Also would of been nice to see the code running the servo!
@SoggyCashew
@SoggyCashew 2 жыл бұрын
Learned a lot thank you
@WintonMc
@WintonMc Жыл бұрын
Hi Tim, Your videos are so good. They're still relevant. Won't you be making more? It's been a year!
@EvilKimau
@EvilKimau 3 жыл бұрын
I really need to make a catalogue or something to figure out all the random parts I have in my electronics kits. Would be nice to have the part numbers or store links in the description (^_^)
@tinkertechtrove2910
@tinkertechtrove2910 3 жыл бұрын
Thanks for the feedback, that's not a bad idea :-)
@chrisl2656
@chrisl2656 3 жыл бұрын
It’s normal for a servo to want a pulse of between 1ms (0 degrees) and 2ms (180 degrees), which would equate to PWM duty cycles corresponding to what your data sheet recommended. 50Hz = 20ms. 1/20 = 5%, 2/20 = 10%. I think the fact that you had to significantly expand this range is because your sweep is much faster than the servo can physically track. Try an alternating 5% for 5 seconds, 10% for 5 seconds and I expect you’ll see the range of motion is very close to the full 180 degrees.
@tinkertechtrove2910
@tinkertechtrove2910 3 жыл бұрын
Oh that's very interesting, it would explain things. I'll give that a go, thanks for the suggestion!
@brianmoore5454
@brianmoore5454 3 жыл бұрын
Tinker...a very interesting coding. How can I modify the code so that, at switch on, the Horn moves to Zero Position, then requests the user to tell it (via a text message in the shell area) to what angle it should move, and at what speed.. I am a newbie at MicroPython so having to just play with the various variables. At the moment the code just makes the horn thrash back and to.
@MicrobyteAlan
@MicrobyteAlan 3 жыл бұрын
Interesting and well presented, thanks. I sub’d 👍🏽
@atinsuarez8974
@atinsuarez8974 Жыл бұрын
how many volts is your supply?
@naomisunga4799
@naomisunga4799 2 жыл бұрын
Hello, can I ask if we can code a pid control in the servo motor using raspberry pi pico? (sadly, without the use of arduino)
@JarleTeigland
@JarleTeigland 2 жыл бұрын
Great Video- n00b question - HOW do you interpret datasheets from the servos (into duty cycle etc) ??? Having Trouble with a servo/robot arm
@elfenmagix8173
@elfenmagix8173 2 жыл бұрын
Great video BUT... 1) The SG90 (and the MG90) has a swing of about 210 and not 180. But 0 to 180 is used so that the arm is not pulled back when it goes past 180 degrees. 2) "High Torque?" It is called the SG90 because 90grams of the max allowed force the servo should run on. Anything more the plastic gears start to get chewed up. Now, the MG90 is a metal gear version of the SG90. Though the gears are metal in the MG90, does not mean one can go past 90grams though it can handle 4x the force, you can still break it. The SG90 and the MG90 are the same shape and size though the SG90 uses plastic gears and the MG90 uses metal gears. Otherwise great video!
@davidroberts5090
@davidroberts5090 2 жыл бұрын
Duty_u16 has a range of 0-65534, doesn’t it? Maybe that’s why you had to jiggle your calculated values for full range movement as you were using 65025?
@marcosdasilva7409
@marcosdasilva7409 2 жыл бұрын
SHOW 😁 🇧🇷
@manwithgutz
@manwithgutz 3 жыл бұрын
Hi, Possible to do one for a drone brushed motor?
@bosqueblanco3744
@bosqueblanco3744 2 жыл бұрын
this is one of the first videos i watched to get an understanding of using servos with my micro controller - revisiting it now as i have upgraded to mg90s servos for a robot project and mainly i wanted a clarification to the importance of that last line of code: "pwm.duty_u16(duty)" i thought it corresponded to what pin was in use but i see this is incorrect - can someone explain?
@guillermosuperboy2001
@guillermosuperboy2001 3 жыл бұрын
hi could you explain me why " direction = -direction " in the if and elif, what does it mean and how does it work? thanks you very much
@tinkertechtrove2910
@tinkertechtrove2910 3 жыл бұрын
Sure, if direction is 1 then -direction sets it to -1. If direction is -1 then -direction sets it to -(-1) which it 1. So its just a quicker way to say "if direction == 1: direction = -1; elif direction == -1: direction = 1". This value, 1 or -1, is then added to the servo position control to make it 1 bigger or 1 smaller as needed. Hope that helps
@guillermosuperboy2001
@guillermosuperboy2001 3 жыл бұрын
@@tinkertechtrove2910Thanks a lot I hadn't understood that part
@rizacelik
@rizacelik 3 жыл бұрын
How can we read PWM from an RC receiver, can you make a simple example. Can you take a video.
@timwalt9190
@timwalt9190 3 жыл бұрын
since now the pico is supported on the arduino ide, can you do a tutorial how how to program the pico and servos with pwm using arduino ide
@ravindrabhoi8944
@ravindrabhoi8944 3 жыл бұрын
yes we want it
@johntyler4222
@johntyler4222 6 ай бұрын
Every single video on this subject ends up making the servo run backwards and forwards but nobody takes it any further and shows how to move to a certain point if some input occurs and another point if something else happens. It’s only half a story.
@Mark-ut3ml
@Mark-ut3ml 3 жыл бұрын
sir how can i turn 1 time 360degrees
@tinkertechtrove2910
@tinkertechtrove2910 3 жыл бұрын
The sg90 can only turn through 180degrees.
@Mark-ut3ml
@Mark-ut3ml 3 жыл бұрын
If mg996r sir you tried ?
@MrBeiger
@MrBeiger 3 жыл бұрын
I got the Micro Servo 9g SG90 and it can definitely spin around and not just 180 degrees.
@rjinnh3933
@rjinnh3933 3 жыл бұрын
Sorry OldMan but if you had Zoomed_In on the CodeScreen I'd have given you a Thumb'sUp instead of a Thumb'sDown. You need to BrushUp on your YT_VideoSkills.....
@TheUnofficialMaker
@TheUnofficialMaker 2 жыл бұрын
yeah, I had to look at the code on his github page.Contrast sucks too.
@projo2
@projo2 3 жыл бұрын
I did a Google search and the definition audio pronounced it Peye-Co.
Raspberry Pi Pico Stepper Motors via PIO
25:17
Tinker Tech Trove
Рет қаралды 60 М.
How To Use A Servo With Raspberry Pi Pico
11:49
Core Electronics
Рет қаралды 20 М.
English or Spanish 🤣
00:16
GL Show
Рет қаралды 7 МЛН
Underwater Challenge 😱
00:37
Topper Guild
Рет қаралды 33 МЛН
Magic? 😨
00:14
Andrey Grechka
Рет қаралды 20 МЛН
ROLLING DOWN
00:20
Natan por Aí
Рет қаралды 11 МЛН
Writing PWM Outputs | Raspberry Pi Pico Workshop: Chapter 2.7
7:25
Core Electronics
Рет қаралды 1,4 М.
Raspberry Pi Servo Motor Control
17:36
ExplainingComputers
Рет қаралды 387 М.
Raspberry Pi Pico gets WiFi via an ESP01 and UART
21:20
Tinker Tech Trove
Рет қаралды 48 М.
controlling lots of servos with a Raspberry Pi Pico
13:38
pileofstuff
Рет қаралды 13 М.
Using PWM on the RPi PICO microcontroller
22:57
Making Stuff with Chris DeHut
Рет қаралды 4,3 М.
Raspberry Pi Pico: WiFi part 2, Deep Sleep!
23:13
Tinker Tech Trove
Рет қаралды 15 М.
Raspberry Pi Servo Motor Control - No Jitter!
13:52
Gary Explains
Рет қаралды 53 М.
Raspberry Pi Pico: nRF24L01 over SPI
19:05
Tinker Tech Trove
Рет қаралды 29 М.
Raspberry Pi Pico - Control the (I/O) World
1:03:16
DroneBot Workshop
Рет қаралды 607 М.
English or Spanish 🤣
00:16
GL Show
Рет қаралды 7 МЛН