Arduino Due
The bike uses an Arduino Due to run its balance loop, read sensor inputs, and output motor commands. The Arduino is attached to the printed circuit board, and usually runs the ROS Arduino Wrapper code.
Intro
The Arduino Due is a microcontroller used to process and control all components of the bike. The Due was chosen as the microcontroller for the bike due to its many input/output pins and its high clock speed. This allows the Due to communicate with multiple devices and to calculate many instructions every second.
Hardware
The Arduino Due reads signals up to 3.3V. Inputting any signal larger than that will harm the microcontroller. The Due is also capable of outputting 3.3V and 5V signals. The Due utilizes the Atmel SAM3X8E ARM Cortex-M3 32-bit processor and contains 54 digital input/output pins. Digital pins are pins that only take low (0) or high (1) values.
Twelve of the digital pins support Pulse Width Modulation (PWM). PWM is a method for producing an analog value ranging between 0 (off) and 3.3 V (fully on) by using a digital signal. This is done by changing the duty cycle of the digital output i.e., controlling the fraction of time in each cycle that the signal is high or low. A duty cycle is the ratio between the duration a signal is high to the overall duration of the period. The average of the outputted PWM voltage is equivalent to a constant voltage between 0 V and 3.3 V. This is relevant for our purposes, because we want to control the speed of a DC motor, and this can be done by supplying different voltages, or by applying PWM signals.
Software
The Arduino's code is documented in the ROS_Arduino_Wrapper page.