Ionization Chamber

Ionization chamber is a device to measure radioactivity level. When air's atoms are hit by radioactive particles, an ion-pair is produced. Ions has electric charge, if they are in electric field create by positive and negative electrodes, negative ions will move to positive electrode and positive will move to negative electrode. They will try to "meet each other" thus creating a current. This current can be measured. The current is proportional to amount of ion-pairs. Amount of ion-pairs is proportional to radioactivity level.

Architecture of the device is presented below. It's made of analog part + STM8 microcontroller that collects and sends measurements via UART. Those measurements are collected on Raspberry side and processed using Python and R scripts. results are stored in .cvs (raw data) or .png (diagrams). It would be possible to simplify this setup and avoid Raspberry, but I wanted to made it possible to gather data and flash the chip without being physically around the device.

Outside electrode of ionization chamber was made from PCB scraps and copper plate, inside electrode was made using a couple of centimeters of non-emaled wire. To avoid electromagnetic interference, amplifier was placed in metal chassis.

PCB for analog ans data acquisition part was designed in KiCAD, all files are available on project's GitHub.

High voltage is needed to create sufficient voltage field in the chamber. Originally I didn't know how big it needs to be, so I added on the PCB a simple DC/DC converter to generate 400V DC. Tests show that 4x12V from batteries is sufficient, so while the DC/Dc converter is soldered (visible on the bottom left side of the picture), it's not used.

Software was written in C, compiled by SDCC. A weird limitation of SDCC is that even if functions are unused, they are still compiled and added to final binary. I'm using StdPeriph as a HAL, so there is a lot of unused functions, that took space, so I ended up with adding #ifdef 0 ... #endif around each of them and then trying to compile and uncommenting those that are needed.

Below diagram shows results obtained from the device. As visible, it's quite sensitive.

More detailed documentation, source code and PCB design are available on project's GitHub

Camera nuclear-radiation sensor: part I

In previous posts I've described a radioactivity detector based on a photodiodes. Image sensors in cameras use photoelements too, so I think that they could be also used to detect radioactivity. At this moment i didn't success in this , nevertheless I will describe here my attempts.

I'm using RaspbberyPI, to get data from the sensor, camera is some low-budget/quality clone designed for RaspberryPI. I have removed optics, and covered whole camera in black tape to block any light coming to the sensor. It's visible on the picture below.

To handle the camera on the software side, I'm using Python script (with PiCamera library). In infinitive loop it takes a photo and calculate sum of pixels value and then sums values of each RGB channel. This value with timestamp is put to CSV file that is later parsed to diagrams using R script.

Without any sample, internal noise of the sensor (and maybe background radiation) should give after some time (e.g. after a couple of hours) a Gaussian curve on the histogram. After putting measured sample to the sensor and waiting similar period, a new Gaussian curve would appear, so that the histogram would have to visible peaks. That was my assumption, hit would prove that the sensor works, however as visible below it doesn't - there is only one peek.

I will try to better isolate the sensor also from electromagnetic noise or maybe buy a new camera (less noisy). Other than that I don't have ideas to make it works.

Weird arrays in C

Recently I've saw quite strange way to create an array in C. I will describe it bellow - looks quite interesting!

Let's assume we have an array given bellow:

int myArray[4];
We could rework it, so that each element is declared separately:
    int myArray0;
    int myArray1;
    int myArray2;
    int myArray3;

Now we can obtain pointer to first element and last element, and iterate through elements in between it as with regular array. We exploit that compiler will probably put those variables in the same order in the same place in memory.

A full example is given below:

#include <stdio.h>

void processElement(int e)
    printf("processing element in array, it has value %d\n", e);

int main()
    int myArray0 = 0;
    int myArray1 = 1;
    int myArray2 = 2;
    int myArray3 = 3;

    // dummy way to force compiler not to optimalize-out our array members
    printf("%d\n%d\n%d\n%d\n", &myArray0, &myArray1, &myArray2, &myArray3);

    int *start = &myArray0;
    int *stop = &myArray3;

    if(start > stop)
        start = &myArray3;
        stop = &myArray0;

    for(int* it= start; it <= stop; *it++)


Semiconductor nuclear-radiation sensor: part III

In this post I will present a new hardware version of my sensor, older versions are described in part I and part II. In comparison to the previous one, sensitivity is roughly x10 more sensitive.

In previous version, tin foil window for photodiodes was very close to the BNC sockets and because enclosure was small, it was hard to place a sample close enough. Not it's better, however, if I would choosing again, I would use metal enclosure similar to those used in PC oscilloscopes and put BNCs on front panel, power socket on rear panel and tin foil window on top. This would allow me to easier access for debugging- now I have to desolder sockets to get to photodiodes or to bottom side of PCB (fortunately this side is empty).

Bellow you can see the diagram (click on it to enlarge), what has changed in comparison to previous version:

  • One additional photodiode (previous version has only two of them) to increase sensitivity, also the window in enclosure is much bigger
  • x10 bigger resistance of the feedback loop resistor in first stage amplifier, I tried bigger, but then osculations started
  • Bias for photodiodes using 12V batteries, I could increase it, but didn't have enough space in this enclosure
  • Buffer op-amp at the analog output
  • Digital output.

Additional changes not shown on diagram:

  • U1 is OPA657U
  • U2 is OPA656U
  • R4 is 1G
  • As close as possible to input power socket are placed in paraller 1n/16V and 100n/16V, without them the device started to oscillate randomly.
  • A Schottky diode is connected in series after mentioned above extra capacitors to reduce risk of damaging the device when power supply is connected incorrectly. I don't know if it will help enough but I have already broke one PCB of this device this way, so now it's there.

Digital output is 12V in high state, 0V in low state, this is not very useful for 3V3 logic microcontroller that I'm using for data acquisition, so I made a simple converter using additional PCB.

Here it is visible soldered. I like in those SMA Female sockets that they can be soldered to the edge of the PCB (as visible below) and this is still quite mechanically stable, but doesn't require to drill holes as in regular mounting way.

All materials (including software part presented in previous post) for this hardware revision can be downloaded from project's repository.

Semiconductor nuclear-radiation sensor: part II

There are many ways to measure radioactivity level, semiconductor detectors sense interactions between ionizing radiation and p-n junction. Because in hobbyist area most popular are Geiger-Muller based detectors (in short: not a semiconductor but lamp based devices), I think it's a cool idea to take a look at this approach.

In this post I will present such home-made sensor and a set of software to parse collected results.

Picture below presents circuit of the sensor that I made, it consist of a photodiode that acts as a sensor, transimpedance amplifier and "regular" amplifier. I've selected op-amps that has little input noise.

Changes that I made during testing the device, that are not presented on the diagram:

  • D1 is BPW34
  • U1 is OPA657U
  • U2 is OPA656U
  • 2p capacitor is connected in parallel with R6
  • 820k resistor is connected between U2 out and BNC socket.

Below is visible sensor in enclosure and without it. Because the device is sensitive for background EMI and light noise, a metal housing is needed. To increase exposure of the sensor to the radiation, where it is, in the housing, a hole is made and just a tiny adhesive metal tape is covering it.

Collecting data from measurements devices using USBTMC, SCPI, Python and R

High end test gear allows two-way communication with PC to set measurement parameters and to send the measured data to PC for further analyze. On PC side there are applications for this (LabView, BenchVue), but they are expensive. One option is to make own program/script that will communicate with the device and parse/present measured data - this approach I will present it in this post. The tool I'm using it with is 34460A(digital multimeter).

Below is an example of the measurement graph made using this home-made software.

The module of communication with the device I made in Python, it stores data to .csv file, that is later parsed by a script in R and the output graph is stored as .png image. The R part could ass well do some numeric stuff and print it on STDOUT, but for me that was not the case.

Initially all was in Python, but I didn't like Python's graphs, they weren't visually nice.

Python part when started will save measurements to the .csv file constantly, at any time, user can run R script to create new graph.

Installation steps

Assuming device driver correctly enumerate in the Device Manager (if not one needs to install its drivers first).

  • Install Python and R, add them to Path (environment variable).
  • In R, install following packages: latticeExtra, gridExtra, grid.
  • In Python install following packages: usbtmc, pyusb.
  • On Windows, download libusb-win32 and follow README steps to bind it to the device. In addition it didn't work for me if I didn't run the tool as an Administrator. If everything went ok, device will be visible in Device Manager in branch named libusb-win32 devices.
  • Download Python/R scripts, they are available via my IonizationChamber repository.
  • In, replace idDMM with id of the device.

For usbtmc, I got the same problem as described here, fortunately the fix presented in that thread fixed it, so please check it if you have some weird stacktrace errors in Python.


I made those scripts for my personal use, so they may be a bit awkward to work with, but once the setup is done, everything should work fine.

  • Set meassurement type and range on your device (this could be also done via python script)
  • Start python script
  • Run R script, it will create results.png file with graphs.

That's all.

Negative resistance oscillators

Normally -according to the Ohm's law- when the applied voltage is increasing, the current is increasing too, however some components can break this law. When the voltage increases, current decreases. This is called negative resistance.

One of the most know element that exhibits this behavior is a tunnel diode. Once very promising, today it isn't widely used in popular designs and occupies a niche in microwave applications. It's a bit challenging to get one, fortunately simple circuits that have negative resistance feature can be build from popular discrete elements. One of them I will present today.

The circuit is so called "negistor" - a regular npn transistor connected in a way that the base is not connected at all, and collector-emiter junction is polarized in reverse direction. The generator that uses negative resistance is presented below, and consists of R1, C1 and T1, the voltage when it works is between 9-12V, R2, C2 are used to block DC voltage, D1 is used to indicate if the generator works. T1 works as the negistor.

It's worth noticing that the tunnel diode works due to a quantum effect called quantum tunelling, I'm not exactly sure if the negistor works also due to it.

Below you can see the voltage on the TP1 (test point), on the first image the scope was is in DC coupled mode, on the second in AC coupled mode.

Other configurations od the oscillators based on the negistors can be found on Alan's blog.

Another circuit that also exhibits negative resistance region is a lambda diode. While P-JFETs aren't widely popular, it's possible to replace it by an npn transistor, as presented in this article. An interesting oscillator based on the lambda diode is presented here.

The idea of a negative resistance is something very interesting and it's worth to take a look on it. Another fascinating and simple generator is a Joule thief but this is a topic for another post.