Hello!
Today’s example is building on our earlier robot examples last week. We will be showcasing an obstacle avoider robot. Not all robots are battle tanks so we don’t want our bots to get hurt! This example will using the PSoC 4 to detect objects ahead of the robot and adjust its course to avoid the obstacle. In this example we are using environmental feedbacks to drive the motor operation. For this example we will be using the following hardware:
- PSoC 4 Pioneer Kit
- ArduMoto shield
- Custom Robot hardware
- AA battery pack
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
Components Used:
The user can download the example project at the bottom of this post. The project uses the following list of Creator Components:
- PWM
- CyClock
- Status Register
- Fractional Frequency Synthesizer
- D Flip Flop
- Logic Gates
- CyPins
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.
Firmware Description:
The main.c firmware is included in the example project. Please review the commented sections for more details.
In this design we are using two IR controls, Transmit and Receive, to detect the proximity of the area around the robot. We then feedback the values we received to control the motors.
The robot will read in the output from the TSOP1738 IR sensor. Depending on the value we assign a ‘positioning value’. This value is tested and then initiates an action based on the obstacles. The obstacles can be positioned around the robot (Left, Forward-left, Center, Forward-Right, and Right). Depending on the detected obstacle the robot will perform a different action to avoid the obstacle.
Hardware Connections:
Please connect the motor shield to the Pioneer kit and connect the battery pack to the motor shield. You will need to connect the motors to the motor shield and wire up the IR circuitry.
The prototype area of motor driver shield is used for soldering 3 IR LEDs, 3 IR receivers which act as proximity sensors. It takes advantage of PSoC4 UDBs to implement transmitter modulation waveforms for TSOP1738 IR receiver. The UDB circuit switches IR LED on and off in a manner that three IR LED - Receiver pairs can work simultaneously as proximity sensor with minimal current consumption.
TSOP1738 - 3no.s, IR LEDs - 3no.s, 220Ω resistor for LED current limiting and 1uF capacitor for power supply filtering across TSOP1738.
Test Your Project:
Set up your obstacle course and program the Pioneer board. Set the robot down on the course and start the project.
I hope this example can help you in your design.
Best,
Matt