# Calculating molarity, weight concentration from absorbance value for plasmonic nanoparticles in solution

It is common to measure the peak absorbance of the plasmonic nanoparticles in solution and then get the following:  Molarity (moles/liter) Number of particles per ml  Weight concentration (ug/ml) I wrote a small python function to extract these parameters.  The following inputs are needed for the function d_nm :   diameter of the particle in nanoparticle od :  peak OD measured from the absorbance plot path_length_cm :  cuvette length in centimeter density_g_per_cm3 :  for gold it is 19.28, for silver it is 10.49 molar_Extinction_perM_percm :  Molar extinction coefficient extracted from here. This can extracted from measuring absorbance at different concentrations and then Read More …

# Creating Energy Band Diagrams for Solar cells and LED

Energy band diagrams are used to visulize the electron and hole transport in Solar cells and LED. I want to quickly draw them and came up with a python module. You can download the module at my github repository. Here’s an example on how to use this code. from Band_diagram import metal, semiconductor, plot # # Define the metals and semiconductors. Here wf is the work function of metals, cb is conduction band minimum and vb is valance band maximum wrt to vacuum level ITO = metal(wf = -5.2, name= ‘ITO’) p_nio = semiconductor(cb = -1.85, vb = -5.49, name Read More …

# Dealing with plotting negative, zero and positive values in log scale

Sometimes you have to show positive, zero and negative number in log scale. However you cannot take log of negative numbers and zero. But one could approximate it with a log transform modulus as stated here. In Python with numpy: from numpy import sign, abs, log10 import matplotlib.pyplot as plt # Data varies in several magnitudes and has both positive, zero and negative numbers x = [-10000,-1000,-100,-10,0,10,100,1000,10000] # log modulus transform x_log_modulus_transform= sign(x)*(log10(abs(x)+1)) f, ax = plt.subplots(2, sharex=True) ax[0].plot(x,’o’) ax[0].margins(x=0.12, y=0.2) # for better visualization of datapoints at the end of axis ax[1].plot(x_log_modulus_transform,’o’) ax[1].margins(x=0.12, y=0.2) # for better visualization of Read More …

# Python code for generating plasmonic metal dielectric functions

I keep needing a python code to generate the dielectric functions of plasmonic materials such as Au, Ag, Pd, and Pt. I wanted the dielectric functions called by other python codes such as TMM. So I wrote a python version of LD.m LD.m is a matlab file written by Bora Ung that produces dielectric functions of metals either for Lortenz and Loretnz drude models. The dielectric functions are given as follows: . The first part of the function is the Drude part and the second part is the Lorentz part. The parameters for these models are taken from Rakic et Read More …

# DDSCAT on amazon EC2

Amazon provides high performance computing capabilities through their EC2 service. You can find more information here They provide a 750 hr free instance with their a free-tier program. If you want more resources, you can pay for it. See the pricing, pricing seem very reasonable. I wanted to see how easy it was to install ddscat and run some examples files. Amazon allows to create an instance through their very easy-to-use web interface. I chose to install ubuntu amazon machine image on the instance.  While you are creating an instance you are allowed to create a key pair file and download Read More …

# Doorbell with NRF24L01 and Arduino

My current apartment does not have a doorbell (Its strange but it is true). I went ahead and built a doorbell using two arduino pro-minis and two NRF24L01 transceivers. The melody to be played when a guest presses a button is controlled by me. I have four melodies programmed in. Here it is in full action: Here are some details: Remote The schematic for the remote is shown below. The remote is configured to run on 2 AAA batteries and goes to sleep mode most of the time and then wakes up when a guest presses the button. This button Read More …

# Airtel tune on arduino

For my doorbell project, I needed some melodies to be played on arduino. One can takes notes of a melody and write a corresponding arduino code. I like airtel tune and wanted to play it with arduino. I got the notes from https://www.youtube.com/watch?v=3m5j5UIRqQc Here is the final result, where I use it in my doorbell project. My code is here:

# Controlling Rigol Dp832 with python

DC power supplies are very handy for electronic projects. They help to apply bias to a devicve. Controlling it by a computer by a program is helpful in advanced projects where timing and accurate control is an issue. I got my hands on a RIGOL DP832 which is three channel (two 30V and one 5V) power supply and is programmable through SCPI commands. The device can be controlled by USB and rs232 (optionally by LAN). SCPI commands can be sent to the instruments using VISA interface. I used Python and pyvisa module to communicate with it. I wrote a class Read More …

# DIY Audio cables using CAT5

Inspired by the article on speaker cables, I built the CAT5 V3 version of the speaker cable. Following are the images of how I made them. I have access to a precise LCR meter and will measure R, L and C as function of frequencies shortly. The capacitance of the cat5 speaker cables is known to be high.

# Electric field at localized plasmon resonance using MEEP

This article is about simulating localized plasmon resonances in metal nanospheres using MEEP package. Generally, I am interested in solving three problems in LSPR systems: Calculate the extinction, scattering, absorption spectra of metal nanoparticle The procedure for doing this is very similar to the method I mentioned here. Calculating the electric field enhancement spatially as function of wavelength This involves taking electric field distributions with a particle in time domain and taking FFT of them. Also to be noted is that the electric fields near the particle should be normalized with electric fields with no nanoparticle. This has to be Read More …