Research and Teaching Blog

14 Posts with tag: programming

Serial communication demo

Demo code for connecting two computers using an Arduino-mediated serial connection. Needs fixing.. 

// An Arduino-mediated serial communication device
// Kaustubh D. Bhalerao

/* Device topology:

  Computer1--USB--Arduino1==Serial==Arduino2--USB--Computer2
  
  We are going to try this....
  
  Computer --TX0---> Arduino
      #    <--RX0--- USART0
                       ##
                     SWSerTX <===|
                                 |
                     SWSerRX <===|
  
  The computer sends a packet over USART/USB to the Arduino
  The arduino relays it to the SWser transmit port which is 
  received on the SWSer RX port, which relays it back to the 
  computer
*/

// Pin Layout

// Pins 2 and 3 ...

Posted on April 12, 2012 0 Comments
Tags: ABE425 , programming

PID Control using the arduino

The Arduino comes with a beautiful contributed PID library. The following code demonstrates how to use the PID library to control the voltage level in a 'leaky' capacitor. 

 

#include <PID_v1.h> 
// This file loads the PID_v1 library. 
// make sure the PID library is stored in
// Path/to/Arduino/libraries/ folder
// http://arduino.cc/playground/Code/PIDLibrary 
// PID library
// http://arduino.cc/en/Reference/Libraries 
// How to install the library


/* Tank filling PID controller. 
 Kaustubh Bhalerao
 ABE 425 Demo
 
 In this ...

Posted on March 8, 2012 0 Comments
Tags: ABE425 , programming

Digital IO with interrupts

Here is an improved version of the code. Note that the digital input pin is actually never even read! It is only used to detect the state changes (Here falling edges). 

It is simple enough (and robust enough). As you can see my two-yr old can operate the circuit. It is unbelievable he has  more fun with this switch than with an iPad!

Sammy on the arduino

 

/* 
A control system based on the Arduino microcontroller platform

Copyright: Kaustubh D. Bhalerao. All rights reserved

System ...

Posted on February 24, 2012 0 Comments
Tags: ABE425 , Instrumentation , programming

Crowdsourced quantum computing

By now you've probably been hard at work trying to figure out what quantum computing is, and have been eager to share your findings with everyone. 

After class on Monday I thought a little bit more about the nature of the 'experiment' we started, and figured that it was probably a better idea if everyone had a bit more time to work on the problem. So rather than have you bring your contribution to class on this Wednesday (today ...

Posted on February 1, 2012 0 Comments
Tags: ABE 446 , nanotechnology , programming

DIY thermal cycler

This post is way long overdue. In the Fall of 2008, (or was it 2007?) I taught a small module in the ABE 221 course dealing with automation in Biological Engineering. My hope was to create a home-made thermal cycler for less than $1000. Of course many people in the DIYBio community have constructed thermal cyclers for way less, and truly, you probably don't need to pay more than $300-400 (perhaps even less) to build a reasonably good quality ...

Posted on September 13, 2011 0 Comments
Tags: Do it yourself Biology , Instrumentation , labjack , programming , python , synthetic biology

Stochastic kinetics solution

This post is related to the problem posed in the stochastic kinetics lecture. Attached here (link missing) is the solution to the problem (the .R code). To run the code, you will need this reaction.csv input file. The file is a text description of the reaction as a graph. The format is very simple: nodes are the reaction states, and are described by the line e.g. "node, Pyruvate" or "node, Pyruvate_PDC". State transitions are described by "edge, Pyruvate ...

Posted on December 6, 2010 0 Comments
Tags: BIOE504 posts , courses , programming

Labjack Sensors

Here are some resources on installing the drivers for Labjack on Windows, a prebuilt installer for Mac OS X as well as the python modules.

Steps required to install the LabJackPython module:

  1. Open a command prompt (Click on Start > Run and type cmd in the box. Should open a DOS window)
  2. Change directory to the folder where you have your LabJackPython files extracted (e.g. 'cd \Downloads\LabJackPython\)
  3. type the command 'python setup.py install' in the folder where the ...

Posted on November 29, 2010 0 Comments
Tags: Instrumentation , labjack , programming , python , tsm435

Temperature and RH in 376A

Here's an experiment. I have a script uploading hourly temperature and humidity data to a spreadsheet. Here's the visualization of the temperature and humidity data in my office.

Posted on November 23, 2010 0 Comments
Tags: Instrumentation , labjack , miscellaneous , programming , python

Resistor codes

Here is a program to find the value of a resistor based on its color coding.

Posted on October 28, 2010 0 Comments
Tags: miscellaneous , programming , tsm435

Particle aggregation

Particle aggregation is a fascinating area, important for all kinds of applications, from computer graphics to biotechnology and bioprocessing. Here's a particle aggregation simulation app I wrote a while back to study the emergence of particle size distributions as a result of entropic considerations in the aggregation process. Here's a link to the application.
Watch how the particles dissociate / aggregate when you toggle the surfactant.

Posted on July 10, 2009 0 Comments
Tags: Java , particles , programming

Web interface for the LabJack

One of the things I've always wanted to do is to create a web-based controller for the LabJack family of devices. This is not exactly the same thing I've written about in the past, but it is not unrelated either. U3OverIP provides a good framework to build the web interface, but writing the actual interface is non-trivial - at least for me.
Any way. Here's a simple implementation. Look at the "Announcements" section of the index page of ...

Posted on June 10, 2009 1 Comment
Tags: Instrumentation , labjack , programming , python

Network graphs for KEGG

Here's a graph of all the compounds connected by various reactions in the KEGG database. I used the flat file provided at the KEGG FTP site which lists the reactions including their reversibility (or lack thereof). The file was parsed with Python, networkx and pydot, and the graph was generated using Graphviz using the neato algorithm. Here's the link

Posted on June 3, 2009 0 Comments
Tags: programming , synthetic biology

U3OverIP

Joshua Sander, our student in ABE is currently finishing up his MS working on a a high channel DAQ system as shown in the figure. Briefly, the system is constructed as follows:

First the hardware:

We have a standard LAMP server with the labjack u3 connected to it. We built our own MUX boards capable of doing analog or frequency (RH) signals using an Analog Devices (I believe ADG506) with basic RC filtering. The sensors are standard chip-based temperature / RH ...

Posted on May 20, 2009 2 Comments
Tags: Instrumentation , labjack , programming , python

First Post

About time I created the research page for my website. Figured I'd make a blog instead, where I can blog about the research. So here it is: "Hello World!".
I used the basic blog structure provided by Ross P (www.rossp.org) and used it to integrate it into the website.

Posted on May 19, 2009 5 Comments
Tags: miscellaneous , programming , python

 
Loading