Project in progress
Candle led light

Candle led light © GPL3+

This code is bit more advanced, but make fake candle more realistick.

  • 100 views
  • 0 comments
  • 1 respect

Components and supplies

Necessary tools and machines

Hy gluegun
Hot glue gun (generic)
09507 01
Soldering iron (generic)
pincers

Apps and online services

About this project

This is project to make electronical imitation of candle for church.

I use Arduino pro micro, and flip flop swicth with very poor power consumption.

and bit stronger led.

Code

candle_realistic_ledC/C++
Is replacement for candles, code is made to make as much realistick as posible.
Is posible to use in chandelier candlestick things
/*
* Led light Candle imitation. This code I created to replace sometimes dangerous
* candles for children. Now She can go safely by the street not wory that she will be * burn. Or acydently hurt other persons.
*/
const int pin = 10; // PWM pin. For other arduino use diferent pin
long random_led;
long random_time;
int difer_time();

void setup() {
  
  pinMode(pin, OUTPUT);
  randomSeed(analogRead(A3));
  Serial.begin(9600);
  
}

int min_led = 200;
int max_led = 1024;

void loop() {
  
  random_led = random(min_led, max_led); // random number to shine led
  random_time = difer_time(random_led); // convert stranght to time
  analogWrite(pin, random_led); // set pin to value PWM
  delay(random_time); // set delay depending of the stranght

}

int difer_time(int s){
  
  int a, b, wait;
  
  b = map(s, min_led, max_led, 1, 100); // remap streinght to 100%
  
  // 3 stages of random speed. If more light then longer delay
  if (b > 80){
    wait = random(80, 100); // max strenght
  }
  else if (b > 20 && b < 60){
    wait = random(20, 80); // midle strenght. 
  }
  else{
    wait = random(1, 20); // led almost turned of, time very short.
  }
  
// In Arduino ID I use Tracer window to see values as lines
  Print(80); Print(40); Print(20); // print base line
  Print(b); Print(wait); Print(s); // print values to the screen
  Serial.println(""); // make new line.

  return wait;
}

void Print(int d){
  // Print function is alowing make code above shorter
  Serial.print(d); Serial.print(" ");
}

Comments

Similar projects you might like

Blinky Bacon Blackboard - LED Art Light

Project in progress by ArduBacon

  • 545 views
  • 0 comments
  • 4 respects

Bluetooth control led with lcd led status display real time.

Project tutorial by Youssef Sabaa

  • 17,377 views
  • 4 comments
  • 34 respects

Ambient Light Sensor Using Photo Resistor and LED Lights!

Project tutorial by DCamino

  • 3,367 views
  • 4 comments
  • 17 respects

Multifunctional RGB LED Light

by PauliusPlus

  • 5,896 views
  • 1 comment
  • 29 respects

Rings of Saturn LED Music Visualizing Pendant Light

Project tutorial by Modustrial Maker

  • 5,480 views
  • 2 comments
  • 32 respects

Bluetooth TFS Build LED strobe light

Project tutorial by Jimmy Ramkisoen

  • 3,265 views
  • 0 comments
  • 10 respects
Add projectSign up / Login