Dienstag, 19. November 2013

Energy Effiency and Powerpoint

The time has come to revise the work and have an eye on the power consumption also the apperance of the program was slightly changed.

Due to the face that the original program on the Arduino was sampling all the time the microcontoller consumed a lot of energy. It sucks 22mA in a normal operational status which is quiet heavy for the operation we are doing. In order to save energy the Arduino is now set to sleep when he is no needed. This reduced the current input to 14mA, a huge save!
When the "Take a sample" button is pressed in the C# GUI, the PC sends a byte via the serial connection to the Arduino which wakes him up. He then responds with a 100 samples of the A/D converter (Ethanol Sensor) and falls back to sleep immediately.
In addition the Overall appearance of the GUI was changed and i learned how to merge cells which increases the visibility of the chart.

A short Video shows the operational program below

It was also necessary to create a little slideshow for the lecture. It can be found below if interested.

Alcodino Presentation 20.11.2013


Worked: (21h) + 4h30m = 25h30m

Dienstag, 12. November 2013

Serial Connection + Chartfilling

Serial connection established and data shown with C# Chart control

The connection is now established and the Alcodino GUI is able to receive data from the Arduino. Therefore the data  is shown in a chart using C# Chart control.
The current solution is not more then a prototype showing the possiblies of the future program. Still a lot of nasty errors occured on the way there. For example when trying to use Serial commands in C# the message "Serial port is already open" occured and froze the PC. The modification was then to insert more Serial.Close commands which led to the problem of data corruption. It took some time until a nice and clean working serial environment was established.
The Data collection was then only time consuming but not challenging. Still there are some problems: while collecting the data the program is not controllable and the user has to wait until the sampletaking is finished.

Next steps are:
- Make it possible to abort the sampletaking
- Introduce the I2C Sensor
- Rework the C# GUI

Alcodino Prototype - Serial connection + Data in Chart
Worked: (16h) + 5h = 21h

Montag, 4. November 2013

C# Chart Control

Chart Control -- Problems


Using the C# Chart Control i stumbled across a lot of problems. For example i can`t divide between X and Y values the data will always be displayed at both the x Axis and the y Axis even though i used 3 different methods.

  
 

private void fillButton_Click(object sender, EventArgs e)
        {
            Random rnd1 = new Random();

            int[] xaxis1;
            int[] xaxis2;
            int[] xaxis3;
            xaxis1 = new int[10];
            xaxis2 = new int[10];
            xaxis3 = new int[15];

            for (int i = 0; i < 5; i++)

            {
                xaxis1[i] = i*2;
            }

            toprightChart.DataSource = xaxis1;
            toprightChart.Series[0].XValueMember = "Y";
            toprightChart.Series[0].YValueMembers = "X";
            toprightChart.ChartAreas["ChartArea1"].AxisX.Interval = 1;
            toprightChart.DataBind();

            for (int j = 0; j < 10; j++)
            {
                xaxis2[j] = rnd1.Next(0, 10);
            }

            bottomleftChart.DataSource = xaxis2;
            bottomleftChart.Series[0].XValueMember = "Y";
            bottomleftChart.Series[0].YValueMembers = "X";
            bottomleftChart.ChartAreas["ChartArea1"].AxisX.Interval = 1;
            bottomleftChart.DataBind();

            List<double> chartData = new List<double>();

            for (int k = 0; k < 5; k++)
            {
                chartData.Add(rnd1.Next(0, 10));
            }

            bottomrightChart.DataSource = chartData;
            bottomrightChart.Series[0].XValueMember = "Y";
            bottomrightChart.Series[0].YValueMembers = "X";
            bottomrightChart.ChartAreas["ChartArea1"].AxisX.Interval = 1;
            bottomrightChart.DataBind();
        }


After those problems are solved there should be a focus at real time charts and the serial connection to the Arduino.

Worked (13h) + 3h = 16h