More average

I’ve not yet discovered any bugs in the march updates of the TCD1304-driver firmware, but that doesn’t mean there’s no room for improvement.

For instance, the time to capture a dataset can be as short as 15 ms + integration time,  but transmission of the same dataset takes more than 642 ms.¹  So if you want to average just two readings, it will take you at least 1.3 s regardless of the integration time.

Wouldn’t it be wonderful if the firmware could handle averaging on it’s own? Well, now it can. You can request from 1-15 integrations, which will then be collected, averaged and sent back to your pc (in that order).

The CCD isn’t flushed between readings as the integration time is the same for each collection. That means you’ll save up to:

15·(15 ms + 642 ms) = 9855 ms

that you can spend doing things you love. But wait, there’s more! To actually make it work the CLI has also been updated:

TCD1304-driver firmware (UART) [sep. 10th 2017]

Otterly CCD CLI (sep. 10th 2017)

On an entirely different note, I’ve changed laptop, and somehow it has broken the Otterly CCD GUI. (Well to be fair it was held together with chewing gum and duct tape.) The program’s not exactly beautiful – not on the outside and certainly not on the inside – but I will clean up the communication functions in the coming days.

Oh and I almost forgot. Here are two captures from my OtterVIS with the new firmware:


One single integration.


Fifteen integrations averaged.

There are all sorts of artifacts present in this spectrum of an incandescent bulb, so it’s not so easy to see the improvement. I will see if can find it in my heart to make a better example.

1 The 15 ms goes to flushing the CCD. The 640 ms is because the UART runs at 115.2 kbps.


DIY optical breadboard

The cake is a lie. This is actually a post about anodising aluminium.

The internet is full of information about anodization/eloxation of aluminium, so I’ll just summarize what I’ve learnt is important:

  1. Current control rather than voltage control
  2. Temperature control
  3. Cleanliness is next to godliness
  4. Work in a well-ventilated area
  5. The alloy is important. I’ve used AlMg3 (5754).


Every single paper I’ve come upon agrees on that a current density of at least 1.25A/dm² and an electrolyte temperature of 20-30⁰ C is required for a type II coating (what you want for nicely coloured aluminium), so current control is definitely needed.

Continue reading

Finally Windows

There’s finally a Windows interface for the TCD1304. It’s not me, I didn’t do it, it’s the work of Jens-Ulrich Fröhlich and it looks like this:


The JFS-OtterVIS running on linux.

Being Java-based it can also run on other OS’s, and I’ve been able to play a bit with it on linux and it looks great. The COM-port system of Windows is of course different from linux’s TTY-system, so I couldn’t actually connect to the nucleo board, but the program can handle both. There’s all the basic necessities like wavelength-calibration, baseline, transmission and absorption, printing, scaling etc, and a very well made help functionality. In other words it has all the stuff and more, that I’ve been to lazy to do anything about myself.

The weather for today

Today I finished the PSU for the peltier element and connected the stm32f103 to the thermistor (the stm32f103 is still not measuring the voltage over the TEC). And here are the readings (sorry for the blurry photographs):

First, before the TEC was turned on:


It’s fairly hot in DK at the moment. The ambient temperature is 25-26°C.

Then after 5min with the TEC on. The voltage drop over the TEC is app. 8V, I have no idea what current draws, but the transformator is rated at 4A:


So it reaches a temperature difference of around 10°C. Not as much as I had hoped.. With some heatsink paste between the peltier element and the aluminium plates the temperature dropped another 1.5°C, still not anywhere the expected ΔT of 30°C.

So good animals are uncooked, as we say here in Denmark. I had a second look at the audine project to see if I had missed something. Most likely I have, but I didn’t find anything suspicious about my setup except that the TEC 12706 protrudes slightly on the cold side. I had some smaller TEC’s from another shopping spree, most notably the TEC 03506. You see the difference in size here:


And with the little one, it’s an entirely different story. The voltage drop across the smaller TEC was around 5.6V and the temperature difference was much greater. The CCD started to collect condensation, which is around the time I stopped the test:


The temperature at this point was -0.6°C 🙂


New spectrograph geometry calculations

Here’s a quick walk-through to calculate the geometry of the spectrograph. I guarantee nothing concerning the correctness of what follows (but please do correct me if you find errors).

At the heart of everything is the diffraction equation:

The relevant wavelengths are given by the Raman shifts:

If we’re interested in wavenumbers from 150-4000cm⁻¹ and λ₀ = 532nm, the range for λ₁ becomes 536.3-675.8 nm. The edge filter’s cut-on wavelength is 540 nm, so the range is in fact 540-675.8 nm – this also means that the spectrometer’s lower limit is 278 cm⁻¹.

d is given by the grating in the case of 1200 lp/mm it becomes

Because the CCD is 29.1 mm wide and the focal length of the focusing off-axis parabolic mirror is 152.4 mm we can calculate what angles of the diffracted light we would like. For 540 nm to fall on the edge of the CCD, the angle should be:

The angle for 675.8nm is of course identical except for the sign. It gives us an angular range of ±5.45° around the center angle. The angle of incidence can now be found by solving this set of equations:

Of course not any solution will fit the spectrograph’s geometry. The angle of dispersion (γ) for the central ray must match the angle between the off-axis parabolic mirrors as seen from the diffraction grating (2α):

2α is determined by the position of the mirrors and is:

Where lm is the distance between the mirrors. Their diameter is 25.4mm, so lm cannot be shorter than this.

I’m don’t think there’s a (practical) solution to the equations, but setting lm to 27mm, 2α becomes 10.16° and then these values more or less cover the spectral range:

The CCD then covers the spectrum from 538-680 nm.

For better explanations go here:

Sneak peak at the new spectrograph

My original choice for the spectrograph’s geometry turned out to be much worse than I had even dared expect. The difference between the angle of incidence and the angle of the diffracted light was far too great.

I (obviously) didn’t know at the time, that there’s something called the anamorphic factor.¹ The definition is as follows:

r = cos θi / cos θm

If the anamorphic factor is significantly different from 1, the image of the slit on the CCD will be deformed. I don’t fully understand the implications, but I could see that a “line” supposed to take up maybe 100µm was spread out over almost 1 mm. Ok, I might be exaggerating slightly, but it was very obvious that it was never going to work.

I spent some time not thinking about it(!?), and eventually came across T.J. Nelson’s page about a High resolution compact spectrograph, and decided that this was juuust exactly what I wanted to do.

Continue reading

Blue pill blues

Every once in a while I get the question if the STM32F103 “blue pill” will be able to drive the TCD1304, and while the chip has enough peripherals to do all the driving and reading, it lacks a 2nd DMA-controller to handle communication.

Of course that doesn’t mean the mcu can’t be used in this application, it just means that my firmware can’t be ported to the F103 without rewriting at least parts of it.

But that isn’t what this post is about anyway, it’s actually about using a thermoelectric element to cool the TCD1304, to keep dark current down thereby enabling long(er) integration times.

Here is the CCD on top of the cold tip. The TEC-12706 is sandwhiched between the two aluminium plates. The lower plate will be secured to the chassis of the spectrograph, which in turn has a larger heatsink:

Continue reading