February 17, 2025

Software for the BTC100 spectrometer - developer notes, part 1

I received my spectrometer on Thursday February 13, 2025.

I use a Ugreen USB to serial "cable" along with a 5 volt 1.5 amp power supply to get it going. It communicates at 9600 with a fairly simple serial protocol. The baud rate can be kicked up to 115200, which is advantageous.

I wrote a short C program to talk to it, and took this as far as being able to read a spectrum from the device and save the results to a file. Then I moved to python, and recreated the same ability. Then I extended the python code to support the more complex binary mode of reading the spectrum. This is more compact and significantly faster. After a couple of days work I had a python class that allows me to access all of the capabilities of the spectrometer that I am aware of.

My reason for using python is that it provides the easiest path I know of to develop software, particularly GUI software, that can run on both linux and windows. I do all of my development work on linux, and generally find working with windows awkward and distasteful. But I have two interested parties who also have purchased one of these spectrometers, and they only work with windows.

I am no great lover of python either. It is an acceptable programming tool, but it makes a poor religion. I will say no more. It has a fair number of warts, but probably every language does. The most severe shortcoming is that an overly enthusiastic group is endlessly working on and changing the language. This results in instability for the end user without perceivable benefits, but I know of no better alternative.

I am using "wx" as the GUI toolkit for python. I have used both Tkinter and Wx and far prefer Wx. Tkinter is some descendent of the original Tk for Tcl. Wx is more modern and at is core is a well thought out and mature package for the C++ environment. And happily it is easily available for windows, and seems to work fine in the windows environment, as does python.

Other python projects

Every good programmer will reuse code they have previously written. I have a number of projects that may yield components that can be reused in this project:

WxPython tricks and fine points

It is 2-21-2025 and I have a basic GUI working. Here are some interesting Wx links: Getting sizers to cooperate and yield a layout you want is always a challenge. You can let them do some thing on their own, or try to take control of things.

Wx offers a Toggle button, but I don't like it. It just makes a subtle change to the background color (i.e. grey) to indicate that is is active. I want a left to right switch type thing. The following takes the brute force approach and creates one from bare metal and fabric.


Have any comments? Questions? Drop me a line!

Tom's Electronics pages / tom@mmto.org