Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Generation of a Random Flicker Effect?

Status
Not open for further replies.

davepusey

Member
I need code for my pic that generates a random flicker effect on PORTB of the PIC16F84A but am not sure how to do it?

All help would be appreciated!
 
Hi,
You could use this one to generate a random number:
One bit of the random number could be used to drive the pin low/hi and the random number for the duration of the low/hi-state.
Or just roll the the random number through the portpin.
hth
regards
joachim
 
Circuit Cellar had a Atmel program awhile back that simulated a candle flame with an LED flicker. It had a lot of mathematical theory of the candle flame flickering behind its formulas. Also had a self-heating thermistor to sense changes in airflow so it would respond to blowing on it or carrying it around. I never built it, but it sure sounded cool. Should be in Circuit Cellar's archives.
 
Looks like Circuit Cellar wants you to buy the article (only $1.50).

It appears someone pirated the code, but they may have taken down the file and left the dead link:
http://www.dtweed.com/circuitcellar/caj00147.htm

Just seach the web for "circuit cellar candle". Someone may have it.
 
...

mhh...

if i was u just putted a couple of arrays in whit different numers...

then just start doing crazy things whit them..increase one whit the other divde by the other array..asume 1 asume 2 arrays.. then increase whit 2 divde by the next array thing...

but offcourse a pair of formulas would be tough trou

in fact..the sensor is securing you in the above project that the candle never burns the same..

i think better should be using a clok..because it's time and date are always unique soow thats simpeler..

TKS
 
You could always break a neon light...
 
Oznog said:
You could always break a neon light...

I want my lights (controlled by PIC) to flicker in the style of a broken neon light. Also like in star trek voyager when they flicker the lighting on damaged ships and corridors etc. I have a 665KB **broken link removed** to help get the idea across, it's only 14.57 seconds so i suggest playing it looped.
 
Well, what's wrong then with the first answer you got? The random number generator...

Just play around a bit with the random number to turn your light on/off...

for example is bit 2 OR bit 6 is set turn the light on, otherwise off, see what this does... if not satisfactory, just try something else
 
Replicating the dynamics of a failing neon light in a convincing way is going to be a bit more complicated than a simple RNG. It's a bit on the complicated side. If I recall correctly, when in the started mode it's relatively likely to stay that way from a few seconds to minutes, perhaps with periodic instabilities which don't turn it off. Same with being off, wanting to turn on. There's a dynamic to it struggling to flicker on too.

Depends on how much time you want to spend on tweaking it to being perfect, or just using a generic flicker.
 
Oznog said:
Replicating the dynamics of a failing neon light in a convincing way is going to be a bit more complicated than a simple RNG. It's a bit on the complicated side. If I recall correctly, when in the started mode it's relatively likely to stay that way from a few seconds to minutes, perhaps with periodic instabilities which don't turn it off. Same with being off, wanting to turn on. There's a dynamic to it struggling to flicker on too.

Depends on how much time you want to spend on tweaking it to being perfect, or just using a generic flicker.

Did you see the **broken link removed** i posted earlier. That is more like what i want.
 
Hi,
just had a look at the video.
No problem.
Generate a random number. Now You've got 8 random bits. Shift them through the portpin to turn LEDs on and off. Having shifted 8 times generate a new random number, shift it.....and so on.
Other way: Use only one bit of the random number and generate a new one every time You update the portpin.
All You have to think about is the speed of shifting/updating. For the beginning try about 50-100ms between two shiftings/updates.
With the right time chosen it should look exactly as in the video.
hth
joachim
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top