Raspberry Pi Robots – Basic Motor Control – Episode 1
Robots… Robots… Robots… Everyone loves robots. Not a single person doesn’t. Fact. They are awesome. And I’m going to teach you how to make your first one! That makes me awesome too!
Welcome to Episode 1 of my latest Raspberry Pi Robots series! In this video I will show you how to control a robot wirelessly from a different computer. By the end of this video you will understand a Python program and be able to make your Pi2Go-lite move! Watch the above for all of the details.
INFORMATION (Chronologically of course):
Previous episode (Introductory one!): http://youtu.be/_hDy9WY5UM0
Pi2Go-lite: http://4tronix.co.uk/store/index.php?rt=product/product&product_id=400
Panasonic Eneloops: http://www.amazon.co.uk/Panasonic-eneloop-BK-3MCCE-8BE-Batteries/dp/B00JZBX8DQ/ref=sr_1_1?ie=UTF8&qid=1419755694&sr=8-1&keywords=panasonic+eneloop
My USB WiFi dongle from The Pi Hut: http://thepihut.com/products/usb-wifi-adapter-for-the-raspberry-pi
List of compatible USB WiFi dongles: http://elinux.org/RPi_USB_Wi-Fi_Adapters
PuTTY download from here: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
COMMANDS:
1) Boot to the desktop with the command: startx
2) Download the code with the command: git clone https://github.com/the-raspberry-pi-guy/robot
3) Download Python package to ensure the libraries all work!: sudo apt-get install python-smbus
4) Navigate into the correct directory with the command: cd robot/pi2go
5) Look at the program with the command: nano motor.py
6) RUN the program with the command: sudo python motor.py
Thank you for watching! Make sure you stay tuned by subscribing! Don’t forget to like, share and comment!
The Raspberry Pi Guy
Y U NO SUBSCRIBE?!
Good video…but I have a question. Can you please tell me if by running the sudo python motor.py command will automatically write the python commands for us or will we have to write it on our own? Beginner in robotics raspberry pi
That will run the code for you? You don’t need to write that code out if that is what you mean?
Yeah
No need to write it out. I’ve done that all for you. By all means go in and have a tinker, otherwise you just run it with sudo python motor.py!
Nice Video . Please make a video on how to connect pi to board and motor. The whole video was easy. Thanks
http://www.theraspberrypiguy.com/raspberry-pi-how-to-control-motors-2/
^ This video is about controlling single motors with your Raspberry Pi
Glad that you liked the video!
can I use c/c++ instead of python @raspberrypiguy
Feel free to modify this and use it with whatever language you desire!
i code a raspberry and i want my range go infinity
it is a gpio as gpio
for x in range(0,10) so i want it
for x in range(infinity)
thanks.
Hi there,
If you would like something to repeat for an infinite amount of time, a “while” loop would be much more suitable. Simply use the statement “while True:” in Python – http://www.tutorialspoint.com/python/python_while_loop.htm
Thanks
The Raspberry Pi Guy
I cant find the wifi config utility you mention. Where can I find it and how do I access it? Assuming of course it is already installed.
Thanks
Antony
I think I may have solved my above problem but I now have a new one. When I open putty and put in my ip address – the box is appearing but the connection times out. I believe mine is opening a different port – number 24. So I am replacing the 22 with 24 in the box. Is that right? Any idea why the connection is timing out?
You may indeed have a different port number – usually it is 22 however if you know different then use that! Could be causing those pesky time outs.
Hello, nothing happens with the motors when I run the code. Everything looks good on the terminal but the pi2bot won’t move an inch. Any suggestion?
Hey there!
Have you constructed your Pi2Go properly? Are you using the Pi2Go-lite?
Thanks
The Raspberry Pi Guy
Hello,
JUst followed your very clear video, thank you. Unfortunately when motor.py. Refused to run I realised you had written this for pi2Go lite and I have a pi2Go. Is that why I get the following error? Do you have a pi2go version?
Trace back (most Recent call last):
file “motor.py”, line 8, in
Import pi2go, time
FIle”/home/pi/robot/pi2go/pi2go.py”, line 96, in
GPIO?setwarnings(False) # Pah, who needs runtime errors nowadays.! MTB edit
ATtributeError: ‘module’ object has no attribute ‘setwarnings’
Hey nice video buddy. I want to control my robot with PS2 remote, i want that code in python. Will you please help me out with it?