Brown noise sleep machine

Here’s my fantabulous sleep machine, so far:

brown

I haven’t finished painting it, squaring it off, or adding some mesh to protect the speakers.

As a first step, let’s build a white noise generator. You can find electrical circuits online (or here) to do just that. I opted for something simpler: using a MCU (microcontroller) to generate random on-off signals to generate the white noise. I used an ATTiny85 in my circuit, which is a nice, cheap MCU. It is overkill for the task, but the chips are cheap, and it is what I had available. An Arduino Uno would be excessive overkill for the project, but you can use it if you want to experiment. I found RS Components to be a great supplier, where the chips cost about £1. You could use cheaper chips like the ATTiny45. The 85 cost just a little more than the 45, but will give you more breathing space for your projects. Really, most chips will be up to the task for what this project needs it for.

The code for the Arduino IDE is as follows:

const int SPK = PB1;// Pin 6
void setup() {
  pinMode(SPK, OUTPUT);
}

void loop() {
  digitalWrite(SPK, random(2));
}

The code is so simple that you should not have any problem adapting it to your MCU.

Here is the schematic:

white_schem

Here are the components I used:

  • R1: 100K ohm potentiometer. This was really too much for what I wanted. I would recommend that you try to 1K pot, and see how that suits you. If the volume is still too loud, then maybe try a 10K pot. If the volume is too low, then try a lower pot.
  • D1: 1N4148 diode. This is a pretty common diode. Many diodes are likely to be suitable. At a pinch, you can omit the diode, but I advise you to use one if you have one. It acts as a flyback, a protective measure to against voltage spikes caused by inductive loads, in this case the speaker.
  • SPK: 4 ohm 5W speaker. This is quite large, and probably overkill. Just use whatever speaker you have at hand.

Instead of sticking slavishly to my specs, feel free to experiment. There is considerable scope for using other components. Do not over-fuss your design at this stage, because producing Brown noise will change it.

Note that I have used 5V as input. You might feel happier using 3.3V, but note that it will affect you choice of potentiometer and maybe speaker. Although the specs for the ATTiny85 say that it takes 3.3V input, I found that it was 5V tolerant. You have to be careful with voltages going in an out, as it possible to wreck the chip if you do things in a bad way. The ’85 was perfectly happy with my particular setup, though. I have accidentally abused ’85 chips in the past, and they have shown themselves to be quite robust little chips.

White noise has equal intensity at equal frequencies (Wikipedia). This sounds tinny and harsh to humans. The problem is due to the high frequencies. In order to produce a more pleasant sound, we need to attenuate those high frequencies. This is called a “low pass filter”.

Fortunately, there is a very easy way to do this: add a capacitor. We won’t produce the exact Brown Noise frequency response, but our results will be perfectly adequate for our purposes. We have thus created an RC circuit. A schematic of the intensity output of a resistor-capacitor at a given frequency looks something like this:

lpf

Compare this with proper Brown noise (as might be generated by Audacity):

brown-freq-audacity

Our modified circuit looks as follows:

brown_schem

It is basically the same setup, except that an electrolytic capacitor C1 has been added. I found that 100uF to be suitable. If the output sounds too tinny, which I think is unlikely, then increase the capacitance.

As you increase the capacitance, the output volume will go down. So you might try experimenting with a lower capacitance and potentiometer.

I hope you found this article useful and get a good night sleep as a result.

Update: This post is being discussed on Reddit.

About mcturra2000

Computer programmer living in Scotland.
This entry was posted in Uncategorized. Bookmark the permalink.

2 Responses to Brown noise sleep machine

  1. enno says:

    Works perfectly. Thank you very much. Exactly what I was looking for.

  2. Pingback: #rakulang Puttering about with digital signals | Mark Carter's blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s