H
high frecuency real time chart using winforms
Guest
i'm making a project where i'm trying to get an EEG monitor, with the data comming from the arduino, EEG measures frecuencys from 10-30 Hz, wich means i would need to measure at least 60 samples per second (60 Hz) to get a valid representation of the signal...
the code i'm using right now is this one:
private void serialDataReceivedEventHandler(object sender, SerialDataReceivedEventArgs e)
{
try // en caso de que ya este proceso haya iniciado y se precione el boton de cerrar el puerto, produce un error
{
SerialPort sData = sender as SerialPort;
string recvData = sData.ReadLine();
//LOG.BeginInvoke((MethodInvoker)delegate { LOG.AppendText("Received: " + recvData); });
// initialization of chart update
double data;
bool result = Double.TryParse(recvData, out data);
if (result)
{
medicion m = new medicion(recvData, tag, data);
if (tag == null)
{
m = new medicion(recvData, " ", data);
}
else
{
m = new medicion(recvData, tag, data);
tag = null;
}
//datarecorded.Add(recvData);
this.Invoke((MethodInvoker)delegate { updatechart(m); });
}
}
catch
{
//MessageBox.Show("failed");//do nothing ... test msg
}
}
this trigers whenever the serial port gets a msg, now the program is working too slow, so the chart falls behind with the real time data, it represents the graph good, but too slow.
could anyone has a clue how could i make the graph update at a faster rate?
the ideal scenario would be to keep using the chart since i need the graph to be "infinite" and scrollable.
thanks in advance.
Continue reading...
the code i'm using right now is this one:
private void serialDataReceivedEventHandler(object sender, SerialDataReceivedEventArgs e)
{
try // en caso de que ya este proceso haya iniciado y se precione el boton de cerrar el puerto, produce un error
{
SerialPort sData = sender as SerialPort;
string recvData = sData.ReadLine();
//LOG.BeginInvoke((MethodInvoker)delegate { LOG.AppendText("Received: " + recvData); });
// initialization of chart update
double data;
bool result = Double.TryParse(recvData, out data);
if (result)
{
medicion m = new medicion(recvData, tag, data);
if (tag == null)
{
m = new medicion(recvData, " ", data);
}
else
{
m = new medicion(recvData, tag, data);
tag = null;
}
//datarecorded.Add(recvData);
this.Invoke((MethodInvoker)delegate { updatechart(m); });
}
}
catch
{
//MessageBox.Show("failed");//do nothing ... test msg
}
}
this trigers whenever the serial port gets a msg, now the program is working too slow, so the chart falls behind with the real time data, it represents the graph good, but too slow.
could anyone has a clue how could i make the graph update at a faster rate?
the ideal scenario would be to keep using the chart since i need the graph to be "infinite" and scrollable.
thanks in advance.
Continue reading...