Selfie Flashlight
Many a times while taking photos or clicking selfies, you must have felt that your picture lacks some quality or property. You would be having a perfect background, camera, make up but the thing that would restrict you from taking a perfect shot is proper lighting. I used to face such problem a lot either while taking selfie with a friend or while making an Instructables. Though my phone had a small LED flash light, it was not capable enough to make my picture from worse to best so I looked on the internet for some flashlights and also found few that could mingle up with my phone to give me a perfect shot. But the problem with those flashlight was that they did not provide all the features that I needed and were too costly to be used so I decided to make one by my self.
From the images above, you can clearly see that this selfie flashlight is small in size making it more handy and portable. It easily plugs in the headphone jack of your phone and you can capture photos by tapping on the push button present on the flashlight. When you will tap on it, the LEDs will glow for 1 sec and the flashlight will command you mobile phone via headphone jack to capture the moment. iPhone 7 users can also use this but the only condition is that you can not attach this flashlight to your phone so you need to hold it with hand while clicking photos. You can also use this flashlight for shooting videos by changing the mode of the flashlight to continuous mode in which the LEDs will glow continuously and you can shoot videos. A third mode also know as settings mode is also present in which you can control the brightness of the LEDs using the potensiometer. The most important feature of this flashlight is that it has warm white LEDs along with normal white LEDs. Those warm white LEDs are used to adjust the saturation of the image so as to give you a more beautiful shot with rich colors.
Let us go deep inside and see the specification of the flashlight. So this flashlight uses 4 warm white and 4 normal white LEDs whose brightness can be adjusted in the setting mode of the flashlight via potensiometer. The LEDs used here are 4V 1W SMD LEDs. These LEDs are capable of diffusing the light in its surrounding giving you a wider ranger of light. The battery used in the flashlight is Nokia BL-5C battery with a voltage of 3.7V 800mah. This battery is small in size and has a inbuilt circuit protection so you need not to buy some special chargers to charge it. We are using Arduino pro mini as the brain of the project. There are a total of three modes present in the flashlight. Mode one is used for clicking photos, mode two for shooting videos and mode three for adjusting the brightness of individual LED.
Here is the link of step up step instruction of this project:
and don't forget to subscribe to my YouTube channel and follow me on instructables. Here is a link to my youtube channel:
https://www.youtube.com/channel/UCHnIUs2HC0e6SQHtR...
NOTE: While making this project, I accidentally destroyed my Arduino pro-mini and my 5V step up module. The part that I had were not small enough to be fitted in that tiny box. So just to show you guys how this project works, I made it on a breadboard using Arduino nano. Everything is same- the LED matrix, 3.7V battery, power transistors etc. The only change that I made was that I am now power my Arduino board(nano) via USB cable. This particular problem was with my project only and your Arduino board and 5V step up module would not be damaged while making it so feel free to make this project. To see how this project work, forward the video to 3:02.
Gather Parts
You don't require a lot of parts for this project and the cost of each part is also very cheap. You can easily find them on amazon and eBay.
- Arduino pro-mini
- A 3.7 V cellphone battery
- 5V step up module
- Headphone jack
- 4 x 1 watt white LED
- 4 x 1 watt warm white LED
- 2 x TIP31C power transistor
- 10K potensiometer
- 10K resistor
- Push button
- Encloser
TOOLS:
- Soldering iron
- Drill machine or a dremel
- Pliers
- Wires
Prototyping the Circuit and Some Silly Mistakes
Before making the final product, it is good to make a temporary one because this help us in checking all the parts and stuff and you also get to know about the circuit and various problem which help you later-wards. There were multiple problem that I faced while prototyping the circuit which I wanna share with you. There are three modes in the project and one of them was not working. I looked through all the connections and stuff but was not able to find out the problem. Then I realized that pin 1 of my microcontroller was not working fine and this was creating the problem which I solved by changing it with some other pin in the code. So you should take care of the technical faults of your board. While prototyping the project, I noticed some delay when increasing or decreasing the brightness of the LED. This problem was sorted out by changing the faulty push button. The push button was always high and due to this the modes were changing continuously and thus creating the delay.
While prototyping, you need not to make the whole project. You just need to check the circuit with necessary amount of parts or divide the circuit into various parts and check them individually. You can also use a more handy microcontroller like Arduino nano(like me) or Arduino UNO. This will simplify your work.
Uploading the Code
I thinks this is the best time to upload the code to your microcontroller because it would be easy for you to do it now and you definitely don't want to break any connecting of your project while uploading the code afterwards. You don't need to add any additional library to you IDE to make this code work so relax and take a chill pill. You can also download the code from the attachments given below.
<p>int led1=9;<br>int led2=10; int mobile=12;</p><p>int slide1=11; int slide2=2; int slide3=3;</p><p>int push_button=5; int pot=A0;</p><p>int state=0;</p><p>int warm_white=255; int white=255;</p><p>void setup() { pinMode(led1,OUTPUT); pinMode(led2,OUTPUT); pinMode(mobile,OUTPUT); pinMode(slide1,INPUT); pinMode(slide2,INPUT); pinMode(slide3,INPUT); pinMode(push_button,INPUT);</p><p>}</p><p>void loop() {</p><p> if(digitalRead(slide1)==HIGH) { analogWrite(led1,white); analogWrite(led2,warm_white); } else if(digitalRead(slide2)==HIGH) { if(digitalRead(push_button)==HIGH) { analogWrite(led1,white); analogWrite(led2,warm_white); delay(50); digitalWrite(mobile,HIGH); delay(200); digitalWrite(mobile,LOW); delay(1000); } } else if(digitalRead(slide3)==HIGH) { analogWrite(led1,white); analogWrite(led2,warm_white); if(digitalRead(push_button)==HIGH && state==0) { state=1; delay(500); } else if(digitalRead(push_button)==HIGH && state==1) { state=0; delay(500); }</p><p> if(state==0) white=map(analogRead(pot),0,1023,0,255); else if(state==1) warm_white=map(analogRead(pot),0,1023,0,255); } delay(10); analogWrite(led1,0); analogWrite(led2,0); }</p>
Downloads
Attaching LEDs to the Box
Before doing anything, please make sure that the enclosure that you are using is small and handy or you'll have difficulties in carrying it. So let us start by choosing the LED for our project. I decided to go with 1W SMD LEDs that work on a voltage of around 4V. These LEDs are round in shape and does not have a lens so they are gonna diffuse the emitted light and you would have a more broader range. In my flashlight, you can find that I have used LEDs of two different color(i.e four white LEDs and four warm wight). This mod helps you to find the perfect saturation for your photo by changing the brightness of individual LED array.
In the above para I mentioned that these LED work on 4V but the output voltage of our microcontroller is 5V so your LEDs could get damaged if you directly connect them with your microcontroller. For that I decided to switch the 5V of the Arduino output with 3.7V of battery using a NPN power transistor. This thing has another positive aspect that the output current of Arduino's digital pin is 40 mili amps but these LED require much more current so by switching Arduino's output with power transistor, we could also increase the current reaching the LEDs and they would work more efficiently.
Let us begin with the project. First start by drilling the hole in your box of the same size as that of your LED. Then arranged the each LED on its place temporarily and then use super glue to make the connection permanent. I tried using hot glue before but the result that I got was not worth praising. Attach four white LEDs at the extreme corners and the other four warm LEDs in the center to get the best results.
Connecting Arduino to the Battery
Choosing a perfect battery backup for your board is one of the most important thing. There are a lot of batteries available in the market like lead acid battery, lithium polymer, lithium ion, Ni-cd, Ni-Mh etc but we can not use any battery like this. We would be needing a battery which is small in size, capable to provide power to all our hardware parts, doesn't get exhausted very easily, handy and easy to charge. I found that Li-ion battery of old Nokia phones was best for this project so I decided to go with a 3.7V 800mah Nokia BL-5C battery.Since it's a lithium ions battery, neither it is not costly(costs around $2) nor very heavy. You can use lithium polymer batteries but you need to spend a lot to buy them and would be needing a costly charger to charge them. Also you need a protection circuit so that you don't destroy you hardware part with these batteries having such a high discharge rate.
We are using a 3.7V li-ion battery for the flashlight but the input voltage of our arduino board is 5V so we are gonna need a 5V step up module to boost up the voltage of the battery from 3.7V to 5V. If you ever made a joule thief, you can easily understand the working of the module. This module will not harm your battery so don't be anxious.
We are gonna start by removing the female USB attached to the module so as to save space(I didn't do that in my case because the space acquired by the module before and after removing the USB was same). Connect the negative input of your module to ground and positive input to the +3.7V rail with a normal switch in between. You can use a voltmeter to check the output voltage of the module. Connect the positive output of the module to Arduino's 5V pin and negative output to the ground. After you are done, you can check the circuit by switching on the switch and uploading blink sketch to your board. Everything should work fine and normal.
Since I am using a Li-ion battery which has a inbuilt protection circuit, I can easily charge it by connecting the battery directly to a cellphone charger with a 1N4007 diode in between. You can find the circuit diagram of all the connections of this step in the images above.
Connecting the LED to Arduino Via Power Transistor
Now its time to connect the LEDs to our arduino board but as told earlier by me in the step 4 that we can not connect the LEDs directly to our Arduino board due to its higher voltage and lower current rating as require by the LED so we are gonna need a module or thing which can switch the higher voltage of Arduino with the lower. This can be done very easily by transistor. For this project, NPN transistor would be nice choice. But there is a problem in choosing a normal transistor(like BC547) that those small transistor can not handle high current whereas our LEDs require more than 1 Amp current. This much current can ruin our transistor so we are gonna use a NPN power transistor for this project. Power transistor work same as transistor but are capable of handling higher current as well as voltage. I am using TIP31C in my flashlight. There are a bunch of NPN power transistor present in the market that you can use.
So start by connecting the pin 1 from the left of the first transistor to the digital pin 9, middle pin to negative of white LED array, and third pin to ground. For the second transistor, the first pin will be connected to digital pin 10, third pin to negative of warm white LED array whereas the middle pin will go to same i.e ground. Connect positive of both the LED arrays directly to the positive(+3.7V) of the battery. After this you are done with your connection.
Connecting the Switches,potensiometer and Various Stuff
To switch between various modes, to click photos, adjust brightness of LED, send signals to the phone to click a photo, you'er gonna need various stuffs like switched, potensiometer etc and in this step we are going to connect those thing to our flashlight. You require two switches, a potensiometer and a headphone jack for this project. The first one is a 3 mode slider switch that you would be requiring to choose the mode of the flashlight(i.e video mode, photo mode or setting mode). Second is a push button that you would be needing to click photo in photo mode and in setting mode for switching between warm white LEDs and white LED. potensiometer is used to change the brightness of the LEDs in setting mode and the headphone jack is used to send signals to the phone to click photo in photo mode.
Connections of the 3 mode slider switch:
- pin 1-----digital pin 11
- pin 2-----digital pin 2
- pin 3-----digital pin 3
- common pin-----5V of Arduino board
- Short Arduino's pin 11,2,3 with ground using a 10K resistor
Connection of the push button:
- pin 1-----5V of Arduino board
- pin 2-----digital pin 5
- short digital pin 5 with ground using 10K resistor
Connections of headphone jack:
- sleeves-----Arduino gnd
- ring and tip-----Arduino digital pin 12
Connections of potensiometer:
- pin 1-----gnd
- pin 2-----analog input A0
- pin 3-----5V
After doing this hot glue everything to their suitable place and your flashlight ids ready.
How to Use It ?
You made the project, you know all the circuitry behind it but the main part is still left which is how to use it and I am gonna tell you that in this step. As told earlier by me, this flash light has 3 modes which are photo mode, videos mode and setting mode which you can select by the slider switch. Firstly plug in the flashlight to your cellphone through headphone jack. In photo mode, you need to press the push button and the LED will flash for about 1 sec. The flashlight will automatically command you phone to click the photograph. In video mode, the LEDs on the flashlight will glow continuously so that you can shoot videos. In setting mode you can change the brightness of the LEDs by turning the knob of the potensiometer. When you will move to setting mode, you can rotate the potensiometer to change the brightness of white LED. To change the brightness of warm white LEDs, press the push button once and now you can change the brightness of warm white LED by turning the knob. If you again want to change the brightness of white LED, press the push button. That sit. This is all how this flashlight work.
As told earlier by me, I destroyed my Arduino board and my 5V step up module while making this project that why I am explaining the working of the project on breadboard. Sorry again for inconvenience.
The End
Hope you like the project. Follow me on instructables. If you have query about this project please comment down below. If I made a mistake anywhere, please post it in the comment section below. Video of this project is coming out soon so please connected.
NAMASTE!!