Model Train Forum banner

A warm(white) light of fire

1K views 10 replies 5 participants last post by  Shdwdrgn 
#1 ·
Hi,

Just playing around with a R3 Uno and some LEDs, creating the shine of fire.....
Some troubles with the camara (whitebalans) but we where happy with the results :D

 
#4 ·
Hi, thanks for reaction. The Flashrate is random, the effect on the video is much more then in "real life", in real it loks more natural.

And a lot for work? No, not really, it is simple to build. At this time it will turn on when it gets power, but in the futere i will program a LDR and a scene. Then a steady light will turn on when de power is connected and the lights in the room are dimmed. Then, after a while, the fire is lightened up.
 
#6 ·
The code is written in Arduino:

int ledpin1 = 3;
int ledpin2 = 5;
int ledpin3 = 6;
int switch1 = 2;
int switch1state=0;

void setup() {

pinMode(ledpin1, OUTPUT);
pinMode(ledpin2, OUTPUT);
pinMode(ledpin3, OUTPUT);
pinMode(switch1, INPUT);
}

void loop() {
switch1state = digitalRead(switch1);
if (switch1state == HIGH){;
analogWrite(ledpin3, 5);
delay(random (30));
analogWrite(ledpin1, random (2,10));
delay(random (30));
analogWrite(ledpin2, random (10));
delay(random (10,30));
analogWrite(ledpin3, random (1,20));
delay(random (30));
analogWrite(ledpin2, random (2,20));
delay(random (10,50));
}else{
analogWrite(ledpin1, 20);
analogWrite(ledpin2, 0);
analogWrite(ledpin2, 0);
}}
 
#9 ·
Nice effect! My question would be to ask why you used three LED's for this? I did something similar in the past with a single LED, and for my firelight effect I set minimum and maximum values and a random delay between changing brightness values, plus added in the occasional flicker. I might have to rebuild that circuit again to see how it compares to what you're getting with multiple LEDs.
 
#10 ·
The idea behind the 3 LEDs was to create a "full" fire, but maybe it can be done with 1 or 2. I was teaching my 10 year old son how he can program multiple LED sketches and after that I was programming the fire with the same board, so thats why 3 LEDs are used ;)

It would be nice to see your fire-effect with one LED, waiting for it:thumbsup:
 
#11 ·
Well I found the original code, it was written up as part of a DCC accessory decoder on a Nano when I was playing with a PCA9685 board (16 PWM outputs from an I2C bus). I also had an effect for an arc welder which always seems to be popular at the shows. I'll see if I can clean this up to use on another board I already have running.
 
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top