Measurement Science Lab: Introduction

From ChemWiki
Revision as of 22:57, 29 November 2014 by Jp806 (Talk | contribs) (Assessment)

Jump to: navigation, search

Lab Overview

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. This wiki contains the instructions from the manual as well as downloads of iPython notebooks for use in data analysis and more information about the hardware and software available to you. Please supplement the information on the wiki and in the manual with your own research.

Course Timetable

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. The lab is designed to take the full 4 weeks and we recommend that you plan you time carefully a proposed time plan could be:


Week 1 Week 2 Week 3 Week 4
Monday Initial Spectrometer Design Improve Initial Design Make Measurements Make Improvements to Raspberry Pi
Tuesday Build Initial Design Build in Improvements Incorporate Raspberry Pi Make Measurements with Improved Pi
Thursday Test Initial Design Test Improved Design Test with Raspberry Pi Prepare Final Report
Friday Test Initial Design Make Measurements Measurements with Raspberry Pi Present Your Final Design

Assessment

  1. The lab course will be assessed by judging the final spectrometer that you design, it is important that you are able to present details of your design iterations and the results that you have obtained. To do this you must keep and present a detailed lab book, the form of your final report is left up to you to decide in your group you can give a short (10 slides maximum) Powerpoint presentation, submit a written report or submit a wiki link. To submit a wiki link you:
  2. In the address box, type something like wiki.ch.ic.ac.uk/wiki/index.php?title=MSL:XYZ1234
  3. The characters MSL indicate a report associated with the Measurement Science Lab and XYZ1234 is your secret password for the report. It can be any length, but do not make it too long! It should then tell you there is no text in this page. If not, try another more unique password. You should now click on the edit this page link to start. Use a different address for each module of the course you are submitting.
  4. It is a good idea to add a bookmark to this page, so that you can go back to it quickly.

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.


If you do not follow these simple safety instructions you will be asked to LEAVE the lab.

Timetable

Lab Script

The Beer-Lambert law provides a relationship between absorbance (A), and the concentration of a species (c) through the extinction co-efficient of the species (\varepsilon) and the path length (l).

A = \varepsilon c l

The absorbance is related to the intensity by:

A=-\log_{10}\left|\frac{I_{\mathrm{sample}}}{V_{\mathrm{solvent}}}\right|

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

\frac{I_{\mathrm{sample}}}{I_{\mathrm{solvent}}} = \frac{V_{\mathrm{sample}}-V_0}{I_{\mathrm{solvent}}-V_0}

Where V_0 is the background voltage and V_{\mathrm{sample,solvent}} 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 y=mx+c 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

Raspberry Pi B+ top.jpg

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.