"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;
}
}
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.
The SD card module comes in various form, a shield is also available.
Cheers, Finn Hammer