Go Down

Topic: Stepper Motor control using Sensors (Read 2074 times) previous topic - next topic


Hello, I am trying to control a stepper motor using the results of a temperature sensor.  I want to do it so it acts as an automated window, where if the temperature is too cold or hot, the window closes (or stays closed), and if the temperature is nice, the window opens.

I'm not entirely sure how to write the code for the stepper motor portion of this.  It's a 200 step, 1.8 degree motor.  So I kind of want...

Window starts closed
If temp is less than 18 C, window closes or stays closed
If temp is greater than 30 C, window closes or stays closed
If temperature is between those two values, it opens, by turning the motor 199 steps.

Any help is greatly appreciated.  I sincerely thank anyone for their help.


Sounds like a cool project.  There is some sample code for angular control of stepper motors at LucidTronix: http://lucidtronix.com/tutorials/24.  They are using a potentiometer to control the sensor but it wouldn't be to difficult to adjust that code to work with a temperature sensor, just change the range of values that are getting mapped to the angles.  Also I think they are using the same motor as you, 200 step, bipolar.

Go Up