Dear Arnoud,
that is fantastic! I cannot wait to lay hands upon Mathematica 10. I do have a larger number of project which will greatly benefit from Mathematica 10’s new features. I had already planned to “translate” all of these programs, including the Geiger Counter to Mathematica 10. Thanks for your great input on that. I very much like that cloud export feature. That will make many new projects possible. The following post is a bit long, but the main question is:
As I said, unfortunately, I do not (yet) have access to Mathematica 10 and that’s why I have to run lots of things using SerialO. One critical thing is the rate with which Mathematica can read the serial port. This is crucial for this particular project but also for my thermal imaging camera . In the latter case I can reduce the scanning time if Mathematica reads quick enough. There is also the limit of the actual sensor though.
In the radioactivity example, it is indeed quite possible to monitor radioactivity over a rather long time period automatically and with Mathematica 10 it seems to be really quite straight forward to use the cloud and monitor everything from a distance. That is brilliant.
In my post I also tried to read in the actual event times. The Geiger counter does not provide the times, so unless I want to reprogram the chip on the Geiger Counter, I need to read it into Mathematica as quick as I can and time-stamp it. Now that crucially depend on the speed of the SerialRead and was why I tried this in the first place. The waiting times between two consecutive events is exponentially distributed and in the case of the Americanum source Mathematica fitted
ExponentialDistribution[1.15882]
The thing is that sometimes events will occur in very quick succession. The PDF is
PDF[ExponentialDistribution[1.15882], x]
The sampling rate in my example was 0.002 in Mathematica with SerialIO.
s = {}; tZero = AbsoluteTime[]; SerialRead[myGeigerCounter];
Dynamic[
Refresh[
AppendTo[s, {SerialRead[myGeigerCounter], AbsoluteTime[] - tZero}];,
UpdateInterval -> 0.002],
SynchronousUpdating -> False]
I noticed that the Raspberry Pi has problems with that because it is often busy with other things and cannot maintain that update interval. My laptop (an old one for experiments) has no problems reading at that speed if it doesn’t do anything else. Now here comes the problem. How likely is it that two events occur faster than the 0.002 seconds?
NIntegrate[PDF[ExponentialDistribution[1.15882], x], {x, 0, 0.002}]
(*0.00231496*)
If I have 22000 events I would naively expect
0.00231496*22000
(*50.929*)
So slightly more than 50 events which are too fast for our data aquisition. In my original post I observed 66 which is ok I guess. I am not sure yet, but the some of the discrepancy might be due to the actual refresh rate being slightly lower than 0.002 seconds; and also because I effectively have a >0.002 binning.
I think that one can make an Arduino sample analogue data at about 8000 times per second - see this post. This limit is bascially from the AD converter; I am currently trying to link other AD converters to Mathematica to push the limit a bit further. It would be nice to get Mathematica to read this as quick a possible.
I am really curious to see how Mathematica 10 deals with this. Could you by any chance try and see how fast Mathematica 10 can read serial reliably? That would greatly help me, because I could prepare some other projects so that they work the day Mathematica 10 comes out.
I think that in your example you read the entire device buffer, which of course, makes me see all 0s and 1s as long as I read faster than the buffer fills up. In my example I tried to read only one bit at a time and use Mathematica’s time stamp to record the event times. So if a sensor sends data quickly and does not provide times, how well can Mathematica 10 deal with that? (There is a more serious application I have in mind for this…)
Thank you very much for your post. I am very much looking forward to trying it myself on MMA10.
M.
PS: I’ll post something on the speed of data aquisition a bit later.