Informatics

radiation detection with Arduino: cumulative counter

In a previous article, I used a radiation detection board adapted to the Raspberry Pi with an intercommunication board.

But obviously the radiation detection board was primarily intended to use with Arduino.

I used the code provided by the manufacturer, until I noticed that it wasn’t useful for real (amateur) radiation measurements: the radiation is a fundamentally stochastic phenomenon and that means that radiation values must be measured over a long interval, as they can greatly vary for short periods of time. This is particularly truth if one is interested in natural background radiation measurements.

For example this is a real graphic of background radiation cpm values taken over almost an hour. Each point is a 10 seconds counts per minute (cpm) value averaged for a minute value (so, point = [ counts in 10 s ] * 6):

radiation measures over almost an hour

The code for Arduino would be very much useful if a, say, five minutes average value could calculated every 10 s.

This can be easily accomplished with a circular buffer of 300 / 10 = 30 stored previous values. In case the time elapsed from measurement start is less than 5 min, the average value is calculated over the real elapsed period.

So with some modifications to the original, the code now shows on the display both instant cpm every 10 s and an accumulated value on the right averaged over the last five minutes.

Here is the complete code: radiation_shield_buffer.ino

Also as git repository here.

[Oct 2014 Edit: the program has been updated: see this post]

This way with Arduino and the cumulative counter, it’s possible to construct a portable radiation detector than can show good estimations if left there laying for some minutes next to your point of interest.

The Arduino and radiation boards, with 6x AA batteries to power it, easily fit in a small box.

The display shows instant values on the left (cpm on top, uSv/h below) and on the right of each of these ones, accumulated values over a five minutes period.

portable arduino radiation boardarduino radiation portable detector in a small box

These are the basic changes made to implement the circular buffer:

// keeps the sum of counts for the ring
unsigned long cpm = 0;
// stores the pulses for a set of 30 interval (10 s) periods
unsigned long ring[BUFFER_COUNTS] = {0};
// pointer to the next cell in the ring to update
byte pointer = 0;
boolean buffer_full = false;
long countPerMinuteAccu = 0;
float radiationValueAccu = 0.0;

// buffer calculus:
// —————–
// calculate the moving sum of counts
cpm = cpm – ring[pointer] + count;
// store the current period value
ring[pointer] = count;
// move the pointer to the next position in the ring
pointer = (pointer + 1) % BUFFER_COUNTS;
if ( pointer == BUFFER_COUNTS-1 ) {
buffer_full=true;
}

if (buffer_full == true) {
countPerMinuteAccu = cpm/5;
} else {
countPerMinuteAccu = cpm*6/pointer;
}
radiationValueAccu = countPerMinuteAccu * CONV_FACTOR;
// —————–

Note that on line:

countPerMinuteAccu = cpm*6/pointer;

cpm*6/pointer != cpm/pointer*6

:-)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s