With this option you can now interact with the Raspberry Pi wirelessly to perform all sorts of tasks from teleoperation to writing code and reprogramming the robot. Copy and paste into LXterm ip addr show It will be the number before the / after the topic " inet " ***Remember that the Raspberry Pi and the windows machine need to be on the same network/router.*** Once you are logged in to the Raspbery Pi you can now interact with the desktop as you normally would but with a very slight delay. The IP can be found by using the command line on the Raspberry Pi. You can download the program here Ultravnc Download Once the program is installed and running we just need to input the raspberry Pi's IP and verify our password to connect to it. Copy and Paste into LXterm vncpasswd After the password is set its time to login to the sever with the other computer.There are a many VNC Client programs for most OS's, but I will be using Ultravnc on a Windows machine. Copy and paste into LXterm sudo apt-get install tightvncserver After it is installed we can start the service with Copy and paste into LXterm vncserver :1 -geometry 1280x800 -depth 16 -pixelformat rgb565 The first time you run the vncserver you may be asked to create a password to authenticate connection if not use the following command. In order to complete this task we will need a wireless router and a wifi dongle connected to the Raspberry PI as well as a separate computer to control the robot through VNC. Which in our case is going to be useful for wireless remote teleoperation of the robot and basic control of Raspberry Pi. VNC (Virtual Network Computing) is one way we can control and monitor a computers desktop from another computer over a network. You can either double click Buttons.py or use the following terminal command Copy and paste into LXterm python /home/pi/Buttons.py You can always modify the program and sketch to add more buttons and new commands. And the last program is a simple button interface that displays clickable buttons to send data to Arduino to drive the robot. Copy and paste in LXterm python /home/pi/term.py /dev/ttyACM0 115200 When the program is executed properly we are able to use the keyboard to send data to the Arduino over serial to control our robot. Now we are going to use that information to designate our port and baudrate to start the next program term.py. Copy and paste in LXterm python /home/pi/scanports_arduino.py Since I we using Arduino UNO scanports-arduino.py should give us a terminal like window with the output of /dev/tttyACM0. We are going to need this information for the next program. Beginners Guide Youtube Tutorial Arduino - Python The first program we are going to execute is the scanports_arduino.py This little program looks for likely ports that the Arduino is typically mounted to "UNO" /dev/ttyACM0, "others" /dev/ttyUSB0. You can also try some of the links below. So if your curious about how Python works or its rules, syntax, expressions. I am only going to briefly explain the nature of the code by including some comments within the code. There are many useful tutorials on Youtube and online that you should investigate if you want to develop a stronger understanding of Python. I have chosen some useful and simple programs that may help you begin to understand Python, and get you connected to your Arduino. Arduino And lastly refer to the wiring diagram above for setting up the power connections to the robot base. Arduino Robot Base Sketch If you are unfamiliar with Arduino and its IDE you can read up on it here. The last step is to download and load the sketch with the Arduino IDE. scanports-arduino.py term.py Buttons.py Now we have to make the programs executable with a chmod command Copy and paste in LXterm sudo chmod +x /home/pi/scanports-arduino.py sudo chmod +x /home/pi/term.py sudo chmod +x /home/pi/Buttons.py The programs should now be executable and we can run them by double clicking them or via terminal. Copy and paste in the LXterm sudo apt-get install python2.6 Install some of the the dependencies sudo apt-get install python-serial Copy paste in the LXterm sudo apt-get install python python-tk idle python-pmw python-imaging Next download and place the following files to your pi folder. If Python is not installed on your system you can use apt-get granted your Raspberry Pi is connected to the Internet. Copy and paste in the LXterm python -version For the examples we are going to go over it is recommended that you use Python versions 2.6 or later. wheezy-raspbian.img We can check our python version by using the terminal to verify. Now If you are using " -wheezy-raspbian.img " image or later on your Raspberry Pi, Python should be pre-installed. In order to get our Python programs running we need to ensure first that Python is installed on our system along with the proper dependencies and verify the version we are using.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |