Remote GPIO control over Bluetooth | Raspberry Pi 4

preview_player
Показать описание
Join our email list by clicking on the link below for free technology-related reports, educational content, and deals on our courses.

Remote GPIO control over Bluetooth

In this video, we are going to learn how to control the GPIO pins of the Raspberry Pi 4 wirelessly using Bluetooth from an Android smartphone, and later you will be given an activity to build a remote-control robot using the blue dot library.

(If you liked this video and would like to buy our course, you are in for a pleasant surprise. Please click on the link below to buy the course for $25 ONLY. Original price is $195.

We are going to use a nifty Bluetooth library called Blue Dot, to establish remote control between the raspberry pi and the smartphone. This library also provides functions to control one Raspberry PI from another Raspberry Pi. The Blue dot library uses a client-server model to establish communication. The BlueDot class inside the library creates a Bluetooth server, on the server device, that is the Raspberry Pi, and the Blue Dot application installed on the client device will connect to this server via Bluetooth Communication. The transmission of data from client to server or server to the client is a simple stream of data. No acknowledgments or data is sent in response to commands when using the Blue dot library.

Now, let's install the Bluedot library. Open the terminal and first type
sudo apt install python3-dbus

This module is a prerequisite for working with the bluedot library. This library provides an abstraction layer for the bluedot library to do inter-process communication for the Bluetooth interface.
Now enter the following to install bluedot
sudo pip3 install bluedot

If your Raspbian OS version, already has bluedot, it is always a good thing to check for any updates and upgrade it using the following command
sudo pip3 install bluedot - - upgrade

The next step is to Pair your raspberry pi to the android phone. Go to your android device’s settings, and inside the Bluetooth configuration menu, make your device discoverable and then enable the Bluetooth. Now go to your Raspberry Pi Desktop and click the Bluetooth icon and select “Make discoverable”, then click “Add device”. Your phone will appear in the list, select it and enter a pin code for pairing. Now on the android phone, enter the same pin code when prompted and touch “Ok”.

You have now successfully paired your phone with the Pi. Now go to the play store in your android phone and search for the Blue dot app. Install the one made by martin, and open the app. It will ask for permission to use Bluetooth. Please accept it. Now you can see our Pi on the list of connected devices. Select it, and you can see a blue dot.

The Blue Dot is a joystick as well as a button. You can tell if the dot was pressed in the middle, on the top, bottom, left or right. The app can send the information of the exact relative position of touch within the dot to your Pi via the Bluetooth. We are going to leverage this data incoming to implement wireless projects using the Raspberry Pi.
First, let’s control an LED using Bluetooth. Wire up a Red LED on the breadboard, with a current limiting resistor, and connect it to the GPIO Pin 17 as we did in the last section. Now, in the Thonny IDE, open the Bluetooth LED.py file from the repository and run the code. Now, on your Blue Dot app, if you press the blue dot, the LED will become ON. It will be ON till you release the blue dot in the app. In the code, we have imported the BlueDot Class from the Bluedot module with the first command. This class consists of all the methods also known as APIs, that allow us to establish and communicate with the client device.

Summary
In this video, we have covered the following topics
● Setting up the Pi with the Blue Dot Library
● Implementing GPIO Control over Bluetooth
● Remote Controlled Robot Project

"For Blue Dot Application to work, you must follow a specific sequence of steps in a particular order, which is not mentioned in the video. You can download the document to these steps here"


(If you liked this video and would like to buy our course, you are in for a pleasant surprise. Please click on the link below to buy the course for $25 ONLY. Original price is $195.

Check us out on
Рекомендации по теме
Комментарии
Автор

Very good video, your explenations apper as very followable to me. Keep up this clean and great quality.

astronut
Автор

Hello. When I tried to install BlueDot, I was told "unable to locate package bluedot".

AuroraZhang-uihm
Автор

Hello, I found that it is using client and server architecture, could it be done using serial data transmission which is done in Arduino microcontrollers

HarishKumarC
Автор

"For Blue Dot Application to work, you must follow a specific sequence of steps in a particular order, which is not mentioned in the video. You can
download the document to these steps here"

MAKERDEMY
Автор

When ever I open bulluedot on my phone I get an error that it can't connect

smashthonypro
Автор

Hi, when I try to use the sudo pip3 install bluedot command, it tells me that it could not find a version that satisfies the requirement bluedot or no matching distribution found for bluedot. Did I do something wrong?

jakeflores
Автор

don't have android. can this use iphone?

jeffegg
Автор

Im a little confused on how to run the script

smashthonypro
Автор

Anyone else think he sounds a little like Jauffrey from Oblivion?

stevesixpence