Introduction: PC Robot Revisited

About: computoman.blogspot.com Bytesize articles instead of a trilogy in one post.

This is a redo of my original pc robot instructable so I could add a lot of details.

Have not made much time to work on special projects. One thing I need to start back on is robopet. There is nothing real super snazzy about this unit although it could be. Mainly I will use it for carrying snacks back and forth from the kitchen during sporting events. There will be a second level not currently attached to hold the goodies. More information about the unit follows.

Had to make special adapter plates to connect the wheel assemblies to the cart. Originally I used clear plastic, but those broke too easily. Wood worked much better, but not as pretty. Attached a third generic card wheel.

Step 1: Power.

Using a standard power supply to test the unit, but it will run on
battery when I finish it. Since the motherboard is AT and the DC-DC PS is ATX, I had to make a special cable from scratch to interface the two. Tested the cable and it works.

https://www.instructables.com/id/Atx-to-At-ps-test-cable/

Use the schematic at your own risk, we are not responsible for any or all issues.

Step 2: Bench Testing.

Using an old Pentium I computer, usb wireless, DC battery power, dc-dc
atx ps and compact flash with an ide conversion interface.

The Linux OS is installed. The OS resides on a compact flash.The iso
file for the version of the Ubuntu distribution also resides on the flash drive and gets mounted as a loop.

Step 3: Communications

When bench testing, can use a normal network card.

Have the wireless working via a usb interface set up to work with a
specific router via the mac address and the zone. Albeit the wireless is 11 mb, more than fast enough to receive and send communication

We installed ptelnet on an old Palm pda to use it as a dumb
terminal. That way we do not have to hook the robot to a monitor when we want to access the unit. Saves electricity and makes it more portable. With the installation of Boa, the Chumby can also be used to control the robot without requiring an umbilical cord. Which means that getting an Android or the like tablet more feasible. Added schematic for turning blinker.

Found a binary of the very lightweight web server Boa on launchpad.net for the version of Ubuntu I am using. Installed it. Apache2 is too bulky for this project. Eventually, I want to make an autonomous unit. This unit will be more like a remote controlled car via wifi.

Step 4: Control

Made a special wiring hardness to connect the parallel port with the
control electronics. Now I need to start testing the electronics for the motor control. Hoping the h-bridge can take the current. If not, I think I have a IC that will. Worst case scenarios is to do it the old fashion way with transistors. After that, everything should fall into place.

https://www.instructables.com/id/Mini-parallel-port-break-out-cable/

https://www.instructables.com/id/No-solder-parallel-port-break-out/

Using my own home grown robot control software to gather data from
sensors and to operate the unit.

Step 5: Powertrain

Code to control the motors has already been tested ( using parcon.c)
and is working. Using a hardwired connection, already tested client/server socket programming to communicate with and control the unit. That should be way more efficient and possibly more secure than using a web server per se..

Powered wheels came from two Tonka RC cars that I dissected.

Step 6: Et Cetera Circuits

Blinking lights.

Step 7: Operating System.

We are using Ubuntu 5.1, but I will probably move to Slackware or Tinycore. Just a matter of doing a typical install and then adding the appropriate needed modules. Will get a new memory card for the new install so we do not lose what already has been done. Slackware 14 will easily run on a Pentium I as will Tinycore linux, Both are more up to date than Ubuntu 5,1. The latest Ubuntu is too bloated to run on this system,

To get the old modules listing we may use:

$ dpkg –get-selections > installed-software.log read

$ dpkg (dash)(dash)get-selections > installed-software.log

---------------------------------------------

Slackware Installation for Ros
The following instructions have not been tested for Electric Due to its simple vanilla-linux setup and highly customizable design Slackware is a great distribution to pair with ROS when building a custom robot. Unfortunately, it will require a little more setup work from the end-user due to the lack of a proper package-management system. ROS assumes we have multiple non-standard packages installed already, many which Slackware does not currently include. These instructions should help you get past the major initial hurdles. After completing these steps you should be able to run through the ROS/Tutorials without any compile or run-time errors. Contents

Slackware Installation SVN Based Install (download-and-compile) Pre-installation rosinstall Environment Setup rosinstall Environment Setup Building Packages Tutorials

SVN Based Install (download-and-compile)

Pre-installation

install mercurial? (need some details on this new step for electric) Get super-user access. You will need your system administrator to give you sudo access. If you can login as root yourself you can add sudo access to your account by running:

echo 'your_username ALL=(ALL) ALL' >> /etc/sudoersInstall libyaml from source cd /opt sudo wget http://pyyaml.org/download/libyaml/yaml-0.1.3.tar.gz sudo tar -xzf yaml-0.1.3.tar.gz cd ./yaml-0.1.3 && sudo ./configure && sudo make && sudo make installYou can now sudo rm /opt/yaml-0.1.3.tar.gz if you want to. Build and install python-setuptools from source: cd /opt sudo wget http://slackbuilds.org/slackbuilds/13.1/development/pysetuptools.tar.gz sudo tar -xzf pysetuptools.tar.gz cd pysetuptools sudo wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz sudo chmod +x pysetuptools.SlackBuild sudo ./pysetuptools.SlackBuildThe output you see from building should end with something like: Slackware package /tmp/pysetuptools-0.6c11-i486-1_SBo.tgz created. Now create a directory where you will keep your compiled packages, and move this created package there for safekeeping and install it:

sudo mkdir /opt/installed_tgz sudo mv /tmp/pysetuptools-0.6c11-i486-1_SBo.tgz /opt/installed_tgz/ sudo /sbin/installpkg /opt/installed_tgz/pysetuptools-0.6c11-i486-1_SBo.tgzYou can now sudo rm -rf /opt/pysetuptools and the tar.gz file if you want to. Build and install logcxx from source: cd /opt sudo wget http://www.gtlib.gatech.edu/pub/apache//logging/log4cxx/0.10.0/apache-log4cxx-0.10.0.tar.gz sudo tar -xzf apache-log4cxx-0.10.0.tar.gz cd apache-log4cxx-0.10.0Unfortunately there are some issues currently between logcxx and the most recent version of gcc that Slackware uses. We will need to modify the logcxx code as follows. First download the following two patch files to your log4cxx directory and apply them by issuing these commands:

sudo wget https://issues.apache.org/jira/secure/attachment/12439514/exampleFolder_stringInclude.patch --no-check-certificate sudo wget https://issues.apache.org/jira/secure/attachment/12439513/cppFolder_stringInclude.patch --no-check-certificate sudo patch -p1 -i cppFolder_stringInclude.patch sudo patch -p1 -i exampleFolder_stringInclude.patchNow you will need to prepend one line that the makers of log4cxx forgot to include in one of the example header files. Do this with the little trick below, or just use your text editor:

sudo touch console_temp.cpp && sudo chmod 777 console_temp.cpp && echo "#include " | sudo tac src/examples/cpp/console.cpp - | sudo tac > console_temp.cpp && sudo mv console_temp.cpp src/examples/cpp/console.cppNow, finally we can build and install log4cxx:

sudo ./configure --prefix=/usr sudo make sudo make installYou can now rm the .tar.gz file we downloaded if you want to. easyinstall pyyaml sudo easy_install pyyamlBuild and install wxWidgets (Optional). Many of the ROS graphical tools (turtlesim,rviz,gazebo,pr2_dashboard) assume you have a working installation of wxWidgets. In order to compile and use these tools build and install wxWidgets as follows:

cd /opt sudo wget http://slackbuilds.org/slackbuilds/13.1/libraries/wxPython.tar.gz sudo tar xvf wxPython.tar.gz cd wxPython sudo wget http://downloads.sourceforge.net/wxpython/wxPython-src-2.8.11.0.tar.bz2 sudo chmod +x wxPython.SlackBuild sudo ./wxPython.SlackBuild sudo mv /tmp/wxPython-2.8.11.0-i486-1_SBo.tgz /opt/installed_tgz/ sudo /sbin/installpkg /opt/installed_tgz/wxPython-2.8.11.0-i486-1_SBo.tgzYou can now sudo rm -rf /opt/wxPython and the .tar.gz file if you want to.

rosinstall

The following lines will download the ROS source code using the rosinstall tool, and bootstrap the installation. The installation downloads all ROS stacks in subdirectories inside the ~/ros directory, one subdirectory for each stack in the rosinstall file. First install rosinstall: sudo easy_install -U rosinstallThere are many different libraries and tools in ROS. We provided four default configurations to get you started. Desktop-Full Install: (Recommended): ROS Full, rviz, robot-generic libraries, 2D/3D simulators, navigation and 2D/3D perception rosinstall -n ~/ros "http://packages.ros.org/cgi-bin/gen_rosinstall.py?rosdistro=electric&variant=desktop-full&overlay=no"Desktop Install: : ROS Full, rviz, and robot-generic libraries rosinstall -n ~/ros "http://packages.ros.org/cgi-bin/gen_rosinstall.py?rosdistro=electric&variant=desktop&overlay=no"ROS-Full: ROS package, build, communication, and graphical tools. rosinstall -n ~/ros "http://packages.ros.org/cgi-bin/gen_rosinstall.py?rosdistro=electric&variant=ros-full&overlay=no"ROS-Base: (Bare Bones) ROS package, build, and communication libraries. rosinstall -n ~/ros "http://packages.ros.org/cgi-bin/gen_rosinstall.py?rosdistro=electric&variant=ros-base&overlay=no"NOTE: the instructions above download all stacks inside the ~/ros folder. If you prefer a different location, simply change the ~/ros in the commands above.

Environment Setup

Shell language:

Bash

Zsh

You'll now need to update your environment. You can do this by typing: source ~/ros/setup.bashIt's convenient if the ROS environment variables are automatically added to your bash session every time a new shell is launched, which you can do with the command below: echo "source ~/ros/setup.bash" >> ~/.bashrc . ~/.bashrc

Building Packages

Since rosdep cannnot detect the Slackware OS any rosmake commands will will throw dependency errors. You will need to build packages manually without dependencies using the --no-rosdep flag like in the example below. Compiling rostest and many other simple packages should work for you at this point:

rosmake --no-rosdep rostest

Tutorials

Now, to test your installation, please proceed to the ROS Tutorials.

Step 8: Software.

In progress...

Robot os. The infinite loop.
While true% ' set or reset values ' input sensor values ' Other jobs ' Do what is needed based on input values. wend Part I. Set or reset values. Part II Get sensor values. Reading the Input pins

The command to read from ports in qbasic is INP. The address you need to read from is the address of the parallel port (usually 378h) + 1; so the usual address is 379h. As i mentioned before, the pins used for input are 10-13 and 15. Reading the different pins is little harder than writing to the ports, as you have to mask out the pins your not interested in. When you read the port, the first 3 bits returned are not used. For example, the qbasic code below would read pin 12 (out of paper). When this port is high, "Out of paper / pin 12 toggled" will be displayed: data = inp(&h379) IF (data and 32) = 32 then print "Out of paper / pin 12 high" The table below list the pin input pin number, its normal purpose, and the number required to read it (eg 32 was used in the above example): Pin Number Normal Purpose Number to read 10 Ackowledge 64 11 High when not Busy 128 12 High when out of paper 32 13 High when printer online 16 15 High when no error 8

If you understand binary, you should immediately see where these numbers are coming from, and why they are used to mask out all of the other pins we aren't trying to read. The simplest thing you can use to test this is to just connect a switch between an input pin and a ground pin (18-25). For example, if you connect a switch between pins 15 and 20, you could use the following code to monitor when the switch is pushed: start: res = INP(&H379) CLS IF (res AND 8) = 8 THEN PRINT "Button pushed" ELSE PRINT "Button NOT pushed" FOR delay = 1 TO 500: NEXT delay GOTO start I know this code is a little messy, and will flicker, but it's written for clarity. The same code can be used to monitor the other four input lines by changing to the '8' to another number from the table. Part III Other jobs. Part IV We can use programs such as parcon to set values at the parallel port for such jpbs as controlling the power train. see also: https://www.instructables.com/id/Mini-parallel-por... https://www.instructables.com/id/Mini-parallel-por...

Portcontrol is a nice program for reading data and writing data to the ports available at:

http://www.epanorama.net/circuits/portcontrol.tar

You will need a C compiler for your system to make it work,

Port control software for Linux
Version 0.3

Copyright Tomi Engdahl 1996-2005

Introduction

This software package provides access to PC computer hardware I/O ports under Linux operating system.

This softare package is designed to run on Linux system that runs on normal PC hardware. The software has been tested to run nicely on Fedora Core 4 Linux distribution. You need GCC to compile the programs.

This package provides the following tools:

lptout simple program to control LPT1 printer port data pins portcontrol general use I/O port reading and writing application control.php AJAX/PHP based web interface for parallel port controlling

The software are provided with no guarantee of their correctness. Use them at your own risk.

Compiling

Run: make install

Installing

Log in as root. Run: make install

The software is now installed to /usr/local/sbin/ directory Using lptout

The user has to have the root previledges to have access to the ports for the program to run. For this reason the the program is installed with SUID ROOT settings, meaning that every time the program is run it is automatically run at root previledges no matter who runs it. This program is designed to access LPT1 parallel port at I/O address 0x378 (normal address for parallel port integrated to motherboard)

For example command /usr/local/sbin/lptout 0xFF will turn all data pins in LPT1 port to high state (1). Command /usr/local/sbin/lptout 0x00 will turn all data pins to to low state (0).

Using portcontrol

portconrol is a simple general purpose I/O port control program for Linux. It allows you to write and read the supported I/O ports. The software allows writing specified value to port, reading value at given I/O address and printing it out to screen in different formats and bit-level manipulation of the port data.

Examples

/usr/local/sbin/portcontrol LPT1DATA read setbit 1 write Reads parallel port data, set bit D1 to 1 and writes value back Effectively sets the LPT1 pin D1 in parallel port to logic 1

/usr/local/sbin/portcontrol LPT1DATA read resetbit Reads parallel port data, set bit D1 to 0 and writes value back Effectively sets the LPT1 pin D1 in parallel port to logic 0

/usr/local/sbin/portcontrol LPT1DATA setvalue 0xff write Writes value 0xff (255 dec) to the parallel port Effectively sets all LPT1 data pins to logic 1

/usr/local/sbin/portcontrol LPT1DATA read print bin Reads the parallel port data pin states and prints the results as binary numbers to the screen (standard output).

/usr/local/sbin/portcontrol LPT1DATA read print bin Reads the parallel port data pin states and prints the results as binary numbers to the screen (standard output).

/usr/local/sbin/portcontrol LPT1DATA read printbits 021 Reads the parallel port data pin states and prints the states of bits D0, D2 and D1 in that order to the screen (standard output).

Supported port identifiers LPT1DATA LPT1 port data lines controlling (0x378) LPT1STATUS LPT1 printer status inputs register LPT1HANDSHAKE LPT1 handstake output controlling JOYSTICK Joystick port reading (only reading makes sense)

Supported commands PRINT DEC Read data, gives output as decimal number PRINT HEX Read data, gives output as hexadecimal number PRINT BIN Read data, gives output as binary number PRINTBITS bits Reads the specified bits in the specified order (0..7)

WRITE Writes register value to port READ Reads value from specified port to register

SETVALUE value Sets the given value to register AND value Performs AND with given value and register OR value Performs OR with given value and register XOR value Performs XOR with given value and register SETBITS bits Sets given bits to 1 in register RESETBITS bits Sets given bits to 0 in register SETBIT bits same as SETBITS RESETBIT bits same as RESETBITS TOGGLEBITS bits Toggles specified bit values

value can be gives as decimal number or heaxadecimal starting with 0x bits is a list of bit position identifiers from 0 to 7

Port names are ment to be written at high case. Commands at low case.

Using web interface

The web interface for controlling paralle port is simple modern web based interface for controlling parallel port. To make it you need to have the following parts in your system: - Apache web server with PHP5 support working with it - portcontrol software installed to the default install directory - SAJAX Simple Ajax Toolkit by ModernMethod - Modern web browser that supports JavaScript (IE6, Mozilla Firefox)

Installing the web interface is simple. All you need is to copy the control.php file to a suitable place on your web directory you want it to be copy the Sajax.php file from the SAJAX package to the same directory where you have the control.php.

Then just go to the URL where you have that control.php accessable. You should see status line plus a set of control buttons. The status bar shoudl automatically update every 5 seconds with the parallel port status and current time on the server computer. Pressing the buttons will change the parallel port bit states.

Note that on some systems the PHP script might hot have enough rights to run the portconrol software. Check your access rights to make sure that rights are correct (the system did not work on my Fedora Core 4 system when I had SELinux security enabled).

SAJAX Simple Ajax Toolkit by ModernMethod can be downloaded from http://www.modernmethod.com/sajax/

NOTE: There is an another version of the control.php file available. This file controlfile.php work pretty much in the same way, but instead of controlling parallel port writes and reads the status from a file (status.txt in the same directory as the script is). It can be used to test the AJAX/PHP based control system.