Arduino noise generator

Noise generator

This noise generator has simple sketch, but lot of fun. Also, source of noise for acoustic experiments.

noise

// random noise on desired pin
// another noise mixed with first one 
// to get maximum output-loudspeaker
// between that two pins give the maximum
// output power. Make paper trumpet to get
// directed sound, and you have 
// "noise from the hell" :D

                           
void setup() {
  pinMode(6,OUTPUT);
  pinMode(7,OUTPUT);
}

void loop() {
digitalWrite(6,random(2)); 
digitalWrite(7,random(2)); 
}

In the example above, I am using already “populated” breadboard with lot of wires – you may chose any two pins and declare it as output. Then use simple instrucion: digitalWrite(pin1,random(2)); or in the case you want single pin and ground, make it with just one command.  Or, you can use say 6 pins, connect in series 10 kOhm resistor, and connect from all 6 pins to single point and feed into audio amplifier as needed. Example above using passive piezo speaker, without oscillator inside. It is possible to use active one, but it has oscillator at about 2.6 kHz, so this frequency will dominate. Or some “normal” loudspeaker. Arduino has overcurrent protection, so you are safe. Even AttinyXY (for example Attiny85) can work with this code. Just need way to program it.

Make trumpet for more acoustic power

As old gramophones has – small or big trumpet to get more acoustic power out of such small loudspeaker. Also, play with numbers, and instead both random numbers of 2, put in both parenthesis 255, you will get noise that resembles Geiger counter. 😀

Science and more

%d bloggers like this: