Controlling a Servo with a PICAXE and an IR Sensor

Learn how to combine a PICAXE, IR sensors, and a servo motor to create a device that responds to a moving stimulus. Spoilers: I hook it up to eyeballs that can follow a finger. PICAXEs are PIC microcontrollers that have been preloaded with a bootstrap code that allows programming in BASIC language. All About Circuits provides a series of articles that serve as a guide to choosing and using any of the chips in the PICAXE family. This article will provide an excellent starting point and will lead you to other articles in the series. This project consists of building a circuit using common IR (infrared) LEDs to produce IR emissions and an IR phototransistor to detect reflected IR light. The voltage from the phototransistors varies with the intensity of the IR light received. A specially programmed PICAXE microcontroller converts this analog voltage to a digital format and stores it for comparison with the output from other IR phototransistors. Based on the relative levels of the IR light, the PICAXE signals a servo motor to rotate to a predetermined position. Thus, reflected IR light can be used to control physical movements.”

Link