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

Picture of Build a Random Music and Light Generator and Glimpse Evidence of GOD

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

Picture of 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

Picture of 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

Picture of 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

Picture of 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.

Comments

Ploopy (author)2014-07-27

Cool!

Dave Kruschke (author)2014-07-07

I sure wish that the author would have posted some history and info about the schematic used. I'm particularly interested the purpose/theory behind the parts that connect Leg 5 of the Pic to Leg 3 of the 386...

botronics (author)2011-11-08

Does anyone have a video of it in action so e can hear hat it sounds like?

legionlabs (author)2010-02-20

If there is a higher consciousness which designed the universe, I would like to give it a good stern talking to about proper engineering practices (not to mention documentation).

Humor aside, I built an actual random number generator a while back. It uses a shielded particle detector to sample the impact of helium atoms originating from a radioactive source. The full engineering specifications are available at your request. If you want to try and prove your hypothesis that there is no randomness, I have just over 100 megabits of data you can have if you want.

I'd be happy to give it to you and let you see what you can find. That's science, right?

I'll be honest: I've already run extensive statistical tests on it and it passed every one I can throw at it. It's random so far as I can tell, as predicted by current knowledge of quantum physics.

Also: Praise Eris.

fastlines49s (author)legionlabs2011-09-27

Woot for the absolute randomness of quantum physics!

marc_is_curious (author)2011-07-17

Am totally new to Picaxe
a Mac (hence MacAXEpad ) User
and
just tried to look at the code
receiving the message "error: loop without Do" message -
this happens with a lot of other PIcaxe script
which i downloaded too,
hence it must be me
who "does smthng wrong" -
may you please provide a hint
on this (for an absolute newbee)?

i look forward to your reply!

mikey77 (author)marc_is_curious2011-07-17

Most likely the problem is loop: and goto loop.

If you change loop: to loop1:

and change all instances of goto loop to goto loop1 that should solve the problem.

This program worked fine with the older picaxe programming software until the word "loop" became part of the command set in the newer programming software. So loop can no longer be used as a label unless you add additional numbers or letters to it.

marc_is_curious (author)mikey772011-07-18

good hint - thanks -
but now the code gets stuck at ....

lookup b8,($20,$2 ....

.... telling me about syntax errors.

am a bit worried that eventhough i work myself through
whole script it's functionality might suffer from my corrections.

however and whatever remains:
such a shame they changed the syntax -
i like your project !
i need to teach myself/learn about the alterations
of the current script - and "translate" it.

thanks for you rreply
& have a great day!

AKninja04 (author)2009-12-09

Hi, I'm trying to use the LM 386 for a different project. This is surely a noobish question but I wanted to know: do all the grounds in this project run back to the negative end of the battery?

ski4jesus (author)AKninja042011-04-04

absolutely. if not, no power would run at all. rule of electrons is they have to have a backwards route, or nothing will work.

codongolev (author)2010-04-08

there's so much more evidence for God than nature. I mean, it depends on which God you're talking about, but I've found that the God of christianity has the most evidence for existence.

but really, do you think this was the best place for this? I mean, this is instructables. and this was kind of jammed onto the end of an instructable. I'm not saying you're wrong, I'm saying that you probably could find other, more effective ways of sharing your faith.

mikey77 (author)codongolev2010-04-08

I see evidence of God in the magnificent conscious designs that are all around us in Nature and the Universe.

If you have evidence that is independent of Nature and the Universe please share it with us.

By the way, the most effective way of sharing is to go where there is a need.

codongolev (author)mikey772010-04-09

um.... the evidence I'm talking about would be too long to explain in this little box. but I'm currently reading "the case for christ" which explains the historical accuracy of the bible (actually documents an atheist's journey to discredit christianity, and ends with him converting- true story), and I've read "mere christianity" (which has a large chunk of it explaining how morality proves God exists), and I'd like to read "evidence that demands a verdict" and "more evidence that demands a verdict" (obviously both by the same author), which, because I haven't read, I can't really account for the topic. (by the way, all three of these authors were atheists who decided to search for the truth and became christians. I find this to be overwhelmingly convincing for the evidence of Christ and God.)

but yeah. that's what I mean by there's more evidence.

nikolardo (author)codongolev2010-07-21

My current view is that there is something more to the universe than we can discover and test scientifically - all the real things science cannot explain - but I won't put faith in any religion. Religions are the oldest form of organized crime, Christianity being no better. However, every single religion I've ever heard of has the same base: be nice to other beings. Every religion is based on that principle, only the dogmas are different. Interestingly, almost all/all religions have a mystical sect, and they vary very little in their dogmas, even. So while I agree that there is something to spirituality, I strongly doubt the existence of a single conscious entity, "God". Also, at the instructable: things that survive millions of years of evolution have to look designed, and are designed, not by a conscious entity with forethought, but by the continual process of evolution. Also, it has been suggested that the human tendency to view things as "designed" is evolutionarily beneficial, as it comes to the same thing in terms of survival, etc, but is simpler than comprehending evolution. It does make trouble philosophically, though.

Robot Lover (author)nikolardo2010-11-24

Christianity is not based on doing good things to others to go to heaven. Although God does want us to love one another and do good things. it is not how to inherit eternal life. The way to get into heaven is to accept that Jesus died on the cross and believe what god says in the Bible. Believing in God is not about religion, it's about worshiping God.

nikolardo (author)Robot Lover2010-11-27

Maybe - your post was a little confusing, and I didn't follow it entirely - so maybe Christianity is not based on doing good things to others to go to heaven. However, Jesus's main teachings went along the lines of "all you need is love," and are contradictory to much of the Old Testament. Also, I don't believe that any God could support faith without evidence based on a book written by men, who are fallible. The last thing you said, though, about belief in God not having to be tied into religion, I support that. Maybe not in the blind worship plane of things, but certainly in that one can experience God (or a deeper understanding of the universe, or what-have-you) without dogmatic religion.

Robot Lover (author)nikolardo2010-11-27

I am glad you think the same about religion as I do. I do not view you as a bad guy because you have different beliefs, just wanted to get that straight so we don't brake out fighting. I am sure you are a great guy. I hope that you do not get angry for me saying this, but that is your opinion and I am sure many others share the same opinion as yours. My belief is my opinion which I have based my life around. i do not believe it as an opinion though, because I thoroughly believe it. I am sure you feel the same way.

nikolardo (author)Robot Lover2010-11-27

Not really, actually. My notion of the "everything else" in the universe has changed a lot over the years, and I suspect it will continue to do so. It's like my view of anything else - when I gain more information and experience, I have to change what I believe to fit what I know. What I believe is based on what I experience, and because I'm always experiencing more, my beliefs change accordingly. Really, all I have now are a set of suspicions, because I don't believe that I have it right.

macmaniac (author)2010-06-27

A rock does not become a plant. Evolution is not random or blind.

and7barton (author)2009-05-27

I made a simple random number generator which I believe, did make truly random number sequences - I pointed a lens at the sky, with an Light dependant Resistor mounted underneath it, connected to an A-D converter, resulting in a number between 0 and 255, which was dependant upon the light level affecting the LDR. Clouds, which are random in size and thickness, affected the primary light levels so there was truly a random output. I then wrote some simple software to compress the 0 - 255 range into a small range of 0 - 9.

legionlabs (author)and7barton2010-02-20

The problem of course is proving that clouds are random size and thickness. I'm sure many meteorologists would claim otherwise.

The best thing to do is test the ouput! NIST produces a decent randomness test suite (if such a thing can exist), though you'll need ~100 megabits of data.

http://csrc.nist.gov/groups/ST/toolkit/rng/index.html

Sandisk1duo (author)2008-07-10

Love th last step :' )

JohnJY (author)Sandisk1duo2009-11-25

I second that motion!

bigdeee (author)2009-07-31

Odin is truly a wonderous god. Thanks for providing evidence!

Aar000n3y (author)2008-07-10

Also, if there's a way to randomize the note's length with a limit on how long it can go for, that could make it sound more musical

Timmydamonkey (author)Aar000n3y2009-06-09

ur post got removed. wat did you sat?
was it bad. Oh no it was bad wasn'y it.?!!!

noob.

and7barton (author)Aar000n3y2009-05-27

That's easy, with a simple set of software rules. You need to write a rule for each possible value your random input delivers. I only know it in BASIC, in which it will be a FOR-NEXT loop. Turn the sound on, loop so many times, then turn the sound off. Don't ask my how to do it for a PC.

budsiskos (author)2009-04-19

kind of reminds me of that galatic god from futurama

AzurusNova (author)2009-02-14

Iv come across this a few times and always liked it. I was curious if there is a way to put in a potentiometer into this design to increase or decrease the speed and volume. If I can get the parts for this and put together one of my own, I'm sure Ill have it up online somewhere. :P Also a light resistor could add some fun to this as well >:)

mikey77 (author)AzurusNova2009-02-16

You can easily put a potentiometer into one of the inputs of the Picaxe and then read the voltage to change the random variable. Obviously, this would require reprogramming the Picaxe microcontroller. All kinds of real world inputs such as light or sound or temperature or touch can be used to vary the speed, volume and frequency.

sreekarthi (author)2009-02-10

Looks great!! Could you please give the RGB LED specification?

mikey77 (author)sreekarthi2009-02-16

You can use any RGB LED. Even a 5mm regular size LED will work fine. I used a surface mount led just to see what kind of light it would output. If you use a regular LED you can sand down the lens to cut the length in half and paint the sides with white or silver paint. This will improve the mix of the three colors.

dmitry (author)2008-09-16

I don't really get what the crap about creationism is about, but that's an alright statement about creating true randomness. Which is, as far as I know, impossible.

saites2001 (author)2008-07-10

You can generate truly random numbers.

Goodhart (author)saites20012008-07-11

That is more "deriving" random numbers then "creating" them though, isn't it?

saites2001 (author)Goodhart2008-07-11

I would think they're the same thing.

Goodhart (author)saites20012008-07-11

Well, when one tries to create randumness, it is no longer random, but if one can use an already random sequence and just take from that, they would have randomness, but without really creating it. I know, it is kind of a fine point :-)

GWJax (author)2008-07-10

In your program why did you not use the RANDOM command to create your random numbers rather than pick them out of your pre-selected data base? I like the sound, I guess that could be installed into a robot some how for noise. So I won't say anything wrong with entering it. One other thing is that you could add a mic and a modulator to really get the sounds of GOD. Just a thought. GWJax

mikey77 (author)GWJax2008-07-10

I did in fact use the RANDOM command to create the pseudo random numbers that create the musical notes, rhythm, and LED colors.

See step 3 and the program details.
random w0
random w1
time=1

b9=b1+b3
b8=b9/7

This creates random number variables B9, B8, and B6 which then choose among the pre-selected data base of musical notes and timing.

The interesting thing about random numbers is that at some point they have to be used to randomly select from a finite data base of possible real world outputs. This alone imposes a logical pattern on the random numbers.

GWJax (author)mikey772008-07-11

my bad I missed that instruction I thought it had an ' in front of it but that was on my screen, lol. I take back my last statement, a vote for you! thanks

Belcher1035 (author)2008-07-11

It's the smash hit of summer 2008!!!! Boop Bee Bope Be Boo Beep Beep Boo Boop Boooop Beeooop

pitty (author)2008-07-10

It's his Instructable and he did label it appropriately. If you are offended by people talking about there beliefs may be you should not have gone past the title. Great instructable and good on you for talking about your beliefs.

LinuxH4x0r (author)2008-07-10

If you don't like it don't read it. He can say what he wants. BTW, nice ible. If nothing else, that 1.5 to 5v chip looks promising

CarpetGnome (author)2008-07-10

Good instructable, and poetic thoughts on a higher being..... reminds me of a time I never knew.

sr1sws (author)2008-07-10

Those that have ears to hear, will. Steve

About This Instructable

14,595views

32favorites

License:

Bio: I believe that the purpose of life is to learn how to do our best and not give in to the weaker way.
More by mikey77:3D Printing Circuit Boards and Components4D Printing: Make a Collapsible Lantern    3d Printing: Zizzy-A Robot Assistant
Add instructable to: