KalamalkaKid
Posts: 3
Joined: Tue Apr 01, 2014 1:07 am

Random Generator to control light display

Tue Apr 01, 2014 2:22 am

Greetings I am hoping to create a simple program that will execute a random number generator that controls a set of 12 lights.
From a small switch, I want the lights to light up sequentially (or randomly) from 1 through 12 linearly (1,2,3,4 etc) all the way up to 12 then back down (12,11,10,9 etc) randomly stopping somewhere between 1 & 12 and staying lit. I want this set of lights to remain lit until the next time the sequence is started by the switch.

Essentially I am creating a "Love Tester" that would randomly generate a value that would correspond to a set of lights up on a board. Below is an example of what I would like to create.

http://www.youtube.com/watch?v=-rGqHNviVcI

I am a COMPLETE noob to this, so please be specific in what I would need.

Thank you for your time

Mikee

User avatar
FLYFISH TECHNOLOGIES
Posts: 1750
Joined: Thu Oct 03, 2013 7:48 am
Location: Ljubljana, Slovenia
Contact: Website

Re: Random Generator to control light display

Tue Apr 01, 2014 2:38 am

Hi Mikee,
KalamalkaKid wrote:I am a COMPLETE noob to this, so please be specific in what I would need.
Ok, let me be specific: a COMPLETE noob needs to perform small (and simple) steps.

It is very hard to answer to "tell me all" question. I'd suggest that you start reading some articles and tutorials and after a couple of weeks you'll be able to split this one task (alias question) to smaller one (alias specific questions).

Keep in mind: uncle Google is your friend.


Best wishes, Ivan Zilic.
Running out of GPIO pins and/or need to read analog values?
Solution: http://www.flyfish-tech.com/FF32

KalamalkaKid
Posts: 3
Joined: Tue Apr 01, 2014 1:07 am

Re: Random Generator to control light display

Tue Apr 01, 2014 3:27 am

OK let me ask then specifically then what it is I need to make the aforementioned happen :

1 - what hardware do I need?

2 - what software (besides the OS) or scripts will I require?

Thank you.

Mikee

Tarcas
Posts: 741
Joined: Thu Jan 09, 2014 5:38 am
Location: USA

Re: Random Generator to control light display

Tue Apr 01, 2014 3:54 am

KalamalkaKid wrote:OK let me ask then specifically then what it is I need to make the aforementioned happen :

1 - what hardware do I need?

2 - what software (besides the OS) or scripts will I require?

Thank you.

Mikee
Mikee,
You haven't told us enough about the project to tell you all the hardware that you'll need. Are you talking about incandescent light bulbs, or small LEDs? You said this is on a display board, so you'll have to design exactly what that means.
My recommendation is to pick up a breadboard and jumper wires, and prototype it with LEDs, even if you intend to do something "bigger" like using incandescent or CF lights later. If you do this, you will need a relay per light that's rated for switching mains-level power. Be careful if you do this, because doing it incorrectly can kill you, and/or burn down your house. If your goal is to switch mains-level power, I recommend hiring an electrician to check your design, and to wire up that part of it.

As far as the scripts, I think you just need one to read a button, generate a random number between 1 and 12 (more likely 0 and 11 since that's easier math for a computer) and do your lighting thing. It can all be as simple as a single shell script, or you can do it in Python, C, or whatever language you prefer. Again, I recommend prototyping this with a breadboard and LEDs instead of building your big expensive hardware enclosure first. It will be easier to troubleshoot any hardware issues this way, and definitely safer.

As Ivan said, you need to break it down into bite-sized pieces. Then you can ask us for advice on each piece. We can't and won't design your project from the ground up, but we'll be happy to advise you on how to complete a smaller task.

User avatar
Richard-TX
Posts: 1549
Joined: Tue May 28, 2013 3:24 pm
Location: North Texas

Re: Random Generator to control light display

Tue Apr 01, 2014 4:35 am

Why don't you use /dev/urandom to get your random numbers?
Richard
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip

KalamalkaKid
Posts: 3
Joined: Tue Apr 01, 2014 1:07 am

Re: Random Generator to control light display

Tue Apr 01, 2014 5:03 am

thanks for your input and suggestions. I have found a video that is pretty close to what I want to do. I guess all I need now is for someone to help me write the code. I need something that randomly goes between the integers of 0-11 for about 5 seconds, (outputting those on 12 separate GPIOS which will go to a relay board), and once the random sequence finishes it will remain lit for about one minute on the chosen number and then reset until the next input. The 'random' factor does not have to be NASA or encryption worthy really. Something that even repeats after 100 times would even be enough to seem random for the purposes and intent.

thank you for your time

Mikee

Return to “Beginners”