Lab2PinkNoise
Motors
We have two fancy motors with quadrature encoders:
These motors have a replacement value of $150, so please be nice to them.
These should be used for the proportional-derivative control problem, because they have integrated encoders.
The black and red wires go to the motors. The other 4 wires go to the encoders.
The encoders require a logic supply. Here is a data sheet on the encoders.
The pinout for the encoder is in the data sheet, but here are the important details:
Note: Orienting the board with the network jack on the left side, pins 12 and 13 are on the DIGITAL IN pin header along the bottom of the board, and the motor +5 and ground connections are along the right side.
white ground wire to bottom row of pin 12 orange channel_A wire to top row of pin 12 green +5 volts wire to middle row of pin 12 blue channel_B wire to top row of pin 13 red motor +5 wire to motor 0 +5 black motor gnd wire to motor 0 gnd
There is a good page on PID controllers here
White Noise and Pink Noise Generation
Here is a wikipedia entry on white noise and another on pink noise.
Basically, it seems that white noise has constant power across all frequencies in the spectrum, and pink noise has constant power within each octave of noise. Also, it seems there is no way to generate pink noise, but only to derive it from white noise by filtering. White noise is something like the static on a TV not tuned into a station, like a shhhhhhhhh noise.
We've tried two ways of creating white noise so far, but not sure whether either is correct.
The first way is to create sine waves for all frequencies in a range, say 100Hz to 20000Hz and add them together. This comes out looking good on the scope but doesn't sound quite right.
The second way is to continually generate random samples and play them, which sounds better but doesn't look so good on the scope. This works opposite of what we needed to do to get sound working in the last lab, i.e. you need to put Play_Sound() inside a while loop this time. It seems that generating a short sample of random numbers (noise) and then looping it doesn't achieve the white noise we want. It would probably work better if we could generate a second or two of noise and then loop it, but we can't make arrays that large (48000 samples/sec, 2 channels = 96000 samples at 4 bytes each = 375Kb) or the project won't link.
Please post more progress here as things are discovered, and correct any of the above information if it's way off the mark.