Giter Site home page Giter Site logo

pranjalkushwaha / esp32-bluetooth-ftp Goto Github PK

View Code? Open in Web Editor NEW
22.0 2.0 1.0 70 KB

This project aims to provide file-sharing capabilities between the ESP32 Bluetooth and any Android/Linux device over their default OBEX protocols.

CMake 1.03% C 98.97%

esp32-bluetooth-ftp's Introduction

ESP32-Bluetooth-Obex

This project aims to provide file-sharing capabilities between the ESP32 Bluetooth and any Android/Linux device over their default OBEX protocols, something currently missing from the bluedroid stack bundled with the esp-idf. This can also be used as a starting point/example for anyone trying to write custom Bluetooth protocols.

Usage

To run the code you would need an ESP32 board and ESP-IDF installed on your computer. (Steps listed for Linux systems)

Project Configuration

  1. Run "$ idf.py set-target esp32" (or any other esp32 model) to set the MCU type.
  2. Run "$ idf.py menuconfig" in the project folder after cloning the repo, this would open the config menu. Navigate to Component Config --> Bluetooth, enable the Bluetooth option and from here navigate to Bluetooth controller --> Bluetooth controller mode --> BR/EDR Only. In the Bluetooth controller options select HCI mode and set it to VHCI. Select Controller only in the Bluetooth host menu and press S to save your config.
  3. Run "$ idf.py build" to compile and link the source files.
  4. Plug in the ESP32 board and run "$ idf.py flash" to upload the generated binary to the microcontroller.
  5. Optionally run "$ idf.py monitor" to view the serial output.
  6. From your Android/Linux device connect to "BT-ADV", enter the auth pin "1234" (configurable in the code) and start sending a file. The file will be received by the controller. Note that the handling of the received file has to be implemented according to your needs. Currently the file name is printed on the stdout and the file contents are summed.

The process above has been tested using a Ubuntu 20.04LTS system on an ESP32-WROOM-32 devkit with ESP-IDF v4.3.3-dirty. Currently only recieving a file is supported

Lastly, this project is still under active development and several known bugs are gradually being patched. I would appreciate any feedback/suggestion so feel free to open an issue or contact me directly via email ([email protected]) for any discussion.

esp32-bluetooth-ftp's People

Contributors

brandonstudio avatar pranjalkushwaha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

brandonstudio

esp32-bluetooth-ftp's Issues

Sending files

Any chance of adding the ability to send from the ESP32?

Using this project with the Arduino environment

Hello,

I'm currently trying to use your project with the Arduino environment. It compiles flawlessly, but the device is not advertised, it does not appear when scanning with my phone.
I believe it have to do with the settings config you expose in the readme :

  • bluetooth enable (I believe it's default in Arduino)
  • bluetooth controller mode BR/EDR only (there is no option for that in Arduino IDE, are there available functions in code to set that ?)
  • HCI mode = VHCI (same thing)
  • bluetooth host menu : controller only
    I believe this is similar to #3, and maybe #4 that comes from it ?

Hope you can help.

Edit : I've dived further into your code, to try to find some hints. It appears that it gets stuck in the while loop of the start_bt() function, waiting for the controller to change its status.
Trying to understand what was the matter, I've compared your code with another bluetooth app that I know, this one.
Although the wrapper functions are a bit different, the bluetooth init is exactly the same, starting with the exact same nvs_flash_init(), then the default config loading, etc.
The A2DP program also test for last connection and adds a 1-second delay between nvs init and bl init, but I don't think that has an impact. I've tried to add both in your code, it changes nothing.

Unable to receive file from Windows

Succeeded on Android, but failed on Windows.

I thought Windows and Android use the same protocol to send file, but it seems I was wrong. Could you explain why it does not work on Windows?

BTW, can you open discussions?

File receiver outputs different sum

Sending one single file from Android repeatedly brings diffenent file sum results:

  1. different between this time and next time;
  2. different before and after reboot.

Ex. 1 (w10.png)

w10.png
File recieved successfully
File sum : 1845384
w10.png
File recieved successfully
File sum : 1897939
w10.png
File recieved successfully
File sum : 1897939
w10.png
File recieved successfully
File sum : 1897939
w10.png
File recieved successfully
File sum : 1897939

Ex. 2 (0.png)

0.png
File recieved successfully
File sum : 3814350
0.png
File recieved successfully
File sum : 3812886
0.png
File recieved successfully
File sum : 3810252
0.png
File recieved successfully
File sum : 3819517

Is this the expected behaviour? If not, what's wrong?

File transfer from ESP32 to Android

Hello,

Sending a file from an Android device to an ESP32 works very well, thank you very much for that.

Is it possible (or will it be possible) to send a file from the ESP32 to an Android device?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.