We have designed a system which has its sensor in it. The sensor that we use sends some numeric signals to computer and we can record these numeric values in a .txt file.
What I want to do is to turn the red, yellow or blue lamps on and off depending on which numeric value the sensor is sending to the computer.
I think, an Arduino product can deal with turning the lights on and off by reading the .txt file located on the computer.
I am someone who is new on these electronic works.
Could you please give your suggestion on which Arduino product should I choose for my work?
What sort of lamps are used to make the red yellow and blue - are they individual LEDS or are they mains powered lamps, or what ?
The Uno is the best Arduino for beginners because most software and add-ons works with it. Any of the Arduinos should be able to control 3 lamps in response to code sent from Matlab.
I think your first step is to get an Arduino and learn to program it. There are many examples with the Arduino IDE and many online tutorials.
I've implemented a serial receiver in matlab (uart protocol) it's very simple, you can use arduino serial port to talk to matlab. I think Arduino Uno suits fine for this tasks but there's a question: what's the protocol of the sensor data?
First of all, thank you very much for your replies.
Actually, what we are able to do with our sensor is that the signals being sent to the computer can be accumulated in a .txt file while the sensing process is being sustained.
The key question is that "Can an Arduino deal with reading the numeric data accumulated in the .txt file and use these data to be able to turn the different colour lights on and off?"
Is the Arduino Uno suitable for this purpose of our?
cagdasakalin:
The key question is that "Can an Arduino deal with reading the numeric data accumulated in the .txt file and use these data to be able to turn the different colour lights on and off?"
Where is the .txt file store? in the computer? SD card?
To read a text file located at Computer, do it through the Arduino Serial port.
How you send the file out from the PC is another matter. You could write a client in Processing that sends the file to a COM port, or do it in Visual Basic, or Java, or 'C'/C++ - basically whatever you prefer.
You appear to have edited your Original Post very recently. What did you change?
I note that a few people have mentioned Matlab although you don't seem to have mentioned it - or have you confused everyone by removing a reference to it?
If you just want to read a text file on a PC and send data to an Arduino that can easily be done with a Python program. This Python-Arduino demo could provide a starting point.
Sorry if I missed something, but the goal seems to be to:
-get sensor data
-store sensor data in .txt file
-light the correct lamp
-display the correct warning
If that is all you need then isn't it possible to just, separate the work
On the arduino:
-get sensor data
-light correct lamp(trough relays, if they are not LED's)
-send it over serial
In Matlab:
-store sensor data
-display warning
The decision making about the light color is done in Arduino.
The decision making about the warning is done in Matlab.
So now you don't have to worry about reading a value from a .txt file on a PC, just writing it there.
Both decisions should be based on the last value of the same variable. Both decisions will have a time difference of how-long-it-takes-to-update-Matlab's value-over-Serial. If the code is only that, then I expect a time delay in the order of milliseconds - if that is not a problem for your application...
If you need to use PC computing power for some long and complex code, and/or real time is critical for your application then skip the idea.
But then again, I also am new to this thing, so let more experienced guys confirm or deny the idea first.
mart256, what you are expressing in your last message is the point that I am exactly looking for.
After decision of toggling in Matlab, I do not how to send the command to Arduino and WHICH Arduino model I should use.
mart256, what you are expressing in your last message is the point that I am exactly looking for.
After decision of toggling in Matlab, I do not how to send the command to Arduino and WHICH Arduino model I should use.
If you can, please, make it clear for me.
Cheers.
Are you using the "Matlab Support Package for Arduino" ( Arduino Hardware - MATLAB & Simulink )? It has a fairly simple interface for directly manipulating Arduino digital and analog I/O pins and examples of such use. It also has a list of supported Arduino devices. As Robin notes above, unless there is a compelling reason to use a different device, the Arduino Uno is a good choice.
If your application requires faster sensor I/O then the Matlab library might not be a viable approach, but without knowing the specific sensor you are using or the details of your application, no one can say.