Shop OBEX P1 Docs P2 Docs Learn Events
light sensing system- photoresistor connecting problem — Parallax Forums

light sensing system- photoresistor connecting problem

guy20sanjoseguy20sanjose Posts: 13
edited 2011-09-16 05:51 in Accessories
Hello :smile:


I want to connect the photoresister to a step motor. The step motor works fine without the photoresister sensor. The setup for the photoresister works fine without connecting to the motor power. As long as the motor power wire connect to the Vout of the photoresister setup, the motor stop working due to the voltage drop. Anyone knows why? Please help

I use:
Basic stamp
Board of education
BS2e chip
Stepper motor
ULN2003 chip
Photoresister
A 500 k ohm resister (for photoresister setup)
1024 x 768 - 113K
1024 x 768 - 84K

Comments

  • kwinnkwinn Posts: 8,697
    edited 2011-09-13 21:56
    A photoresistor will not pass enough current to drive a motor. You need to amplify the output from the photoresistor to drive the motor.
  • Mike GreenMike Green Posts: 23,101
    edited 2011-09-13 22:18
    Since you have a BS2e on a Board of Education and you can use the BS2e to read the photoresistor and separately to control the stepper, have the BS2e read the photoresistor, then use the value you get to set the speed of the motor steps. I'm sure there's a PAUSE statement somewhere in the stepper control program that sets the time between motor steps (unless the motor is running as fast as the BS2e can drive it). Just use a variable for the PAUSE time and experiment with different values for different speeds, then make up a table for photoresistor value vs. motor PAUSE time and use a LOOKUP statement to change the one value into the other.
  • guy20sanjoseguy20sanjose Posts: 13
    edited 2011-09-15 09:11
    Thanks guys,
    I do need a transistor to amplify the current. Great. Now I run into another problem: When it's dark, the stepper should completely stop, however it steps back and forth. Any ideas ?

    Thanks in advance
  • alex123alex123 Posts: 102
    edited 2011-09-15 09:56
    You need to give us more information about your goal.
    Do you want the motor speed to change based on the light conditions or you want the motor to rotate at a given speed when the light is present and stop when it's dark?

    Since you're already controlling the stepper with BS2e it'd be best to connect the photosensor to an unused pin on it. The digital inputs on th BS2e don't seem to be Schmitt triggered so you may have issues when the light will cause the voltage to be right in between the input voltages for 1 and 0 (this may be what you're observing already). I would use one gate from SN74HC14. This would give you a threshold detection with hysteresis. You'd change the threshold by varying the polarizing resistor (makes sure it's not 0ohm though).
    If you want a linear detection based on light conditions you'd need and ADC converter. This way you'll get a digital value from complete darkness to the detector saturation.
    Hope this helps.
    Alex
  • Mike GreenMike Green Posts: 23,101
    edited 2011-09-15 14:16
    The "Basic Stamp Syntax and Reference Manual" has a chapter on the RCTIME statement which can be used to measure a resistance like that of the photoresistor. Read that section. You'll get a number out of the statement and you can establish either a numeric threshold for turning the motor on and off or you can use a LOOKUP statement to set up a correspondence between resistance and motor speed (using stepper timing).
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-09-16 05:51
    Hysteresis can be done in software.
    This is a microcontroller forum, afterall.
    (At least one guy gets that.)
Sign In or Register to comment.