Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Raspberry Pi Robotic Blueprints

You're reading from   Raspberry Pi Robotic Blueprints Utilize the powerful ingredients of Raspberry Pi to bring to life your amazing robots that can act, draw, and have fun with laser tags

Arrow left icon
Product type Paperback
Published in Oct 2015
Publisher
ISBN-13 9781784396282
Length 198 pages
Edition 1st Edition
Concepts
Arrow right icon
Toc

Table of Contents (9) Chapters Close

Preface 1. Adding Raspberry Pi to an RC Vehicle FREE CHAPTER 2. Adding Raspberry Pi to a Humanoid Robot 3. Building a Tracked Vehicle That Can Plan Its Own Path 4. Building a Robot That Can Play Laser Tag 5. A Robot That Can Draw 6. A Robot That Can Play Air Hockey 7. A Robot That Can Fly Index

Accessing the RC car remotely

You can now control your RC Car, but you certainly want to do this without any connected cables. This section will show you how to add a wireless LAN device so that you can control your car remotely. The first step in doing this is to install a Wireless LAN device. There are several possible ways to do this; however, the one that works well, with full documentation, is described at https://learn.adafruit.com/setting-up-a-raspberry-pi-as-a-wifi-access-point/overview.

You should now be able to connect to your Raspberry Pi via the Wireless Access Point. Once you've created the wireless access point, you can login via a VNC connection, this way you can add a USB webcam to your car to make it even easier to control. To do this, first download an application that can support a VNC connection. You can get this on your Raspberry Pi using an application called vncserver. You'll need to install a version of this on your Raspberry Pi by typing sudo apt-get install tightvncserver in a terminal window on your Raspberry Pi.

TightVNC Server is an application that will allow you to remotely view your complete graphical desktop. Once you have it installed, you can do the following:

  1. You need to start the server by typing vncserver in a terminal window on Raspberry Pi.
  2. You will be prompted for a password and then asked to verify it, then you will be asked if you'd like to have a view-only password. Remember the password that you have entered, you'll need it to remotely login via a VNC Viewer.
  3. You'll need a VNC Viewer application for your remote computer. One choice for Windows users is RealVNC, available at http://www.realvnc.com/download/viewer/. When you run it, you will see the following:
    Accessing the RC car remotely
  4. Enter the VNC Server address, which is the IP address of your Raspberry Pi, and click on Connect. You will get a warning about an unencrypted connection, select Continue and you will get the following pop-up window:
    Accessing the RC car remotely
  5. Type in the password that you entered while starting the vncserver, and you will then get a graphical view of your Raspberry Pi, which looks like the following screenshot:
    Accessing the RC car remotely

You can now access all the capabilities of your system; however, they may be slower if you are doing a graphics-intense data transfer. To avoid having to type vncserver each time you boot your Raspberry Pi, use the instructions given at http://www.havetheknowhow.com/Configure-the-server/Run-VNC-on-boot.html.

Vncserver is also available via Linux. You can use an application called Remote Desktop Viewer to view the remote Raspberry Pi GUI system. If you have not installed this application, install it using the update software application based on the type of Linux system you have. Once you have the software, perform the following steps:

  1. Run the application and you will get the following result:
    Accessing the RC car remotely
  2. Make sure vncserver is running on Raspberry Pi; the easiest way to do this is to log in using SSH and run vncserver at the prompt. Now click on Connect on Remote Desktop Viewer. Fill in the screen as follows, under the Protocol selection, choose VNC, and you will see the following screenshot:
    Accessing the RC car remotely
  3. Now enter the host IP address, make sure you include a :1 at the end and then click on Connect. You'll need to enter the vncserver password that you created when you first ran vncserver on Raspberry Pi, like this:
    Accessing the RC car remotely

You can see the graphical screen of Raspberry Pi. Now you are ready to observe the output of a USB webcam connected to your car. This is quite straightforward, simply plug in a USB webcam and download a video viewer. One such video viewer that works well is luvcview. To install this, type sudo apt-get install luvcview.

With all these tools installed, you can now run vncview, bring up a luvcview window so you can see what your RC Car is seeing and control it remotely by running the xcmodControl.py program that you wrote earlier. The screen will look similar to the following:

Accessing the RC car remotely

There are a lot of additions that you can make to your Raspberry Pi controlled car, such as adding the joystick control or more autonomy. However, let's move on to the next project.

You have been reading a chapter from
Raspberry Pi Robotic Blueprints
Published in: Oct 2015
Publisher:
ISBN-13: 9781784396282
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image