Measurement Science Lab: Introduction
Contents
Lab Overview
This lab is designed as a problem solving exercise and will run for 4 weeks from 18/01/2014 to 06/02/2014. The lab will be open every weekday from except Wednesday from 2:00pm – 5:30pm and you can spend as much or as little time in the lab as you like. There is only one experiment in this lab that is to build and test a spectrometer based on the information held in this lab manual.
People Involved in the Lab
| Course Co-ordinator: | Dr. Joshua Edel | joshua.edel@imperial.ac.uk | ||
| Dr. Kristelle Bougot-Robin | k.bougot-robin@imperial.ac.uk | |||
| Demonstrators: | Silvia Di-Lecce | silvia.di-lecce12@imperial.ac.uk | ||
| Raquel Fraccari | r.fraccari12@imperial.ac.uk | |||
| Markéta Kubánková | m.kubankova13@imperial.ac.uk | |||
| Ali Magness | alastair.magness12@imperial.ac.uk | |||
| Hugh Sowley | hugh.sowley12@imperial.ac.uk | |||
| Technicians: | Simon Bastians | s.bastians@imperial.ac.uk | ||
| DeeJay Kristnah | d.kristnah@imperial.ac.uk | |||
| Simon Turner | s.t.turner@imperial.ac.uk |
Course Materials
As well as this Wiki there is a lab manual. Please supplement the information that is provided in the manual and this wiki with your own research.
Safety
This lab course is designed to be one that you enjoy however safety is still paramount, please follow these simple rules to keep yourself and others safe.
- YOU MUST WEAR A LAB COAT AND SAFETY GLASSES AT ALL TIMES IN THE LAB.
- You must not eat or drink in the lab, or bring any food in with you.
- The use of mobile phones is not allowed in the lab.
- The saftey regulations given to you at the beginning of the Foundation Course still apply.
- You must carry out a risk assessment and get it signed before beginning any practical work.
Timetable
Lab Script
The Beer-Lambert law provides a relationship between absorbance (
), and the concentration of a species (
) through the extinction co-efficient of the species (
) and the path length (
).

The absorbance is related to the intensity by:

The intensity cannot be measured directly but we can infer it from the voltage recorded since the voltage recorded is
the number of photons reaching the diode.

Where
is the background voltage and
are the voltages recorded when the sample or jsut the solvent are in the cuvette. This is the method that all spectrophotometers use to record an absorption spectrum, it is just that the spectrometer does the above steps for you to output absorbance. In your Raspberry Pi home directory there is a script for calculating the absorbance, you could try to implement this automatically and use it to create a linear plot of absorbance against concentration. You should then fit your data to
to get the extinction co-efficient for the substance you are using.
An iPython notebook is also available if you are not comfortable with coding in a text editor. Please note that the Raspberry Pi supports python 2 not python 3 as you have been using, this should not create any difficulties for you though. A copy of a suggested script to analyse your data is below, you can run this on the Raspberry Pi by using python name_of_script.py or you can make an iPython notebook to run it. We do not recommend using iPython notebooks on the Raspberry Pi.
# This script will help you analyse your data, it will load the data in a useable format
# you then need to decide how to analyse it.
import matplotlib.pyplot as plt
import numpy as np
from pylab import *
# Name of the file you want to analyse.
filename='test_big.dat'
data = np.loadtxt(filename, skiprows=2)
V = [] # create empty arrays to store values in
C = []
for i in range(len(data)):
C.append(data[i,0])
V.append(data[i,1])
# Now can load V for Voltage and C for Concentration
## Calculate Absorbance
# You need to calculate the absorbance for each concentration and call it A
# to do this relate voltage (V) to intensity and then intensity to absorbance A
# the programming is basically done you just need to complete the calculation
# step
A = []
for i in range(len(data):
VI = V[i] ... # complete this step (or make multiple steps)
A.append(VI)
## Plot to see the shape
plt.plot(C,A, '-bo')
plt.ylabel('Absorbance')
plt.xlabel('Concentration (M)')
## Fitting
# The polyfit function takes 3 arguments polyfit(x,y,n) where x and y are the data
# to be used in the fit and n is the order. The order is this highest power so order
# 1 would be y=mx+c and order 2 y=ax^2+bx+c etc...You should pick an order that
# will give the curve closest to your plot.
fit = polyfit(C, A, n) #you must pick a value for n
fit_fn = poly1d(fit) #this has made the fit a function
plt.plot(C, A, 'bo', C, fit_fn(C), '--k')
plt.ylabel('Absorbance')
plt.xlabel('Concentration (M)')
plt.show()
Raspberry Pi Instructions
Once you are at the stage where you are ready to use a Raspberry Pi please follow these instructions on how to use and setup a Raspberry Pi.