MICROCAMP ZX-BLUETOOTH Application



MICROCAMP ZX-BLUETOOTH Application

This chapter will teach you how to integrate your existing Microcamp robot to INEX ZX-BLUETOOTH module to allow Bluetooth communication and control between your robot and your JAVA based Bluetooth Handphone.

Adding the ZX Bluetooth

First, secure the zx-bluetooth firmly on your microcamp robot. This can be placed anywhere that is of convenience to your robot and does not need to be according to the illustration diagram below.

[pic]

This Picture shows the ZX-BLUETOOTH mounted in the front of Microcamp.

Wire Connection of ZX-BLUETOOTH to MICROCAMP

There are total of 4 main wires from the ZX-BLUETOOTH to the MICROCAMP. These are namely, the TX, RX, +5V and GND

The table below shows the pin to pin connections

|ZX-BLUETOOTH |MICROCAMP |

|TX |RX |

|RX |TX |

|+ |+ |

|G |G |

Please take precaution when connecting these 4 pins. The Ground and + power supply are VERY IMPORTANT. DO NOT Place them in the wrong direction as this may cause a short circuit on the ZX-BLUETOOTH Board. Also take note that the TX and RX of both boards connects to their opposites as this is how a serial transmission is conducted.

[pic]

ZX-BLUETOOTH Connections

[pic]

MICROCAMP Connections

After connecting the ZX-BLUETOOTH to the MICROCAMP robot, check all connections ONCE MORE.

Turn on your Microcamp and if done properly, you will see the ZX-BLUETOOTH’s Blue led flashing away. This is its current wait for pairing mode.

HANDPHONE Software

The handphone software used in this chapter are the Python Runtime Module and the BK-REMOTE Python Script.

You will need to copy the installation files into your handphone first. These can be done via a memory card on your phone or a direct Sync to your PC via your handphone software.

For example purpose, we will use the NOKIA symbian s60 v3.0 based handpone as an example.

First, copy the files required into your handphone which are, BK_Remote.py ,

PythonScriptShell_1_4_4_3rdEd. SIS and PythonForS60_1_4_4_3rdEd.SIS

Next install PYTHON RUNTIME on your phone from the 2 installation files :

- PythonScriptShell_1_4_4_3rdEd. SIS

- PythonForS60_1_4_4_3rdEd.SIS

Program the following Microcamp Code into your Microcamp

#include

#include

#include

#include

#include

#include

#include

//---------- NOKIA KEYS Definitions -----------------

/*

nokia multiway button

UP = 65

DOWN = 66

LEFT = 67

RIGHT = 68

STOP / MIDDLE = 83

1 = 49

2 = 50

3 = 51

* = 42

4 = 52

5 = 53

6 = 54

# = 35

7 = 55

8 = 56

9 = 57

0 = 48

*/

//----------------------------------------------------

void BT_activate()

{

uart_puts("AT+BTSCAN,3,0"); // Send AT+BTSCAN command

uart_putc(13); // Is enter key

}

void main()

{

unsigned char send=0;

char str[8];

int tempstr;

char dec1[2];

int ledPC4=0,ledPD5=0,ledPD6=0;

uart_set_baud(9600); // Initial UART baudrate 9600 bps

BT_activate(); // Bluetooth active wait for connect

/*

// --- for checking bluetooth values via LCD on P0--

soft_serout_init(0,9600); // Initial Serial Comm 9600 8N1

serout_byte(0,0xFE);serout_byte(0,0x00); // Command Initial LCD Module

serout_byte(0,0xFE);serout_byte(0,0x80); // Command First Line ,First Char

serout_text(0,"Ready....");

// --------------------------------------------

*/

while (1)

{

tempstr = _key;

utoa(tempstr,dec1,10);

if (tempstr==83) // STOP

{ motor_off(); }

if (tempstr==65) // UP

{ forward(100); }

if (tempstr==66) // DOWN

{ backward(100); }

if (tempstr==67) // LEFT

{ s_left(100); }

if (tempstr==68) // RIGHT

{ s_right(100); }

}

/*

while(1)

{

// --- for checking bluetooth values via LCD on P0 --

tempstr = _key;

utoa(tempstr,dec1,10);

serout_byte(0,0xFE);serout_byte(0,0x01);

serout_byte(0,0xFE);serout_byte(0,0x80); // Command First Line ,First Char

utoa(tempstr,dec1,10);

serout_text(0,dec1);

// --------------------------------------------

}

*/

}

RUNNING MICROCAMP

1) Turn on your Microcamp Robot.

2) Run the Python Application on your handphone.

3) Click on the OPTIONS TAB

4) Choose “RUN SCIPRT”

5) Choose “filebrowser.py”

6) Choose the Drive that you copied the BK-Remote file into

7) Choose the Directory that the BK-Remote file is in

8) Select BK_Remote.py

9) Choose “execfile()”

10) Your handphone will start to search for existing Bluetooth Devices. The microcamp DEVICE ID should be “BT GPS”.

11) Click on it to choose

12) After which, if a passcode is required, type in “1111”

13) Try moving the direction keys on your handphone. Microcamp Should run.

-----------------------

ZX-BLUETOOTH

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download