In order to get the whole project together, refer to the book's code files and find the folder called Bluetooth Gateway. Copy the folder somewhere on your Raspberry Pi Desktop using a standard USB. Assuming that your downloaded files now rest in the ~/Desktop/BluetoothGateway folder, you should be seeing two folders there. One is gateway and the other is navible. Before moving into the technicalities, make sure that you have all the project dependencies installed. Navigate to your gateway folder and run the following command:
cd gateway
sudo npm install
This will install all project-related dependencies and keep them in the node_modules folder. In order to install the server, use the following command:
sudo npm start
Upon starting the project, you should see the following screen:
If you are unable to see this screen, there might be a problem in communicating with the Bluetooth module. To troubleshoot this problem, install bluez-hcidump by executing the following command:
sudo apt-get install bluez-hcidump
Once it has been installed, check whether the hci0 interface is up and running. To do this, run the following command:
sudo hcidump
If it is unable to find the interface, you can manually restart it by executing the following:
sudo hciconfig hci0 down
sudo hciconfig hci0 up
sudo bluetoothctl
You should now start the discovery process by running this command:
bluetooth# scan on