WHAT IS THE REALTIONSHIP BETWEEN Voltage of the sensor and Pulse Width Modulati
Andres
Posts: 10
The combination of Sharp Sensor and the AD0831 CONVERTER will produce a digital signal. How that Digital Signal will be useful to control the duration of the Servo Motor.
I already went over "Robotics with the BoeBot" Chapter 2 for controlling Servo motor. But it doesn't talk about how the SENSOR OR THE AD0831 CONTROLS THE CONTINUOUS SERVO MOTOR.
I already went over "Robotics with the BoeBot" Chapter 2 for controlling Servo motor. But it doesn't talk about how the SENSOR OR THE AD0831 CONTROLS THE CONTINUOUS SERVO MOTOR.
Comments
Suppose your sensor readings ran from 0-10, representing the number of inches to the nearest object. You could write code that would have your motors run forward (moving the robot forward) when the readings were 5 or above, but stop once the reading is below 5. Alternatively you could write code that would have the motors run backwards if the sensor reading is less than 3, forward if its from 3 to 6, and stop if it's above 6. Or any other combination you want.
In essence, you have this:
Sensor readings ---> Code that decides on the basis of the readings what actions to take ---> Servo motor control
So there is no single answer to your "what is the relationship?" question. It's whatever you program it to be. You learn to set up hardware/software so you can read sensors, and hardware/software so you can control motors, and then software (alone) to decide how to relate the two.
Do you know a solution for this problem
THANK YOU
This program will read the sensor and give and output in binary number and a decimal value.
[noparse][[/noparse] Title ]
' Basic Analog and Digital - PL3_1R0.bs2
' Program Listing 3.1 Revision 0.
' {$STAMP BS2}
' {$PBASIC 2.5}
'
[noparse][[/noparse] Declarations ]
adcBits VAR Byte
v VAR Byte
r VAR Byte
v2 VAR Byte
v3 VAR Byte
'
[noparse][[/noparse] Initialization ]
CS PIN 0
CLK PIN 1
DataOutput PIN 2
DEBUG CLS 'Start display.
'
[noparse][[/noparse] Main Routine ]
DO
GOSUB ADC_Data
GOSUB Calc_Volts
GOSUB Display
LOOP
'
[noparse][[/noparse] Subroutines ]
ADC_Data:
LOW CLK
LOW CS
PULSOUT CLK, 210
SHIFTIN DataOutput,CLK,MSBPOST,[noparse][[/noparse]adcBits\8]
HIGH CS
RETURN
Calc_Volts:
v = 5 * adcBits / 255 '? new line
r = 5 * adcBits // 255 '? new line
v2 = 100 * R / 255 '? new line
v3 = 100 * r // 255 '? new line
v3 = 10 * v3 / 255 '? new line
IF (v3 >= 5) THEN v2 = v2 + 1 '? new line
IF (v2 >= 100) THEN '? new line
v = v + 1 '? new line
v2 = 0 '? new line
ENDIF '? new line
RETURN
Display:
DEBUG HOME
DEBUG "8-bit binary value: ", BIN8 adcBits
DEBUG CR, CR, "Decimal value: ", DEC3 adcBits '? new line
DEBUG CR, CR, "DVM Reading: " '? new line
DEBUG DEC1 v, ".", DEC2 v2, " Volts" '? new line
RETURN