Monday, December 31, 2012

Spectroscopy

Absorbance, transmittance and reflectance all different types of spectroscopy. What I want to try and do is be able to acquire a visible spectra of something using a camera. Decomposing RGB values into a spectra is going to be tough but I think if I base it on empirical values from a spectrophotometer. Wavelength might not be too crazy but intensity is going to be the tough part. Was working on using a webcam today. I think I need something with a little better resolution.

A 96 well plate reader

So I just received a fellowship for building a biosensor, The Chromochord. The old version of the Chromochord had a lag problem in that it took a certain amount of time to scan and read the optical spectrum of each well. I want to do this all at once and have so far come on to two solutions. One is to make a sensor for each well using photodiodes. The other is to use a camera or CCD of some sort. There are definitely ways I can do these things without making the device broadly applicable but that is not what I want. I want people to be able to use a device such as this without having to modify it much or at all. I really really don't want to use diffraction grating spectroscopy. Good lord is that stuff pitiful but I just might have to suck it up and do it. Anyone know much about using cameras in extremely low light?

Wednesday, December 5, 2012

Build your own Synthesizer Part 3

I think the Arduino is one of the coolest things to come out in recent years it allowed me to go from someone who knew nothing about electronics to prototyping and building ideas in a very short period of time. When I started graduate school at the end of 2008 I literally had zero electronics experience. I always wanted to teach myself but I was daunted by the idea of using assembly language and no libraries. This is a realistic fear especially if one is using Texas Instrument microprocessors. They really need some good tutorials besides their code examples. Of course I had a really strong C programming background so that helped. I use the Arduino for anytime I want to interface hardware with my computer. This made it ideal for this project. I wanted to build a musical instrument or some type of synthesizer since I guess all the sounds are synthesized, it is technically a synthesizer. For all of this stuff I will be using Linux because it is so much easier to interact with devices such as the USB port that the Arduino will be plugged into. In linux that will be /dev/ttyUSBX where X is an non-negative integer (0,1,2,3). So our goal is to have it that when we press a button the Arduino sends information through USB to our computer which can then translate it into some sort of music. A good programs to help with this are ttymidi . The ttymidi program allows us to interact with JACK and fluidsynth to generate the actual sounds. So first we need a button.

Tuesday, December 4, 2012

Build your own Synthesizer Part 2

What we will learn how to do first is how to have all the software running and working together so that we can hear MIDI output through the speakers on our computer. So hopefully you downloaded and installed all the software I suggested last time. Now we need a terminal preferably root. What we need to start first is JACK. This program allows all the programs we use to communicate with each other and also with our speakers. The easiest way to start it is to run "qjackctl &" . This should open up the JACK GUI. Once it is open we click start.   The next thing we need is to have fluidsynth running, which we can start up with "qsynth &". Qsynth is a software synthesizer frontend GUI for fluidsynth. It takes all the MIDI commands and will generate our music. So now we have the minimum programs we need to run. We can test it out using rosegarden or another MIDI program. What you need to do after starting rosegarden is to open up the JACK connect button and setup the connections they should be as follows: Under the ALSA tab rosegarden or your software should be connected to FLUID Synth. Most common problems when using my own synthesizer for me have always been having the correct connections. Next we will work on setting up the arduino and buttons and ttymidi.    

Monday, December 3, 2012

Build your own Synthesizer Part 1

I guess this is where I should start as this was the basis for my current main project the Chromochord.

This is not a guide for building a standalone synthesizer as all MIDI sound generation will be done through a computer. All the software and hardware that I used to build my own synthesizer is Open Source, WOOHOO! I did write some custom code though as any hardware/software hacker needs to be able to do for a custom system.

What one minimally needs to build a synthesizer such as the one I built:

A computer running Linux

An Arduino or your favorite microprocessor

Some Buttons, Wires and Resistors

Probably a sodering iron unless you are going for a ghetto fabulous project that is duck-taped together (I admit I have done this before).

On my Dell laptop I installed Ubuntu. Not necessarily a big fan of Ubuntu but Fedora was being difficult and I didn't want to spend all my time just trying to make my video drivers work. I'm too old for that. There are a number of cool and awesome MIDI programs for Linux, when I first started I was so excited and spent a bunch of time messing around with alot of them including Rosegarden and Hydrogen. These are not what we will use but are pretty cool for just playing around and learning about MIDI sound generation.

The software I use and what you probably need are:

JACK audio software

Qsynth

Sooperlooper

ttymidi

 

I think all of these programs can be installed with yum or apt-get except ttymidi, which can be acquired from Here I chose to use the arduino with this project because it already has a serial MIDI interface library so you don't have to code one up on your own. MIDI messages(See here) however are pretty straight forward and would not be that difficult to code up on your own say if you were using something such as the MSP430. Once you have all your hardware and software then we are ready to move onto the next part!

Monday, July 30, 2012

The Chromochord in Europe

It has been pretty crazy being over here in Amsterdam. I came over to do some science with Dr. Tilo Mathes who works with Dr. John Kennis at Vrije University. We worked on doing Fourier Transform Infrared Spectroscopy on a bunch of mutant proteins I created of the AsLOV2 domain. We actually acquired a fair bit of results on over 10 proteins. I am pretty happy. I travel to Berlin tomorrow and I am going to give a talk titled "Protein Engineering and BioElectronics using light activated LOV domains." I am really excited about Berlin and giving a talk. I plan on playing the Chromochord a little bit for them. I will be really glad to make it back to America. It is really difficult to leave for 3 weeks in another country. Things that were normal and simple in your old life, such as obtain cash from an ATM become difficult. It is also stressful to the body which makes it difficult for the mind to function at it's peak. And I forgot that my soldering iron doesn't work with 220V and so now when I need to solder something I have to heat it up on the stove, hah. Yes, I brought some electronics things to work on while I am here. Not as productive as I hoped but still ok. Hopefully I will have some good posts next week on electromyography.

Tuesday, July 10, 2012

Google Ngrams part 2

I originally thought, probably like most people, that Google ngrams was pretty fun and amazing until I figured out that most of their data is completely wrong. I am kind of impressed at how bad the actual dataset is. I think there are a few problems which could most likely be easily fixed. One is with fixing errors from the Optical Character Recognition (OCR). There are some consistent errors that could be fixed with some simple parsing such as recognizing english letter characters as non-english letter characters. I know Google is also using a very loose interpretation of what a word is and what they actually mean is a string of characters. I don't think many? any? languages consider $0.00 or 2& a word One of the other problems is proper nouns and non-common, non-english words. For example words in books that are actively translating in the text See here for example. Figure 2 in the original paper would be completely wrong by all normal standards because it focuses so much on frequency yet the frequencies would be all wrong. The reason so many of the words in ngrams are not in the dictionary is because they either are not words or they are not english words!!! Further, there is a clear dependence on the number of books for a given year and the number of ngrams and most likely spurious ngrams(though I have not verified the spurious ngram part). While writing this I stumbled upon Microsoft's Web N-grams http://research.microsoft.com/en-us/collaboration/focus/cs/web-ngram.aspx which I will look at soon. Hopefully in the next two weeks I will put up the basic information I found from my language analysis. I am going to the Netherlands to perform some ultrafast laser spectroscopy so hopefully I will have lots of free time to code and write as I heard that they don't work on the weekends overseas. haha.      

Friday, June 29, 2012

Google Ngrams Part 1

So I have been spending some time analyzing language usage from a bunch of different areas including: chats, twitter, email, phone conversations and books. I have been starting to analyze the raw data from Google ngrams and the raw data sucks ass. Come on Google you can't write a 5 minute piece of perl code to parse the grams. Don't believe me look here:
As you can tell there has been a drop in the usage of vi for editing books, as it probably moved on to be a programmer's tool around the 1830s. This is not even to mention the words with non alpha numeric characters. I guess I will parse my happy heart out. Just removing words that contain numbers or non-alpha characters besides (') has me at about 1/3 of the original size for 1grams. I also removed words with less than 5 occurrences in less than 2 books. I.e. each word has to occur at least 5 times in at least 2 books. I'll post the scripts when I am done.

Friday, June 1, 2012

LCD Clock MSP430 Nokia 5110

So I finally managed to program a somewhat real-time clock using the MSP4302012 target boards (http://www.ti.com/tool/ez430-f2013). It took me a while because all of the code I tried to use did not work haha. I ended up kludging together some prewritten code and then writing some of my own (https://drive.google.com/file/d/0B_R75gIJvkFUMGFBNy16cjRoQmc/view?usp=sharing). The code was written in Code Composer Studios and will not work with mspgcc.



The connections I used are as follows:
Nokia   :   MSP430
1 VCC :    P1 VCC
2 GND :   P13 GND
3 SCE  :   P2
4 RST :  P3
5 D/C : P4
6 DNK(MOSI) : P5
7 SCLK : P6
8 LCD : P7

One should just be able to import this code into Code Composer and if using the same pin connections It should work immediately. You can run it off the ez430 USB stick or 3V. I used two coin cells in parallel. Feel free to comment if you have any questions.

Wednesday, May 30, 2012

Water

Lately I have been thinking alot about water. An interesting thing about macromolecules is that they are slaves to their solvent well at least some people think so... This train of thought was pioneered by Hans Frauenfelder. I heard him give a talk a few years ago and he still uses an overhead projector. Water has structure. It is a bunch of H2O molecules interacting in specific patterns.
When people say H2O is water it bothers me because H2O is not water. H2O molecules interacting in a specific manner is water. Anyways, I was thinking about how this specific structure of water can be perturbed by proteins or ions or a number of things. They might be able to change the structure of water interactions enough that the water becomes a slave to the "solute" which is a slave the solvent. In such a case protein A in water near protein B they would both effect each others structure and conformational equilibrium due to each effecting the structure of water. My goal is to understand if and how we can significantly alter the structure so that at a reasonable distance one molecule or protein say can effect the structure of water enough to effect the dynamics of another molecule.

What I am going to do is run some simulations with different concentrations of Sodium(Na) and Chloride(Cl) ions and see how it effects the structure of water and see if it does in a predictable way and also what concentrations are needed.

So initially I am having problems using GROMACS and I want full electrostatics but that requires turning off periodic boundary conditions... Hmmm What should I do? Well I did a run with just normal parameters except I extended the electrostatic and Van Der Waals cut-offs. I kind of see what I almost expected unfortunately.
The pictures is just a few atoms from the simulation of 879 water molecules modeled using tip4p and 4 sodium ions and 4 chloride ions. You can see the sodium molecules in blue and water hydrogen in white and water oxygen in red. It's not that obvious but what you can notice in the picture if you look at the water molecules away from the sodium their Van Der Waals radii overlap but where the two sodium atoms are the closest the water molecules don't interact like the others forming a unique structure or unique interaction. The problem is if that the two sodium molecules are not relatively close this does not happen and I think it might be just because water is so awesome in its ability to rearrange in such a way that these molecules are only minor inconveniences. But it could also be because my box is essentially infinite in size due to periodic boundary conditions, which because there are "infinite" other simulations connected a water molecule never has to be without other interacting water molecules except when they directly interact with something you put in the system. My next step will be to remove the damn PBC.

This post has taken me a few days to try different simulation parameters and figure things out. Sorry. Will try and do more experiments when possible.

Wednesday, April 18, 2012

The first 5 seconds

So for the past few days one of the experiments I have been performing on myself is trying to see if it is possible to teach myself to think of two different things at the same time. Sounds crazy huh? We can teach our bodies and minds so many different things what makes it impossible to think that we cannot follow two different trains of thought at the same time? Wasn't there a time when you thought that algebra was impossible? Or maybe learning to juggle a ball with your foot like Ronaldinho. I have spent about 10 -15 minutes each day practicing for the past week. I have tried a few techniques such as trying to write from 1 to 10 with one hand and A-Z with the other, read and write at the same time, focus my attention on something such as a memory task (I use Memory Trainer which by the way also shows me how badly my brain functions the next day after a late night at the bar). So I video recorded myself using my laptop to see if I could find reasons why my brain quit focusing on both tasks. The interesting thing... I always lost my concentration after ~3-5 seconds repeatedly. When I was reading a book and writing the alphabet always around the letter F. Sometimes I would write the letter 'F' twice or sometimes I would skip 'E' or 'G' but the initial lose of focus always happened around this time. But for the first three seconds I could read coherently and write coherently. I wonder if the brain takes ~3 seconds to initially begin focusing on a task? or it is just the nature of the experiment? I wonder if other people experience the same thing. Try it and let me know!

Wednesday, April 11, 2012

More thoughts on Water

Well I have been still messing around with the water box simulation and found that 200mM NaCl is not sufficient enough to have large disturbing effects on the water. It is fairly obvious that the effects are largest when two ions of the same charge i.e. negative-negative or positive-positive are near each other you have the biggest effect because waters are trying to align the same way to interact with both i.e. hydrogens near the negative or oxygen near the positive. The concentration of positively charged ions in the cell is ~150mM but this is not including all the other mess of proteins and stuff. Here is an interesting thing I found "Calcium concentration microdomains". I mean if there are in fact microdomains of different ions I think around 300-400mM would be sufficient concentration to start to really mess up the local water structure. I mean empirically we know that ions can help neutralize charges on proteins that can prevent aggregation or other bullshit. But do the ions actually have a significant enough effect to significantly change the thermodynamic equilibrium of a protein and is this change due to water? Things to contemplate.