Countdown to extacy, or: Create that activation decay graph.

Discussions and images as necessary related to microcontroller or computer instrumentation and fusor control software and hardware.
Post Reply
User avatar
Finn Hammer
Posts: 298
Joined: Sat Mar 05, 2016 7:21 am
Real name: Finn Hammer
Contact:

Countdown to extacy, or: Create that activation decay graph.

Post by Finn Hammer »

Previously, I have had to document the decay of activated isotopes by showing a video of the Ludlum model 3 instrument face, and although this is accompanied by the exciting sound, many finer points are lost, so I have been working on a way to record the data coming out of the Ludlum, and present it in a comprehensible manner.
"Coming out of a Ludlum" is kind of a bold statement, since you have to locate a place in its insides to tap a pulsing signal yourself, but placing a hot rock against the pancake, and poking around with a scope probe should solve that problem in fairly short order. The signal needs to be at least 2.5V amplitude (for a 5V ATMEGA 328P) (better make it at least 3) and the pulses can be as short as 40nS, or perhaps shorter, but that is the lower limit from my generator.

I decided to write code for the arduino, and to store the results on a mini SD-card. I guess perhaps it would be almost as easy to copy the data off the serial monitor, but I wanted a stand alone unit, and this way, I can grab the data without having the PC connected to the µprocessor board.

One peculiarity worth mentioning is, that the first 2 records that goes on to the file written to the SD card, contain very inaccurate numbers, and since I could not find a way around it otherwise, I decided to simply write those 2 first records in fast succession, with a zero timestamp, and then initiate the timestamp at the 3rd. data point. It is not the prettiest of solutions, but once you are aware of it: easy to use, just skip those 2 first entries.

Accuracy is within 1:1000, which should fall within the thickness of the line in most spreadsheet diagrams.....

I have tested the code with up to 120kHz, where the accuracy still is within 1:1000. This number corresponds to 7.2Mcpm which ought to cater for most our amateur fusor needs.

Code: Select all

/*This code counts the input to pin 3 of an  Arduino,
  and records it on a SD card, using a HobbyComponents SD card module
  (HCMODU0074). These modules can be had other places too, but I built
  on the code provided by HobbyCoponents, thus the mention here.

  The purpose of the code is to record the radioactive decay of isotopes
  created by neutron capture.

  The input to pin 3 should be a square wave pulse of 5V amplitude and
  at least 40nS pulse duration.

  The code also generates a timestep prefix label to the count, the intention
  being, that this will auto fill the time axis in an excell sheet graph.

  For some odd reason, the first 2 counts recorded to the card, are way off. I
  have therefore executed these 2 counts in 20mS succession, and labelled both
  with a zero in the time prefix.

  After a reset, the file will look like this at 1Kcps and a 1 second timestep:

  SD Card OK
  Counter is ready and counting!
  0,83
  0,19
  1,1001
  2,1000
  3,1001
  4,1000
  5,1001
  
  etc....
  
  End of count

  I have tested this code against the output of a Siglent SDG 1032X function
  generator, and it counts to an accuracy of better than 1:1000 in the range from
  1cps to 50Kcps, the latter corresponding to 3Mcpm, which should suffice
  even for the hottest of activation activities.

  Counting is terminated by pulling pin2 low, and this closes the file on the
  SDcard, so that the card can be removed and the file be read.
  Please notice that the file is deleted everytime the program is restarted.

  Cheers, Finn Hammer 9/16/2021
*/

///********************************************

//Edit "timestep" for the sampling period you want:

int timestep = 1;

///********************************************


#include <SD.h>

#define SD_CARD_CD_DIO 4 /* DIO pin used to control the modules CS pin */

File SDFileData;
int timeinterval = timestep * 1000;
int timeprefix = timestep;
int timeprefixincrement  = timestep;
int interval;
unsigned long previousMillis = 0;
volatile unsigned long counted = 0;
bool stopper = true;
int fastprint = 0;


void setup() {

  pinMode(2, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(2), finish, FALLING);
  pinMode(3, INPUT);
  attachInterrupt(digitalPinToInterrupt(3), pulsecount, RISING);

  Serial.begin(115200);
  /* DIO pin used for the modules CS function. */
  pinMode(4, OUTPUT);
  /* Initialise the microSD card */
  if (!SD.begin(SD_CARD_CD_DIO))
  {
    /* If there was an error output this to the serial port and go no further */
    Serial.println("ERROR: SD card failed to initiliase");
    while (1);
  }
  else
  {
    Serial.println("SD Card OK");
  }
  /* Check if the text file already exists */
  while (SD.exists("decay.txt"))
  {
    SD.remove("decay.txt");
  }

  /* Create a new text file on the microSD card */

  SDFileData = SD.open("decay.txt", FILE_WRITE);
  if (SDFileData)
    Serial.println("Counter is ready and counting!");
}

void loop()
{

  unsigned long currentMillis = millis();
  if (fastprint < 2) {
    interval = 20;
    timeprefix = 0;
  }
  else (interval = timeinterval);

  if (currentMillis - previousMillis >= interval) {
    previousMillis = currentMillis;
    if (stopper) {

      SDFileData.print( timeprefix);
      Serial.print(timeprefix);

      SDFileData.print( ",");
      Serial.print( ",");

      SDFileData.println( counted);
      Serial.println (counted);

      counted = 0;
      fastprint ++;
      timeprefix = timeprefix + timeprefixincrement;
    }
  }
}

void pulsecount() {
  counted ++;
}

void finish() {
  if (stopper) {

    SDFileData.print("End of count");
    Serial.print("End of count");
    SDFileData.close();
    stopper = false;
  }
}
Below is an example of the readout available by pasting the data into Excell, and displaying it in a graph.
Since the cube is down for maintenance and upgrades, I generated the pseudo decay curve by FM modulating a 10kHz pulsed signal with an exponentially falling waveform, having 9.5kHz deviation and 100 secs. decay. Sometimes an arbitrary waveform generator really comes in handy.

Udklip.JPG

The SD card module comes in various form, a shield is also available.

Cheers, Finn Hammer
User avatar
Richard Hull
Moderator
Posts: 14976
Joined: Fri Jun 15, 2001 9:44 am
Real name: Richard Hull

Re: Countdown to extacy, or: Create that activation decay graph.

Post by Richard Hull »

Great work! I understand what you did. Pin 3 is an interrupt for those who do not know. Interrupts are how I count also in my fusor GM activation system data collection. I assume each count is logged to a microsecond basis. Would granulated creep into the graph at a peak count of only 10 counts per second with an average noise floor of 5cpm. You used an almost impossible CPS rate in your simulation.

Richard Hull
Progress may have been a good thing once, but it just went on too long. - Yogi Berra
Fusion is the energy of the future....and it always will be
The more complex the idea put forward by the poor amateur, the more likely it will never see embodiment
User avatar
Finn Hammer
Posts: 298
Joined: Sat Mar 05, 2016 7:21 am
Real name: Finn Hammer
Contact:

Re: Countdown to extacy, or: Create that activation decay graph.

Post by Finn Hammer »

I do realize that this little program is trivial to anyone who can actually do programming himself, but I post it anyway to encourage those who still don't, to get on the waggon and learn coding.

I used a very high rate of virtual clicks in the sample graph, but that was just do demonstrate that the device will respond accurately to very high count rates and that there isn't an 8 bit limit to the numbers that gets recorded.

The processor is able to respond correctly to a 120kHz signal,I guess it means that the resolution is 8µS.

If I get to lower recorded counts with an uneven distribution, like the ones you show with Rhodium in the Warmup to Heas thread, this setup will reveal the same granularity. I will try to make a sample on Sunday, I think I have an idea about how to do it without the Fusor.

Cheers, Finn Hammer
User avatar
Richard Hull
Moderator
Posts: 14976
Joined: Fri Jun 15, 2001 9:44 am
Real name: Richard Hull

Re: Countdown to extacy, or: Create that activation decay graph.

Post by Richard Hull »

I do note that your work is a fast responder and good for you for doing that with the 16mhz Arduino.

The circuit I used and the software was a tiny modification of my normal GM circuit and software developed 3 years ago. I already had a moderately fast count and capture operation in the GM system. All I had to do was set "timer 1", (software library on line), to interrupt every five seconds to store that numbered count in the Arduino EEPROM (120 bytes), reset the GM count variable to zero, increment the count loop by one and count again for 5 seconds, etc. This made for 6 minutes of 5 second counts. The count stops after the loop counter hits 119 and the program returns to the "button menu"... program done and the data is locked into EEPROM.

I then hooked the USB from the UNO at any future time to my Computer, ran the Arduino IDE and dumped the 120 numbered EEPROM cells into the display of the serial monitor (line feed after each entry)
I then did a cntrl A, cntrl C to paste it to CPU computer memory. Saved this to a notepad file by going to edit in notepad and hitting "paste" Saved that file to my hard drive.
Later, I just loaded the comma delimited file into Xcel and the graph was a snap.

I do the same to get a similar background graph and average before I start the fusor. My average 5 second background is around 5 to 5.4 counts day-to-day. I have a lot of background in my lab. 260-320 cpm is the norm for a 2" pancake GM detector in my lab. I have stacked 1/2-inch lead plates all around the small block moderator that has the Rhodium wrapped GM tube in the center. This backs the count down to ~60cpm which is what it is in my front yard, outside.

I attach images of my Arduio box under the fusor platform. NOTE: My original system of 2019 gave 10 sec count totals, 60 data points. I changed this in late 2020 to 5 sec counts. 4 lines of code changed

Richard Hull
Attachments
Block diagram.jpg
Arduino counter-timer (7).JPG
Arduino counter-timer (9).JPG
Arduino counter-timer (10).JPG
Arduino counter-timer (11).JPG
Arduino panel.anno.jpg
Arduino CT annotation.jpg
Progress may have been a good thing once, but it just went on too long. - Yogi Berra
Fusion is the energy of the future....and it always will be
The more complex the idea put forward by the poor amateur, the more likely it will never see embodiment
User avatar
Finn Hammer
Posts: 298
Joined: Sat Mar 05, 2016 7:21 am
Real name: Finn Hammer
Contact:

Re: Countdown to extacy, or: Create that activation decay graph.

Post by Finn Hammer »

Richard,

You asked about granularity, here is a simulated decay from a 16000 CPM to background.

I put a piece of pitchblende (half the size of a little finger nail) next to the pancake, start the recording, and slowly removed the rock splinter further away over a period of 2.5 minutes. I take a sample every second, but that can be changed in the first line of code.
This reveals the granularity of the samples taken.

Udklip.JPG
This was a good opportunity to check the meter against actual counts, and it is in cal.


Cheers, Finn Hammer
User avatar
Richard Hull
Moderator
Posts: 14976
Joined: Fri Jun 15, 2001 9:44 am
Real name: Richard Hull

Re: Countdown to extacy, or: Create that activation decay graph.

Post by Richard Hull »

Fabulous work Finn! I look forward to your continued efforts with activation once your system is back on line. Quite often we go on hold due to issues with our fusion systems. Keeping busy with related efforts is always a good idea and usually improves our understanding via related experiment, study and development. Thanks for this interesting test with your data capture system.

Richard Hull
Progress may have been a good thing once, but it just went on too long. - Yogi Berra
Fusion is the energy of the future....and it always will be
The more complex the idea put forward by the poor amateur, the more likely it will never see embodiment
User avatar
Finn Hammer
Posts: 298
Joined: Sat Mar 05, 2016 7:21 am
Real name: Finn Hammer
Contact:

Re: Countdown to extacy, or: Create that activation decay graph.

Post by Finn Hammer »

Richard,

So true, not to mention the non-fusor related tasks which dominate the summer period.

But now I have the data collecting system for Radioactive decay fixed, the camera for remote viewing is up and running, and there is the Dataq 2108P that I have been waiting for so long, coming in the day after tomorrow. 8 channels of 16 bit data collection, that ought to do it.
Pressure, current, voltage, deuterium flow, neutron count, fusor temperature, coolant flow, and a couple of other parameters as of yet undetermined.
I feel it is prudent to establish both a remote operating facility as well as to an automatic data collecting regime, since I am not so good with log books.

Cheers, Finn Hammer
User avatar
Richard Hull
Moderator
Posts: 14976
Joined: Fri Jun 15, 2001 9:44 am
Real name: Richard Hull

Re: Countdown to extacy, or: Create that activation decay graph.

Post by Richard Hull »

I have long sought this auto run and control scenario and have little doubt that I could do it in software, certainly with an Arduino Mega ~ $27.00

However, turning over control to a microcontroller may be a risky business for the casual effort that seems so doable to the programmer. All the interfaces streaming to the controller are subject to noise.
This includes the occasional arc or High burst RF that can reset the controller CPU or jumble the programmed data causing disastrous runaway decisions based on corrupted software interpretations.

Shielding is a must, to the highest degree. Perhaps even line free, battery power for the system in control. Plug and play sounds nice until a lot of the possible control malfunctions are considered from every angle.
These considerations give me pause when thinking I am so smart and how easy it might to do this in software controlling hardware.

Richard Hull
Progress may have been a good thing once, but it just went on too long. - Yogi Berra
Fusion is the energy of the future....and it always will be
The more complex the idea put forward by the poor amateur, the more likely it will never see embodiment
User avatar
Finn Hammer
Posts: 298
Joined: Sat Mar 05, 2016 7:21 am
Real name: Finn Hammer
Contact:

Re: Countdown to extacy, or: Create that activation decay graph.

Post by Finn Hammer »

Richard,

I am designing a remote operation station, not an automatic controller. My primary goal lies in data recording, and I realize there is no merit in sitting a half meter from the fusor.
Previously, I have had to rely on gut feeling when steering the fusor towards higher neutron yield, and this has been successful, but afterwards I had trouble remembering the precise data parameter values.
I prefer to be able to report right values, and be able to back them up with recorded data if needed.

Cheers, Finn Hammer
User avatar
Richard Hull
Moderator
Posts: 14976
Joined: Fri Jun 15, 2001 9:44 am
Real name: Richard Hull

Re: Countdown to extacy, or: Create that activation decay graph.

Post by Richard Hull »

Sorry, I misunderstood, obviously. Still, It has always been a pipe dream to get the fusor working fine manually and then turn on auto-pilot and allow the system to self-stabilize and maintain operation via feedback. I just feel that with associated issues during a run, no auto-pilot could do as good a job as having a well trained pilot at the controls.

Richard Hull
Progress may have been a good thing once, but it just went on too long. - Yogi Berra
Fusion is the energy of the future....and it always will be
The more complex the idea put forward by the poor amateur, the more likely it will never see embodiment
Post Reply

Return to “Control and Instrumentation Hardware and Software”