PDA

View Full Version : Bluetooth text file transfer from mobile phone to PIC - rookie's question



flotulopex
- 28th November 2023, 13:47
Hi All,

Is is possible to send a text file from a smartphone's bluetooth standard to a PIC?

I imagine there is a complex file transfert protocol to make sure things are send and received properly.

Nevertheless, there might some "module" out there that could do this for me.

Is it the case?

Jerson
- 29th November 2023, 02:53
You could look at a module called the HC05. It will pair with your bluetooth phone and can talk on 5V UART with the PIC.

flotulopex
- 29th November 2023, 17:34
Thanks Jerson.

I'll grab some of these modules and try :wink:

richard
- 30th November 2023, 00:05
wifi is the easy way , just add an esp module or a socket for one

flotulopex
- 4th December 2023, 08:12
Like i.e. this one?

9503


Okay, and then, is there any particular protocol to involve or what is the idea to transmit data from à common smartphone to a PIC?

richard
- 4th December 2023, 09:11
esp01 modules tend to have smallish flash chips installed something with a 4meg or bigger flash is better. [wemos d1 mini or d1 mini pro]
i set the esp up as a simple web server. user can upload/download files from the server via a html script using any sort of browser.
the esp can then send or fetch the file data from the pic via a ttl serial connection or spi or i2c or whatever floats your boat at whatever speed you like
whenever you like. no special software is needed at all in your browser for most common file types to upload or download successfully

https://www.picbasic.co.uk/forum/showthread.php/26659-WiFi-to-setup-a-PIC-based-device?p=154776#post154776

amgen
- 6th December 2023, 18:52
Okay, and then, is there any particular protocol to involve or what is the idea to transmit data

How big a file or text to send/receive ?

flotulopex
- 19th December 2023, 21:28
It would be a config file containing data like:

001:123456789
002:234567890
...
...
...
254:456789012
255:567890123

So this makes a count of about 2'300 characters in total.

flotulopex
- 31st December 2023, 16:40
After many hours of trying and trying again, none of my four HC05 modules are willing to accept the "Master" Role. I assume this is why I couldn't establish a serial link between them :confused:

This is the most common example of HC05 modules configuration:

' Slave Configuration:
' AT+RMAAD (To clear any paired devices)
' AT+ROLE=0 (To set it as slave)
' AT+ADDR (To get the address of this HC-05, remember to jot the address down as it will be used during master configuration)
' AT+UART=9600,0,0 (To fix the baud rate at 9600)

' Master Configuration:
' AT+RMAAD (To clear any paired devices)
' AT+ROLE=1 (To set it as master)
' AT+CMODE=0 (To connect the module to the specified Bluetooth address and this Bluetooth address can be specified by the
' binding command)
' AT+BIND=xxxx,xx,xxxxxx (Now, type AT+BIND=98d3,34,906554 obviously with your respective address to the slave. Note the
' commas instead of colons given by the slave module)
' AT+UART=9600,0,0 (To fix the baud rate at 9600)


Every time I send the command AT+ROLE=1, the answer is OK but if I check with AT+ROLE, the answer is always +ROLE:0.

I even found some information suggesting to have the MASTER role physically set with a jumper 3.3V <> Pin 28 or even 3.3V <> Pin 34, which I tried.
https://www.martyncurrey.com/hc-05-fc-114-and-hc-06-fc-114-part-3-master-mode-and-auto-connect/
https://www.martyncurrey.com/arduino-with-hc-05-bluetooth-module-at-mode/


But still nothing works...

Is there a beam in my eye or can possibily all my four modules be malfunctioning? They're new....

These are my modules:
9532 9533

Jerson
- 1st January 2024, 02:32
Firstly, wishing all who read this post a happy and fruitful year ahead.

I have used these modules. You need to ensure that the interface to the module works @3.3V not 5V. I just re-looked at my C code and see that there is zero initialisation that I have used with the modules. They natively connect akin to a serial UART and you can use a BT serial terminal to read/write to it. I have not used a single AT command in the code, and it works.

flotulopex
- 1st January 2024, 16:05
I use FTDI USB cables that have 5V power and 3.3v UART levels so it should be okay from this side.

I finally ordered new and different (looking) HC05 modules.

9534

These ones have two almost equally sized black chips unlike the ones I have on my desk so they might be a little différent.

So wait and see...

flotulopex
- 15th January 2024, 16:43
Just received the "new" modules and guess what?

9561


These are the ones I have now.

9562


I finally can start my tests :wink: