Introduction: Build a Random Music and Light Generator and Glimpse Evidence of GOD

About: I believe that the purpose of life is to learn how to do our best and not give in to the weaker way.

Generating truly random numbers appears to be impossible. It is, however, fairly easy to use a microcontroller to generate pseudo random numbers and then use them to display sounds and different colored lights. While the music that is generated is not exactly Beethoven, it is more interesting than you might expect. I would venture to say it is more pleasant to listen to than much of what they play on the radio these days. A music generator slightly better than this, may someday replace rock stars (I am hoping).

The fact that we cannot generate true random numbers has interesting implications which are considered in step 4.

pic 1 shows the music and light generator. It is 1.3"x2.3"x.8". It plays music over a two octave range through a built in 1" speaker. A surface mount RGB LED displays a range of colors below the speaker. It runs on a 1.5 volt AAA battery.

Step 1: Music Generator Components


Pic 2 shows the random music generator top of circuit board.
Pic 3 shows the bottom of circuit board

You can see the liberal use of Liquid Tape to reduce the chance of shorting between the components.

MATERIALS

1.5 volt to 5 volt voltage converter:
http://www.bodhilabs.com/vpack5aaa1.html

08m Picaxe Microcontroller: http://www.hvwtech.com/

1 inch, 32 ohm speaker, LM-386 amplifier, switch, resistors, capacitors, .1" header sockets, RGB LED: http://www.mouser.com

On-off Switch, Plastic Case-1.3"x2.3"x.8" : http://www.jameco.com/

Step 2: Music Generator Circuit

The Circuit
Pic 4 shows the schematic of the random music generator. An 08M Picaxe controller is used to light up the RGB LED and send musical tones to a LM 386 amplifier that outputs to a 1" built in speaker.

In order to keep it small, I used a voltage converter that steps up 1.5 volts to 5 volts. It was taken from an LED flashlight that ran off of a single AA battery. If you do not mind making it bigger, you could use 3 1.5 volt batteries instead.

The video below shows you the RGB light display and you can hear a brief cut of the random music generator.


Step 3: Generating Random Numbers


It turns out that creating true randomness is very difficult. It may even be impossible. Using mathematics and computer programs to create random number generators creates a sequence of numbers that are not truly random. Because they are mathematical and from a known formula--they are predictable. They are thus call pseudo-random number generators (PRNGs). It also turns out that so far no one has been able to create a random number algorithm that does not repeat itself. It does not matter how big the program or formula, the pattern eventually begins to repeat itself. No matter how hard we intentionally try to create randomness, there is an underlying tendency towards order that asserts itself.

True random number generators (TRNGs), use electronic or environmental noise to generate the number and on the surface appear to be more random than pseudo random generators. However if we knew enough about the mechanics of the generation of such noise, we would most likely be able to predict the numbers generated. Just because we are not smart enough or perceptive enough to predict something does not make it inherently unpredictable. Such generators are also notoriously sensitive to their environment and will often pick up repetitious patterns from the environment around them (AC hum, florescent frequencies, temperature variations, etc.).

A Pseudo Random Number Program
In the program below you can see how I used the Picaxe microcontroller to generate pseudo random numbers to play frequencies over a two octave range. Depending on the number (b8) a note is picked and played for a short time (b6) and then one of seven colors is picked to light up for a short period of time. Then the process repeats itself.

TEXT OF PROGRAM:

'Random music and light generator
symbol time =b3

loop:
high 0
high 1
high 4

'readadc 1,b12
'debug b12

random w0
random w1
time=1

b9=b1+b3
b8=b9/7
pause 57

'$0C pause ,$1A,$1B
lookup b8,($20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$2A,$2B,$00,$01,$02,$03,$04,$05,$06,$07,$08,
$09,$0A,$0B,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,
$1A),b6
tune 0, time,(b6)
pause 31
lookup b8,($25,$26,$27,$28,$29,$2A,$2B,$00,$01,$02,$03,$04,$05,$06,$07,$08,$09,$0A,$0B,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$1A),b6
tune 0, time,(b6)
pause 21
lookup b8,($28,$29,$2A,$2B,$00,$01,$02,$03,$04,$05,$06,$07,$08,$09,$0A,$0B,$10,$11,$12,$13,$14,$15,$16,$17),b6
tune 0, time,(b6)
pause 11

branch b8,(p6,p3,p1,p2,p6,p3,p2,p5,p4,p5,p7,p1,p8,p2,p1,p2,p6,p3,p2,p5,p4,p5,p7,p1)

goto loop

p1: 'random pauses
low 0 'white
low 1
low 4
pause 41
goto loop

p2:
low 1 'green
pause 61
goto loop

p3:
low 4
pause 65 'blue
goto loop

p4:
low 0 'yellow
low 1
pause 53
goto loop

p5:
low 1 'blue green
low 4
pause 31
goto loop

p6:
low 0 'violet
low 4
pause 57

p7:
low 0 'red
pause 67

p8:
goto loop

Step 4: A Glimpse of GOD


In our attempts to create randomness or grab it out of thin air, it turns out to be elusive. In our everyday life we are constantly looking for and finding--patterns. What is the all pervading force that that provides order to our thoughts and patterns to the Universe?

If you stop and look, life, in all directions, is mind boggling. From the tiniest bug that can walk upside down on glass to the largest elephant that can communicate through the ground for miles, there is evidence of impeccable design. The smallest cell contains the pattern of the whole body. There are ants that can learn, fish that can fly, and birds that take care of their young. From the smallest photon to the largest sun we can catch a glimpse of a directed energy that is Immortal—a Life Force that is endless.

The evidence is right in front of you, everyday, on any scale that you care to examine. If you bother to look, you cannot help but see things designed and built by a higher consciousness than ours. Everything we design is but a pale imitation of the pre-designed. All our clever contraptions are but a subset of the master set. We are mostly reinventing what has already been invented.

A dandelion blowing in the breeze has all the essential ideas in a parachute. Round rocks roll like wheels. A tree has filters and plumbing and solar collectors. There are cameras in eyes and microphones in ears. Science is just now beginning to realize that every cell in a human body is more than just a complete blueprint of the human design, it is a microcomputer.

Imagine a network vaster than the internet with billions of microcomputers, too small to see, connected together and in constant communication electrically and chemically. That network has been designed and already exists. We call it the human body.

We are surrounded by intricate, interwoven designs. We can see designs beyond our designs—way beyond our imagination. Everywhere is intention—bounded by limits. It is no accident that it seems to be impossible to create truly random numbers. What we call random or chaos is simply an intentional pattern too long or too wide for us to see.

How can we see magnificent designs bordering on the miraculous and not believe that they were consciously designed? Can we have designs without a designer? Surely it takes more than a blind and random evolution to create the magnificence that is life. Accidental refinement does not exist. The designer is always a higher form of consciousness than the design.

Everywhere we look we see matter becoming more conscious. All around you, things are rotting, rusting, dissolving—fading in the sun. On the surface that appears like chaos—entropy. In fact, older things are constantly being melted down in order to feed the New, so that it can be reborn—improved. A rock becomes a plant, a plant becomes an animal, and an animal becomes a human. In this way does the lower become the higher and the less conscious continually evolves into a higher consciousness.

If you look at any of the parts of Creation they are imperfect. Only Perfection can be complete and the parts must always be incomplete. Even unfinished Nature has a delicate elegance that could never result merely from random evolutionary accidents. There is no evidence of an infinite shadow, yet there appears to be infinite light—a Light that cannot be destroyed. And it is of Conscious Light that we are made of. There can only be one Infinity and one Perfection. That Perfection is a Consciousness that is constantly recreating itself, while pulling us toward a higher center. That higher consciousness has most often been called God.

The Instructables Book Contest

Participated in the
The Instructables Book Contest