This tutorial will show how to transfer files wirelessly over the Bluetooth Low Energy protocol. We will use two BleuIO dongles for this project—one for sending and another one for receiving. The sender dongle will be in central mode, while the receiver dongle will be in peripheral mode.
We have already created two python scripts for sending and receiving. You can get the source code from: https://github.com/smart-sensor-devices-ab/bleuio_file_transfer_example
You can try this project on two different computers.
A video tutorial will show you how to do it on one computer and send files between two BleuIO dongles.
- First, connect two BleuIO dongles to your computer.
- Note down the COM port for each dongle. You can find the port using device manager.
- Try to find receiver dongle MAC id. To do that, start advertising your receiver dongle and note down the MAC id. Follow the video if you need more details on how to do it.
- Open file_recieve.py and file_transfer.py files. Update COM port and MAC id where necessary.
- Set the file type that you are expecting to receive. For example, if you are expecting a jpg file, change file_name on file_recieve.py to result.jpg, and for a text file, you can rename it to result.txt
- Keep the file in the same directory with file_transfer.py and change the file name accordingly.
- Now run the script file_recieve.py using a terminal. It will start advertising and will be ready to receive.
- Now run the file_transfer.py script.
- Once both the dongles are connected, you will be asked to send the file from the file transfer script.
- The receiver dongle will give you a confirmation once received, and you will find the file stored in the same folder with the receiver script.
- Finally, you can check if you received the file correctly by running a checksum.
Please follow the video if you have difficulty in understanding.