Fundamental Concepts

From Bike Wiki
Jump to navigation Jump to search

Overview

This page serves to hold fundamental information related to the electrical, embedded, communication systems present on the bike.

Serial Peripheral Interface (SPI)

The motivation behind using SPI communication rather than serial ports is because serial ports act on asynchronous communication. Ansynchronous communication (i.e. not synchronized with a common clock) often requires extra overhead due to the use of start and stop bits (i.e. sync bits). Synchronous communication, however, uses a common clock to synchronize data transmission. The clock is normally idle and only produces an oscillating signal to tell the receiver when to sample bits on the data line. SPI is type of synchronous communication that allows bi-directional data transmission. Thus, there are two lines of communcation, MOSI and MISO. MOSI (Master-Out-Slave-In) allows the master to send data to the slave. MISO (Master-In-Slave-Out) allows the slave to send data to the master. Only one side of the SPI generates the clock signal (called SCK for Serial Clock) and is usually referred to the master (because they control when transmission occurs). In the case of the bike, the arduino DUE is the master and IMU acts as a slaves. Another capability of SPI is communicating with multiple slaves and supported using the SS line (Slave Select). There are two ways to implement SS: separate lines for each slave or salves daisy-chained. The bike uses separate lines to communicate with the IMU and RS (i.e. BeagleBone).

Encoder Channels

The encoders used on the bike are incremental encoders that have a total of three channels (A, B, and C). Channel A is a square-wave signal such that every time the rotary encoder passes through a "tick" it will produces a square-wave. From the number of these incremental ticks, one can determine the amount of rotation. The second channel B produces a signal identical to A except for the fact that it has an induced phase to determine the direction of the rotation (i.e. CW or CCW). The third channel C produces a one-pulse-per-revolution to signal when the encoder completes one turn. The function behind this is for homing and pulse count verification. The encoders have three channels, yet six outputs (i.e. A1, A2, B1, B2, C1, C2). These extra three outputs provides differential measurements for more accurate data.

Inertial Measurement Unit

The Inertial Measurement Unit (IMU) is a sensor that provides the bike's current angle (Euler angle) and the rate at which the angles change (gyro rate). For example, the IMU tells the micro controller whether its off center (if the bike is vertically upright, then output of 0 rad) and how quickly its moving off center in rad/s. The IMU has an embedded accelerometer that measures the acceleration in a Cartesian reference frame and a gyroscope that measures yaw, pitch, and roll. However, the bike only critically uses roll (or lean angle) of the gyroscope such that the control algorithm keeps the bike balanced. Yaw and pitch are not used unless the bike is using the GPS to help identify what direction the bike is turning and the bike is on angled slope. The current IMU on the bike is Yost Labs 3-Space Sensor 3-axis with 9 degrees of freedom. The bike communicates with the IMU using SPI communication. This is due to the bi-directional communication between the MCU and IMU (i.e. the micro controller sends commands to the IMU and the IMU responds with measurements). Below is a table of commands and statuses published by the team in Spring 2016:

Commands Overview
0x01 Tared* Euler Angle
0x26 Corrected** Gyro Rates
0xF6 Signals the start of the packet
0xFF Gets status and data from IMU
Statuses Overview
0x0 (Idle) IMU is waiting for a command***
0x1 (Ready) IMU has processed command and has data to send back
0x2 (Busy) Currently processing a command
0x4 (Accumulating) Currently accumulating data
  • Signifies that the IMU uses the tared orientation as the reference/zero orientation
    • Signifies that the measurements are biased and scaled to real world units
      • Any command besides 0xF6 has no effect