Arduino Mini Spotlight

About: I'm a teenage male that has an interest in arduino, robots and other awesome stuff.

This is a mini led spotlight that I made which can be controlled by a potentiometer.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Materials

You will need:

Arduino Uno Rev 3

Radioshack Standard Servo

Potentiometer(I used a 10k)

6v Battery Pack

Breadboard

Jumper wires

Small led Flashlight

Step 2: Attach the Potentiometer

The first step is pretty simple just attach the potentiometer as shown in the picture.

Step 3: Attaching the Servo

Attach the servo as shown in this picture.

Step 4: Attaching the Battery Pack

Attach the battery pack as shown in this picture.

Step 5: The Led Light

For this next step you can attach the led by wrapping it around the servo horn.

Step 6: CODE!!!

The code for this project is pretty simple just copy and paste this program right here and upload it into the arduino:

#include <Servo.h>

int potPin = 2;

int pos;

Servo myservo;

void setup()

{

myservo.attach(9);

}

void loop()

{

pos = analogRead(potPin);

pos = map(pos, 0, 1023, 0, 179);

myservo.write(pos);

}

Step 7: Your Done

If you made it to this step then that means your done with the project. To use this project just turn on the power, turn on the led and twist the potentiometer to move the led.

Be the First to Share

    Recommendations

    • CNC Contest

      CNC Contest
    • Make it Move

      Make it Move
    • Teacher Contest

      Teacher Contest

    2 Discussions

    0
    None
    ibenkos

    4 years ago

    Smart idea! Thanks for shearig :)