6950 kHz, just before 0100 UTC 2017/9/5 – heard from Florida.

Skip to content
# Blog

## Pirate radio can be beautiful

## Dichotomies: A brief and incomplete mathematical analysis

## Shrooms!!!

## Eclipse 2017

## A Walk In The Woods – The Silver Mine in Middlesex Fells

## Random Number Generation Part II – Some Data Analysis

## Random Number Generation Part I – The Hardware

## That Time When I Discovered The Earth Was Round

## Hiatus

## Lotteries and “Getting what you are looking for”

Top
6950 kHz, just before 0100 UTC 2017/9/5 – heard from Florida.

I had a another nice walk in the Middlesex Fells this weekend – just a quick one really with the dog this time. We happened to stumble upon this nice cluster of mushrooms, however. If anyone knows what species they are, I’d love to know! I have never seen such a cool cluster of mushrooms.

Oh, and this variety too was near by. Again, a huge patch, but I think slightly different species.

Update 2018/01/29:

Both of these patches of mushrooms were almost certainly honey mushrooms **( Armillaria mellea)**

So Solar Eclipse 2017 has come and gone. I managed to be outside for it – only partial here in Boston unfortunately. I put together a nice little shoebox viewer, which worked quite well. It was virtually impossible to get a good photo of it though, so no pictures. I was up Wright Tower in the Middlesex Fells where lots of others were out with a multitude of various ‘devices’ to see the partial eclipse.

So while I didn’t get a good shot of the sun being blocked, I did come home and hit up a web site with a series of satellite images of the US as the eclipse moved over the country. Below is a gif of the transit:

You can see the sun slowly rising over the western part of the country followed by a dimming of the light over Washington State and Oregon. The white splotch is presumably from the total darkness of the total eclipse area.

Most interesting is watching the speckled ‘cloud’, which looks like rising humidity as the day progresses, around the gulf of Mexico – Texas coast to Florida and up into Arkansas and Tennessee. When the totality of darkness moves through the area, this cloud disappears for a while, only to reform when it passes. Pretty cool effect!

Today I went on a nice little walk in the woods, just me and dog – like I do most weekends. Our favourite haunt is the Middlesex Fells, situated in the northern suburbs area of Boston. We’ve been going for about a year, so I have seen all seasons in the park/forest and know most of the trails quite well.

Oddly enough there is one area where I always seem to get a little lost. Not lost – lost. Just disorientated. In my own head I call this region the ‘Fells Triangle’ because I seem to lose all sense of orientation. Coincidently, this area also contains the site of an old silver mine. I’ve been looking for this mine and it turns out I’ve been looking in the complete wrong area for some time. The map of the area contains references to the old mine with a hill named for it and a path. In the picture below you can see in red the area I’ve been looking.

But it turns out it is located much closer to the reservoir, in the area circled in green. (I originally screwed this up and circled the area in blue – this is the wrong area and more proof this part of the Fells is weird and deserves its name as ‘The Fells Triangle’.) This green area is also where I always seen to get confused about where I am.

The mine is clearly labeled by the park with a sign up on a nearby tree. See below:

The flat depression in the center of this picture is actually a concrete slab that covers what used to be a huge hole dug out of the ground. Historic reports describe how workers used explosives to carve the mine but very little silver if any was ever found. I also recall reading how the miners used lots of water and since the location of the mine is closer to the reservoir waters, this all makes a lot more sense. There are also a number of concrete poles that are erected around it and look like they once carried planks of wood designed to keep people and/or animals out. The concrete slab is square and now well covered by nature’s debris and time:

I can only imagine how they managed to place this here. The concrete is reinforced with steel bars, which can be seen in a small hole that is in the center of the slab. The hole looks like it has been dug out by curious hikers who wanted to see into the remains of the mine:

There seems to be water at the bottom. I dropped some sticks into the hole and after a considerable time I heard it splash. I would estimate the depth to be more than 10 meters or the height of a three story building.

What possessed people to think there was silver here? Or anything of use? When I hit the ‘net’ looking for information on the Silver Mine I could find very little information. Now I’ve found it its tempting to hit google again and see what more I can find out. The whole thing just seems like an odd enterprise.

On the way there and back there was a number of wild flowers out. This time of year is great for hiking. The weather is starting to cool off, and like today the humidity can drop down quite a bit here in New England. But the summer flowers persist and look so much better in the less harsh light this time of year. I’ll post some pictures below. I have no idea what these flowers are or what the plant name is. I’ll try and figure it out and edit this post.

If you know more about the mine in the Middlesex Fells or the names of these flowers, feel free to drop me a line.

Cheers,

Scott.

Following on from my last post, I’ve been trying to read the voltage values that are generated from the random number generator I put together. I was initially using an arduino unit so I could control the voltage output down to below 1 volt. Ultimately I want to read the values with an ESP8266 unit running micropython so I can upload the values to an internet based data logger and the ESP8266 is only 1 volt tolerant on its analog-to-digital pin. So, the voltage has to be controlled and I didn’t mind blowing up one of my arduinos (which are 5 volt tolerant). The voltage divider is now composed of a 10k resistor from positive rail to analog out and a 1k resistor from analog out to ground.

The ardunio was giving me readings up to about 180 unit out of 1024 which gives about 180/1024 * 5V = 0.8789 volts… nice and safe.

Reading these voltages with the ESP8266 gave some interesting results. The code to do this was very simple:

from machine import ADC import time adc = ADC(0) # create ADC object on ADC pin for i in range(1000000): print(adc.read(), end=',') time.sleep_ms(10)

This reads a voltage every 10 milliseconds from the analog pin and reports one million of them. It took about 2.8 hours and the output was redirected to a file of type csv with this command on my mac:

`ampy --port /dev/tty.SLAB_USBtoUART run readanalog.py > avalanche_noise.csv`

‘ampy’ is a nice program from Adafruit, which you can learn more about here.

I then analyzed this data in python using the jupyter web interface. A histogram plot of the values looks like this:

The values range from 135 to 674 with a mean of ~292.6. This distribution is obviously skewed too so it’s not gaussian distributed – maybe Poisson? But the most striking thing is the lines of empty space (no blue) – is this a plotting problem or are certain values skipped during the reads? Well lets zoom in around the top of the distribution.

So its true, some values are just never recorded. Its hard to believe the voltages from the circuit would do this. Also, its clear from the numbers that every 12th value is skipped. I think this must be an error in the way micropython reads the register so I’ll probably post this somewhere in the micropython forums and see if this is true or if I’m just doing something wrong.

Next I tried to fit this distribution to a gaussian curve. It failed. Here is the python code:

import math import numpy as np import matplotlib.pyplot as plt import scipy as scipy import scipy.stats as stats from scipy.optimize import curve_fit from scipy.misc import factorial from scipy.stats import norm %matplotlib inline # needed for plotting in jupyter data_p = data # not really needed fig = plt.figure(figsize=(20, 8)) entries, bin_edges, patches = plt.hist(data_p, bins=(int(np.amax(data_p)-np.amin(data_p))), range=[np.amin(data_p),np.amax(data_p)], normed=True) bin_middles = 0.5*(bin_edges[1:] + bin_edges[:-1]) # poisson function, parameter lamb is the fit parameter def gauss(x, *p): A, mu, sigma = p return A*np.exp(-(x-mu)**2/(2.*sigma**2)) # fit with curve_fit p0 = [1., 260., 30.] # initial guesses for height, mean and SD parameters, cov_matrix = curve_fit(gauss, bin_middles, entries, p0 = p0) print parameters # print results print np.sqrt(np.diag(cov_matrix)) # print errors of fit # plot poisson-deviation with fitted parameter x_plot = np.linspace(0, np.amax(data_p), 1000) plt.plot(x_plot, gauss(x_plot, *parameters), 'r-', lw=4) plt.show()

Output:

This doesn’t fit very well. But it does reveal the skew present in the data. It does in some ways look poisson distributed (you can read more about this distribution here) and electrical noise is typically poisson distributed because of the discrete nature of electrical charge (read about this and shot noise here).

**Mathematical aside:**

One way I like to think of the Poisson distribution and Poisson processes is as follows. They arise from discrete events that must always have a positive value – this is not true for Gaussian distributions. So, in our circuit, current (electrons) flow or do not flow. When they flow, a discrete (integer) number of them flow. There is a lower limit on the number that can jump the gap. That number is zero. The gaussian distribution is the limit of a binomial distribution as the number of events goes to infinity. The binomial distribution is based on the idea that an event either happens or does not. (N.B. this is different from the Poisson case because in that case, events either happen 1 or more times or do not happen). If we accumulate binomial events, there is no limit to how many ‘yes’ or ‘no’ events can happen so some of the distribution must extend as far as the number of events recorded – for gaussian this limit goes to infinity and negative infinity. The Poisson distribution doesn’t act this way. If we try and model the Poisson distribution as an infinite binomial distribution we quickly realize that while we can get an infinite number of ‘zero value’ events as well (with low probability) there is more than one other alternative. So the distribution must take into account these many possible values which stretches the distribution in the positive direction while there is a still a hard limit at zero. We can shift the Poisson distribution so ‘N’ zero-value trials will be plotted at ‘-N’ (like we would for a binomial distribution) but on the positive size, the curve would extend past ‘+N’ because some of those trials can have a value of more than 1.

Enough qualitative description of distributions…

Using a poisson function instead like this:

def poisson(k, lamb): return (lamb**k/factorial(k)) * np.exp(-lamb)

and we get this:

It doesn’t converge at all.

Yikes, whats going on?

Well my thought was that the numbers I’m reading don’t match the number of electrons actually flowing. This signal is amplified by the transistors and then quantized, not in nature, but by the ADC converter in the ESP8266. My hope is that this signal is proportional to the number of electrons that flowed during signal acquisition. But this signal is not the same as the number of electrons which will be behaving as a Poisson process. But the recorded numbers should be proportional to the number of electrons. So if we divide these values by some constant, can we get the fit to work, and at what optimal division factor.

Long story short, if I divide the 1000000 million points by 23.9 I get an optimal fit in terms of the error reported for the fitted parameter. That parameter, which is the mean value, is ~6.558336. Does this mean, that on average 6.5 electrons pass through the transistor while the ESP8266 is taking an ADC measurement? I think it might be! Here is the fit:

If I take these same numbers and try and fit a Gaussian curve, it doesn’t do as well.

**Conclusions?** The electrons that flow across the junction in reverse bias are behaving as a **Poisson process** as expected. **The distribution is not flat. **I’ve seen some discussion on the net where people seem to assume this would be the case. **It does seem to be random! **One of the next steps is to convert these numbers to a flat distribution or at least make it generate a binary sequence. It seems to be that XORing or Von Neumann filtering will not do a good job of removing the biasing that the Poisson distribution will introduce.

**Intro:**

The notion of randomness has consistently intrigued me, so I have always wanted to build a random number generator and play with it. Just how easy is it to generate truly random numbers as opposed to pseudo-random numbers? First of all, pseudo-random numbers are based on an algorithm so computationally they are easy to generate but also easy to copy or determine the nature of the sequence. They also ‘repeat’ their pattern eventually, even if the repeat cycle might be very large. No, no, no. I want to generate random numbers from an unpredictable natural source such as radioactive decay, cosmic rays, radio noise or ‘avalanche noise’ (hint: not the noise of snow falling down a mountain).

**The Source:**

In short, avalanche noise is the noisy current flow when a diode is reverse biased (voltage applied the wrong way), once that voltage is high enough to make electrons jump over the semiconductor gap the wrong way. The nifty thing is transistors have these diode junctions and so current can flow, for example, from the base to the emitter in an NPN transistor once it is reverse biased with high enough voltage. So what many circuits do to generate random noise is set up a transistor in this way, and then amplifying the current that flows, which for ‘quantum energy gap’ reasons is noisy.

**An Example Circuit:**

Browsing the net I came across Rob Seward’s attempts at doing this and set up his circuit since I had all the components on hand. The circuit is below:

This is my understanding of this circuit: Here, Q1 is reverse biased with 12 V of EMF via the 4.7k resistor. Q2 is forward biased and so it should conduct with a small voltage drop (~0.9 V) across its base to emitter junction so the reverse bias in Q1 is actually ~11.1 volts through the 4.7k resistor. This should be enough to jump the gap as outlined in this great summary of this phenomenon by Giorgio Vazzana. If current randomly jumps the gap in Q1, this current will flow into the base of Q2 where it will be amplified by a common emitter setup and passed into the 0.1 uF capacitor. These spikes in current will pass through the capacitor and into the base of Q3, which is highly biased by the 1.5M resistor. I think whats going on here is this transistor is set up to be a switch – this high bias turns the collector to emitter current essentially off, so any current that flows into its base will turn it on. Thus a voltage appears at its collector (its also in common emitter mode). This voltage is divided by the two resistors of 10k and 4.7k and presented as an analog out signal.

I put this together and applied the analog out and a ground to some earbuds I had lying around. Faint noise!

I quickly wired up an arduino to take sample measurements of the voltage via an analogRead(). The values were peaking out at around 260 out of 1023 where 1023 would be a voltage of 5V. So Im seeing peak voltage here of about 1.25V. Ultimately I want to read these voltages with an ESP8266 unit or a raspberry pi which can only safely sample an analog voltage of 1V so I needed to play with the voltage divider. I’m not entirely sure why this works but I replaced the 10k resistor with a 22k resistor and the 4.7k resistor with a 10k resistor, which in turn dropped the analog reads to maximum reads of about 110 – or a little over half a volt. This is nice and safe.

The code I used for the arduino is here:

```
/*
Read analog signal on pin A0
```

*/
const int analogInPin = A0; // Analog pin that noise is fed at
int sensorValue = 0; // Inital sensor value
int low = 30; // Set a low value to be surpassed
int high = 40; // Set a high value to be surpassed
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
}
void loop() {
// read the analog in value:
sensorValue = analogRead(analogInPin);
// if value is higher than ever recorded, lets note it
if (sensorValue > high) {
Serial.print("high: ");
Serial.println(sensorValue);
high = sensorValue;
}
// if value is lower than ever recorded, lets note it
if (sensorValue < low) {
Serial.print("low: ");
Serial.println(sensorValue);
low = sensorValue;
}
// wait 2 milliseconds before the next read
// thats 500 samples per second
delay(2);
}

**Whats next:**

The next step before making an extensive set of analog reads is to add an OP amp so I can drive a speaker and listen to the noise out loud and make some recordings for here. Until then…

A quick heads up (I have a cold and sound awful):

The recent flare up between rapper B.o.B and Neil DeGrasse Tyson over earth curvature has been interesting to watch. A nice summary can be found here (NPR link). B.o.B asserts not only that the earth is flat but that there is also a NASA coverup. It’s not clear why there would be a coverup.

So lets unpack this a bit. The tweet below is what set off the whole thing:

https://twitter.com/bobatl/status/691411463051804676?ref_src=twsrc%5Etfw

First, lets explain why our perceptions can be mistaken. B.o.B asks, “Where is the curve?”. Well it is right in front of his eyes but over a distance of 16 miles it is not perceptible. Sixteen miles is only about 0.064 % of the earths circumference (if you believe it has a circumference) which means there are over 1500 more of these distances in the great circle that includes these two cities. Now, imagine you cut a pie or an orange 1500 times, pull out a single slice and looked at its edge. How much evidence of the original curve do you think you will see? This is a classic mistake where we think we are seeing everything we need to see. And ‘seeing is believing’. ‘Our eyes are never mistaken’. This is wrong. And there is a litany of optical illusions on line that can demonstrate this. A classic is the straight lines that look bent.

It’s a different phenomenon but it illustrates the problem.

Another tweet B.o.B put out appears to be a from a list of reasons why the earth is flat. No doubt from a very trusted online source.

https://twitter.com/bobatl/status/691625693717893121

This contains a lie and demonstrates that the earth is curved, all in one poorly thought out argument. To begin, you can’t see Polaris 20 degrees South. But thanks for using a curved metric (what does 20 degrees mean if the earth is flat?) to prove the earth is not curved. Polaris is about 2 degrees off the Northern Pole so Polaris is visible from the Southern Hemisphere so long as you are very close to the equator and not too far south into the Southern Hemisphere. Any further south than Nairobi in Kenya and it does indeed never rise above the horizon.

So I guess Barak Obama never saw it either until he moved to the US. Yes, that is how dumb this all sounds.

Now lets get personal. I know all this about Polaris because I was born and grew up in the Southern Hemisphere. I never saw Polaris until one day I moved to the US. One of the first things I did was go out at night and look up at the night sky and look for all the constellations I had been told about but could never see. Heh, maybe I had been lied to. Think of it from my perspective. Time and again, we of the Southern Hemisphere are told how to find north by using the Pole Star and how to find it using the ‘Big Dipper’ (North American media is strong – it’s not called the big dipper anywhere else). What utter crap! There is no Big Dipper, no Pole Star! From my 33 Degrees South location, none of this is visible. But I could see the Southern Cross and the Magellanic Clouds, neither of which can be seen from most of the Northern Hemisphere and certainly not Atlanta (just saying).

These things are real, but you have probably never seen them for two reasons. 1) You probably have never heard about them and 2) You are probably from the Northern Hemisphere (see first reason) and the earth beneath you makes you point in the wrong direction to see it… because the earth is round. Just like it is impossible to see the Pole Star from the Southern Hemisphere. This is how I knew for sure the earth was curved – not that I ever doubted it but it was amazing to have it demonstrated. It was mind blowing and humbling. The Pole star was there, but my Southern Cross was gone. It hadn’t just been moved further down in the sky (like if the earth of flat)… it was gone!

So this is the fundamental problem. Our perspective can be so limiting some times its hard to think outside it. It’s easier to accept our small world view and assume a conspiracy of lies:

https://twitter.com/bobatl/status/691420354699354113

For what purpose? Doesn’t matter. We just assume we can’t be mistaken.

And that is so damn arrogant. The realm of twitter feeds.

Hiatus is over…

`<stream of consciouness>`

My last blog post was way back in February 2014. Thinking back now its obvious to me why I stopped blogging here then. My life took a serious detour. Truth be known I have been blogging elsewhere – a far more personal (and anonymous) blog. The problem with anonymity is the posts are disconnected from a person. I don’t own them the way I would like. And while I have my reasons for having a anonymous period, that writing can’t be fully integrated into who I am. Here (this blog) I am who I am. Science weirdo. Sometimes obsessive. Mostly completely ignoring this place.

So this is why I’m back here. Well other reasons too. Reason the first) I think I have something to say and I think I should communicate that. Reason the second) I still have lots of technical things I like to explore and discuss. But from time to time I will incorporate less technical topics and perhaps more personal topics into this blog. Well, we’ll see how that goes.

`</stream of consciouness>`

Life goes on. You still get to score a goal from time to time. And you never ever stop learning more about yourself.

I came across a review/excerpt in Scientific American for a new book called “The Improbability Principle: Why Coincidences, Miracles, and Rare Events Happen Every Day”. This article has an excellent description of how seemingly impossible events can and do take place all the time.

The major point of the excerpt was that some events like finding people with matching birthdays can be a rare event or a common event depending on what you mean by a matching event. In a room of 23 people there is about a 6% chance one of them will share a birthday with you, but a greater than 50% chance that two of the 23 people in the room will share a birthday (see a description of the birthday problem here). An intuitive explanation for this is when you’re looking for someone who shares your birthday you have limited the possibilities – they must match* your birthday* – but when we allow *anyone* to match *any other person*, the possible number of combinations of people matching birthdays goes up a lot. So its a lot more likely. The maths for this is at the above link. I don’t need to repeat it here. The point is, a subtle change in the question can have big consequences for the answer.

The excerpt then goes on to talk about the Bulgarian Lottery coincident that occurred in 2009. In one draw, the winning numbers were 4, 15, 23, 24, 35, 42. “Amazingly” the next draw, the same numbers again. There was outrage with people calling the draw rigged and there was even a full government investigation. As an aside, if you could rig the draw why would you repeat the numbers? Seems silly to do that. Why not just rig the draw with some other numbers? Anyway…. the question is, how surprised should we be that this happens at all?

The Bulgarian lottery is a 6 number draw from 49 numbers. So the probability of getting the right numbers is 1/(49!/(6!*43!)) or one in 13,983,816. Once you have a particular set of numbers the chance that any other specific draw will have the same numbers is one in 13,983,816 – its the same as picking the numbers in the first place. This seems like a pretty unlikely event. But this is like finding someone who has the same birthday as you. You are trying to match one specific draw to another. What happens when you have many draws and you are trying to find a match between any of those two draws? The Bulgarian lottery has been going on for a while, so there have been many draws and so the chances that a match would happen among all these draws is much less amazing. For example, among 50 draws there are 1,225 ways we could match 2 of the draws. Quickly, the number of ways to find a match goes up and as a result the probability of a match happening goes up as well.

Now some skeptics might say, “But this was two draws in a row!!! Not a draw this week matching a draw from 5 years ago. This is very special because of the serial way in which it happened!”. I felt this objection was glossed over in the SciAm excerpt. Thinking that the consecutive nature of the draws is *special* in this case is thinking about it all wrong. Actually its *thinking yourself into *the special circumstance. You are saying that the two draws in a row is a special thing. But this is the same as finding that one person who matches *your birthday*.

Another way to think about this sort of thing is to consider the following. Instead of drawing 4, 15, 23, 24, 35 and 42, imagine the lottery drew 1, 2, 3, 4, 5 and 6. Would you think this was amazing? Rigged? Would it be all over the internet and in all the papers? Yes it would. But is it any more unlikely than 4, 15, 23, 24, 35 and 42? No, its not. They have the same chance of happening… one in 13,983,816. The only reason it would be considered special is because the numbers are consecutive. By why is that any more special than starting at 4, adding 11, adding 8, adding 1, adding 11 again and then adding 7? Its only because of the value placed on consecutive numbers by our minds. We humans would say consecutive draws has more meaning or is more special than one draw matching a draw from 5, 10 or 15 years ago. In terms of random events neither is more special than the other.

Your perspective influences your expectation, but not reality. Uncommon things will still happen all the time, just not the sort of uncommon things *you* might expect to happen.