has to read and send to computer two analog signals and one digital.
has to send two control signals to electronics being monitored: one is digital, the other is a PWM with varying duty cycle depending on the captured data
all this has to happen at a minimum frequency of 1kHz.
There are also a lot of conditions dependent on captured data in place for the protection of the electronics being monitored.
I need help with programming architecture on this. Any thing done similar to this? (Remember its not just a datalogger, its a controller too).
Any help on this would be appreciated.
The timing is looking a bit marginal in several respects.
About 20% of your time will be taken up just by those analog reads.
I don't know what format you plan to use when you send the measurements to the PC, but you will need a high speed on the serial port and a very concise format to achieve 1KHz updates.
You don't mention the control algorithm so I assume it will be simple - as long as it is, that remaining 80% of the CPU time should be ample.
Thanks for the reply.
However my understanding was that analogRead() is quite fast. The website says that it is 10000 time a second: http://arduino.cc/en/Reference/AnalogRead (oh and you are right about 20%)
I thought the problem at this speed was sending data to computer via serial.
So my question is what is the fastest method to send 5 data to the computer? to make matters worse, to capture two of these data I have to do serial comm with the two temp sensor breakout boards.
What is the solution for super fast serial communication?
The temp sensors that I am using are these: Thermocouple Amplifier MAX31855 breakout board (MAX6675 upgrade) : ID 269 : $14.95 : Adafruit Industries, Unique & fun DIY electronics and kits
Out of the two temp sensors, one of them is measuring the temp on an electronic component that can have a temp change of 25 to 100 degrees C in 100 milliseconds. So quite fast. And I need to read these two sensors (in addition to two analog sensors and one digital) every milliseconds and send the values via serial to computer for data logging and analysis.
On the PC the data are being graphed in real time using SimPlot (also the data are being stored as text files).
FardinB:
So my question is what is the fastest method to send 5 data to the computer? to make matters worse, to capture two of these data I have to do serial comm with the two temp sensor breakout boards.
You haven't mentioned the break-out boards until now. How are they connected? What serial settings and protocol do they use? Can they actually provide samples at a sustained 1KHz?
To send the results to the PC you will need to whack the serial port speed up, use a concise message format, and hope for the best. I don't know whether you'll be able to achieve 1 KHz sample rates, but perhaps you will manage it.
This is a example code for how the temp sensor breakout board is connected and run: https://github.com/adafruit/MAX6675-library/blob/master/examples/serialthermocouple/serialthermocouple.pde
As you can see in this example the delay at the end is 1 second. I can change that to what ever I want. So no problem there (only the serial comm speed between the breakout boards worries me).
The highest speed for serial comm to PC is 115200bps. I am not sure if that is enough for this application.
Any thoughts on this?