From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Race Car Project

Hello everybody, my group and I were requested to work on a project with the use of LabVIEW. However, we all are beginners and actually underestimated this project and thought it was very simple. So, I would really use some help here.

 

I will explain what exactly we are doing on this project:-

 

First of all, the project is basically a race car track, with 2 racing cars. 

 

We have a photogate sensor on the starting point. So, as the cars first pass through the photogate sensor, we need this to trigger a stopwatch which will calculate the time for that single lap.

 

As a car completes one lap, when it passes through the photogate sensor again. I want the stopwatch to keep the recorded time of the 1st lap and start counting the next lap. 

 

Secondly, to determine the winner throughout the 5 laps. I need a formula function to calculate the average velocity (I am aware of the photogate sensor's ability to calculate velocity, but what I am looking for is AVERAGE velocity and NOT INSTANTANEOUS velocity). 

 

So, I want the formula function to either be like this (L*D/t). 

Where: L is the number of laps. D is the length of the track (manually measured). t is time as counted by the stopwatch.

 

Or either count the average velocity for each lap, and then find the average of the 5 values found. 

 

The car with higher velocity should be the winner. And finally, I am trying to keep the front panel as simple as possible, so that all I need to do is run the program, and then start the race and after 5 laps are completed the winner is determined and THEN the program stops.

 

I wonder if it is possible to write ONE program that contains 2 parts (each for one car), so that it does all the tasks mentioned above for each cars separately, and finally there is some sort of comparison function that compares between the 2 final values of the 2 cars (the average velocity of the 2 cars throughout the 5 laps). 

 

Additional information: it is possible to control the velocities of the cars via their remote controls.

 

And thank you guys in advance,

 

0 Kudos
Message 1 of 24
(3,201 Views)

@UINacarizo wrote:

I wonder if it is possible to write ONE program that contains 2 parts (each for one car), so that it does all the tasks mentioned above for each cars separately, and finally there is some sort of comparison function that compares between the 2 final values of the 2 cars (the average velocity of the 2 cars throughout the 5 laps).


Sure it is.  For the front panel, I would recommend two arrays to show the times for each lab (1 array for each car).  FOR loops would be useful here.  How do you plan to read the photo gates?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 24
(3,194 Views)

Hi crossrulz, 

 

Just to tell you, I am new to this forum. So I have no idea about the Kudos or Marked Solutions thing. 

 

As for your question: "How do you plan to read the photo gates?" 

I don't think I understood you properly, but to clarify: I want the photo gates to 'detect' the cars as they pass (rising), and I want this to be connected with the stopwatch so that the stopwatch will start. For the rest of the race I want the photo gate to make use of the stopwatch's lap function (very common in most smartphones' clock apps).

 

For example, my smartpohne's stopwatch has 2 main buttons, (1) Start and (2) Lap, when I press 'start' the stopwatch begins counting. When I press 'lap' the first recording is stopped and the stopwatch counts another lap right from 0.

 

So, I want the photogate to act as the 'start' button when the cars are first detected. And act as the 'lap' button when the cars are detected again.

 

I had problems explaining that concept to my project partners in real-life discussion, so it's more likely to face problems explaining it here.

 

 

0 Kudos
Message 3 of 24
(3,180 Views)

Are you up to create something like in this youtube video?

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 4 of 24
(3,175 Views)

Hi Norbert,

 

Well, our project is similar but I believe it's way simpler than that. First, we don't plan in using any smartphones in this project, the cars will be controlled via their remote controls. 

 

To make things simple,  our LabVIEW program will basically calculate average velocity and determin the winner, that's it. I have mentioned the details in the first post.

 

Well, I hate to admit it, but we actually struggled a lot, and with nothing paid off. Our teacher says it's easy and simple and THEREFORE he thinks that we should depend on ourselves.

0 Kudos
Message 5 of 24
(3,170 Views)

UINacarizo wrote:

As for your question: "How do you plan to read the photo gates?" 

I don't think I understood you properly, but to clarify: I want the photo gates to 'detect' the cars as they pass (rising), and I want this to be connected with the stopwatch so that the stopwatch will start. For the rest of the race I want the photo gate to make use of the stopwatch's lap function (very common in most 


I believe he asked how you will connect the photo gates to the computer. A good first step for you would be a program that shows you, on the screen, whether there is an object in front of the photo gate. To do this you need some way to read the photo gate status on the computer. What hardware or device do you have to do this?

0 Kudos
Message 6 of 24
(3,156 Views)

@nathand wrote:
What hardware or device do you have to do this?

I am using a DAQsensor.

0 Kudos
Message 7 of 24
(3,145 Views)

@UINacarizo wrote:

I am using a DAQsensor.


Great! Although are you sure you didn't mean SensorDAQ? Have you wired everything together yet? Can you see that when you put your hand in front of the photo gate, you can read it on the computer in a test panel? How about in a simple LabVIEW program?

0 Kudos
Message 8 of 24
(3,133 Views)

"Well, I hate to admit it, but we actually struggled a lot, and with nothing paid off."- where's the code that didn't pay off? What's it doing wrong? Please post what you have. If you can show you've had a stab at it, you are much more likely to get help.

0 Kudos
Message 9 of 24
(3,110 Views)

@nathand wrote:

Great! Although are you sure you didn't mean SensorDAQ? Have you wired everything together yet? Can you see that when you put your hand in front of the photo gate, you can read it on the computer in a test panel? How about in a simple LabVIEW program?


Oh sorry, my bad. That is exactly the device I'm using. 

 

And yes I've wired everything and the photo gate sensor works. However, I am not able to show you a screenshot of the program currently, maybe in around 3 hours I might be able to post a screenshot. (as the program is in the lab's computer currently)

 

I used a stopwatch program written by someone in this forum but I forgot his name. However, I tried to connect the photo gate sensor to the stopwatch but when I run the program the stopwatch starts automatically regardless of whether the photo gate sensor detected something or not.

0 Kudos
Message 10 of 24
(3,082 Views)