I run a German Shepherd rescue shelter, and it's going to help me monitor a few things around the farm. If I have to pay someone, please tell me how much something like that would cost.
I have an NI-9421 digital input attached to my USB carrier. Everything is installed and configured, and I have the DAQ assistant in Labview. (After tons of downloading updates, etc.)
I just can't seem to figure out anything in Labview, I'm trying to figure out a way to take a input and send an e-mail when that input is received.
My inputs are on channel 2,3 and 7, and I just want to have it send an SMPT message when either of those inputs become true.
Thanks for any help or suggestions,
This is pretty simple. You're first step is to verify that you can make a boolean indicator (virtual LED) toggle on aand off when you're sensor is tripped. Then, write the code to send whatever email notification is required. You should start with the examples that ship with LabVIEW. Take a look at the DAQmx examples first.-- Help>FindExamples>Hardware In and Out>DAQmx>Digital Measure>Cont. Read Dig Channel.vi would be a good place to start. See if you can make your sensors trigger changes in the digital graph. (Don't bother with the DAQ Assistant even though you're new. It will only cause confusion later.
What version of LabVIEW are you using?
What exactly are your sensors? How do they become "True"?
There are also examples for e-mailing. Take a quick look and come back with any questions. It sounds like you're doing this for a good cause, I'm sure you'll get the help you need here but just take it a step at a time so you learn enough LabVIEW to modify and enhance your systems capabilities in the future.
You need to separate this task out and check out that each part works properly. Forget the email part for now.
Have you been able to verify the functionality of the card using MAX? That's the first thing you want to do. You can run test panels from MAX and make sure your hardware is working properly.
Next, try to read the card in LabVIEW. There are numerous ways you can do this. In MAX you can create a task to read what you want, and then reference that task from LabVIEW. Or, you can configure the task in LabVIEW by specifying which channels to read. There are numerous examples that are installed when you install DAQmx, which you can find via the Example Finder (Help -> Find Examples). Note that these examples don't use the DAQ Assistant, but that's OK since the DAQ Assistant is pretty much just a pretty shell around the basic DAQ VIs.
The email part is a different matter. The biggest issue you will have here is what kind of email server you will be using. Almost all email server nowadays require authentication, and the SMTP VIs that ship with LabVIEW do not support authentication. (Aside: Shame on you, NI for being so far behind the times on this!) Thus, you will need to use an alternate method. If you're on Windows then one common way to do this is to use .NET. The GMail using LabVIEW example is one that can be used. For a more platform-independent solution you can use the OpenG SMTP VIs. Just do a search for these on this forum, as they've been posted.
Let us know how far you get.
Thanks NIquist for your quick response!
Right now my inputs are just three reset buttons I borrowed off some old computer cases. I'm using the buttons and a 20V power supply from a laptop to send the signal to my 9421. When I toggle the buttons the LEDs light up on the device, as well as when I select the channels in Labview. Eventually they will be connected to a scale and some motion equipment, but that's phase two! It's Labview 2010 (trial with 24 days left) and I will be purchasing it after that. I got the USB-9162, NI-9421 and a bunch of other stuff at a auction, and I'm determined to use it, however I think this might be a little too powerful for me.
Thanks for your help. and I'll try to get more familiar with Labview before I bug people with my questions.
@ smercurio: Actually, I'm too far ahead of the times. I've been using the new Sub-Light QuantumComm protocols to beam my thoughts for so long that I've forgotten about e-mail. It's a bit disconcerting that my friends on MindBook often reply to my messages before I actually send them but I'm getting used to it.
Courtney, it sounds like you're making good progress. Feel free to post your VIs if you want some suggestions or need more help.
Here's a link to the LabVIEW tutorials: http://www.ni.com/gettingstarted/labviewbasics/ They're pretty quick and give you a good overview of the basics without going too deep.
Hi! Okay, I'm starting to second guess myself thinking this might be too difficult.
Everything is setup in MAC from what I can tell, attached is a screen shot with my 3 inputs triggered. (I moved them to 0,1,2)
I got this template VI from the NI example files, and I got it to work with my NI9421 (attached is a screen shot)
I thought this would be a good template to start with, but I don't know what to change.
As far as emailing, our local Humane Society is letting me use their Exchange server to send mail via SMTP, that part will be easy since I have a networking background. (however I don't have much programming skills) But I thought Labview would take care of that for me?!
Thanks for all the help you guys have given me thus far!
Why are you lacking confidence, you're doing fine. I added a case structure to decode the boolean array into text messages. When your email is set up you can use something like this to determine what should be sent.
That's really cool! It looks like it would basically work right now except the fact that I don't know what to attach to the SMTP thing.
I put in the SMTP thing and tried to add string like the help file said. I think I have the right strings in it, but I don't know why it won't let me put a recipient into it. Plus, what would I do to trigger the email? Basically like you have the text indicating when an event happens. I know I've already asked for too much, I really do want to lean this program, but it doesn't work like I think it should work..lol
So yea, if I can send the email that corresponds with the booleen LEDs just like your message does.
Is there some place else I configure the SMPT info? I just used the strings like it said in the help, which I learned from looking at the message box you made for me.
The SMTP VI needs to be inside the loop. However, before you blindly put it in there, you need to decide exactly when the email is supposed to be sent. Is it supposed to be sent when a sensor value goes from low to high? High to low? If you want an email sent when the sensor's state is read as a high, then you need to make sure you don't keep sending an email while it remains high. In other words, send an email, if it's high, but not if you've already sent it. Reset the flag once it goes low. What about if you send an email when Sensor 1 went high, and then you have Sensor 2 go high. Is the email supposed to say that just Sensor 2 is high (since you already sent out an email about Sensor 1 being high, or is it supposed to say that both Sensor 1 and Sensor 2 are high?
Okay, now you're making me think more logically.
after Input 0 - - Send me an e-mail because it happened
after Input 1 - - (a dog will trigger this input after hearing input 0) (I know it sounds weird, but trust me)
after Input 2 - - Send 1 more email, and restart the program - This means everything is back to normal (A time value for how long it took to get from 0 to 2 would be great here, but I'm not pushing my luck.
Okay, now that you all think I'm certifiably insain.. lol.
These dogs are amazing, and I will have to show you this when I'm finished.
I love you guys!