On Thursday I re-soldered the EB500 header strip to the PS/2 connector wire. Abuse/overuse had led to the failure of Chiu Yen's original solder job.
After completing that task and verifying the motor system, we conducted our first test of the truck's performance. With a stopwatch we measured the time for the truck to travel a pre-determined distance as a function of our input to the speed controller. I was in charge of recording data; Allen drove the truck via the netbook, ensuring that it accelerated to the target speed before entering the test zone and keeping it on a straight course; Chiu Yen was the truck retriever and called out when it entered the test zone; and Venkat manned the stopwatch at the end of the test zone. In this arrangement we conducted fifteen test runs; three each at five input speeds. The test zone was the carpeted area beside the computers in the MEM UG computer laboratory and measured 2.45 meters in length. The plot below shows a summary of our data; the average velocity for each control input is plotted along with the standard deviation.
Friday, February 19, 2010
Tuesday, February 16, 2010
Bluetooth - PS/2 Connection
We connected our EmbeddedBlue EB500 Bluetooth Transceiver via one of the Parallax Propeller's built-in PS/2 ports. The male connector was re-purposed from an old keyboard; the wire ends of the cord are soldered to a 2 x 10 male x female header (0.1" spacing). The wiring diagram is below:
We elected to connect to the green PS/2 port labeled "Keyboard," communicating on the Propeller's digital pins 24 and 25. The actual signal connections are shown in the table below:
PS/2 Pin Signal EB500 Pin
---------------------------
1 TX 3
2 N/C -
3 GND 1 & 2
4 VCC 20
5 RX 4
6 N/C -
The TX connection is data transmitted from the EB500; RX is the data line incoming from the Propeller. N/C = no connection. Note that the EB500 data sheet specifies that both pins 1 and 2 be connected to ground; we have accomplished that by soldering them together on the header. That way we weren't risking any damage to our (now out of production) Bluetooth board.
Thursday, February 4, 2010
Basic working code!
We finally got some code to work and interface with the blue tooth through hyper-terminal. Check out the code below!
{{Truckbasic.spin}}
{{
11-25-08
Control E-MAXX truck equiped with 5 Ping))) sensors and a CMUcam2+
}}
Con
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
Th_Channel = 12 'servo control settings
St_Channel = 7
Rate = 1
MaxDist = 100 'ping range settings
NeutralDist = 40
MinDist = 1
MaxForward = 135 'speed controller settings
MinForward = 131
Neutral = 125
MinReverse = 122
MaxReverse = 115
ExtLeft = 190 'steering settings
ExtRight = 40
MaxSteer = 50
Center = (ExtLeft + ExtRight) / 2
SensLim = 100
SteeringProportionalGain = 1
ConfidenceThreshold = 75
OBJ
Servo : "PWM"
Serial_PC : "FullDuplexSerial"
Num : "Numbers"
Distance : "Ping"
VAR
Byte Throttle 'display values
Byte Steering
Byte Cam_angle
Word D0
Word D1
Word D2
Word D3
Word D4
Byte mx 'camera values
Byte my
Byte x1
Byte y1
Byte x2
Byte y2
Byte pixels
Byte confidence
Byte r1
Byte r2
Byte TargetAquired
Byte CrMean
Byte YMean
Byte CbMean
Byte CrDeviation
Byte YDeviation
Byte CbDeviation
PUB Main
BTSetup 'setup bluetooth connection
Throttle := Neutral
Steering := 115
Cam_angle := 125
r1 := 0
r2 := 0
repeat 'main loop
UserIn
UserOut
Servo.Send(Th_Channel, Rate, Throttle)
Servo.Send(St_Channel, Rate, Steering)
PUB BTSetup
Serial_PC.start(24, 25, 0, 9600) 'if bluetooth card is in 9600 mode change it to 115200
Serial_PC.str(string("set baud 115200 *", 13))
waitcnt(clkfreq/10 + cnt)
PUB UserIn | input
input := serial_PC.rx
Sample
if input == "w" 'forward
Throttle := Throttle + 3
elseif input == "s" 'reverse
Throttle := Throttle - 3
elseif input == "a" 'turn wheels left
Steering := Steering + 10
elseif input == "d" 'turn wheels right
Steering := Steering - 10
elseif input == " " 'all stop
Throttle := Neutral
Steering := 115
Cam_angle := 125
repeat
if serial_PC.rxcheck <> -1
quit
UserOut 'temp added for loop
Servo.Send(Th_Channel, Rate, Throttle)
Servo.Send(St_Channel, Rate, Steering)
if D4 < 5
quit
throttle := Neutral
Steering := 115
else
serial_PC.tx(13)
serial_PC.str(string("unknown"))
PUB UserOut
serial_PC.tx(13)
if Throttle
serial_PC.str(string("Throttle:"))
serial_PC.str(Num.ToStr(Throttle, Num#DDEC))
if Steering
serial_PC.str(string(" Steering:"))
serial_PC.str(Num.ToStr(Steering, Num#DDEC))
if D0
serial_PC.str(string(" D0"))
serial_PC.str(Num.ToStr(D0,Num#DDEC))
if D2
serial_PC.str(string(" D2"))
serial_PC.str(Num.ToStr(D2,Num#DDEC))
PUB Sample
D0 := Distance.Centimeters(0) 'only enable pins with a ping attached or code will hang
waitcnt(clkfreq/1000 + cnt)
D2 := Distance.Centimeters(2) 'only enable pins with a ping attached or code will hang
waitcnt(clkfreq/1000 + cnt)
{{Truckbasic.spin}}
{{
11-25-08
Control E-MAXX truck equiped with 5 Ping))) sensors and a CMUcam2+
}}
Con
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
Th_Channel = 12 'servo control settings
St_Channel = 7
Rate = 1
MaxDist = 100 'ping range settings
NeutralDist = 40
MinDist = 1
MaxForward = 135 'speed controller settings
MinForward = 131
Neutral = 125
MinReverse = 122
MaxReverse = 115
ExtLeft = 190 'steering settings
ExtRight = 40
MaxSteer = 50
Center = (ExtLeft + ExtRight) / 2
SensLim = 100
SteeringProportionalGain = 1
ConfidenceThreshold = 75
OBJ
Servo : "PWM"
Serial_PC : "FullDuplexSerial"
Num : "Numbers"
Distance : "Ping"
VAR
Byte Throttle 'display values
Byte Steering
Byte Cam_angle
Word D0
Word D1
Word D2
Word D3
Word D4
Byte mx 'camera values
Byte my
Byte x1
Byte y1
Byte x2
Byte y2
Byte pixels
Byte confidence
Byte r1
Byte r2
Byte TargetAquired
Byte CrMean
Byte YMean
Byte CbMean
Byte CrDeviation
Byte YDeviation
Byte CbDeviation
PUB Main
BTSetup 'setup bluetooth connection
Throttle := Neutral
Steering := 115
Cam_angle := 125
r1 := 0
r2 := 0
repeat 'main loop
UserIn
UserOut
Servo.Send(Th_Channel, Rate, Throttle)
Servo.Send(St_Channel, Rate, Steering)
PUB BTSetup
Serial_PC.start(24, 25, 0, 9600) 'if bluetooth card is in 9600 mode change it to 115200
Serial_PC.str(string("set baud 115200 *", 13))
waitcnt(clkfreq/10 + cnt)
PUB UserIn | input
input := serial_PC.rx
Sample
if input == "w" 'forward
Throttle := Throttle + 3
elseif input == "s" 'reverse
Throttle := Throttle - 3
elseif input == "a" 'turn wheels left
Steering := Steering + 10
elseif input == "d" 'turn wheels right
Steering := Steering - 10
elseif input == " " 'all stop
Throttle := Neutral
Steering := 115
Cam_angle := 125
repeat
if serial_PC.rxcheck <> -1
quit
UserOut 'temp added for loop
Servo.Send(Th_Channel, Rate, Throttle)
Servo.Send(St_Channel, Rate, Steering)
if D4 < 5
quit
throttle := Neutral
Steering := 115
else
serial_PC.tx(13)
serial_PC.str(string("unknown"))
PUB UserOut
serial_PC.tx(13)
if Throttle
serial_PC.str(string("Throttle:"))
serial_PC.str(Num.ToStr(Throttle, Num#DDEC))
if Steering
serial_PC.str(string(" Steering:"))
serial_PC.str(Num.ToStr(Steering, Num#DDEC))
if D0
serial_PC.str(string(" D0"))
serial_PC.str(Num.ToStr(D0,Num#DDEC))
if D2
serial_PC.str(string(" D2"))
serial_PC.str(Num.ToStr(D2,Num#DDEC))
PUB Sample
D0 := Distance.Centimeters(0) 'only enable pins with a ping attached or code will hang
waitcnt(clkfreq/1000 + cnt)
D2 := Distance.Centimeters(2) 'only enable pins with a ping attached or code will hang
waitcnt(clkfreq/1000 + cnt)
Subscribe to:
Posts (Atom)
