Bluetooth: Unterschied zwischen den Versionen
(→Steps) |
(→PC remote control application) |
||
Zeile 43: | Zeile 43: | ||
For Programming the Module, you must connect the Key Pin from the BT Module to the 3.3 V from the PCB and disconnect after programming. | For Programming the Module, you must connect the Key Pin from the BT Module to the 3.3 V from the PCB and disconnect after programming. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
=Bluetooth module configuration steps= | =Bluetooth module configuration steps= |
Version vom 19. Juni 2017, 12:36 Uhr
Inhaltsverzeichnis
Abstract
The Ardumower can be monitored and controlled wirelessly:
- via phone/tablet (Android App)
- via USB Bluetooth dongle (PC serial console)
On the phone, you'll need the App 'ArduRemote'. Alternatively, you can use the App 'pfodApp'.
The phone menu includes:
- Status information (battery voltage, charging current etc.)
- Settings (Timer etc.)
- Calibration (Motor, IMU etc.)
- Remote control (Start/Stop, Switching on/off mower motor, blade modulation etc.)
Bluetooth module
On the robot, you'll need a Bluetooth HC-05 module supporting Bluetooth Serial Port Profile (SPP). SPP uses Bluetooth Service Discovery Protocol (SDP) and the RFCOMM protocol.
Bluetooth HC-05
Wiring:
Bluetooth HC05 VCC --- PCB VCC Bluetooth HC05 GND --- PCB GND Bluetooth HC05 TX --- PCB RX Bluetooth HC05 RX --- PCB TX
For Programming the Module, you must connect the Key Pin from the BT Module to the 3.3 V from the PCB and disconnect after programming.
Bluetooth module configuration steps
- Configuration mode: The Bluetooth module must be in configuration mode for the next step:
- for HC05: Connect KEY pin to 3.3V after powering on the module
- for HC06/linvor: Do NOT pair/connect (LED must be blinking)
- for FBT06/MBTV4: First you have to solder the PIO11 pin to VCC (PIN 12) which is 3.3 Volts using a thin wire.
- Baud rate: Blueooth module and Arduino Mega must use the same baud rate (19200) - The baud rate of the BT module can be changed via Ardumower serial console. Connect Ardumower Mega board to your PC (USB), enter the serial console in the Arduino IDE (CTRL+M), and choose baud rate 19200, then choose 'd' to enter the Ardumower menu, '3' for communications menu, and '3' to configure the module to the correct baud rate.
- Restart: After your BT module is configured successfully, remove KEY pin connection again (HC05), and restart module.
- Pairing: The BT module must be 'paired' with your Android device once (via Android device settings). On the Android device, choose symbol "Settings" (via Android menu). Now choose "Wirless and Networks->Bluetooth Settings" and "Find device". Finally, choose "pair with this device" and enter your pin (very often "1234"). The Bluetooth module should now appear as "paired".
- pfodApp: Now you can start pfodApp/ArduRemote to connect to the Ardumower.
Communication protocol
The communication protocol between robot and Android app (the 'pfodSpecification') is defined here: http://www.forward.com.au/pfod/.
All menus (menu items, sliders, buttons) are created inside the robot. The App only visualizes the created menus, and sends back a command if a menu item was clicked by the user.
Example communication:
1. App requests main menu: {.} 2. Robot sends main menu to App: {.title`1000|key1~text1|key2~text2|key3~text3} The App will visualize the main menu like this:
title [text1] [text2] [text3]
3. User clicks menu item 'text1', App sends back to robot the corresponding command: {key1}
You can log the communication to a file (folder 'pfodAppRawData' or 'ArduRemote') on your Android device. For the ArduRemote, press the 'Android menu button' on your device and choose 'Enable logging'.
Sensor logging
For PC data analysis, algorithm modelling and optimization, you can collect robot sensor data using pfodApp like this:
- Using your Android pfodApp, connect to your robot and choose 'Log sensors'. The logged sensor data will be displayed. Click 'Back' to stop logging (NOTE: for ArduRemote, press Android menu button before and choose 'Enable logging' to enable file logging).
- Connect your Android phone to the PC, if being asked on the phone choose 'Enable as USB device', so you phone shows as a new Windows drive on your PC.
- On your PC, launch Windows Explorer and choose the new Android drive, browse to the 'pfodAppRawData' folder (for ArduRemote: 'ArduRemote' folder), and copy the data file to your PC (you can identify files by their Bluetooth name and date).