Arduino Light Sensitive Stepper Motor


Introduction: Arduino Light Sensitive Stepper Motor

About: I like finding new uses for things, making things, and improving things. I'm a student who is currently looking for a better job, one where I can make an actual difference.

I've come up with a simple way to make a stepper motor move from one position to another based on the lighting in a room. Using a handful of basic components I had lying around, no need for fancy motor / stepper shields. This setup could be used to automate blinds, so they open and close based on ambient light. The code allows you to edit amount of steps in either direction and sensitivity to light. I've also wrote in code to turn off the stepper once it is done moving. The components required are : Arduino board with 4 digital outputs and 1 analog input, 4x general purpose npn transistors, 4x 1k resistors,10k resistor, light dependent resistor (LDR),12volt stepper motor,12 volt power supply, 5 volt power supply for the arduino, I used a 7805 5 volt regulator for this.

Step 1: Code

This code steps the motor 150 steps clockwise when it gets dark, then steps the motor counterclockwise 150 steps once it detects light again. The amount of steps, speed, and light sensitivity are all easily adjustable. Make sure to enter how many steps your motor has where it says define steps (mine had 48). Also I used a 5 wire 12v motor where one wire always received positive voltage, and the other four wires were grounded in sequence to turn the motor.



    • Oil Contest

      Oil Contest
    • Clocks Contest

      Clocks Contest
    • Water Contest

      Water Contest

    7 Discussions

    hello friend. i tried this code and doesnt work,it just sping clockwise 150 step in a loop. i want to use this stepper(28byj-48) to open blinds when it is light on ldr and close them when is no light outside.please help

    I used 2n5190 npn transistors in my final build, but on the breadboard I think those are tip120 npn transistors. Any similar npn transistor should work fine.

    Hi Khaleel,

    I've sent you a direct e-mail, but it seems you did not get it.

    can you please provide the full schematic for the LDR Sensitive Stepper? i did not knot where to connect the motor. My e-mail is: Thanks in advance.

    I don't recall seeing the previous message, I also don't receive email updates on comments made on instructables. I think it has something to do with my email server or something. The schematic posted in the instructable is the full schematic I used. I used a stepper motor with 5 wires, one of those is a common for all 4 coils inside the stepper. I used a multimeter in ohms to figure out which wire is the common one. Then used a small 12 volt wall adapter, to provide momentary power to each coil. This gave me an idea as to what the sequence is for the coils to properly step either forward or backward. Of course you can avoid all of this extra testing if you already have a pinout for your stepper motor. This shematic only works for unipolar 5 lead stepper motors.

    Hi Khaleel,

    Thank you much for the reply. I wanted to know where did you connect the motor's four (4) wires on the schematic? It is not shown on the schematic. Did you connect them at the diode's Emitter?

    The connection from the arduino digital pin goes into a 1k resistor and that connects to the base of the general purpose npn transistor. The emitter on the transistor is connected to ground and the collector is connected to the stepper motor. Hope this helps.