LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sending SMS using labview

Hi
I need help, in my Vi code the message are send every 5 second and this is my problem.

I want to send only one message if weight are greeter then set in box weight, and if i set a new number greter then also must send only one message. 

And my second problem are when receive SMS to my cell, the message looks: are: 502,00000 
The word weight are missing and five zeros I do not know where they come from .




Thanks in advance for any help

 

Download All
0 Kudos
Message 1 of 25
(5,896 Views)

It does not matter whether you're sending an SMS message or hitting a kumquat. You need to have a flag that is set once the message is sent. You look at the flag to determine if a message has already been sent. You reset the flag once the weight falls below your target. A simple Boolean will work as a flag. You can use a shift register or a Feedback Node.

 

Other comments:

  • Do not place the VISA Configure Serial Port and VISA Close inside the loop. These belong outside the loop - you do not need to reconfigure the serial port each time you send a message.
  • Do not use such a large time delay. It effectively prevents you from quickly stopping the VI. If you press Stop while the code is inside the inner case you have to wait 10 seconds before the VI actually stops. If you want to check the weight once every 10 seconds, then use a small loop delay and use the Elapsed Time to see if the required amount of time has passed. 
  • I don't quite understand why you are using a combo box for the message prefix. Why not a simple string control?

As for your second problem: the extra zeros are due to the Format Into String function. You did not provide an explicit format string, so it's giving you a default conversion. Please read the LabVIEW Help on the Format Into String function for various formatting strings. If you want the weight rounded then you can simply use %d to convert to an integer.

 

 

Message 2 of 25
(5,873 Views)

Hi

Thanks for help, now i solve the problem of zeros and now I working on SMS problem.

  • How can I clear buffer of rs232 before send a message? Because now in this VI, when receive a SMS looks: AT+CMGS="+38670xxxxxx" Weight is 41, 
  • Do not use such a large time delay. It effectively prevents you from quickly stopping the VI. If you press Stop while the code is inside the inner case you have to wait 10 seconds before the VI actually stops. If you want to check the weight once every 10 seconds, then use a small loop delay and use the Elapsed Time to see if the required amount of time has passed. 

I insert the delay because when the case is true I receive 4 sms in 3seconds.

 

  • I don't quite understand why you are using a combo box for the message prefix. Why not a simple string control?

The program must have a box to insert a sms number.

Thanks for your help which I still need Smiley Happy

 

 

 




 

 

0 Kudos
Message 3 of 25
(5,847 Views)

@Ajtimstoj wrote:

Hi

Thanks for help, now i solve the problem of zeros and now I working on SMS problem.

  • How can I clear buffer of rs232 before send a message? Because now in this VI, when receive a SMS looks: AT+CMGS="+38670xxxxxx" Weight is 41, 

The VISA Flush I/O Buffer is used to clear the buffer(s). I do not know why you want to clear the buffer. You did not indicate what you are controlling (I'm guessing it's some kind of modem), so clearing the buffer is not necessarily the correct thing to do.

 


Do not use such a large time delay. It effectively prevents you from quickly stopping the VI. If you press Stop while the code is inside the inner case you have to wait 10 seconds before the VI actually stops. If you want to check the weight once every 10 seconds, then use a small loop delay and use the Elapsed Time to see if the required amount of time has passed. 

I insert the delay because when the case is true I receive 4 sms in 3seconds.


This doesn't make much sense. Your fundamental problem is that you do not have a flag that checks to see if a message has already been sent. Your loop will keep sending the message over and over again while the weight is above a specified value. Is this what you want? Or, do you only want to send it one time only, each time the weight exceeds the value? If it's the latter, then you need a flag. See attached example.

 


I don't quite understand why you are using a combo box for the message prefix. Why not a simple string control?

The program must have a box to insert a sms number.


This makes no sense either. Your SMS number is a different control which is a string control. Why do you need a combobox to provide the text that comes before the value? Are you intending to provide a choice of messages? If not, then using a combobox makes no sense.

 

 

You also still have the serial port initialize and close inside the loop.

0 Kudos
Message 4 of 25
(5,833 Views)

Why did you create a new thread?

 

The questions you asked in the new thread seem to be pretty much the same ones you asked in the original thread!

0 Kudos
Message 5 of 25
(5,815 Views)

@Ravens Fan wrote:

Why did you create a new thread?

 

The questions you asked in the new thread seem to be pretty much the same ones you asked in the original thread!


My mistake, I thought it more visible if I open a new thread. Sorry about that. 

0 Kudos
Message 6 of 25
(5,805 Views)

@smercurio_fc wrote:

@Ajtimstoj wrote:

Hi

Thanks for help, now i solve the problem of zeros and now I working on SMS problem.

  • How can I clear buffer of rs232 before send a message? Because now in this VI, when receive a SMS looks: AT+CMGS="+38670xxxxxx" Weight is 41, 

The VISA Flush I/O Buffer is used to clear the buffer(s). I do not know why you want to clear the buffer. You did not indicate what you are controlling (I'm guessing it's some kind of modem), so clearing the buffer is not necessarily the correct thing to do.


 

Now I know where is the error, I put wait (ms) before VISA write and now SMS receive complete.

 


Do not use such a large time delay. It effectively prevents you from quickly stopping the VI. If you press Stop while the code is inside the inner case you have to wait 10 seconds before the VI actually stops. If you want to check the weight once every 10 seconds, then use a small loop delay and use the Elapsed Time to see if the required amount of time has passed. 

I insert the delay because when the case is true I receive 4 sms in 3seconds.


This doesn't make much sense. Your fundamental problem is that you do not have a flag that checks to see if a message has already been sent. Your loop will keep sending the message over and over again while the weight is above a specified value. Is this what you want? Or, do you only want to send it one time only, each time the weight exceeds the value? If it's the latter, then you need a flag. See attached example.

 


 I want to send only one massage in one time only, now i working on it, thanks for example.

 


I don't quite understand why you are using a combo box for the message prefix. Why not a simple string control?

The program must have a box to insert a sms number.


This makes no sense either. Your SMS number is a different control which is a string control. Why do you need a combobox to provide the text that comes before the value? Are you intending to provide a choice of messages? If not, then using a combobox makes no sense.

 

 

You also still have the serial port initialize and close inside the loop.


The combobox is not my idea but of my teacher, the user must insert diferent message inside, I know that there is no sense but must work this 🙂
Now in this Vi the message send complete, no code inside and so on ... Now just work on flag 🙂 

 

0 Kudos
Message 7 of 25
(5,800 Views)

I do not know how to do, if (temperature measured greter or equal set temperature) Then set true else set false.
Can anyone help me.

Download All
0 Kudos
Message 8 of 25
(5,787 Views)

I don't understand your question and I don't understand what you are trying to do.

 

Is this related to your other questions?  If not, then now is the time to start a new thread.  You shouldn't start a new thread for the same question like you had because you wind up getting people to take time to answer questions that were already answered in the other thread.  (Notice how some of the answers here were identical to the ones in the other thread.)

 

Back to your latest VI.  I don't know why you have a case structure inside a case structure.  They both are triggering off the same boolean wire.  If the outer case structure is True, then the inner one is automatically true because you have the same boolean wire going to the selector of the inner one.  The false case on the inner structure can never run.  And in that inner True case structure, you are doing another comparison that is identical to the one you already have outside the case structures.  So you might as well just use the boolean wire coming off the outer comparison.

0 Kudos
Message 9 of 25
(5,765 Views)

Now the program work if weight is hreter then I set send sms,but the results is 6 sms messages in 8 seconds.I want only one sms when is condition is true (set weight and measured weight)  I really do not know how to set the flag when is first sms send, and reset the flag when weight dropt down. 
 

Message 10 of 25
(5,746 Views)