So this is how we open whole new world to the maestro board such as blending with opencv and such, make own algorithms in python and send command to the board.
THANK YOU SO SO MUCH! Very helpful, with lots of details video. I used Pololu Maestro for my robot control with Pololu C# sample code under Windows, and now moving to Python and Raspberry Pi under Linux. Definitely will use you code. Thank you!
Very helpful tutorial. I've actually been able to use your Python module to send commands to the Maestro both via the UART and USB connections. For the USB connection, you have to set the serial mode of the Maestro as 'USB Dual Port', and when creating the instance of the MaestroUART class you must set the serial port as '/dev/ttyACM0', since from what I understand the Maestro creates two virtual ports when connected via USB: '/dev/ttyACM0' for commands and '/dev/ttyACM1' for communications. I didn't have to change anything in cmdline.txt to get it to work. I also haven't seen any problems with having the Maestro's power coming from the USB connection, even when moving many servos at once.
Yup, been programming since I taught myself BASIC and 6809E assembly on a TRS-80 Color Computer in the early 80s. C was my main language but I'm learning python now since I'm doing neural network stuff and most neural network these days seems to be done in python.
How do I expand the range of motor? seems like the motor moves only in the range of 992 - 2000, but it actually moves only 30 degrees. Even without the if logic regulation the motor doesn't wanna move more than that. Could you help me to solve this? Thank you :)
For what it's worth, what you're doing by removing the "console=ttyAMA0,115200" is disabling the serial console in the Linux kernel on the Pi (which is probably obvious). Linux supports having a serial console just in case something truly terrible happens and the regular consoles can't be brought up -- the serial console is extremely low-level and can be used for debugging. ttyAMA0 is, of course, the serial device, and the 115200 is the baud rate. You've got to disable the kernel's serial console since you're going to be using the serial port, and you don't want the linux kernel to think that it's allowed to use (and monopolize) the serial port. I think on bigger iron, the kernel is configured to use one of the later serial ports (though I admit, I haven't tried to read or write to the physical serial ports in ages), but of course, it makes sense that the Pi's designers would want to give the kernel the serial port that is accessible on a Pi, if they intended people to be able to use the serial console. It might be more clear to put it this way: The kernel has to get exclusive access to the serial port it's using as a console -- it produces "monitor" output and takes "keyboard" input on that serial port and anything else trying to use it would send garbage to the operating system. Hence the need to take that serial port away from the kernel in order to use it to talk to the Maestro.
Well, the PI has a USB port, so couldn't you connect the Maestro directly to the PI, without the level conversion? Or would it require some other quirks and software to get working? Anyway, nice video!
You can use all 6 channels to control 6 servos. See the video at 2:25. Instead of using jumper wires to connect all that, I could have flipped the board over and soldered wires to those points underneath. That way all the servo pins on top would still be available. I did it the way I did so that I could have easier flexibility when trying to power things in different ways.
The Pi is running the Linux operating system with multiple things going on. Depending on the priorities set for things, the servo software running on the Pi can be interrupted at any time, which means you'll have delays. It is doable, just won't be perfect. The Arduino has far less going on. There are interrupts for timing, but that's far less than a full-blown non-realtime OS. Of course, even an Arduino can have delays depending on what else your code is doing. Feel free anyone else to pipe in on this...
Well, the pi is magnitudes faster in clock speed, and operations per second, than an Arduino too so it should be able to handle it unless someone was playing a video game on the pi but just sitting there calculating, and computing, and controlling the Pi should blow the socks off of an Arduino.
Real time operations like controlling machinery requires a controller with a real time clock that lets the controller start and finish operations in exact time frames. You also need the software that times and schedules your operation exactly in the time you expect. Regular OS like Linux and Windows schedule threads to run whenever based on whatever algorithm they use to efficiently give every program time to run, which is how they can handle multithreading hundreds of programs running in the foreground and background.
Precisely what I wanted to know Panzer and the #1 reason I never jumped on the Pi bandwagon and your explanation confirmed my suspicions from a few years ago when PI was first released . Seems it would be better, and cheaper, to use a Pic or an Arduino for these sorts of things. Thank you.
No problem, the Pi is a fun tool though. AFAIK it's basically what you'd find in a smartphone, which is why people use Pis for stuff like media hosting servers for home, streaming boxes (like chromcast), very light-weight desktop for internet browsing, and other stuff you would normally need a personal computer for. Arduinos are more for robotics and machinery and other types of control systems.
Thank you so much!! Also, which way did you use to control pi as I didn't see either HDMI wire or wireless Bluetooth adapter. Sorry to have so many problems...I'm new to raspberry pi and your video really helped me a lot! There are so resources I've checked but they can be very complex or just not working..
The Raspberry Pi has WiFi built in. I connect it to my WiFi network and access it from my computer. But the question then is how do you set up the WiFi on the Pi in the first place? Most people connect an HDMI monitor and USB keyboard and mouse to it and boot it up like a regular desktop. That way they can set up the WiFi. After that they can boot it up like I do and access it remotely. If you don't have a monitor and keyboard to connect to it then it's more tricky. I talk about all these options and some solutions on my webpages here rimstar.org/science_electronics_projects/connect_to_raspberry_pi_via_wifi_wirelessly.htm Another getting started resource is the main Raspberry Pi website here www.raspberrypi.org/
Do you mean instead of the Maestro servo motor controller board or instead of the Raspberry Pi? If you mean instead of the Pi, I'm going to run some big neural networks on the Pi with a Pi Camera. If you mean instead of the Maestro, in my experience I'm getting finer servo movement with the Maestro than I ever did with the Arduino's main loop.
Liked just because the explanations were one of the best I've ever heard for anything on TH-cam.
So this is how we open whole new world to the maestro board such as blending with opencv and such, make own algorithms in python and send command to the board.
THANK YOU SO SO MUCH! Very helpful, with lots of details video.
I used Pololu Maestro for my robot control with Pololu C# sample code under Windows, and now moving to Python and Raspberry Pi under Linux. Definitely will use you code. Thank you!
Very helpful tutorial. I've actually been able to use your Python module to send commands to the Maestro both via the UART and USB connections. For the USB connection, you have to set the serial mode of the Maestro as 'USB Dual Port', and when creating the instance of the MaestroUART class you must set the serial port as '/dev/ttyACM0', since from what I understand the Maestro creates two virtual ports when connected via USB: '/dev/ttyACM0' for commands and '/dev/ttyACM1' for communications. I didn't have to change anything in cmdline.txt to get it to work. I also haven't seen any problems with having the Maestro's power coming from the USB connection, even when moving many servos at once.
John, thank you - very helpful comment with explanation how to use USB.
Thanks for sharing that.
Thank u this really helps with a project I’m working on
My pleasure. Glad to hear it helps. I'll be adding to the code on the webpage as I progress through my project.
wow, nice. Would this run on the Orange Pi5 with OPi.GPIO? Thank you.
Awesomee info. Thank you!!
i didnt know you can program as well super cool!
Yup, been programming since I taught myself BASIC and 6809E assembly on a TRS-80 Color Computer in the early 80s. C was my main language but I'm learning python now since I'm doing neural network stuff and most neural network these days seems to be done in python.
How do I expand the range of motor? seems like the motor moves only in the range of 992 - 2000, but it actually moves only 30 degrees.
Even without the if logic regulation the motor doesn't wanna move more than that. Could you help me to solve this? Thank you :)
For what it's worth, what you're doing by removing the "console=ttyAMA0,115200" is disabling the serial console in the Linux kernel on the Pi (which is probably obvious). Linux supports having a serial console just in case something truly terrible happens and the regular consoles can't be brought up -- the serial console is extremely low-level and can be used for debugging. ttyAMA0 is, of course, the serial device, and the 115200 is the baud rate. You've got to disable the kernel's serial console since you're going to be using the serial port, and you don't want the linux kernel to think that it's allowed to use (and monopolize) the serial port. I think on bigger iron, the kernel is configured to use one of the later serial ports (though I admit, I haven't tried to read or write to the physical serial ports in ages), but of course, it makes sense that the Pi's designers would want to give the kernel the serial port that is accessible on a Pi, if they intended people to be able to use the serial console.
It might be more clear to put it this way: The kernel has to get exclusive access to the serial port it's using as a console -- it produces "monitor" output and takes "keyboard" input on that serial port and anything else trying to use it would send garbage to the operating system. Hence the need to take that serial port away from the kernel in order to use it to talk to the Maestro.
Thanks.
That is awesome!!!!!
Thanks!
Cool stuff!
Thanks!
Well, the PI has a USB port, so couldn't you connect the Maestro directly to the PI, without the level conversion? Or would it require some other quirks and software to get working?
Anyway, nice video!
I saw that others couldn't get it to work so I didn't try it.And thanks!
@@RimstarOrg What´s the problem with running the Maestro via USB?
Is it possible to use the 6 channels to controll 6 servos? Or two of them must be used fot leve-shifting and signal?
You can use all 6 channels to control 6 servos. See the video at 2:25. Instead of using jumper wires to connect all that, I could have flipped the board over and soldered wires to those points underneath. That way all the servo pins on top would still be available. I did it the way I did so that I could have easier flexibility when trying to power things in different ways.
Why would the pi have trouble controlling a servo like those pictured but the Arduino (a far inferior setup) not?
The Pi is running the Linux operating system with multiple things going on. Depending on the priorities set for things, the servo software running on the Pi can be interrupted at any time, which means you'll have delays. It is doable, just won't be perfect. The Arduino has far less going on. There are interrupts for timing, but that's far less than a full-blown non-realtime OS.
Of course, even an Arduino can have delays depending on what else your code is doing.
Feel free anyone else to pipe in on this...
Well, the pi is magnitudes faster in clock speed, and operations per second, than an Arduino too so it should be able to handle it unless someone was playing a video game on the pi but just sitting there calculating, and computing, and controlling the Pi should blow the socks off of an Arduino.
Real time operations like controlling machinery requires a controller with a real time clock that lets the controller start and finish operations in exact time frames. You also need the software that times and schedules your operation exactly in the time you expect. Regular OS like Linux and Windows schedule threads to run whenever based on whatever algorithm they use to efficiently give every program time to run, which is how they can handle multithreading hundreds of programs running in the foreground and background.
Precisely what I wanted to know Panzer and the #1 reason I never jumped on the Pi bandwagon and your explanation confirmed my suspicions from a few years ago when PI was first released . Seems it would be better, and cheaper, to use a Pic or an Arduino for these sorts of things.
Thank you.
No problem, the Pi is a fun tool though. AFAIK it's basically what you'd find in a smartphone, which is why people use Pis for stuff like media hosting servers for home, streaming boxes (like chromcast), very light-weight desktop for internet browsing, and other stuff you would normally need a personal computer for. Arduinos are more for robotics and machinery and other types of control systems.
Hey, what should I do if motor runs at least 6V
That's not a problem. See the Maestro manual pages88-89 www.pololu.com/docs/pdf/0J40/maestro.pdf.
Thank you so much!! Also, which way did you use to control pi as I didn't see either HDMI wire or wireless Bluetooth adapter. Sorry to have so many problems...I'm new to raspberry pi and your video really helped me a lot! There are so resources I've checked but they can be very complex or just not working..
The Raspberry Pi has WiFi built in. I connect it to my WiFi network and access it from my computer. But the question then is how do you set up the WiFi on the Pi in the first place? Most people connect an HDMI monitor and USB keyboard and mouse to it and boot it up like a regular desktop. That way they can set up the WiFi. After that they can boot it up like I do and access it remotely. If you don't have a monitor and keyboard to connect to it then it's more tricky. I talk about all these options and some solutions on my webpages here rimstar.org/science_electronics_projects/connect_to_raspberry_pi_via_wifi_wirelessly.htm
Another getting started resource is the main Raspberry Pi website here www.raspberrypi.org/
RimstarOrg XD I forgot I have the WiFi adapter, it’s in the box. Thank you!!
Why not Arduino?
Do you mean instead of the Maestro servo motor controller board or instead of the Raspberry Pi? If you mean instead of the Pi, I'm going to run some big neural networks on the Pi with a Pi Camera. If you mean instead of the Maestro, in my experience I'm getting finer servo movement with the Maestro than I ever did with the Arduino's main loop.