C# Project

Industrial Datalogging and Monitoring System

×

Need Help?

Do you have questions when working with the project? Use Microsoft Teams (Note! You need to click on the link to the left to request access to the Teams room). A separate Teams room has been created for this project where you can use the chat/post. In Teams you will get the lates updates and information regarding the project. You can can ask questions, see previous questions and answers, get last minute tips and tricks, etc. It is also recommended that you use c139a on Mondays where you can work together, collaborate and help each other. There are several supervisors involved in this project. By using Microsoft Teams instead of sending E-mail, you will reach everyone and the person (which can be a supervisor or a student) that can answer the question best or fastest will respond.

1 Introduction

In this C# project you will use Industrial DAQ Systems and Sensors, you will use Database Systems, perform Datalogging, create modern Web Applications, and taking care of Cyber Security issues when it comes to modern industrial applications.

Introduction to C# Project (YouTube) + PowerPoint (PDF)

 

Microsoft Teams

Do you have questions working with the project? Use Microsoft Teams (Note! You need to click on the link to the left to request access to the Teams room). Here you can get help and guidance regarding the project. You can ask questions to the supervisors/instructors or ask questions to other students. You can also respond to questions from other students. You learn a lot from helping each other. If you help others, others may want to help you. Many students also typically have the same questions, so then the supervisor only needs to answer the question once, and you can easily see previous questions and answers in the chat/post in Teams.


Below you see an overview of the project:

The only way to learn Programming is to do a lot of coding by yourself, and not only small code snippets with a few lines of code. You need to make large Applications. It takes time and may be demanding, but thats the only way! The reward is knowledge that goes deep, and you will gain skills that are highly desired by the industry and work life.

 

Additional Resources

Write Technical Reports in Microsoft Word (YouTube) - Here you learn the basic structure of a Technical Report, how to insert Figure Captions and refer to those in the text, how to insert Equations and refer to those in the text, how to add References, etc.

Project Checklist (PDF) - Be sure to check the list before you start coding and be sure to check that you have done all the points before you deliver

Report Checklist (PDF) - Be sure to check all the points before you deliver

Report Template (MS Word) - This is just an examle, you may use another template or use your own personal template

Equations and Figures in Microsoft Word and PowerPoint (YouTube) - Word and PowerPoint have a great Editor for writing Equations, Formulas and other Mathematical Expressions. Make sure to use it when writing equations, etc. in your report. PowerPoint is a great tool for making different types of sketches and figures (dont use MS Paint). Typically, these sketches may include some Mathematical Expressions. So here you can use the Formula Editor in PowerPoint.

Citation and Referencing with Microsoft Word (YouTube)

C# Programming Project - YouTube Playlist (YouTube) - Here you find videos that can help you solve the different parts of the projects. Not all videos are relevant to your chosen project.

 

Typically, you should also include a System Sketch (here you see a video how to make a system sketch in PowerPoint in less than 5 minutes). A System sketch is an illustration/figure of your system, the different parts the system consists of, and how they relate to each other. PowerPoint is a great tool for making different types of sketches and figures in just a few minutes compared to more advanced tools.

 

2. Applications

In this project we will create 3 different C# Applications:

These Applications shall communicate with a SQL Server Database. The Data Logging Application should typically be an ordinary Desktop Application (Windows Forms App), while the Data Management Application and Data Monitoring Application should typically be created using ASP.NET Core (ASP.NET Core Web App).

 

Below you find some basic examples for these 3 applications. Note! the names refer to the functionality typically included in these applications. If you prefer and depending on your projects, you can use other names for the applications.

Data Logging Application

The Data Logging Application are responsible for collecting data from your devices and sensors. The Data Logging Application typically needs to be a Desktop Application because you need to connect som hardware (DAQ device, sensors, etc) on the client that communicates using serial communication, etc. See basic example below to get some ideas. You will also find more examples and resources in the other sections on this web page.

Examples:

WinForm Example (YouTube)

 

Data Management Application

The Data Management Application is used to add, edit or delete data in the database based on interactions with the user. The Data Management Application can be a Desktop Application or a Web Application. See basic examples below to get some ideas.

Windows Forms Examples:

WinForm Example (YouTube)

Creating a Windows Forms CRUD Application (YouTube)

ASP.NET Core Examples:

ASP.NET Core Example - Basic (YouTube)

ASP.NET Core Example - Intermediate (YouTube)

 

Data Monitoring Application

The Data Monitoring Application is used to view and monitor data from the devices and the sensors used. The Data Monitoring Application should preferably be a Web Application. See basic examples below to get some ideas.

Examples:

ASP.NET Core Example - Chart (YouTube)

ASP.NET Core Example - Table (YouTube)

 

3 Hardware

In this project you will need to use different hardware. What kind of hardware depends on the project you select.

You need to print out and fill out the Equipment List and give it to the supervisor before you can get the necessary hardware.


Below you see an overview of the hardware for the different systems:

 

Hardware List

Below you find a detailed list with additional information:

Hardware Information Supplier
System #1    
TC-01 Thermocouple Temperature Sensor. User Guide National Instruments
System #2    
USB-6008 DAQ Device from National Instruments. USB cable included. User Guide National Instruments
Screwdriver    
Breadboard   Elfa
Wires 10 wires in different colors Elfa
LED Green What is an LED? Elfa
LED Red   Elfa
TMP36 TMP36 Temperature Sensor Overview Elfa
Thermistor Thermistor Temperature Sensor Overview Elfa
Light Sensor Measures the light level inside a room (or outside) Elfa
Resistor 330 Ohm x 2

Resistor for the LEDs

What is a Resistor? +  Resistor Calculator

Efa
Resistor 10 kOhm Resistor for the Thermistor Elfa
Resistor 33 kOhm Resistor for the Light Sensor Elfa
System #3    
OBD Module OBD - On-board Diagnostics eStore
System #4    
USB RFID Reader

4a: Parallax USB RFID Reader 125KHz

or 4b: Desktop Reader NEO 2 HF 13.46Hz

or 4c: Eccel OEM-MICODE-USB RFID Reader 13.56MHz

USB cable included in all options

RS Online

Elfa

 

RFID Tags

RFID 125KHz Tags or RFID 13.56MHz ISO14443-A Tags

Tags of different shapes are included in the package.

 

You find more details and resources for the different systems below.

4 Visual Studio/C#

In the latest version of Visual Studio we can develop WinForms Desktop Applications for both .NET Framework (4.x) and .NET Core. .NET Core is cross-platform, but .NET Core WinForms will (of course) only work with Windows.

 

Resources:

Simulation and Control with C# and WinForms (YouTube) + PowerPoint (PDF) - This Tutorial goes through how to create a basic Windows Forms Application in Visual Studio/C#.

SQL Server with C# Windows Forms App (YouTube) + PowerPoint (PDF) - This Tutorial goes through how to create a basic Windows Forms Database Application in Visual Studio/C# that communicates with an SQL Server.

Visual Studio, C# and SQL Server - Creating a Windows Forms CRUD Application (YouTube) + PowerPoint (PDF) - This Tutorial goes through how to create a Windows Forms Application in Visual Studio with CRUD functionality. It will communicate with an SQL Server Database. It will Insert, Retrieve, Update and Delete Data using an SQL Server Database.

 

Additional Resources:

C# Tutorial (w3schools.com) (Website)

 

5 DAQ

DAQ (Data Acquisition) is typically needed in all types of applications, which is about getting data from the sensors. Data Acquisition (DAQ) is the process of collection data from different sensors into a computer. A DAQ System consists of 4 parts: Physical input/output signals, sensors DAQ device/hardware Driver software Your software application (Application software).

Visual Studio/C# and DAQ Tutorial

 

Below you find an overview and resources for the different DAQ systems that you can select between in this project.

DAQ systems:

  •   TC-01
  •   USB-6008
  •   OBD
  •   RFID
  •  

    5.1 TC-01 (System #1)

    TC-01 from National Instruments can be used to read the Temperature from the surroundings. It uses the Thermocouple principle.

    To use the TC-01 DAQ device from National Instruments, you need to install the NI-DAQmx driver.

    Firmware: If you get error using TC-01, you may need to upgrade the Firmware

    Here you find information about the TC-01 specifications. Here you find the TC-01 User Guide.

     

    Visual Studio/C# DAQ Resources:

    DAQ in Visual Studio using TC-01 and DAQmx (YouTube) + PowerPoint (PDF)

    Note! The NI-DAQmx driver do not support the newer .NET Core or .NET 5/6, only NET Framework 4.x. Make sure to select "NI-DAQmx Support for .NET Framework 4.x" and "NI-DAQmx Support for Visual Studio 20xx" during the installation of DAQmx. When creating a new project in Visual Studio, make sure to select the template called "Windows Forms App (.NET Framework)".

     

    5.2 USB-6008 (System #2)

    USB-6008 from National Instruments can be used to acquire data from different types of Sensors You can, e.g., make a Home Automation System where you have placed one or more such DAQ devices in different rooms in your home and you have different sensors attached to these DAQ devices USB-6008 has Analog and Digital Input and Output Channels.

    To use USB-6008 from National Instruments, you need to install the NI-DAQmx driver.

    Make sure to read the User Guide and Specifications for USB-6008 and USB-6008 Pinout.

     

    Visual Studio/C# DAQ Resources:

    USB-6008 in Visual Studio and C# (YouTube) + PowerPoint (PDF)

    Visual Studio/C# and DAQ Tutorial

    Note! The NI-DAQmx driver do not support the newer .NET Core or .NET 5/6, only NET Framework 4.x. Make sure to select "NI-DAQmx Support for .NET Framework 4.x" and "NI-DAQmx Support for Visual Studio 20xx" during the installation of DAQmx. When creating a new project in Visual Studio, make sure to select the template called "Windows Forms App (.NET Framework)".

     

    Sensors:

    TMP36 Temperature Sensor (YouTube) + PowerPoint (PDF)

    Thermistor Temperature Sensor (YouTube) + PowerPoint (PDF)

    Light Sensor (YouTube) + PowerPoint (PDF)

    LEDs (YouTube) + PowerPoint (PDF)

     

    5.3 OBD (System #3)

    On-board diagnostics (OBD) is an automotive term referring to a vehicle's self-diagnostic and reporting capability. OBD systems give the vehicle owner or repair technician access to the status of the various vehicle sub-systems. OBD implementations use a standardized digital communications port to provide real-time data. A standardized series of diagnostic trouble codes, or DTCs, are also provided. OBD-II is the latest standard used today. An OBDII Interface ELM327 with USB will be used in this project. Read more (Wikipedia).

    OBD Resources:

    Getting Started with OBD-II (Website, Sparkfun)

    USB OBDII Car Dignostic Scanner - User Guide (PDF)

    www.elm327.com (Website) - Here you find lots of OBD resources, including the necessary Hardware Driver (PL2303 USB OBDII Driver).

    The software ScanMaster-ELM is also recommended, which is an OBD-2/EOBD diagnostic scan tool for vehicle diagnostics under OBD-II/EOBD standards that were developed specifically for the ELM327.

     

    Data Communication Resources:

    Introduction to Data Communication with C# Programming (Textbook NOS, PDF)

    C# Programming Data Communication (PowerPoint NOS, PDF)

    OBD Example Data File (NOS, CSV) - Can be used to get OBD Test data into your system when developing and testing your system.

     

    5.4. RFID (System #4)

    RFID uses radio waves produced by a reader to detect the presence of (then read the data stored on) an RFID tag. Tags are embedded in small items like cards, etc. Typical applications are access control, item tracking, etc.

    Resources:

    RFID Basics (Website, Sparkfun)

    RFID (YouTube) + PowerPoint (PDF) - General overview of RFID with some examples

    Bachelor Project (PDF) + Final Report (PDF) - "Implementering av automatisk utlånssystem for verktøylager". Use it for inspiration when development of your own project.

     

    You can choose between 3 different RFID systems, see details below.

     

    5a. Parallax 28340 RFID USB Reader System (125KHz)

    Below you see the Parallax 28340 RFID USB Reader System. The system consists of a USB RFID reader with a built-in antenna, A USB-A to Mini-B cable and different RFID Tags.

    Parallax 28340 RFID USB Reader System (125KHz) (YouTube) + PowerPoint (PDF)

     

    Resources:

    Parallax 28340 RFID USB Reader (Website, Parallax) - Make sure to read the Datasheet, etc.

    Parallax FTDI USB Drivers for Windows (Website, Parallax) - Make sure to install the driver BEFORE you plug in your Hardware!

     

    5b. Desktop Reader NEO 2 HF RFID Reader (13.56MHz)

    Below you see the Desktop Reader NEO 2 HF RFID Reader System. The system consists of a USB RFID reader with a built-in antenna inside a case bith built-in, USB A cable. Different RFID Tags are included.

    Note! You can use your Student Card as an extra RFID Tag for this system.

    Note!! The RFID reader is normally ready to use from the factory in so-called HID Mode (which is recommended!!) So, you normally don’t need to do any configurations!!

    Getting Started: The only thing you need to do is connect the RFID reader to the PC using the USB cable. For testing, you can open MS Word. Then place an RFID tag on the reader, and the tagid will automatically be scanned and be displayed in MS Word. The same is done in Visual Studio and C#. Create a new application, insert a Textbox, start the application. The tagid will then be automatically put into the Textbox. You are now ready to start creating your application.

     

    Visual Studio/C# Examples:

    RFID Reader with Windows Forms Examples (YouTube) + PowerPoint (PDF)

     

    Typically, you need to create a Desktop Application (and not a Web Application) in order to communicate with such a device. But since this device (Desktop Reader NEO 2) does not need any C# code (which is executed server-side in a web application) to work, you can also use it in ASP.NET Core, since it only needs an active TextBox to work.

    ASP.NET Core RFID Web Application (YouTube) + PowerPoint (PDF)

     

    Additional Resources:

    Desktop Reader NEO 2 HF RFID Reader (13.56MHz) (YouTube) + PowerPoint (PDF)

    Desktop Reader NEO 2 HF 13.56Hz (Website, iDTRONIC) - Make sure to read the Datasheet, etc.

     

    5c. Eccel OEM-MICODE-USB RFID Reader System (13.56MHz)

    Below you see the Eccel OEM-MICODE-USB RFID Reader System. The system consists of a USB RFID reader with a built-in antenna, a case, USB A-B cable and different RFID Tags.

    Note! You can use your Student Card as an extra RFID Tag for this system.

    Eccel OEM-MICODE-USB RFID Reader (13.56MHz) (YouTube) + PowerPoint (PDF)

     

    Resources:

    Eccel OEM-MICODE-USB RFID Reader (Website, Eccel) - Make sure to read the Datasheet, etc.

    MicroRWD MICODE Module (Website, Eccel) - Here you find Datasheet, Configuration Tool, etc.

    The "MicroRWD MICODE" module is the main components used in the "Eccel OEM-MICODE-USB RFID Reader" system.

     

    6 SQL Server

    A Database is a structured way to store lots of information. The information is stored in different tables.

     

    Resources:

    Introduction to Database Systems (YouTube) + PowerPoint (PDF)

    Database Design and Modeling with erwin Data Modeler (YouTube) + PowerPoint (PDF)

     

    SQL Server Express Installation (YouTube)

    Introduction to SQL Server (YouTube) + PowerPoint (PDF)

    Database Views and Stored Procedures (YouTube) + PowerPoint (PDF)

     

    SQL Server with C# Windows Forms App (YouTube) + PowerPoint (PDF) - This Tutorial goes through how to create a basic Windows Forms Database Application in Visual Studio/C# that communicates with an SQL Server.

    Datalogging using SQL Server with C# (YouTube) + PowerPoint (PDF) - This Tutorial goes through how to create a basic Datalogging Windows Forms Application in Visual Studio/C# that Save Data inside a SQL Server Database.

     

    Datalogging and Monitoring (YouTube) - This Tutorial gives an example of a basic Datalogging and Monitoring System.

     

    Additional Resources:

    SQL Tutorial (w3schools.com)

     

    7 Web Programming

    To create a typical web page you need to combine 3 languages:

    Use HTML to define the content of web pages, CSS is used to specify the layout of web pages, while JavaScript is used to program the behavior of web pages. For creating more dynamic web pages, we typically also use a web framework like PHP or ASP.NET, etc. With these frameworks you can communicate with a database for storing or retrieving data.

    Below we se the triangle used in most web pages, namely HTML, CSS and JavaScript.

    Resources:

    Web Programming Overview (YouTube) + PowerPoint (PDF)

    Create Web Pages with HTML and CSS (YouTube) + PowerPoint (PDF)

     

    Additional Resources:

    HTML Tutorial (w3schools.com)

     

    8 ASP.NET Core

    ASP.NET is an open source web framework, created by Microsoft, for building web apps and services using the .NET Framework or the .NET Core. We have both ASP.NET and ASP.NET Core. ASP.NET Core is the new approach built on .NET Core.

    Web Programming ASP.NET Core (Textbook, PDF)

     

    Resources

    Introduction:

    ASP.NET Core - Hello World Application (YouTube)

    ASP.NET Core - Introduction (YouTube) + PowerPoint (PDF)

     

    Database Communication in ASP.NET Core:

    ASP.NET Core - Get Data from Database (YouTube) + PowerPoint (PDF) - Here you learn the basics when it comes to how to get/retrieve data from a SQL Server database.

    ASP.NET Core - Database Communication (YouTube) + PowerPoint (PDF) - Here you learn how to get/retrieve data from a SQL Server and present the data in a table in a webpage. You also learn how we can put the Connection String into the cinfiguration file appSettings.json.

    ASP.NET Core - CRUD Application (YouTube) + PowerPoint (PDF) - Here you will learn to create a "Data Management" Application that Creates/inserts, Reads, Updates and Deletes (CRUD) data from the database.

     

    Monitor and View your Data with Charts:

    ASP.NET Core - Charts (YouTube) + PowerPoint (PDF). In this tutorial Google Charts will be used. Google Charts is an API (or framework) for creating Charts in your web pages. It is free to use and it is easy to use (when you first know how to use it). Note! If the data contains decimals, you may get some trouble if your computer has “,” as a decimal symbol. An easy solution is to change the Decimal symbol to “.” in Windows. In Windows, goto the "Control Panel", then "Clock and Region". Select "Additional settings..." and then set the Decimal symbol to ".". A better solution may be to do some formatting in your code.

     

    Share Code between different Visual Studio Projects:

    ASP.NET Core - Class Library (YouTube) + PowerPoint (PDF)

     

    See here for more ASP.NET Core resources.

     

    9 Cyber Security

    How can we make sure our applications and data are safe? Security is crucial in modern Applications.

    Typically you need to create Login functionality to make the application more secure. In addition you should make sure your data in the database is secure. SQL injection is a code injection technique that might destroy your database or expose information, such as passwords, etc. SQL injection is one of the most common web hacking techniques.

     

    Cyber Security Overview (PDF)

    Cyber Security (Textbook) (PDF)

     

    Resources:

    User Identity and Login (PDF)

    SQL Injection (YouTube) + PowerPoint (PDF)

     

    Here you find additional Cyber Security resources.