Close

Event Capture and Recording with Raspberry Pi (Part 1)

A project log for Cosmic Array

An array of cosmic ray detectors across a landscape that demonstrates in light and sound how cosmic rays are constantly all around us.

paul-schulzPaul Schulz 06/30/2017 at 12:270 Comments

So how can the Cosmic Ray particle detection events from the Geiger-Muller Tubes be recorded?

The following describes how this can be done. Part 1 will discuss the code to collect the data. Part 2 will describe the method for sending this data to a central server.

Introduction

There is a software library for Raspberry Pi computers called wiringPi, mentioned in a previous post, which comes installed with Raspbian. It can be used to monitor the general purpose IO (gpio) lines and trigger a program to run via an interrupt routine.

From the detectors, the attached Raspberry Pi will pass the event over a wireless network to a central server for recording. (See diagram below.) The server will log the events received, process them, and make the available on the internet.

The events can be pulses from either single tube activations, or output from the coincidence circuits.

             Detector
             Tubes        LEDS     DT  LEDS         DT  LEDS 
              |             |       |    |           |    |
  Detector  o-----------------o   o--------o       o--------o
  Board     |                 |   |        | . . . |        |
            o-----------------o   o--------o       o--------o
  GPIO        ||            |       ||   |           ||   |
  Interface   ||            |       ||   |           ||   |
            o-----------------o   o--------o       o--------o
  RPiZW     |                 |   |        | . . . |        |
            o-----------------o   o--------o       o--------o
              :                     :                :
+----------+  :                     :                :
| Wifi     |..:.....................:.... . . . . ...:
| Router   |  :
+----------+  :
              :
            +--------------------+
            | Collector (Server) |
            | Display (HTTP)     |
            +--------------------+
              :
              v
             Wifi/WirelessTeather/Cable
             Internet

Capturing the Events

For an example of how to monitor the GPIO ports there is a useful C program example: isr.c

Download this example to a RPi and compile with:

$ gcc -Wall -o isr isr.c -lwiringPi

This will create a program called isr (interrupt service routine) which when run will detect events on the gpio pins of the RPi. To test the setup, a push-button was attached between the 3.3v supply (connector pin 1) and Pin 0 (connector pin 11).

$ ./isr
...
Waiting ...  Int on pin 0: Counter:  2987
Waiting ...  Int on pin 0: Counter:  2988
Waiting ...  Int on pin 0: Counter:  2989
...

Some comments...

A 10cm unconnected lead was enough of an antenna in my environment to cause the interrupt routine to be continuously triggered. Once the lead was connected by the button the triggering stopped.

(I might also have to submit a patch to make the output from isr more descriptive of the gpio or pin that is being triggered. (eg. gpio 0/pin 11))

The processor package in the Raspberry Pi also has internal programmable Pull-Up and Pull-Down resistors. An advantage of this is that the state of the inputs can be changes from the Pi itself, which is really useful for testing. Making another terminal connection, running the following will trigger an interrupt which will be seen in 'isr'.

$ gpio mode 0 up
$ gmio mode 0 down

I'm thinking that this is going to be really useful for testing the system later. If a series of events are recorded or generated from an algorithm, they could be replayed from the Raspberry Pi of the detector itself.

Next article

Event Capture and Recording with Raspberry Pi (Part 2a) - Recording Events over the Network

Discussions