Signal processing with Mathematica

I’ve been working on some instrument design projects and have hit a brick wall of sorts. My prototypes are riddled with noise, most likely 60 hz. My thought here was to learn a bit more about signal processing to (a) see if I can get a better understanding of what’s going on and (b) see if this is a possible project for students.

So the setup is as follows. I’ve got an Arduino microcontroller that does one of two things, it either reads the signal from a noisy light detector (in this case, an LED connected to an op amp in a current-to-voltage configuration) or – for debugging purposes – outputs a fixed signal frequency by printing $A0 + A cos(2 Pi f millis()/1000)$ where $A0$ and $A$ are amplitude offset and signal amplitude, respectively, $f$ is the frequency and since millis() returns a value in milliseconds, it is divided by 1000. To enact a sampling rate, I set a delay(dt) in the loop routine where dt is the delay time in milliseconds.

On the *Mathematica* side, it’s pretty easy to read the serial data from the Arduino with d = DeviceOpen["Serial", {<port>, "BaudRate"-><baudrate>}] with replacing <port> and <baudrate> with your values. The code below is a tad clunky, but works well at grabbing data and converting it into a format that Mathematica wants.

Continue reading

Zombie projects

I post many of my projects on public sites for two reasons: (a) they *might* be useful to other people and (b) they *will* get lost if I store them on my home computer. It surprises me when I have a project that has been around for a while and then, seemingly out of the blue, there’s some activity. That is the case with my goiolink package that interfaces Vernier’s Go!Link adapter (and compatible sensors) with Mathematica running on a Raspberry Pi. (Clearly, something that many, many people are doing…)

So I was reasonably surprised that within the span of a few weeks earlier this semester, I received several communications about my code. There is clearly some small interest in reproducing my setup but folks are having problems following the directions. I have little experience in distributing software, and because the Vernier/Mathematica/RPi crowd is a fairly small one, I have access to very few beta testers. If there’s any hope of others using my software, it looks like I’ll need to streamline the installation. So here it goes.

Continue reading

LED spectroscopy

I’m working on a project that will include using LEDs as light sensors, and one of the first tasks is to learn a bit more about the wavelengths of light that are emitted by an array of LEDs. Since I’ve recently created a Mathematica interface to an Ocean Optics spectrometer (on a Raspberry Pi, naturally), the first task was pretty straightforward.

Emission spectra of several LEDs. rgb(b,g,r) are in a common cathode RGB led while the others are varieties from Adafruit.
Continue reading