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: 

Car dashboard school project

I have to create a car dashboard as a school project and I don't know how to implement these:

 

1. make a gear box-when shifting up or down i need it to set the acceleration gauge to a specific RPM

2. when increasing or decreasing the acceleration the speedometer(km/h) needs to slowly increase or decrease; it also needs to take in consideration in which gear the gearbox is

3. while the engine is on the fuel tank needs to continuosly drain it'self and show the consumption in liters/hour and liters/km - the higher acceleration is the higher the drain(would also be nice to have a warning when it reaches below 10%)

4. climatronic system

 

I know it's a lot to ask but our teacher only thaught us the basics of the program and I haven't found anything simmilar on the internet.

Any help is apreciated.Cat Happy

0 Kudos
Message 1 of 7
(6,053 Views)

It does not require Labview knowledge above basics.

You do not have gearbox, you have slider control. Set its representation to integer, you will not have 2.5 gear, 2 or 3 only.

RPM is a gauge indicator.

Write formulas how to convert input numbers to output indicators, implement them in LV.

If your labview knowledge is not enough, take basics tutorials, look at the examples on specific task.

When you have specific question, ask it. Now it is too general, you are asking for complete solution of your project.

0 Kudos
Message 2 of 7
(6,023 Views)

I would call this pretty straight forward, the first thing I would do is derive equations for the engine system.

 

Motor speed is determined by how much fuel is being put into it.

Fuel input is determined by throttle position.

Vehicle speed is determined by the gearbox ratio and the motor speed.

 

So you have 2 inputs, throttle and gear that determine 3 outputs, engine speed, fuel consumption and vehicle speed.

 

From there it is just a matter of making a front panel and connecting things up.

0 Kudos
Message 3 of 7
(6,008 Views)

I have almost finished my project. The only things that I could not make to work are the gearbox and fuel tank. I'll attach the VI hoping you can give me some advice,

0 Kudos
Message 4 of 7
(5,896 Views)

A couple of comments.  On my car, the Accelerator and the Brake are not "on-off" devices, but have a range of travel, suggesting that a Slider might be a more appropriate control.  I notice that the Thermometer is controlled by a Dial -- you could consider making temperature dependent on Motor Speed in some fashion.

 

On a more basic note, you should consider taking advantage of some of the built-in Templates that ship with LabVIEW.  In particular, you might look at the Simple State Machine -- if you open LabVIEW, choose Create Project, then choose Simple State Machine and follow the Prompts, you will build an "empty" State Machine Project, with all of NI's Bells and Whistles, and, most important, very good Documentation that explains (a) what a State Machine is, (b) why you might want to use it, and (c) how to modify this Template to adapt it to your particular Project.  [When you create the Template, I recommend editing the Icon when it gives you the chance -- put "Car Sim" or something like that in the little box].

 

In particular, notice the Event structure within the State Machine.  This is looking at your Front Panel controls (such as the Turn Signal, the Accelerometer and Brake, the Ignition and Gearbox).  Whenever they change, the new value is saved in a Cluster held in a Shift Register that holds all of the "State" values.

 

Now consider what you want to have happen.  The first thing you want to do is "Initialize", which here means set all of the variables to their "off" position (including Ignition).  Notice that if you run the Main VI at this point, it will do the Initialize step and will then just wait, taking no CPU time, until you push Exit, at which point it will "wake up" and tell the State Machine to do its Exit State, which stops the While Loop and allows the program to exit.

 

Now think about your Car.  Suppose you step on the Gas, but the Ignition is off.  Well, Ignition is one of the values in the Car Sim data cluster (up near the top of the State Machine).  If this is Off, you don't do anything (right?  if you stop on the gas when the car is turned off, nothing happens).  Otherwise, all you do is save the new value of the Accelerator in the Accelerator entry in the State Cluster.

 

But turning on the Ignition also means that you are changing the "State" of the Car, namely you now need to "Run Engine", "Show Turn Signal", "Show Temperature", and maybe other things.  Turning the Ignition On, itself, could be a State, "Ignition On", which sets the Ignition value in the State Cluster to On and calls on subsequent States.

 

What about Timing?  Well, the Event Structure also has a Timing Input (upper left hand corner) that, by default, is unwired, so it doesn't time out.  You could, however, set it for whatever time interval you want to use in your Simulation and have it call, say, Run Engine (if the Ignition is on, of course).  Run Engine, in turn, could call Show Turn Signal, which could call Show Temperature, which might not need to call anything (if you don't have anything else to do).

 

Do you see how this form of organization simplifies your code's logic, not to mention makes your Block Diagram much more structured and even a bit "self-documenting"?  LabVIEW has tools to make elegant, almost self-explanatory code, but you can also get just a mess of wires and blocks if you just start "coding from scratch".

 

Bob Schor

Message 5 of 7
(5,867 Views)

Hi Bob,

 

A quick search landed me here in a 2015 post. I'm inspired by your thorough explanation on using Simple State Machine to program the car dashboard example. I've tried to follow your approach but got stuck on a loop execution within an event, so just wonder if you could shed some light.

 

I started by setting up the Signal Lights case. When either the signal (left or right) is called in an Signal Light event, the Light will blink (On/Off every 500 ms), which is done within a while loop in this case. I think I've managed to have the signal control part done, but I can't get it working in parallel with other "actions". In particular, I should say, unless the Signal is neutralized (OFF), action event such as "Gas pedal" CANNOT be executed because the event is stuck in the While Loop of the Signal Light Blinking... E.g. If either signal light is ON, I can't pedal gas until the lights are off.

 

Any comments on how to solve this? Many thanks.

 

For your convenience, I've uploaded the code. I'm using 2019 Labview but saved a 2018 version copy under the Main 2018 folder if you need to use 2018.  

0 Kudos
Message 6 of 7
(3,998 Views)

I'm assuming that this is a relatively "early" project in your LabVIEW education, one where you are not quite ready for having independent loops being "spawned" to run simultaneous tasks (such as handling the Gas, signal lights, brakes, etc.) asynchronously.

 

So what is an "Event"?  Pressing the Gas Pedal, changing the Turn Signal, etc. 

 

What do you want to do when you change the Turn Signal?  When you are driving your car, do you wait and do nothing for half a second until the signal goes "tick"?  No, it goes "tick" "automagically" on its own timer.

 

Aha -- when you turn on the Turn Signal, you do not want to "wait 500 msec" (suppose a pedestrian walks out in front at the same time?).  You need another process that says "In 500 msec, handle the Turn Signal again, changing it, turning it off, whatever".  Once you've done this, you can just sit around waiting for another Event to fire (one of which should be "Oops, timer expired, do whatever needs to be done now").

 

How do you handle these Timer Events?  You might not be ready for this, but it will give you some idea of the power of LabVIEW.  Suppose you had a VI you could call with two parameters, a Time Delay (ms), and an Event to execute when the Timer runs out.  What we want to do is to get this Event "into" your Event structure, which we can do through something called a "User Event".

 

So the VI in question would have Wait for so many milliseconds, generate a User Event based on the Event you pass in, and exit.  How would it get started?  You want it to run Asynchronously (meaning "at the same time as") your main routine.  There is a procedure called "Start Asynchronous Call" that does just this -- it starts a specified VI running with specified parameters at the same time that the rest of your code is running.

 

Now, it's a little more complicated.  That's one specific Timer "floating out there" waiting to time out, schedule a single Event, and "die".  What if you need several timers (say, Windshield Wiper)?  Call the same Timer, but make sure it runs "as its own code", what I call a "Clone", and what NI calls a "Reentrant" routine.

 

The point here is you don't really want to put "Waits" inside a State Machine -- that makes them "unresponsive" during the Wait.  You do want to learn enough LabVIEW to take advantage of one of its "hidden features", that it is a naturally parallel processing language -- any VIs that are not "connected by data" run as close to "simultaneously" as the Run Time Engine can make them, allowing multiple tasks to handle different tasks at different speeds without having everything run at the speed of the slowest member.

 

Bob Schor

Message 7 of 7
(3,960 Views)