Model Train Forum banner

1 - 11 of 11 Posts

·
Registered
Joined
·
60 Posts
Discussion Starter #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

 

·
Registered
Joined
·
3,233 Posts
From the programming in the video it would appear that you can slow the flash rate somewhat. Would that be correct?
 

·
Registered
Joined
·
3,444 Posts
looks good .. a lot of work to achieve that .. is it on a switch or always live if it gets power ??
 

·
Registered
Joined
·
60 Posts
Discussion Starter #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.
 

·
Registered
Joined
·
60 Posts
Discussion Starter #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);
}}
 

·
Registered
Joined
·
211 Posts
I get it because I've been doing it for 30 years but I doubt a lot of people are not going to understand what this all means?

George
 

·
Registered
Joined
·
2,229 Posts
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.
 

·
Registered
Joined
·
60 Posts
Discussion Starter #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:
 

·
Registered
Joined
·
2,229 Posts
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.
 
1 - 11 of 11 Posts
Top