spenceraxani / CosmicWatch-Desktop-Muon-Detector

OUTDATED! Please do not use this repository for building new detectors. This repository if for the supplementary material used to build the Version 1 of the CosmicWatch Desktop Muon Detectors
59 stars 21 forks source link

About 280 counts per minute is displayed even with nothing else connected #3

Open mbanders opened 6 years ago

mbanders commented 6 years ago

Good news is we successfully installed the needed arduino libraries and uploaded the Arduino_Code.ino code to a nano, and then connected the oled screen. I hope this image shows up:

img_2064

Nothing else is connected except what is shown - an Arduino Nano and the OLED screen - and we were suprised to see it displays an incrementing "Total Count" of about 200 or so per minute. Is that expected? I would have thought that the curve fit to random noise wouldn't have triggered a hit.

spenceraxani commented 6 years ago

Hi,

The Arduino is monitoring the A0 analog pin, and when it sees the ADC value go above a certain threshold, it counts it as an event. What’s happening right now, is that the A0 pin is left floating and picking up stray EM radiation. The value on the ADC will be all over the place and randomly trigger. Once you plug something into A0, this won’t happen. The rate on the OLED screen seems strange though, 298 counts in 70 seconds should be something like 4 cps.

I’ll have a look at the code to make sure it’s up-to-date.

Thanks,

Spencer

On Dec 13, 2017, at 3:52 PM, Mike Anderson notifications@github.com wrote:

Good news is we successfully installed the needed arduino libraries and uploaded the Arduino_Code.ino code to a nano, and then connected the oled screen. I hope this image shows up:

https://user-images.githubusercontent.com/4564080/33963506-c222d7be-e01a-11e7-9ba3-a6afedba5f67.jpg Nothing else is connected except what is shown - an Arduino Nano and the OLED screen - and we were suprised to see it displays an incrementing "Total Count" of about 200 or so per minute. Is that expected? I would have thought that the curve fit to random noise wouldn't have triggered a hit.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/spenceraxani/CosmicWatch-Desktop-Muon-Detector/issues/3, or mute the thread https://github.com/notifications/unsubscribe-auth/ABpeuwEx0UrWZthS12tv5NOfnamNGD95ks5tAEcbgaJpZM4RBO1z.

mbanders commented 6 years ago

I see, interesting. So if I read the code correctly, if the voltage on A0 ever goes above 25 mV, it triggers and counts it as a muon hit?

In my original reading of the website where it says,

Arduino samples the decaying pulse and uses this information to calculate the initial pulse amplitude

I thought the code sampled A0, then did a linear fit to find the slope and offset. Then if the slope was negative and the offset positive above a threshold, it would trigger and count it as muon hit. Which is why I originally thought random noise on A0 wouldn't have triggered.

spenceraxani commented 6 years ago

Hi,

The version of the detector that you are referring to triggers if a sample is above 25 ADC counts (not 25mV). It can be changed within the Arduino code, but if you go too low, you will begin triggering on noise.

The linear fit has been removed to save on flash storage space and SRAM. Currently, we simply sample the pulse amplitude (I think 5 times in this case) and take the average value, then convert that average ADC value to a SiPM voltage through the calibration array (shown as cal[] in the code).

The A0 port continuously monitors the the waveform. If any sample on A0 rises above the set threshold, it will trigger the detector to begin measuring and record it as a hit. We then monitor A0 until the pulse decays away.

Thanks,

Spencer

On Dec 13, 2017, at 10:20 PM, Mike Anderson notifications@github.com wrote:

I see, interesting. So if I read the code correctly, if the voltage on A0 ever goes above 25 mV, it triggers and counts it as a muon hit?

In my original reading of the website where it says,

Arduino samples the decaying pulse and uses this information to calculate the initial pulse amplitude

I thought the code sampled A0, then did a linear fit to find the slope and offset. Then if the slope was negative and the offset positive above a threshold, it would trigger and count it as muon hit.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/spenceraxani/CosmicWatch-Desktop-Muon-Detector/issues/3#issuecomment-351604591, or mute the thread https://github.com/notifications/unsubscribe-auth/ABpeu90hvu_m1mo7VtRO0VtKr5uJUT8dks5tAKIOgaJpZM4RBO1z.

mbanders commented 6 years ago

if a sample is above 25 ADC counts (not 25mV) ...

I see now, and according to the doc for analogRead() it is 4.9 mV per unit. So 25*4.9 mV = 122.5 mV is the threshold for triggering.

spenceraxani commented 6 years ago

Hi,

The 4.9mV per unit comes from dividing the range of the reference voltage by 1024 (10 bits). In our case, the reference voltage is about 4.6V, so the division is closer to 4.5 mV per unit. This puts the threshold for trigger at about 112mV. However, the A0 pin is monitoring the peak detector circuit, if you converted a 112mV in the peak detector back to original SiPM pulse amplitude, you would see that we are probably triggering on something like 12-15 mV SiPM signals.

Thanks,

Spencer

On Dec 14, 2017, at 9:58 AM, Mike Anderson notifications@github.com wrote:

if a sample is above 25 ADC counts (not 25mV) ...

I see now, and according to the doc for analogRead() https://www.arduino.cc/reference/en/language/functions/analog-io/analogread/ it is 4.9 mV per unit. So 25*4.9 mV = 122.5 mV is the threshold for triggering.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/spenceraxani/CosmicWatch-Desktop-Muon-Detector/issues/3#issuecomment-351752770, or mute the thread https://github.com/notifications/unsubscribe-auth/ABpeu5lxS4wvw03673PSqJ7PUSU5-oXEks5tAUW3gaJpZM4RBO1z.

mbanders commented 6 years ago

In our case, the reference voltage is about 4.6V ...

The documentation for analogRead() mentions, "The input range and resolution can be changed using analogReference()", but the file Arduino_Code.ino makes no call to analogReference(). So where is the reference voltage being set? Otherwise it just uses the default of 5 V.

spenceraxani commented 6 years ago

The default is 5V if you are supplying the Arduino with greater than 5V, say from a power adapter at 12V. Since the USB port puts out almost exactly 5, the actual reference voltage will be lower (about 4.6V).

On Dec 14, 2017, at 10:38 AM, Mike Anderson notifications@github.com wrote:

h

mbanders commented 6 years ago

I see, just an unwritten subtlety of the board. Thanks for anwering questions, we appreciate it :)

spenceraxani commented 6 years ago

Just to update my comment above, the smallest pulses that this version triggers on is a SiPM pulse roughly 18-19mV, with the threshold set to an ADC value of 20.

I just updated the Arduino code with a new calibration and some of the code for the OLED. It should fix the rate issue that I mentioned above.