Kart/serial link

(Difference between revisions)
Jump to: navigation, search
(SmartPhone to Kart)
Line 45: Line 45:
 
| 2
 
| 2
 
| UINT16
 
| UINT16
| stepper motor period (speed proportional to 1/period)
+
| Stepper motor period (speed proportional to 1/period)
 
|-
 
|-
 
| 3
 
| 3
 
| UINT16
 
| UINT16
| Desired Steering Angle
+
| Desired steering angle
 
|-
 
|-
| 3
+
| 4
| UINT16
+
| UINT5
| LEDs
+
| End switch address
 
|-
 
|-
 
| 5
 
| 5
| UINT16
+
| UINT5
 
| Hardware orientation
 
| Hardware orientation
 +
|-
 +
| 6
 +
| UINT4
 +
| LEDs
 
|-
 
|-
 
| 15
 
| 15

Revision as of 10:17, 12 June 2014

Contents

Serial link protocol

This section defines the serial link protocol used to communicate between the Kart and the SmartPhone. All data is spontaneous send and can not be polled.

Serial port

Communication is done with:

  • 115200 baud
  • 8 bits
  • no parity
  • no handshake

Message Format

SoF (1 byte) Address (1 byte) Data (2 bytes) EoF (1 byte)
0x55 UINT8 UINT16/INT16 0xAA

Registers

SmartPhone to Kart

Address Datatype Description
0 UINT16 DC motor PWM period
1 INT5 DC motor speed: -15 to 15 (Negative numbers = backwards)
2 UINT16 Stepper motor period (speed proportional to 1/period)
3 UINT16 Desired steering angle
4 UINT5 End switch address
5 UINT5 Hardware orientation
6 UINT4 LEDs
15 UINT16 Serial link update interval [ms]

Kart to SmartPhone

Address Datatype Description
0 UINT16 Hall speed count 1
1 UINT16 Hall speed count 2
2 UINT1 Steering status: 0x01 means angle reached
3 UINT16 Actual Steering Angle
4 UINT1 Stepper End (bit is '0' when end switch is pressed)
5 UINT16 ADC Value of the Battery Voltage Level
8 UINT16 Proximity 1
9 UINT16 Proximity 2
10 UINT16 Proximity 3
11 UINT16 Proximity 4
12 UINT16 Ambient Light 1
13 UINT16 Ambient Light 2
14 UINT16 Ambient Light 3
15 UINT16 Ambient Light 4

Hardware orientation

Bit Meaning Description
0 Kart goes as DC motor When '0', the kart goes backwards when the motor turns forwards
1 Kart turns right (clockwise) When '1', kart turns to the right as stepper motor phases go from 1 to 4
2 End sensor is on left side If '1', the angles are measured clockwise.

The end sensor always defines position 0. Angles are always positive.

If bits 1 and 2 are different, the stepper motor phase sequence has to be inverted.

Personal tools
Namespaces
Variants
Actions
Navigation
Modules / Projects
Browse
Toolbox