Turbidity Measurement Demo (with EVAL-CN0409-ARDZ)
The EVAL-CN0409-ARDZ shield is a low to high level water turbidity measurement system in combination with the EVAL-ADICUP360. It uses the ADPD105's ambient light rejection feature to make it ideal for applications where accurate, robust and non-contact turbidity measurements are critical.
Setting up the hardware
To program the base board, set the jumpers/switches as shown in the next figure. The important jumpers/switches are highlighted in red.
Connect the EVAL-CN0409-ARDZ to the Arduino connectors P2, P5, P6, P7, P8 of the EVAL-ADICUP360 board.
Plug in the USB
cable from the PC to the EVAL-ADICUP360 base board via the Debug USB
When the project is being run for the first time a calibration procedure is required in order to achieve high accuracy results. The user must follow the steps described in the UART terminal when the application is started.
The user has the option to modify the solutions that are used for calibrating the device.
Any values can be used for the points that are used for calibration, but a proper distribution along the 0 - 1000 NTU range must be taken into account.
These values can be edited in CN0409.h file inside the include folder within the project structure.
After the calibration sequence is done at least once, the calibration coefficients are saved in the controller flash memory and will be used the next time when a calibration is not done. The calibration can be repeated as desired. If the program is run for the first time and a calibration routine is not done, the program will prompt the user to manually input calibration coefficients.
The following is a list of items needed in order to replicate this demo.
EVAL-CN0409-ARDZ Evaluation Board
PC or Laptop with a USB
Turbidity Calibration Solutions (0.02FTU,100FTU and 800FTU)
Turbidity Solutions (10FTU,15FTU,10FTU,100FTU and 1000FTU)
CrossCore Embedded Studio (2.7.0 or higher)
ADuCM36x DFP (1.0.2 or higher)
CMSIS ARM Pack (4.3.0 or higher)
Serial Terminal Program
Setting up the hardware
Test Setup Functional Block Diagram
Test Vial Considerations
To obtain a most accurate results when taking measurements, process below should take into considerations:
Test vials must be meticulously cleaned. Cleaning involves washing the vials with soap and deionized water, soaking the sample vial in Hydrochloric Acid solution, rinsing with ultra-filtered deionized water, and polishing with silicone oil.
Test vials must also be indexed. After the cleaning process, the vial is used to measure a very low turbidity solution. The position with the lowest measured turbidity should be indexed and this position should be used for succeeding measurements.
Remove bubbles in the solution. This can be done by letting the solution stand for several minutes to allow the bubbles to vacate.
If possible, use one properly indexed test vial.
It is recommended to use LaMotte Test Vial
as the size fits into the on board vial holder
Serial Terminal Setup
A serial terminal is an application that runs on a PC or laptop that is used to display data and interact with a connected device (including many of the Circuits from the Lab reference designs). The device's UART peripheral is most often connected to a UART to USB interface IC, which appears as a traditional COM port on the host PC/ laptop. (Traditionally, the device's UART port would have been connected to an RS-232 line driver / receiver and connected to the PC via a 9-pin or 25-pin serial port.)
There are many open-source applications, and while there are many choices, typically we use one of the following:
Before continuing, please make sure you download and install one of the above programs.
There are several parameters on all serial terminal programs that must be setup properly in order for the PC and the connected device to communicate. Below are the common settings that must match on both the PC side and the connected UART device.
- This is the physical connection made to your PC or Laptop, typically made through a USB
cable but can be any serial communications cable. You can determine the COM port assigned to your device by visiting the device manager on your computer. Another method for identifying which COM port is associated with a USB
-based device is to look at which COM ports are present before plugging in your device, then plug in your device, and look for a new COM port.
Baud Rate - This is the speed at which data is being transferred from the connected device to your PC. These parameters must be the same on both devices or data will be corrupted.
- The number of data bits per transfer. Typically UART
codes back to the serial port so by default this is almost always set to 8-Bits.
Stop Bits - The number of “stop” conditions per transmission. This usually set to 1, but can be set to 2 for redundancy.
- Is a way to check for errors during the UART
transmission. Unless otherwise specified, set parity to “none”.
- Is a way to ensure that data lose between fast and slow devices on the same UART
bus are not lost during transmission. This is typically not implemented in a simple system, and unless otherwise specified, set to “none”.
In many instances there are other options that each of the different serial terminal applications provide, such as local line echo or local line editing, and features like this can be turned on or off depending on your preferences. This setup guide will not go over all the options of each tool, but just the minor features that will make it easier to read back data from the connected devices.
Example setup using Putty
Plug in your connected device using a USB
cable or other serial cable.
Wait for the device driver of the connected device to install on your PC or Laptop.
Open your device manager, and find out which COM port was assigned to your device.
Open up your serial terminal program (Putty for this example)
Click on the serial configuration tab or window, and input the settings to match the requirements of your connected device.
Ensure that local echo and line editing are enabled, so that you can see what you type and are able to correct mistakes. (Some devices may echo typed characters - if so, you will see each typed character twice. If this happens, turn off local echo.)
Click on the open button, and as long as your connected device and serial terminal program are setup the same, than you should see data displaying.
Fill a clean test vial up to 10mL of the solution under test
Allow sufficient time for bubbles to escape before placing the cap
Wipe the test vial with a lint free cloth before inserting into the on board test vial holder to make sure it is free from fingerprints.
Open putty software and hit reset button on EVAL-ADICUP360. Follow on screen prompt for the calibration as shown below.
For first time use, it is required to perform calibration by typing y key. For the succeeding measurements, just hit n key to skip calibration
3-point calibration will perform using 0.02FTU,100 FTU and 800 FTU. Wait for the onscreen prompt before placing each solution.
After calibration, place the solution required to measure turbidity as prompted on the screen.
For more details on the software, visit CN0409 Software User Guide.
Make sure you are holding on the test vial cap when placing on the holder
Obtaining the source code
We recommend not opening the project directly, but rather import it into CCES and make a local copy in your workspace.
The source code and include files of the ADuCM360_demo_cn0409 can be found on Github:
For more information on importing, debugging, or other tools related questions, please see the tools user guide.
Serial Terminal Output
In order to view the data, you must flash the program to the EVAL-ADICUP360.
Once complete you will need to switch the USB
cable from the DEBUG USB
(P14) to the USER USB
Then follow the UART
settings below with the serial terminal program.
Following is the UART configuration.
Select COM Port
Baud rate: 9600
Data: 8 bit
Start: 1 bit
Stop: 2 bit
Flow Control: none
The official tool we promote for use with the EVAL-ADICUP360 is CrossCore Embedded Studio. For more information on downloading the tools and a quick start guide on how to use the tool basics, please check out the Tools Overview page.
For more detailed instructions on importing this application/demo example into the CrossCore Embedded Studios tools, please view our How to configure the debug session section.
The ADuCM360_demo_cn0409 is a C++ project that uses ADuCM36x C/C++ Project structure.
This project contains: system initialization part, setting system clock, enabling clock for peripherals; i2c interface, UART via P0.6/P0.7; UART read/write functions; Memory read/write functions; turbidity calculations;
In the src and include folders you will find the source and header files related to CN0409 software application. The Communication.cpp/h files contain UART and I2C specific data, meanwhile the CN0409.cpp/h files contain the calculation part and Flash.cpp/h provide memory management. .
End of Document