Today we are focusing on integrating sensor detection with motor control. We have created what is lovingly called the ‘PSoC Eye’. In this example we are using the Wii Remote IR tracking sensor to control two servo motors that pan and tilt to track the movement of an IR light emitting target.
Forum Post Attachments:
At the bottom of this post we are including the following items:
- Example Project Zip File
- Zip File of Images
- Project Schematic
- Component Configurations
The user can download the example project at the bottom of this post. The project uses the following list of Creator Components:
- PWM (x2)
The components are configured by right clicking on the component in your Top Design schematic view and selecting Configure. Please enable the following selections in the Configuration windows for the listed components above.
The main.c firmware is included in the example project. Please review the commented sections for more details.
In this example we use the I2C component to communicate with the IR sensor. The values received by this sensor will determine the movement of the two servo motors to maintain the sensor’s view of the target. We are using two PWM components to control the two servo motors.
We have also attached two specifications to this post, one specification for the Pixart sensor and the second for the two servo motors.
In this example we have attached both the servo motors and the Pioneer kit to plexiglass. A custom breadboard is used to connect the Pioneer board to the Sensor and Servo motors. The schematic is included below. The two motors are used to pan and tilt the sensor. The bottom motor is fixed to the plexiglass and will spin allowing for azimuthal (pan side to side) angle calculation. Fixed to the top of that motor is the second motor that will move the sensor about the polar angle (tilt up and down). In this example the bottom and top motors will spin 180 degrees allowing you to track all objects in one hemisphere of available space.
Test Your Project:
Program your Pioneer kit and then move a IR emitting object around in front of the sensor. You will see that the PSoC 4 device will control the servo motors to track the object.
I hope this example can help you in your design.