Bluetooth project using EB024

For E-blocks user to discuss using E-blocks and programming for them.

Moderators: Benj, Mods

Post Reply
vincentchong
Posts: 19
Joined: Mon Jan 11, 2010 11:33 am

Bluetooth project using EB024

Post by vincentchong »

Hi there,

Currently i am working on a project which is to turn the LED on/off using mobile phone(N85) via bluetooth. The kits that i will be using would be:
1)EB024, bluetooth board
2)EB006, multiprogrammer
3)EB004, LED display
4)EB005, LCD display

I would like to have advise from matrix multimedia if there is any additional blocks that i might need in order to make the project success?

Regards
Vincent

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Bluetooth project using EB024

Post by Benj »

Hello Vincent,

You may need a copy of Flowcode and a larger PICmicro device such as a 16F877A or a 18F4455. You will also probably need a PSU.

Other then that you should be ok.

vincentchong
Posts: 19
Joined: Mon Jan 11, 2010 11:33 am

Re: Bluetooth project using EB024

Post by vincentchong »

Hi ben,

I will be using pic16f877 and flowcode 4 for this project. I am not sure what's PSU? well i have some problems at the moment which is communicating to the bluetooth module using ezurio terminal. i will describe how the problem is:

I get a copy of bluetooth example program from the matrix multimedia website and burn it to the PIC, power it up using the adapter and everything seems to be working well. Next i pick up the bluetooth signal using my laptop wirelessly then i open up the ezurio terminal and connects it to the virtual com port. The first thing i did was tying "!!!" and only then anything i typed will be visible in the terminal. The thing is other than me typing "AT" which replies me ok.."AT+BTI will give error 14??and error 5 for other commands?

Also what ever i typed in the terminal will appear on the LCD display? do i have to correctly configure the baudrate?or setting the bluetooth module to master or slave mode?

regards
vincent

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Bluetooth project using EB024

Post by Benj »

Hello Vincent

The AT commands such as AT+BTI will only apply to the bluetooth module on the E-Blocks.

Your laptop will be using a different bluetooth module that may have a different AT command interface if it has one at all, commands cannot be sent over the wireless.

Basically you should be able to send the appropriate commands to the module to allow it to be connected to and then connect from your PC or visa versa. Once you have the devices paired and communicating then you should be nearly there.

Once you have communications configured then you esentially have a bi-directional wireless com port. Eg there is no master or slave but two peers on a bus that can each send or receive data. Using Flowcode you should be able to set up some control eg if it receives an ascii 0 '0' then switch off a output or if it receives an ascii 1 '1' then switch on an output.

vincentchong
Posts: 19
Joined: Mon Jan 11, 2010 11:33 am

Re: Bluetooth project using EB024

Post by vincentchong »

Hi ben,

so what you mean is that for me to communicate with the bluetooth module in the terminal i'll have to connect the bluetooth module to my laptop. And is there any idea how to do this? as i cant seem to connect the bluetooth module directly to my serial port, also is there any driver software required to be installed?


Regards
vincent

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Bluetooth project using EB024

Post by Benj »

Hello Vincent

You will need to setup the remote bluetooth module using a PIC program that sends the correct setup AT commands to the bluetooth module.

For the other bluetooth module you could use some software such as bluesoliel to create the paired connection to enable the bluetooth serial communications.

I think most of this should be explained in the Bluetooth solution manual which is available from our learning centre.

vincentchong
Posts: 19
Joined: Mon Jan 11, 2010 11:33 am

Re: Bluetooth project using EB024

Post by vincentchong »

Hi ben,

I am now trying to connect EB024 directly to my laptop using RS232 - usb converter. So when you look at the Eblock, do i just connect the female connector of EB024 to the serial to usb converter to the laptop and ignoring the male connector?Also not forgetting to supply the +5 and ground to the bluetooth module..please advise if i am doing the right thing.

regards
Vincent

vincentchong
Posts: 19
Joined: Mon Jan 11, 2010 11:33 am

Re: Bluetooth project using EB024

Post by vincentchong »

Still awaiting reply from matrix multimedia...regards

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Bluetooth project using EB024

Post by Benj »

Hello Vincent

What you are trying to do will not work without a great deal of programming effort on your part. The E-Block is designed for microcontroller usage only using Flowcode or your own C application. If you need a Bluetooth adapter for your PC then why not use a Bluetooth USB dongle. They are available from amazon or ebay for around Β£5 each.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Bluetooth project using EB024

Post by Benj »

This document may help you to understand the thinking behind the E-Blocks range of electronics.

http://www.matrixmultimedia.com/datashe ... 5-80-2.pdf

vincentchong
Posts: 19
Joined: Mon Jan 11, 2010 11:33 am

Re: Bluetooth project using EB024

Post by vincentchong »

Hi ben,

I have attached a diagram on what i understand about this project so far. The actual problem that i am stuck with is the part where you need to establish a communication between the bluetooth module connected to the laptop and bluetooth module connected to the PIC. Do i need another bluetooth module EB024 connected to the laptop? I actually have written a program in flowcode to give out bluetooth signal and pairing already.I am just confuse how many bluetooth module that is needed in this project.

Regards
Vincent
Attachments
overview.jpg
overview.jpg (13.51 KiB) Viewed 16693 times

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times

Re: Bluetooth project using EB024

Post by Sean »

Hello Vincent,

I have used a PC (XP) with a USB Bluetooth adapter to communicate with an B-blocks Bluetooth board.

The microcontroller connected to the e-blocks board must run the scripts that make the E-block module discoverable and set the passkey. Sample scripts are contained in the Bluetooth example programs and can be checked against the Ezurio documentation.

With the Bluetooth adapter connected to your PC, you should be able to use the Windows Bluetooth Devices manager (from Control Panel) to search for the E-block as a new device.

If Windows finds the E-block it will allocate new COM ports to it that can be used directly from Hyperterminal or other applications.

If the E-block can not be found by Windows you will need to confirm that it is being programmed correctly by the microconteroller.

Check:
Device clock speed, Flowcode clock speed setting, clock source switches
Port connections
Script commands
E-block jumper links
Power supply voltages
etc.

vincentchong
Posts: 19
Joined: Mon Jan 11, 2010 11:33 am

Re: Bluetooth project using EB024

Post by vincentchong »

Hi sean,

well my microprocessor is burnt with the bluetooth sample from the website. I powered up all the E-blocks and are able to detect the bluetooth device which appear as (Ezurio blui E85721) from my laptop. I opened up the ezurio terminal, connect it to the comm port that the device is connected to and the LED from EB024 lights up. I typed "!!!" and got the OK reply and when i tried to type in other AT commands i start to receive error 14 or 05? may i know the problem im facing with? is it the baud rate setting?

My Device clock speed is K19.6608 , Flowcode clock speed setting is 19660800, clock source switches are set to fast.
The bluetooth device is connected to the Port 20
Script Command
script 1
AT&F*
ATS0=1
ATS536=1
ATS512=4
AT+BTK="1234"
AT&W
ATZ

Script 2
ATS0=1
ATS536=1
ATS512=4
AT+BTK="1234"
AT&W
ATZ

As for the connections, im following those from the data sheet.

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times

Re: Bluetooth project using EB024

Post by Sean »

Hello Vincent,

The system appear to be working correctly and passing messages.

The two error messages are:

05 = Syntax error
14 = Incorrect mode

One problem we have found with the script is that the '&W' sequence can be interpreted incorrectly. Commands like AT&W should be rewritten with the lower case w:

AT&w.

Without the correct AT&w command, the ATZ command is probably clearing the bit that enables the remote control option.

vincentchong
Posts: 19
Joined: Mon Jan 11, 2010 11:33 am

Re: Bluetooth project using EB024

Post by vincentchong »

Hi sean,

I got the idea on how this project is going to work now yet still having some doubts.

1)What i would like to know now is the interface of the bluetooth module? understand that its giving out signals in term of ASCII??How can i send such signal to the bluetooth module? As i know that the module only communicates using AT commands?

2)Do i have to change between local/remote mode at times to configure the settings?or jus use another set of PIC controller and a bluetooth module?because at the moment i am using only one.

Here is the approach on how i write the program:

Send out an inquiry signal for other Bluetooth devices to respond to >> Found a response? >> awaiting for input signal >> sending the signal to PIC to turn on/off the LED.

Regards
Vincent

vincentchong
Posts: 19
Joined: Mon Jan 11, 2010 11:33 am

Re: Bluetooth project using EB024

Post by vincentchong »

Hi

So far i am able to communicate with the bluetooth module in the terminal now. like say sending AT commands and stuffs..well now i am not very sure on how to create the signal like those in ascii code(A10 or A11)? I tried looking at the AT command on sending a data in the manual but didnt find much about it?

Regards,
vincent

vincentchong
Posts: 19
Joined: Mon Jan 11, 2010 11:33 am

Re: Bluetooth project using EB024

Post by vincentchong »

Is it possible to send/receive date from the same bluetooth module at the same time?

vincentchong
Posts: 19
Joined: Mon Jan 11, 2010 11:33 am

Re: Bluetooth project using EB024

Post by vincentchong »

I am really new to bluetooth that why i would like to know also if it also possible to send any data from hyperterminal with 9600 baud rate and receiving the same data back at hyperterminal without connecting to the PIC or writing any program to it?

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Bluetooth project using EB024

Post by Benj »

Hello

This document should answer all your questions,
http://www.matrixmultimedia.com/Learnin ... ersion.pdf
I am really new to bluetooth that why i would like to know also if it also possible to send any data from hyperterminal with 9600 baud rate and receiving the same data back at hyperterminal without connecting to the PIC or writing any program to it?
I'm guessing no.
Is it possible to send/receive date from the same bluetooth module at the same time?
Yes a Bluetooth serial connection is bi directional.

vincentchong
Posts: 19
Joined: Mon Jan 11, 2010 11:33 am

Re: Bluetooth project using EB024

Post by vincentchong »

Hi ben,

I have looked into the pdf file you recomended and understands how to achieve pairing and device discoverable but i still having doubts in understanding in sending of data and receiving it. Also the parameters used in the bluetooth macros. Is it possible to have an example of the program that actually echos back whatever you type in hyperterminal and displays on the LCD? That might be easier to understand?

Regards
vincent

vincentchong
Posts: 19
Joined: Mon Jan 11, 2010 11:33 am

Re: Bluetooth project using EB024

Post by vincentchong »

Hi,

I tried to write a program that gives out passkey "1111" and any blue tooth devices could connect to it but seems like not working. It still uses the default passkeys
1234? Below shows my approach in writing the program.

Initialised >> AT+BTK=1234>>wait for response>>AT+BTW>>wait for response and ATD

I also tried changing the name of the bluetooth device using AT+BTN=NewName...and it turns out to be the same default name as well.

Regards
Vincent

vincentchong
Posts: 19
Joined: Mon Jan 11, 2010 11:33 am

Re: Bluetooth project using EB024

Post by vincentchong »

Dear all,

Referring to the example BT_EX5_Node B...is there any possibilities to issue the AT commands of AT+BTW only without adding the address of the specific device that the bluetooth module intends to connect to?? As i would like other bluetooth devices to be able to connect to it. The problem is i always get the error 4 when doing so. Can i have any suggestion with regards to this matter?

Thanks
Vincent

vincentchong
Posts: 19
Joined: Mon Jan 11, 2010 11:33 am

Re: Bluetooth project using EB024

Post by vincentchong »

Dear Ben/Sean

Please have a look at this program which i have made a slight changes. I have changed the address to my laptop's bluetooth address and i am always getting error 4 on my lcd screen and when i tried using my mobile phone i get error 7. Could anyone of you advise on my problem. I really need to know whats gone wrong.

Regards
Vincent
Attachments
BT_EX5_Node_B.fcf
(19.55 KiB) Downloaded 434 times

User avatar
Steve
Matrix Staff
Posts: 3434
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times

Re: Bluetooth project using EB024

Post by Steve »

vincentchong wrote:Dear all,

Referring to the example BT_EX5_Node B...is there any possibilities to issue the AT commands of AT+BTW only without adding the address of the specific device that the bluetooth module intends to connect to?? As i would like other bluetooth devices to be able to connect to it. The problem is i always get the error 4 when doing so. Can i have any suggestion with regards to this matter?

Thanks
Vincent
As you are using it, Bluetooth is a point-to-point communication protocol. You cannot connect more than 2 devices together unless you implement a higher level networking profile.

Post Reply