Skip to content

BLE service on Raspberry Pi to communicate with mobile phones

Notifications You must be signed in to change notification settings

discover59/IoT_BLE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Purpose Useful Links https://www.hackster.io/inmyorbit/build-a-mobile-app-that-connects-to-your-rpi-3-using-ble-7a7c2c https://github.com/evothings/evothings-examples

Communicate via BLE between Raspberry Pi 3 and iPhone

  1. Start BLE service with Raspberry Pi 3 as peripheral using nodejs bleno library
  2. Detecting BLE service in iOS using Core Bluetooth
  3. Run python script inside nodejs script (get image and text)
  4. Send data to iPhone using characteristic
  5. Display the image and text on iPhone

##Board Configuration sudo apt-get install bluetooth bluez blueman sudo apt-get install raspberrypi-sys-mods

  • Install pi-bluetooth library sudo apt-get install pi-bluetooth

Check bluetooth library version hcitool | grep ver

Change raspberry pi bluetooth name as "raspberrypi" http://stackoverflow.com/questions/26299053/changing-raspberry-pi-bluetooth-device-name

  • Setting environment for bleno library Stop bluetooth daemon
    Temporary

    sudo systemctl stop bluetooth sudo systemctl status bluetooth Permanent

    sudo systemctl disable bluetooth
    Power up bluetooth adapter

    sudo hciconfig hci0 up

    NodeJS installation

    wget https://nodejs.org/dist/v5.9.1/node-v5.9.1-linux-armv7l.tar.gz tar xfv node-v5.9.1-linux-armv7l.tar.gz cd node-v5.9.1-linux-armv7l/ sudo cp -R * /usr/local/ node -v npm -v (check version)

    Other configuration

    sudo apt-get update sudo apt-get install git libudev-dev

  • package install. cd /home/pi/ios/ git clone https://bitbucket.org/FullSoftHub/ble-communication-between-rpi-and-ios.git mv ble-communication-between-rpi-and-ios ble cd ble mkdir data cd nodejs npm install npm install python-shell

Now it becomes advertisable.

Raspberry Pi bluetooth service and characteristics

  • Raspberry Bluetooth service with UUID = ff51b30e-d7e2-4d93-8842-a7c4a57dfb99
  • Running Python Characteristic with UUID = ff51b30e-d7e2-4d93-8842-a7c4a57dfb50
  • Checking completion characteristic with UUID = ff51b30e-d7e2-4d93-8842-a7c4a57dfb51
  • Reading data characeristic with UUID = ff51b30e-d7e2-4d93-8842-a7c4a57dfb52
  • Reading string characeristic with UUID = ff51b30e-d7e2-4d93-8842-a7c4a57dfb53

General Configuration

Get Rpi version

http://www.raspberrypi-spy.co.uk/2012/09/checking-your-raspberry-pi-board-version/ cat /proc/cpuinfo

Run nodejs script automatically after boot up

enable running node without sudo (not necessary for this project)

sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)

sudo nano /etc/rc.local add this line (user name "pi") sudo su -c 'node /home/pi/ios/ble/nodejs/index.js < /dev/null &' save and exit sudo reboot

To test rc.local

cd /etc sudo ./rc.local

Now the script runs automatically after booting up

About

BLE service on Raspberry Pi to communicate with mobile phones

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published