Тёмный

Raspberry Pi Pico Servo Motors via PWM 

Tinker Tech Trove
Подписаться 3,7 тыс.
Просмотров 29 тыс.
50% 1

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/tinkertechtrove/pi...
Comments and feedback always welcome.
Copyright free music from Stream Beats www.streambeats.com/

Наука

Опубликовано:

 

25 фев 2021

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 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.
@jayk806
@jayk806 2 года назад
What a great video. I learned so much about servos and the pico. Thanks for sharing this info!!! 😁
@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 :-)
@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!
@eternaldoorman5228
@eternaldoorman5228 Год назад
It's a Pi co-processor, so you were right the first time, I reckon!
@MicrobyteAlan
@MicrobyteAlan 3 года назад
Interesting and well presented, thanks. I sub’d 👍🏽
@SoggyCashew
@SoggyCashew 2 года назад
Learned a lot thank you
@rahula3944
@rahula3944 2 года назад
really good explanation...
@qcasares
@qcasares 3 года назад
Really clear and simple explanation. EXCELLENT!
@mohamedfarid7499
@mohamedfarid7499 2 года назад
thank you Mr.Tim , i use adafruit keypad hid library to stop and start the video using macro push bottom
@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!
@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.
@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)
@WintonMc
@WintonMc Год назад
Hi Tim, Your videos are so good. They're still relevant. Won't you be making more? It's been a year!
@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
@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 :-)
@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?
@manwithgutz
@manwithgutz 3 года назад
Hi, Possible to do one for a drone brushed motor?
@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!
@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?
@atinsuarez8974
@atinsuarez8974 Год назад
how many volts is your supply?
@marcosdasilva7409
@marcosdasilva7409 2 года назад
SHOW 😁 🇧🇷
@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
@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
@rizacelik
@rizacelik 3 года назад
How can we read PWM from an RC receiver, can you make a simple example. Can you take a video.
@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.
@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!
@johntyler4222
@johntyler4222 5 месяцев назад
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.
@projo2
@projo2 3 года назад
I did a Google search and the definition audio pronounced it Peye-Co.
@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.
Далее
Raspberry Pi Pico: WiFi part 2, Deep Sleep!
23:13
Просмотров 15 тыс.
Raspberry Pi Servo Motor Control
17:36
Просмотров 385 тыс.
Склеил девушку-курьера ❤️
01:00
Raspberry Pi Pico Stepper Motors via PIO
25:17
Просмотров 59 тыс.
How To Use A Servo With Raspberry Pi Pico
11:49
Просмотров 19 тыс.
Raspberry Pi Servo Motor Control - No Jitter!
13:52
Просмотров 53 тыс.
Fun with Transistors
24:33
Просмотров 84 тыс.
Raspberry Pi Pico gets WiFi via an ESP01 and UART
21:20
Raspberry Pi Pico: nRF24L01 over SPI
19:05
Просмотров 29 тыс.
Hacking my garage door with the Raspberry Pi Pico W
11:50
Stop, Intel’s Already Dead!
13:47
Просмотров 205 тыс.