Arduino Due
The bike uses an Arduino Due to run its balance loop, read sensor inputs, and output motor commands. On it runs the ROS_Arduino_Wrapper code, which parses the various sensor inputs and the navigation algorithm to tell the bike how to move.
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 is powered by a voltage source between 7-12 V. Inputting any signal larger than 3.3 V will harm the microcontroller since the Due reads signals up to 3.3 V. The Due is also capable of outputting 3.3 V and 5 V. The Due utilizes the Atmel SAM3X8E ARM Cortex-M3 32-bit processor and contains 54 digital input/output pins. Having many pins (more than other Arduino microcontroller options) allows the Due to connect with more devices and be more flexible. Digital pins are pins that only take low (0) or high (1) values. All digital pins have interrupt capabilities, which allows the program to pause its current task when a user-specified event occurs to
perform another function. Once the function is completed, the processor re- turns back to where it left off.
Additionally, 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. It is also possible to control a servo motor using PWM signals, but that is not relevant to our project. Besides digital
2
Chapter 1. Electronic Subsystems (Jason Hwang) pins, the Due also contains 12 analog input pins and 2 analog output pins.