3D Printing Pelita Raya

Introduction

Since it’s dangerous to use a real 🔥 to light up the Pelita at my house, I decided to print a Pelita Raya using a 3D printer and add an LED. The LED is programmed to look like a real candle🕯

Video

Watch this video to know more about it.

Hardware Preparation

This is the list of items used in the video.

const int LED = 10;
long random_led;
long random_time;
int difer_time();
void setup() {
pinMode(LED, OUTPUT);
}
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 strength to time
analogWrite(LED, random_led); // set LED to value PWM
delay(random_time); // set delay depending of the strength
}
int difer_time(int s){
int a, b, wait;
b = map(s, min_led, max_led, 1, 100); // remap strength to 100%
// 3 stages of random speed. If more light then longer delay
if (b > 80){
wait = random(80, 100); // max strength
}
else if (b > 20 && b < 60){
wait = random(20, 80); // midle strength.
}
else{
wait = random(1, 20); // led almost turned of, time very short.
}
return wait;
}

view raw
Pelita.ino
hosted with ❤ by GitHub

Reference

  1. Candle LED Light Up

Thanks for reading this tutorial. If you have any technical inquiries, please post at Cytron Technical Forum.

Please be reminded, this tutorial is prepared for you to try and learn.
You are encouraged to improve the code for better application.

Leave a Comment

Your email address will not be published.

Share this Tutorial

Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest
Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest

Latest Tutorial

3D Printing Pelita Raya
How to use MAKERDISK M.2 SSD on Raspberry Pi 4 Model B
Getting Started with Robotic Operating System (ROS) and JetRacer AI Kit
Barrier Gate with micro:bit and MakeCode
Play MP3 File on Maker Pi Pico Using CircuitPython
Tutorials of Cytron Technologies Scroll to Top