Project tutorial
The Turbo $1 Flashlight

The Turbo $1 Flashlight © GPL3+

Take a poor preforming flashlight and add great modifications to it in half an hour.

  • 1,068 views
  • 0 comments
  • 4 respects

Components and supplies

Apps and online services

About this project

Do you have one of those $1 LED flashlights?

My standard flashlight ran on a triple A battery trio in series circuit, so around 4.5V. I compared my $1 flashlight to others more expensive versions and saw it's weakness. On and Off. That's all it could do. Though that's great for some uses, I wanted an upgrade. I took the little flashlight apart and removed the LED head. See the terminals were exposed nicely, I melted power and ground wires to it. Connecting it to a 5V power bank, I was so happy to see the extra 0.5V brighten to LED head without burning them out.

Second, I wrote a code and added three different light modes and a rapid strobe. By pressing the button you can cycle between them. I love looking at a random object and thinking of what code is running behind it. This was a fun, quick project.

The circuit includes a single LED to act as the LED head for the diagram. The 5V from the transistor will blow the LED if a 220 Ohm resistor is not placed between the LED and ground. I am using the 2N 2222A transistor.

I hope you have a wonderful day! Enjoy the flashlight!

Code

Flashlight CodeArduino
Enjoy!
int buttonPin = 2;
int lightPin = 3;
static int value = 0;			//Create a changing number
void setup() {
  pinMode(buttonPin,INPUT);
  pinMode(lightPin,OUTPUT);		//Create the pinModes
}
void full_light(){
  digitalWrite(lightPin,HIGH); 
  delay(50);
}
void half_light(){
  analogWrite(lightPin,127);		//Use PWM for brightness level
  delay(50);
}
void fourth_light(){
  analogWrite(lightPin,64);
  delay(50);
}
void strobe(){
  digitalWrite(lightPin,HIGH);		//Change the delays if you want a faster strobe
  delay(100);
  digitalWrite(lightPin,LOW);
  delay(100);
}
void loop() {
int button_check = digitalRead(buttonPin);
if (button_check == 1){			//Check if the button was pressed
  value = value + 1;
  delay(220);
  if (value > 4){
    value = 0;
    delay(70);
  }
}
else{					//Keep the LEDs off if the button was not pressed
  digitalWrite(lightPin,LOW);
}
if (value == 1){			//Output the mode according to the button
  full_light();
}
if (value == 2){
  half_light();
}
if (value == 3){
  fourth_light();
}
if (value == 4){
  strobe();
}
}

Schematics

The Circuit
The single LED represents the the LED head. It will blow if a 220 Ohm resistor is not placed between the LED and ground.
2018 10 22 (2) qbm3nkfsaj

Comments

Similar projects you might like

Arduino Simple "Camera Slider" Electronics

Project tutorial by Ian Cumming

  • 5,758 views
  • 3 comments
  • 15 respects

Standalone Arduino Applied in Projects

Project tutorial by PCBWay and Silícios Lab

  • 5,641 views
  • 8 comments
  • 40 respects

How to Use Modbus with Arduino

Project tutorial by hwhardsoft

  • 5,340 views
  • 2 comments
  • 14 respects

Arduino RGB Color Mixer

Project tutorial by FIELDING

  • 3,197 views
  • 1 comment
  • 11 respects

Simple Arduino Digital Clock Without RTC

Project in progress by Annlee Fores

  • 96,164 views
  • 23 comments
  • 80 respects

Simple Programmable Robotic Arm

Project showcase by Ryan Chan

  • 49,066 views
  • 63 comments
  • 145 respects
Add projectSign up / Login