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

K-Type Thermocouple With Maker UnoX And Blynk
Real-Time IoT Room Monitoring on Maker Pi Pico Using pyRTOS
Build an IoT Plant Monitoring System with MicroBit and Grove WiFi Module
Snap & Fit ABS Case and ICE Tower Cooling Fan Case Stress Test
Raspberry Pi Zero 2 W – Quad-core and 64-bit CPU
Tutorials of Cytron Technologies Scroll to Top