Repeat the previous step for all videos and name as follow: Dark1.jpg and Dark1.jpg. 3 ... (http://www.bioconductor.org/packages/2.12/bioc/html/EBImage.html).
1 1 2 3 4 5
A Low-Cost Method for Quantifying Sodium in Coconut Water and Seawater for the Undergraduate Analytical Chemistry Laboratory: Flame Test, a Mobile Phone Camera and Image Processing Supporting information
6 7 8 9 10
Detailed experimental procedures Overview
11 12
This practice lecture was developed to evidence the relationship between the intensity of
13
a spontaneous emission of radiation and the atom concentration. Consequently, the
14
experiment is intended for a second-year undergraduate classes. The intensity of sodium
15
atomic emission is given by Equation 1:
16 17
(1)
18 19
Where
20
transition,
21
sample of making a radiative transition between the discrete states 3s-3p and
22
average number of sodium atoms on the level 3p.
23
In this context, the intensity of sodium atomic emission is proportional to sodium
24
concentration in the sample. The intensities of RGB channels will increase in the digital
25
images according increase the sodium concentration. As a result, RGB responses could
26
be directly related to sodium concentration in our experiments. It is possible to explore
27
image processing aspects, and additionally, to introduce R statistics, a powerful statistic
28
platform of freely accessible that has a huge range of functionalities in different areas.
29 30 31 32 33
is PlanckĀ“s constant,
is the frequency of photon emission from 3p-3s
is the average probability per unit time for one sodium atom in our is the
2 1 2 3
Flame Test
4
diluting 163 mg of sodium chloride in a 100 mL volumetric flask;
5
Prepare working solutions from the stock solution by dilutions, namely: 20, 40, 80, 120,
6
and 160 mg dm-3 of sodium;
7
Complete the perfume bottles with the working solutions;
8
Discover which student has the mobile phone equipped with the highest resolution
9
camera;
Prepare a sodium chloride stock solution in distilled water at 640 mg dm-3 of sodium,
10
Arrange the experiment as shown in Figure 1. The distance between the flame and the
11
mobile phone must be fixed (~ 40 cm)For this, the test needs two people to perform: one
12
to spray the sample and one to acquire the image;
13
Start spraying distilled water into the flame. Record a video (Blank) of the experiment
14
using a mobile phone. Apply this procedure in duplicate;
15
Repeat the previous step using the working solutions;
16
For seawater, transfer 1 mL of the sample to a 100 mL volumetric flask. Complete with
17
distilled water and homogenize;
18
For coconut water, complete the perfume bottle with pure coconut water;
19
Spray the sample into the Bunsen burner. Record a video (Sample) of the experiment
20
using a mobile phone. Apply this procedure in triplicate.
21 22 23 24
Data Treatment
25
intense light. Reproduce each video using the program of your preference;
26
Advance the video frame-by-frame to find which frame exhibited the most intense light.
27
To accomplish this task, each student could use a program of his or her preference. Our
28
group used Windows Live Move Maker (Microsoft Corporation). Once the specific frame
29
was identified, stop the video and use the print screen to copy and paste the frame into
30
freely accessible GIMP 2.8.6 (GNU) software;
31
Download of GIMP 2 software (www.gimp.org). Install the software;
32
Go to GIMP 2, create a new image and paste the captured image in the print screen;
The resulting video files must be studied to determine which frame exhibited the most
3 1
Cut a square spot (10 x 10 pixels) of the region of the flame that exhibited the most
2
intense light and saved in JPEG format.
3
Repeat the previous step for all videos and name as follow: Dark1.jpg and Dark1.jpg
4
(only the flame), Blank1.jpg and Blank2.jpg (water), Na20mg1.jpg, Na20mg2.jpg,
5
Na40mg1.jpg,
6
Na160mg1.jpg, Na160mg2.jpg, Sample1.jpg, Sample2.jpg and Sample3.jpg;
7
Choose the folder location and save the files to your local system.
8
Download R (www.r-project.org). Install and open;
9
Change the directory for the folder location where the images were recorded;
Na40mg2.jpg,
Na80mg1.jpg,
Na80mg2.jpg,
Na120mg1.jpg,
10
Open Flame Image Processing Script attached on the Support Information;
11
Press Ctrl+R.
12
Next, a script based on the EBImage package (bioconductor.org) was formulated to treat
13
the images. EBImage1 is an R package (R Foundation for Statistical Computing) that is
14
normally used for bioinformatics. First, the background was subtracted using the dark
15
filter, resulting in only the flame image. Second, the RGB channels of the digital image
16
were extracted, and the average values of each channel were calculated. Next, a vector
17
norm ||v||2,3 was determined based on RGB:
18 19
(2)
20 21
where
22
differences between the RGB channels from the sample digital images and the RGB
23
channels from the blank (distilled water). The script generates the calibration curve, a
24
statistics analysis and the sodium concentration. The limit of quantification (LOQ) and
25
limit of detection (LOD) were calculated according to Da Silva and co-workers2,3.
26 27 28 29 30
,
and
are the normalized average values obtained from the
4
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Figure 1. Flame test experimental arrangement.
5 1
#################### Flame Image Processing Script ####################
2 3 4
# To install the EBImage package:
5 6
source("http://bioconductor.org/biocLite.R")
7
biocLite("EBImage")
8 9 10
# To cite this package in a publication (http://www.bioconductor.org/packages/2.12/bioc/html/EBImage.html)
11 12
citation("EBImage")
13 14
# Loading the EBImage package
15 16
library("EBImage")
17 18
# Reading dark and mean
19 20
dark1 = readImage('Dark1.jpg')
21
dark2 = readImage('Dark2.jpg')
22
dark = (dark1 + dark2)/2
23
if (interactive()) display(dark)
24 25
# Reading blank and mean
26 27
blank1 = readImage('Blank1.jpg')
28
blank2 = readImage('Blank2.jpg')
29
blankm = (blank1 + blank2)/2
30
blank = blankm - dark
31
if (interactive()) display(blank)
6 1 2
# Reading 20 mg and mean
3 4
Na20mg1 = readImage('Na20mg1.jpg')
5
Na20mg2 = readImage('Na20mg2.jpg')
6
Na20mgm = (Na20mg1 + Na20mg2)/2
7
Na20mgn = Na20mgm - dark
8
if (interactive()) display(Na20mgn)
9 10
# Reading 40 mg and mean
11 12
Na40mg1 = readImage('Na40mg1.jpg')
13
Na40mg2 = readImage('Na40mg2.jpg')
14
Na40mgm = (Na40mg1 + Na40mg2)/2
15
Na40mgn = Na40mgm - dark
16
if (interactive()) display(Na40mgn)
17 18
# Reading 80 mg and mean
19 20
Na80mg1 = readImage('Na80mg1.jpg')
21
Na80mg2 = readImage('Na80mg2.jpg')
22
Na80mgm = (Na80mg1 + Na80mg2)/2
23
Na80mgn = Na80mgm - dark
24
if (interactive()) display(Na80mgn)
25 26
# Reading 120 mg and mean
27 28
Na120mg1 = readImage('Na120mg1.jpg')
29
Na120mg2 = readImage('Na120mg2.jpg')
30
Na120mgm = (Na120mg1 + Na120mg2)/2
31
Na120mgn = Na120mgm - dark
7 1
if (interactive()) display(Na120mgn)
2 3
# Reading 160 mg and mean
4 5
Na160mg1 = readImage('Na160mg1.jpg')
6
Na160mg2 = readImage('Na160mg2.jpg')
7
Na160mgm = (Na160mg1 + Na160mg2)/2
8
Na160mgn = Na160mgm - dark
9
if (interactive()) display(Na160mgn)
10 11
# RGB Image
12 13
Na20red = channel(Na20mgn, 'red')
14
Na20redm = mean (Na20red)*255
15
Na20redm
16
Na20green = channel(Na20mgn, 'green')
17
Na20greenm = mean (Na20green)*255
18
Na20greenm
19
Na20blue = channel(Na20mgn, 'blue')
20
Na20bluem = mean (Na20blue)*255
21
Na20bluem
22 23 24
Na40red = channel(Na40mgn, 'red')
25
Na40redm = mean (Na40red)*255
26
Na40redm
27
Na40green = channel(Na40mgn, 'green')
28
Na40greenm = mean (Na40green)*255
29
Na40greenm
30
Na40blue = channel(Na40mgn, 'blue')
31
Na40bluem = mean (Na40blue)*255
8 1
Na40bluem
2 3
Na80red = channel(Na80mgn, 'red')
4
Na80redm = mean (Na80red)*255
5
Na80redm
6
Na80green = channel(Na80mgn, 'green')
7
Na80greenm = mean (Na80green)*255
8
Na80greenm
9
Na80blue = channel(Na80mgn, 'blue')
10
Na80bluem = mean (Na80blue)*255
11
Na80bluem
12 13
Na120red = channel(Na120mgn, 'red')
14
Na120redm = mean (Na120red)*255
15
Na120redm
16
Na120green = channel(Na120mgn, 'green')
17
Na120greenm = mean (Na120green)*255
18
Na120greenm
19
Na120blue = channel(Na120mgn, 'blue')
20
Na120bluem = mean (Na120blue)*255
21
Na120bluem
22 23
Na160red = channel(Na160mgn, 'red')
24
Na160redm = mean (Na160red)*255
25
Na160redm
26
Na160green = channel(Na160mgn, 'green')
27
Na160greenm = mean (Na160green)*255
28
Na160greenm
29
Na160blue = channel(Na160mgn, 'blue')
30
Na160bluem = mean (Na160blue)*255
31
Na160bluem
9 1 2
# RGB blank
3 4 5
RGBblank1 = blank1 - dark
6
blankred1 = channel(RGBblank1, 'red')
7
blankred1m = mean (blankred1)*255
8
blankred1m
9
blankgreen1 = channel(RGBblank1, 'green')
10
blankgreen1m = mean (blankgreen1)*255
11
blankgreen1m
12
blankblue1 = channel(RGBblank1, 'blue')
13
blankblue1m = mean (blankblue1)*255
14
blankblue1m
15 16
RGBblank2 = blank2 - dark
17
blankred2 = channel(RGBblank2, 'red')
18
blankred2m = mean (blankred2)*255
19
blankred2m
20
blankgreen2 = channel(RGBblank2, 'green')
21
blankgreen2m = mean (blankgreen2)*255
22
blankgreen2m
23
blankblue2 = channel(RGBblank2, 'blue')
24
blankblue2m = mean (blankblue2)*255
25
blankblue2m
26 27
blankredm = (blankred1m + blankred2m)/2
28
blankredm
29
blankgreenm = (blankgreen1m + blankgreen2m)/2
30
blankgreenm
31
blankbluem = (blankblue1m + blankblue2m)/2
10 1
blankbluem
2 3 4
# ||v|| = Sqrt(R^2+G^2+B^2)
5 6
Na20mg = sqrt((Na20redm-blankredm)^2+(Na20greenm-blankgreenm)^2+(Na20bluem-
7
blankbluem)^2)
8
Na20mg
9 10
Na40mg = sqrt((Na40redm-blankredm)^2+(Na40greenm-blankgreenm)^2+(Na40bluem-
11
blankbluem)^2)
12
Na40mg
13 14
Na80mg = sqrt((Na80redm-blankredm)^2+(Na80greenm-blankgreenm)^2+(Na80bluem-
15
blankbluem)^2)
16
Na80mg
17 18
Na120mg = sqrt((Na120redm-blankredm)^2+(Na120greenm-
19
blankgreenm)^2+(Na120bluem-blankbluem)^2)
20
Na120mg
21 22
Na160mg = sqrt((Na160redm-blankredm)^2+(Na160greenm-
23
blankgreenm)^2+(Na160bluem-blankbluem)^2)
24
Na160mg
25 26
# ||v|| Blank
27 28
Vblank = sqrt(blankredm^2+blankgreenm^2+blankbluem^2)
29
Vblank
30 31
# Analytical curve and residuals
11 1 2
# Concentration of sodium (mmol L-1)
3
a=c(20,40,80,120,160)
4 5
# Intensities
6
b=c(Na20mg,Na40mg,Na80mg,Na120mg,Na160mg)
7 8
# Graph
9 10
y