LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Home automated system question from a newbie

Ok, so I am fairly new to Labview and Matlab but I have been trying to make a home automation system as a little project for myself seeing as I have all the free time in the world to try and keep myself busy. I had read about a similar project someone had done and decided to try and replicate it with the little info given. Ill start off by saying what this system is hoping to achieve, I want the system to be able to read the humidity and temperature for starters then possibly try and add onto that, so I managed to get it working for the humidity but I was kinda confused as to how I could add the temperature, I have a svc file of 360 values for the humidity, temp and PIR, with a 5sec delay timer just so I can simulate 30minutes, I wish I could do real life simulations but im still a newbie haha, also with regards to the temperature id assume i need to use a thermistor/voltage temp characteristic to convert it into % values? its one part my minds blanking on in all honesty but I did see a equation of y = −0.7233x5 + 9.3591x4 − 46.922x3 + 114.91x2 − 160.35x + 145.77 which id assume needs to be added into a formula node, but formula nodes are something i have yet to work with. Id appreciate anyone's help or insight on this. Also ill leave an image of what i have done so far below and before i forget I am trying to get the temperature in graph form so im assuming I can replace the indicator for temp with the graph instead unless im thinking about this wrong and have to attach the graph to the formula node output while the input goes into the array.

0 Kudos
Message 1 of 12
(4,108 Views)

For the equation, all you need is an array of coefficient and polynomial evaluation. Look at the help.

 

You haven't included an image as promised, so we'll wait for that before giving more detailed advice. Actually, we would prefer a VI over an image any time.

0 Kudos
Message 2 of 12
(4,070 Views)

Appeciate the reply, also apologies for the image I did try to attach one at first but nothing showed up so I tried again and forgot to get back to the post with a link, but ill try attaching it one more time from my phone in hopes it works, ill look into that also, I only started using Labview around a week ago so I havent been able to see everything it offers just yet. https://imgur.com/gallery/GvbHra8 

Attaching didnt work so the images are above.

0 Kudos
Message 3 of 12
(4,057 Views)

As a "newbie", you must certainly have looked at the functions on the numeric palette, right?  If you worked with pencil and paper, you might have figured out that you can write a function such as 114.91x^2 − 160.35x + 145.77 as ((114.91 * x) - 160.35) * x + 145.77 (taken from the last three terms of your expression -- the whole expression works the same way).

Equation.png  

Since you are a beginner, "doing it by hand" in this manner isn't a bad idea, and gives you some experience with "wiring" (and, one hopes, striving for neatness in running the wires, which you do by "nudging" the functions around).  You might noticed that there something of a pattern in the above code, and that you might be able to generalize this just by having an array of the coefficients and a single value for x, and might be able to write a function that does this for arbitrary polynomials of one variable, which is the LabVIEW function that Altenbach suggested to you.  But learning to use the simple "math" functions and some wiring practice doesn't hurt, either.

 

Bob Schor

0 Kudos
Message 4 of 12
(4,045 Views)

As I said, we can't really do much with pictures, but here are some comments:

 

  • Your input array will eventually run out of elements and the total number of iterations is known before the loop starts. This means you should use a FOR loop. In you want to stop early, you can still show the conditional terminal wired to a stop button. Of course if the delay time for that iteration is very long, it might take a long time for the stop to apply. If this is a possibility, it might be better to use a while loop with a constant rate and go to the next point whenever time has elapsed. Make sure you encode a sentinel value at the end of the data array to stop the loop (e.g. wait=-1).

Here's how to do the polynomial (note that x can be an array of values, giving you the entire curve over the desired range if desired):

 

altenbach_0-1587400825322.png

 

But of course you an also make your own. Same difference (There are quite a few other ways, e.g. look inside polynomial evaluation for an even simpler method). Make sure you fully understand how they work.:

 

altenbach_1-1587401199944.png

 

Make sure your code is "scaleable" as these two examples. This mean there is no code change needed if you later need a different polynomial order. All you need to do is change the array size of coefficients and everything continues to work. Compare that with Bob's suggestion above where the code needs significant editing operations to change the order.

 

0 Kudos
Message 5 of 12
(4,008 Views)

Hi, I am still fairly new to Labview and just to state this straight away the work I am doing is part of my coursework. I am not looking for someone to do my work for me but would just appreciate some advice/help with where I am going wrong as it is something I do want to learn. To try and sum this up in as short of a message as possible we are making a home automated system which can monitor the Humidity and temperature, also being told to search for any PIR sensor so that its values can be used in the work. A matlab programme was made where we had to add the voltage min and max values, number of values recorded, n of sensors etc which has all been done.

 

I am wanting the project to run for 30mins with a 5 second delay reading both the temperature and humidity, humidity being read by an indicator while a waveform graph is needed for the temp and humidity readings to show the trend. All of the data has already been made on matlab with the humidity and temp voltage values followed by the PIR values but I need to use a formula node to convert the voltage into its appropriate units for the temperature.

 

I have seen a video about the formula node and how you can use it as a calculator in a sense, having a and b as values, followed by a y = a + b inside the node, I was given the thermister voltage/temperature characteristics with the following equation being y = -0.7233x5 + 9.3591x4 - 46.922x3 + 114.91x2 - 160.35x + 145.77 but my mind is completely blank when it comes to implementing the equation, as if I just say copy and paste the equation ill get the semicolon error message. Also as i'm sure anyone reading this will already know but I have the csv file attached so that I get readings for the humidity and temp.

 

Currently I am wondering if I need to use a temperature sensor chart which gives me both the temperatures and the voltages that go with each other and possibly change the x value for an actual voltage value but I am unsure at the moment. My min and max temps needed are -10 degrees and 30 degrees. If anyone could give me some advice or point me in the right path id appreciate the help. Also apologies if I didn't make sense on some things, I've only just woke up.

 

 

0 Kudos
Message 6 of 12
(4,013 Views)

Is this thread also yours?

https://forums.ni.com/t5/LabVIEW/Home-automated-system-question-from-a-newbie/m-p/4037467

 

Seems like the same question.

0 Kudos
Message 7 of 12
(3,987 Views)

Yes, same question but I didn't know how to delete the old post, while I also found out I had an older account and also wanted to reword the question so that i'm asking more for guidance on the matter instead of a straight answer to the question.

0 Kudos
Message 8 of 12
(3,979 Views)

You were told in the other thread how to do a polynomial evaluation. Have you tried?

 

If you insist on using a formula node (makes no sense because there is no point to it!), you need to understand the formula. It is not e.g. "coefficientx5" but "coeficient times x to the power of five), etc.

 

Your formula node needs an input called x and you need to multiply each coefficient with the corresponding power of x. 

 

Start reading here.

 

 

0 Kudos
Message 9 of 12
(3,972 Views)

I have no doubts that a polynomial evaluation would work but the only issue I have is that the assignment im doing tells us that we have to use a formula node, I have looked into it and managed to get it working with the images sent in the past post but did want to at least try and get it to work using a formula node also as bad as it may be, that way I could use the polynomial part as a way to improve the system or well make it easier at the least. From posting this post I did already add a input and output, calling the input x and output y but what I am unsure about is how I actually multiply each coefficient, its something ill be looking up after this reply gets submitted.

0 Kudos
Message 10 of 12
(3,968 Views)