This demo I'm going to show you how to use the Smart Servo Controller to make a robot keep its distance.
It uses two continuous rotation servo motors and a distance sensor. The Smart Servo Controller is used to create a PID-Controller. When the robot is too close it backs off and when it is too far away it comes closer.
Follow us on facebook to stay up to day with new developments: https://www.facebook.com/smartservocontroller
Support our kickstarter campaign here: https://www.kickstarter.com/projects/143152889/smart-servo-controller
Step 1: Build the Robot
Using a servo bracket kit and a couple of continuous rotation servos build up a platform for working on.
Once you have the platform attach the smart servo controller and distance sensor to the robot.
Step 2: Connections
Connect the servo motors to the output channels 1 and 2. Have the right motor on channel 1, the left motor on channel 2.
Connect the IR distance sensor up to the input channel 1.
Now we are ready to start programming
Step 3: Configure the Inputs and Outputs
Set input 1 to analog. The IR sensor we are using outputs an analog signal that is proportional to distance.
Set outputs 1 and 2 to servo. Set the default value and zero point so that the servo motor doesn't move. Using the value picker tool (Ctrl-Click) will make this easier. Move the value picker slider up and down till the servo stops moving.
The default value is the value that is put to the servo motors when no rule is active.
The zero point is the virtual zero position for the output. Values above this number are consider positive and values below are considered negative. This allows for multiple rules to be added appropriately. This value also allows for the PID-Controller output value to be added in correctly.
Step 4: The Control Loop
We need to create a control loop for each of the wheels. Select the PID Controller and set the feedback channel to 1. This is where the distance sensor is connected. Our set point will be a fixed value. Set this value with the value picker tool. Set the output channel the one that the servo motor is connected too.
In this demo we don't need to use the I or D terms so set them to zero. Play around with the P gain. setting it high will cause a fast response but can cause oscillations. Too low and it will have slow response. Because one of the servo motors is flipped backwards, one of the gains will have to be negative to accommodate. Otherwise the robot will try to turn.
Step 5: Test It Out.
Now you can test it out to see how it works.
Thanks for reading and remember to share and support our kickstarter: https://www.kickstarter.com/projects/143152889/smart-servo-controller