Sunday, November 1, 2009

Control Physical World Through Computer (Step by Step) - Part 3/3



Second Example, Driving Remote Control Car


What we will need?

      Remote Control Car.
      Relay.
      Transistor and Buffer (for security purpose only).
      Some wires.

Start

Again we will use the same concept; we will use Relay to control the power from the remote control.

If we try to open and remote, we will find this structure:

coolcode21

If terminal (1) touches up terminal (2) it will go forward, (5) for left and so one.

That is what we can do using Relay. See this figure:

coolcode22

And that is all. Now, start implementing your application to close and open pins.

The only new thing is if you want to use keyboard keys, make keyPreview property of form to (True).

And write down this code in Form_KeyDown event:

if (e.KeyValue.ToString() == "37")

// left

else if (e.KeyValue.ToString() == "38")

// up

else if (e.KeyValue.ToString() == "39")

// right

else if (e.KeyValue.ToString() == "40")

// down

There are more complex remotes which allow you to control speed, break... etc.

But the general idea is the same.

More Applications


Introduction to Robots

In this part, we will try to explain simply what what the meaning of robot is. And how can we start implement small robot.

First of all, the robot is not only this kind of machine which is very similar to human body and face, the Robots is any machine with those 5 parts:

      Body structure: Whatever this structure is, but it is very important because it will affect the operation that it should perform.
      Muscle: Motors as an example.
      Sensor system: Instead of eyes and ear in humans, it maybe any kind of sensors or cameras.
      Brain: The group of functions which will handle the robots while performing its operation, it could be Microcontroller, or for simple use it can be your computer with cables (or wireless) commands to your robot.
      Power supply: Battery instead of food or whatever in humans.

Start Work

Our simple robot mission is to detect the blue line on the ground and move on it.

We can use the same RC car that we have, we can use its body and motors as our body structure, muscles. And its battery as power supply.

Bring any webcam and put it in the front of the car, it will be our sensor system.

In our application, we will have simple Image Processing Code to read the video from webcam, read image by image from it, and detect the blue line, depends on that it will start drive right or left.

And that is our brain.

That was the simplest robot, it is good as beginning.

This is and advanced version, with microcontroller instead of connecting to computer, and motional camera:
http://www.youtube.com/watch?v=Shkur2WrWgA

Attached Files


The demo of this application is based in the application provided in this article:

http://www.codeproject.com/KB/cs/csppleds.aspx

But with more feature, you can open or close by the pin checkbox.

You can also run timer which provide different scenarios of opening/closing pins.

And if you have a seven segment, you can use it to count, it is contains seven segment equations.

And it is contains also the new inpout32.dll library.

Conclusion

Please if you find any mistake just inform me, and sorry for any mistake, I am not an electronic specialist.

Thanks. That it is all :)

This Article was provided before with Arabic Here

0 comments:

Post a Comment