64 Random Pixels - up for grabs
Jay Kickliter
Posts: 446
A few months ago I released a design and gave away a couple empty boards for a concept I was working on. School got tough and I got burnt out on electronics, explaining my absence from the forum. Anyways, I'm on summer vacation, and am resurrecting this project.
The board tiny (~ 1.2" x 2"), with a Propeller and an 8x8 array of LED's. My attempt at conceptual art is for the LED's to step through every possible combination of pixels, not ever getting there naturally. Simple enough, just increment a a 64 bit number and watch the patterns emerge. But I was thinking that it would be cooler to randomly jump around, and temporarily display the current image, then move on. The concept is that anything that can be discernible in an 8x8 matrix will eventually appear, including digits, and the symbol for pi. Oh, and my favorite, 'e'.
To my question, in order for it to work, it seems to me like I need a 64 bit random number generator. Or at least a way to fake it. Is that even possible? I can't just randomize every pixel, since that will only give me static. Any ideas? I figure this might be something that could be posted to hackaday and the like to give the Propeller some nerd cred and exposure. Truthfully, the weather is too nice for me to want to spend too much time indoors working on this, but I'm 99% percent done and would like to give something back.
I messed up reflowing the board that I made, and need to replace the USB connector, but unless I made a really stupid error, it should work.
Edit:
I forgot to add the specs if anyone is curious.
100% surface mount (I used a cheap plastic stencil, which is why I got too much paste on the USB connector)
64 0603 yellow LED's
USB programming
Lithium Polymer battery on the back, either coincell or with JST connector.
Battery charging when plugged in to USB via Maxim 1555 IC
1.2" x 2.1" (ish, don't have my calipers handy)
Low drop out voltage regulator, plenty of decoupling caps, etc. Most passives 0603.
Post Edited (Jay Kickliter) : 5/4/2010 5:24:15 PM GMT
The board tiny (~ 1.2" x 2"), with a Propeller and an 8x8 array of LED's. My attempt at conceptual art is for the LED's to step through every possible combination of pixels, not ever getting there naturally. Simple enough, just increment a a 64 bit number and watch the patterns emerge. But I was thinking that it would be cooler to randomly jump around, and temporarily display the current image, then move on. The concept is that anything that can be discernible in an 8x8 matrix will eventually appear, including digits, and the symbol for pi. Oh, and my favorite, 'e'.
To my question, in order for it to work, it seems to me like I need a 64 bit random number generator. Or at least a way to fake it. Is that even possible? I can't just randomize every pixel, since that will only give me static. Any ideas? I figure this might be something that could be posted to hackaday and the like to give the Propeller some nerd cred and exposure. Truthfully, the weather is too nice for me to want to spend too much time indoors working on this, but I'm 99% percent done and would like to give something back.
I messed up reflowing the board that I made, and need to replace the USB connector, but unless I made a really stupid error, it should work.
Edit:
I forgot to add the specs if anyone is curious.
100% surface mount (I used a cheap plastic stencil, which is why I got too much paste on the USB connector)
64 0603 yellow LED's
USB programming
Lithium Polymer battery on the back, either coincell or with JST connector.
Battery charging when plugged in to USB via Maxim 1555 IC
1.2" x 2.1" (ish, don't have my calipers handy)
Low drop out voltage regulator, plenty of decoupling caps, etc. Most passives 0603.
Post Edited (Jay Kickliter) : 5/4/2010 5:24:15 PM GMT
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
· Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
I suspect you'll be waiting a pretty long time if you want to see a character appear though (at least without some 'cheating' to limit the randomness)
First off, I don't know how.
Could a method from meshed gears work for you.
100 teeth with 50 teeth will repeat meshing the same teeth over and over.
101 : 50 gives very long period.
I don't have the number to add, to get through your 64 bit number with a long period.
Possibly two or more counters working alternately.
my 2 cents.
OK, this (at best) will give you a pattern of 1) many bits 2) vary few bits 3) repeat
That's fails on the part about Looking Random.
Post Edited (Roger Lee) : 5/3/2010 4:00:49 AM GMT
-Phil
The easiest way to achieve what you want is to build a 64 bit LFSR (linear feedback shift register). If the feedback points are in the right positions, the LFSR can be maximum length, meaning it passes through all possible numbers before it repeats. With 64 bits this will take some time
An example for a 64 bit LFSR is the so called "dense" polynome used in the DLT1 spec ECMA-182. It is:
x^64 + x^62 + x^57 + x^55 + x^54 + x^53 + x^52 + x^47 + x^46 + x^45 + x^40 +
x^39 + x^38 + x^37 + x^35 + x^33 + x^32 + x^31 + x^29 + x^27 + x^24 + x^23 +
x^22 + x^21 + x^19 + x^17 + x^13 + x^12 + x^10 + x^9 + x^7 + x^4 + x + 1
You create a 64 bit number pattern with a 1 in places of each term's exponent, so this would be bits #63, #61, #56, #54 ... #0. The value is 0xad93d23594c93659. A byte is fed into the LFSR by 8 times shifting the value left one position and, if the bit #0, #1, #2 of the byte xor the bit #63 of the polynome value is set, xoring the LFSR with this xor value.
But you don't want to feed bytes into a CRC like algorithm, you want pseudo random numbers. You could just do:
Then you call e.g. lfsr(1) and can inspect the two longs lfsr_lsb and lfsr_msb afterwards. If you start with these values, you can see the 1 in oldval shifting up to $80000000 and then the (pseudo) chaos begins.
A much more nerdy project would be to display 64 bits of the digits of Pi, i.e. 0..63, then 64..127 etc. pp. There is a formula that allows you to calculate these from any position in binary or hex. I don't have the formula handy, though.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Pullmoll's Propeller Projects
Post Edited (pullmoll) : 5/3/2010 12:08:30 PM GMT
-Phil
random numbers will be just noise, like a disconnected antenna at the television. The chance to be in front of the screen and see "e" and recognise it·is very very low. So you will have to cheat a little bit and show something that looks like random....... Or random, that looks like something with system: Mandelbrots Fractals perhaps?
Christof
Phil, actually, that's kind of the point. A pin to wear to hacker parties (at least NYC is good for one thing) that you know eventually will show a smiley face but you'll never actually see it. Hey, I'm a wannabe engineer, this is my attempt at 'art'. I just like the idea of knowing patterns are there, even if I'll never see them. If I was to make a bunch of them, people can reprogram to do whatever they want, like display crude animations.
pullmol, thanks for the code. I'm going to give it a try.
That said, I need to get the thing to work first.
Speaking of Mandelbrot, do yourself a favor guys and check out Jonathan Coulton's Mandelbrot Set. Using the lyrics without access to the internet, and some spare time, I came up with the attachment. Code Monkey is good also.
Try dividing 2 to the power of 64 by small prime numbers near 100,
and writing down the primes that divide 2 to 64th with no remainders.
Then, see what happens when you add THOSE, PLUS (OR MINUS) ONE,
to your two longs of 64 bits for the LEDs (with just a couple of lines of Spin).
You only need one of "THOSE" but some sequence results may look nicer than others.
I'd expect the sequences to vary in apparent randomness from static to noticeable patterns,
and probably not skip any combinations like LFSRs do; LFSRs usually skip only zero.
I have discovered some pseudorandom algorithms that make "alien fonts" but they
have limited "alphabets" that I did not design. (Just as nobody "designed" the shape
of Mandelbrot's Set)
Perhaps if you design the font of glyphs you would like to see, and then feed it into
the Berlekamp-Massey algorithm, it will create a repeating LFSR that generates those,
and after that, who knows? But it will eventually repeat. I don't have Mathematica, so
don't ask me how to do that... But... (nevermind)
A simpler, more obvious method would be to create a glyph font, and write a program
that randomly changes pixels to the next glyph, until glyph matches the display, and then stops
trying to make the glyph it just made, and starts trying to make the next one. If you use the
Spin random number generator, be sure to use it to select the one of 64 LEDs, because it
will definitely skip pixels forever if you try to get X and Y from it separately. But it probably
works this way with ?LED and then LED:=LED//64 (and then X:=LED/8 and then Y:=LED//8 if
you Need to do it that way). I would describe this effect as similar to how I saw a digital
picture frame morph between two pictures in such a way that the morph midpoint resembled
TV static more than either of the two pictures.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I should be typing in Spin now.
Coming soon. My open Propeller Project Pages and favorite links index.
You mean like 2*2*2*2 for 2^4 or 2*2*2*2*2 for 2^5?
The prime factor(s) of powers of 2 are 2 - all of them.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Pullmoll's Propeller Projects
How about a mini Conways Game of Life?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Style and grace : Nil point
That should be interesting. You'd have to detect a static "picture", i.e. nothing but blinkers left, and inject some random dots to revive the action.
Start with an R-pentomino for a lot of cycles. I don't remember how much it were... many.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Pullmoll's Propeller Projects
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
EDIT:
You know what, there are a lot more capable people here than me. I'm looking outside, and the weather is nice, and itching for a road trip in my recently acquired diesel car. If anyone here is really good at surface mount rework, I'll give you the one photo. It's fully populated, and as far as I know I only messed up the USB connector. I don't know if the QFN chip flowed correctly, but I'm not reading any shorts on my meter. So, if you're good at this stuff, let me know and it's yours. And feel free to shame for abandoning it, I'll be laughing all the way to the Rockies.
Post Edited (Jay Kickliter) : 5/4/2010 5:21:50 PM GMT
Sorry, I meant (2 to the 64th)-1, assuming that's not a mersenne, and if it is, hmmm.
I was thinking of something like at each step, adding ((2 to the 64th)/91)+1 assuming
that 91 is a prime that divided 2'64 with no remainder. That may be wrong, but if not,
the intent is to get a result similar to adding 1 (going thru all combos in order) but by
also adding a large and ugly non-power-of-2 number to make it look more random
and still guarantee a "Normal" sequence that never skips a combo, just like adding 1,
which may not even be necessary if the "ugly number" divides 2'64 with a remainder
of 1.
I'm sure that what I am trying to say to do works, but its been a while since I did it, so
I am very likely to have forgotten a few minor details. But try to think of something like
a number of degrees of a circle that after appearing to cut it like a pizza, ends at 359
or 1 degrees instead of 360 degrees, thus goes through all combinations after around
360 / N revolutions.
If we didn't figure that one out, at least there is the
easy 64-pseudorandom-numbers morph technique.
I did that once: packed the car in Indiana to visit Glacier N.P. 'Ended up in the Canadian Rockies, then Alaska, Vancouver, Washington State, all the way down the Pacific coast to Tijuana and back home through Colorado. 15,000 miles total. (The next time I took a trip like that, I didn't return to the Midwest -- just stayed here in Washington State and haven't looked back.)
Have a great trip! (And take an extra fuel pre-filter for the Benz. A clogged filter is about the only thing that could strand you with that car.)
-Phil
Phil, thanks for the fuel filter tip. Are you talking about the little inline filters? I'm actually thinking about making it as far as your neck of the woods. My previous shipping work has taken me to Port Townsend several times. I'm seriously considering moving there when I finish school; it's my favorite little town in the US.
Yes, the little clear plastic inline filter. It's there for a good reason, but it can be a show-stopper if you get bad fuel. 'Happened to me once shortly after I got my latest 240D. But the filters are cheap and a cinch to swap out.
I hope you get to P.T. on your trip! Be sure to look me up if you do. It's a great place to visit and an even better place to live. Send me an email (address in my profile), and I'll provide additional contact info.
-Phil
Lawson
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Lunch cures all problems! have you had lunch?