How to generate noise (White/Pink) using an 8-bit Microcontroller?

Software code to generate White or Pink Noise at an output of an 8-bit microcontroller (bit stream or PWM). How?

Answers:
You can generate "pseudo-random" noise in an 8-bit micro using a linear feedback shift register. A shift register of length 8 can generate a sequence that is pseudo-random but repeats every 255 cycles, so the sequence it generates is not perfectly white. Longer shift registers, however, will generate more nearly white noise. Longer registers can of course still be generated by an 8-bit micro if you use several bytes to contain the shift register and use the carry to take the shifted end bit from one byte in the register to the next. Generally speaking, if you choose the right feedback term, sequences of length 2^N-1 can be generated, where N is the number of bits in the register. One practical point - the register should be initialised to any value except all zeros, which will simply generate a string of zeros! The link below gives more details.
Flicker noise is a type of electronic noise with a 1/f, or pink spectrum. It is therefore often referred to as 1/f noise or pink noise, though these terms have wider definitions. It occurs in almost all electronic devices, and results from a variety of effects, such as impurities in a conductive channel, generation and recombination noise in a transistor due to base current, and so on. It is always related to a direct current.

In electronic devices, it is a low-frequency phenomenon, as the higher frequencies are overshadowed by white noise from other sources. Flicker noise is often characterized by the corner frequency between the regions dominated by each type, which is usually below 2 kHz.

Flicker noise is found in carbon composition resistors, where it is referred to as excess noise, since it increases the overall noise level above the thermal noise level, which is present in all resistors. In contrast, wire-wound resistors have the least amount of flicker noise. Since flicker noise is related to the level of DC, if the current is kept low, thermal noise will be the predominant effect in the resistor, and the type of resistor used will not affect noise levels.
Don't use an 8 Bit microcontroller. PWM stands for "pulse width modulation". Its used to control things. The clue is in the name "8 Bit microcontroller". If you want to create white or pink noise just buy or make a really low quality pre amp and totally overdrive it. Or try this web address http://world.std.com/~reinhold/waynesrng.

The answers post by the user, for information only, UKQnA.com does not guarantee the right.

  • Why can't water be compressed?
  • how do i make a magnet?
  • how much electricity produces one hydroelectric turbine in one day and how many liters it needs?
  • what does e=mc2 mean?
  • Why are we referred to as being in the West by Eastern countries when the worlds round?
  • Are all squirrels nutters?
  • If nothing can come from nothing then what did the first thing come from?
  • How is 5.53 x 10squared a ratio?