Introduction |
The purpose of this project is to enhance one's knowledge of alternative operating systems, Digital Logic, wiring/circuit boards, dynamic web pages, web servers and the operational limits of the car in the Nortel room. If it is successfully, we will have discovered how we can use this set of tools to bridge the gap between the digital and physical world. Either way, we will build a base on which others can expand on in the future.
Learning more about these subjects can greatly improve your odds of doing something useful with computers; knowing digital logic and circuit board construction allows you to go beyond software-based computer projects and interact with the real world. A knowledge of UNIX/Linux can be very useful, as it is the way the computing industry is moving. On top of that, learning a bit about dynamic web pages can go a long way, especially if you can set up a web server to go along with them. It is also extremely important for any person living in this post-modern society to know the operational limitations of a toy car, in case their life ever depends on it.
The goals of this lab are as follows:
Design a circuit board capable of reading a digital signal, then supplying power to the car accordingly.
Setup a Linux computer to send digital signals to the aforementioned circuit board.
Build the circuit board and computer interface.
Construct and test the entire system.
Setup a camera to watch the car and make its feed viewable through the web server running off the Linux machine.
Optional: Setup a wireless camera on the car, with a portable power source.
Through performing these steps, we will expand our knowledge of the tools we use and become more adept at problem solving in the high tech world we in which we are living.
This lab is not overly difficult with a little experience (even without it, its not a big problem). It is, however, somewhat time consuming, as there is a great deal of trial and error involved. However, without error, there is no practical learning. Some of the things we learned include the way Linux interfaces with external (and internal) devices, general computer I/O standards and that the car in the Nortel room becomes unstable when powered by a current in excess of 15 volts.
Methodology |
In the beginning, we searched the Internet to find out if anyone else had completed a project similar to ours. When we found a similar project, our next step was to adapt the diagrams we found at http://www.tldp.org/HOWTO/Home-Electrical-Control/ to suit our purpose, then test it on a protoboard. Once the design worked the way we wanted it to, we soldered it to the bread board.
After the hardware was complete, it was time to set up the computer. We knew that we would be setting up a web server that we didn't require a graphical environment and that we would be using significantly out-dated computer. It was obvious to us that Linux was the operating system of choice. A net installation of Debian GNU/Linux was chosen because it would allow a quick setup with solid components and a good package management system. After the base system was set up, we needed to find software which could, one pin at a time, control the parallel port (which is how we chose to interface with the board). Luckily, the same person who wrote the Home Electrical Device Control HOWTO also included the small C++ program he wrote to control the ports. After a small amount of hacking, it was ready to use with our project. We left the rest of the computer interface (the web page) until later, as it could be put together relatively quickly.
Now came the next testing phase, where we would see if the computer could communicate with the board and the board with the power supply. After a few modifications we had the car flying around the track. Finally, we created the website, hooked it up to the second IP address in the Nortel room and set up the sub domain of wtcs.ca with ZoneEdit.
Finally, we set up a small script using IPTables to forward the external port 81 on the server to port 80 on the web cam, allowing people to view it from outside.
To solve the lab, we used a soldering iron, transistors, resistors, diodes, protoboard, bread board, a computer, a power supply, the car created by Mr. Halling's previous classes and Google.
Experimental Procedure |
As for the hardware, we used a standard parallel cable to link the computer and control board. On the board, we used a standard 4.7k ohm resistor, standard red LED, FRT-2 6 volt coil relay, C2253 transistor and a small amount of wire. See the wiring diagram for more detail.
Step-by-step setup and execution
Computer
These are the steps in the computer setup
Take the base computer system (with monitor, keyboard and power plugged in) and insert the Debian Net install CD in to the CD Rom drive
Follow the on-screen setup instructions, choosing a “web server” as the type of installation
Complete the process by verifying that the packages “apache” and “php” have been installed
$ apache
Ouch! ap_mm_create(1048576,
"/var/cache/apache-mm/mm.12908") failed
Error: MM:
mm:core: failed to open semaphore file (Permission denied): OS: No
such file or directory
$ php
<?
echo "Hello,
world!\n";
?>
Hello, world!
$
If either of these commands fail, use apt-get install apache or apt-get install php to install them.
Ensure that both the required network cards work and the external link has received an IP address
$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:04:E2:94:2B:26 inet addr:192.168.1.1 Bcast:192.168.2.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:9349799 errors:0 dropped:0 overruns:0 frame:0 TX packets:10315022 errors:121 dropped:0 overruns:0 carrier:121 collisions:0 txqueuelen:1000 RX bytes:1248063011 (1190.2 Mb) TX bytes:2303012611 (2196.3 Mb) Interrupt:10 Base address:0xdc00 eth1 Link encap:Ethernet HWaddr 00:04:E2:94:26:B4 inet addr:65.84.23.231 Bcast:192.168.2.255 Mask:255.255.255.0 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) Interrupt:10 Base address:0xd800
In this example, the first network interface (eth0) has already been assigned an IP address (using the command (as root) ifconfig eth0 192.168.1.1 and the second interface (eth1) has received an IP from the DHCP server (if it has not, use the command (again, as root) dhcpcd eth1.
Download and compile the parport_ctrl code from http://edc.sourceforge.net/paralle.tar.gz
$ wget http://edc.sourceforge.net/paralle.tar.gz ... $ tar -xzvf parallele.tar.gz ... $ cd parallel $ ./configure && make then, as root $ chmod +s src/parport_ctrl $ make install
You can test parport_ctrl with parport_ctrl -1 on and testing to see if the second pin on the parallel port is high.
Finally, create the web page which will control the car. In its simplest form, it could look like this:
<?
switch($_GET["car"]){
case "start":
exec ("parport_ctrl -1 on");
break;
case "stop":
exec ("parport_ctrl -1 off");
break;
}
?>
<a href=”?car=start”>Star the car</a> <br> <a href=”?car=stop”>Stop the car</a>
Camera
These are the steps in the camera setup
Following the camera's instruction manual, change the default password then set its IP address to be on the same subnet as the internal network card in the Linux server (such as 192.168.1.2, in this example). While still in the camera's administration interface, change the web server and image transfer ports to 81 and 82, respectively. This will allow outside viewers to see the web cam.
Using a cross over cable, connect the internal network card to the camera and ping it to ensure there is connectivity
Create a small script (we used a modified version of the script found at http://www.jimohalloran.com/archives/000120.html, a) to forward ports 81 and 82 to the camera. Check to make sure this worked by using a web browser to connect to the server's IP address on port 81 (http://car.wtcs.ca:81)
Control Board
These are the steps in setting up the control board
Gather all the required equipment together and build the circuit shown in Figure 1.0 on the protoboard.
|
|
|
Figure 1.0: schematic |
After this works, transfer the circuit onto the breadboard, soldering it on. See figures 1.1 and 1.2.
|
|
|
Figure 1.1: Control board, top |
|
|
|
Figure 1.2: Control board, bottom |
Test the circuit without the computer to be sure it works (a “click” noise will tell you the relay is working)
Car and Track
These are the steps in the car and track setup
As the car/track is not the main focus of this experiment, the setup of the car and track will be largely left to the reader. See figure 1.3 for our car.
Set up a track with two metal contacts
Create a car which gets its power from the metal contacts on the track
Connect the power source for the car/track to the power supply and control board
|
|
|
Figure 1.3: Car on the track |
Putting it all together
Combining all the separate parts to make a whole system
By now, everything should be well tested so when it all goes together it should “just work”
Start by plugging in and booting up the computer, power supply and camera
As the computer is booting, plug the camera in to the computer's network card via the cross-over cable and plug the external network cable in to the other network card.
Plug the parallel cable in to the parallel port on the computer, then connect it to the control board.
Connect the control board to the track and the power supply.
Start up a web browser on another computer and check to make sure it all works.
Results |
This project has turned out to be quite a success. While we have not fully completed the project, in that there is not yet a camera on the car and the car can not yet drive backwards, we have provided a solid knowledge base from which we, along with anyone else interested in reading this report, can build on. For example, the car becomes unstable when it is powered by more than 15 volts. As far as my expectations for the project, they were far surpassed. I had expected to be left with a semi-reliable, botched together system, but I feel, aside from the soldering job, we have quite a clean system that is very good at what it does.
we do not believe we have made any form of contention that requires support.
see c.
See links section.
Links |
Conclusion |
|
Overall, the project was a success. There is still work to be done on the car, it can still be improved, and new features can be added. At this point, that is not a problem. The door is open now for many people to continue this work. |