Bluetooth Remote Control
Bluetooth Remote Control
The Main. cpp includes the PIO control for LED, KEY, Lamp, Buzzer, and battery
power detection. The battery power detection uses hardware circuit to
convert voltage measured from analog to 12-bit data. Users can read the data
via PIO and send the UART package the BTS-TMD through UART object to
Android device. The CCar object includes two CDcMotor sub-objects which
control the two DC motors on the A-Cute car. The CDcMotor objects control
the PWM IP to control the speed and rotation direction of DC motors.
Command Description
The last channel of the ADC chip can monitor larger range of input voltage by
dividing input voltage connected to the ADC chip. The digitized value must be
multiplied equally back to get the actual input voltage in mV.
In this demonstration, SPI bus is used to communicate between the FPGA and
the LTC2308. The SPI clock of LTC2308 can be 40MHz at maximal. Considering
the reliability of GPIO cable, 20MHz is used in this demonstration. The source
code of LTC2308 IP is located under the “ M_METER” folder in the system CD.
The register file of the IP is defined below.
When the application is executed, it starts from Activity(Boot) and enters the
boot screen for about 4 seconds before the object is switched from there to
Activity(SmartCar).
If the A-Cute car is connected to a device such as Android device via Bluetooth,
the Activity(SmartCar) will be paused and the Activity(Bluetooth) will be
executed. After the connection is established, it will switch back to
Activity(SmartCar). The Service(SmartCar) is running at the background of
Android device and cannot be found on the UI. It is responsible for the
transmission of all commands between the A-Cute car and Android device. The
Demo Setup
The steps to setup the demonstration are:
Users can open the Quartus project file DE0_NANO_Remote_CAR.qpf and click
the menu item “ProcessingStart Compilation” to initiate the rebulid process.
When the compilation is complete, an output file named DE0_NANO_Remote
_CAR.sof will be generated under the output_files folder.
The Nios II project is created by Nios II v15.1 Software Build Tools for Eclipse.
The source code is located under the folder:
Launch Nios II v15.1 Software Build Tools for Eclipse and set the above folder
as workspace. In the Project Explore Window, right click
“RemoteCar_bsp[nios_system” and select “NIOS II Generate BSP” to build the
BSP. Right click “RemoteCar” and select “Build Project” to generate binary file.
When the rebuild is complete, an output file named RemoteCar.elf will be
generated under the folder:
Figure 8
http://developer.android.com/sdk/installing/installing-adt.html
The project folder needs to be imported prior to the start of building the
project. Choose FileImportAndroidExisting Android Code Into
Workspace from the menu, as shown in Figure 9.
Figure 10
Figure 11