Raspberry pi zero bluetooth

The old verses the new

First of all how do we check which model of Raspberry Pi Zero we have?

The first giveaway are the numbers on the back:

  • Raspberry Pi Zero v1.2 This is the really early Pi Zero
  • Raspberry Pi Zero v1.3 This is the second version Pi Zero which added the camera port
  • Raspberry Pi Zero W v1.1 This is the latest Pi Zero W with WiFi and Bluetooth :D

Then there are a few distinctive parts on the front of the board:

  • If there is no camera port then you have the early Pi Zero
  • If you do have both a camera port and a Raspberry Pi logo on the front then it is the second version Pi Zero
  • If there is no Raspberry Pi logo on the front but instead some components then you have the latest Pi Zero W with WiFi and Bluetooth :)

These new components add the same awesome WiFi and Bluetooth that are built-in to the Raspberry Pi 3. This means you can have a nice small board controlling your robot without the large USB dongles holding it back!

Setting up the WiFi

You will probably want to setup the WiFi before anything else to get access to the internet. This will be needed for most installs and updating anyway. The WiFi can be configured either using the GUI or from a terminal. We suggest using the GUI as it is simpler. The first thing to do is make a note of the WiFi name (SSID) and WiFi password (key). For most modern WiFi routers this is written either underneath or on the back of the router itself. For the examples below I will use the following details:

  • Wireless name (SSID): BTHub5-6NC8
  • Wireless password (key): mypassword

Setup via the GUI

Setting up via the GUI is very straight forward. First click on the disconnected WiFi icon on the right of the taskbar.

Select the network that has the correct name for your router.

You should get a dialog asking for the WiFi key.

Enter the key for your WiFi network and press Ok.

The WiFi icon should go to the typical WiFi image to indicate it is connected. If you click on the icon there should be a green tick next to your network name.

Setup via the terminal

First open up the configuration for the wireless networks using this command:

It should look something like this:

Add this section to the bottom of the file:

The file should now look something like:

Save and exit using CTRL + X , Y , ENTER . If we are lucky everything is now ready to go. If not restart the Raspberry Pi to get the WiFi to restart:

Connecting to a Bluetooth device

For this guide we will look at connecting to a phone with Bluetooth. If you want to setup a PS3 controller using Bluetooth have a look at our How to connect a PS3 remote to the new Pi Zero WiFi guide.

Step 1 — Enable Bluetooth on the device

For devices like smart phones you should start by enabling the Bluetooth functionality and setting the device to be discoverable.

Step 2 — Enable Bluetooth descovery

First click on the Bluetooth icon and select «Make Discoverable».

At this point the Bluetooth icon should be flashing.

Step 3 — Add the Raspberry Pi on your phone

Now refresh the device list on your phone, «raspberrypi» should now be available.

Select it to pair.

Step 4 — Confirm the connection

The Raspberry Pi should come up with a pairing request dialog.

Select Ok to confirm the pairing. You should get a success dialog.

Step 5 — Connect your device

To finish the setup go back to your phone and select the «raspberrypi» device to connect.

If you click on the Bluetooth icon again your device should now be listed with a green tick.

Источник

Raspberry Pi Zero W

The Raspberry Pi Zero W extends the Pi Zero family and comes with added wireless LAN and Bluetooth connectivity.

New Pi Zero W: wireless LAN and Bluetooth for only $10

Getting started

To get started

(not included) you’ll need:

  • MicroSD card with Raspberry Pi OS installed.
  • Micro USB power supply.
  • A special Raspberry Pi Zero camera cable, if you want to use a Raspberry Pi camera (the standard cable supplied with Raspberry Pi cameras is not compatible with the smaller Raspberry Pi Zero camera connector). Suitable cables are available at low cost from many Raspberry Pi Approved Resellers, and are supplied with the Raspberry Pi Zero Case.

For a step-by-step guide to getting your Pi up and running, check out our online Getting started guide.

There are loads of projects to get started on with your Raspberry Pi Zero in our learning resources area. A couple of great projects are:

Specification

  • 802.11 b/g/n wireless LAN
  • Bluetooth 4.1
  • Bluetooth Low Energy (BLE)
  • 1GHz, single-core CPU
  • 512MB RAM
  • Mini HDMI port and micro USB On-The-Go (OTG) port
  • Micro USB power
  • HAT-compatible 40-pin header
  • Composite video and reset headers
  • CSI camera connector

Compliance

Raspberry Pi Zero W has undergone extensive compliance testing, and meets the following European standards:

  • Electromagnetic Compatibility Directive (EMC) 2014/30/EU
  • Restriction of Hazardous Substances (RoHS) Directive 2011/65/EU

The Adopted Trademarks HDMI, HDMI High-Definition Multimedia Interface, and the HDMI Logo are trademarks or registered trademarks of HDMI Licensing Administrator, Inc. in the United States and other countries.

Obsolescence Statement

Raspberry Pi Zero W will remain in production until at least January 2026

Источник

Create a Bluetooth Wireless Console Server with Raspberry Pi Zero W

I know it has been a very long time since I have updated this blog but I blame it on 2020. At any rate, I love the engagement that I have been receiving from my readers in spite of my lack of updates. One engagement that I recently had via email from a reader lit a new fire under me to post a follow up article to one of my previous blog posts. Specifically the email said:

Loved your article ‘Create a Wireless Console Server with Raspberry Pi Zero W’. I too would love an Airconsole but can’t see the $$$ and like your idea building a Pi Zero as a console server.

I like this idea but wonder if you can use it to connect from your laptop via Bluetooth to the Pi Zero so you can use your free WiFi on the laptop and use it separately?

I too hate sitting on the floor in closets, currently use a 10ft console cable.

– One of my valued blog readers

I gave this some thought and racked my brain as to why I never thought about using Bluetooth for this application before. Honestly, it is the better of the two wireless technologies for connecting to a Raspberry Pi Zero W because now I can keep my computer/phone connected to my Wi-Fi while still having access to my console server. Also, I no longer have to set up an access point and know the IP address of the console server, but can do an auto discovery via Bluetooth.

I embarked on this journey and after doing a short bit of research, found the following article that was the holy grail to getting this done. So before I provide my write up about how to accomplish this, I want to give a huge shout out to Patrick Hundal for providing this guide to further enhance the capabilities of using a Raspbery Pi Zero W as a console server.

Building the Console Server

Now I am not going to re-invent the wheel on this one. I have already created detailed instructions in my Create a Wireless Console Server with Raspberry Pi Zero W. Please review that article in its entirety for the basic set up around the Raspberry Pi Zero W. This section of the article will focus on the divergence from the original article and focus on the steps to take to make your Raspberry Pi Zero W a bluetooth accessible console server.

Setting The Pi’s Bluetooth Name

The first step to complete once the Raspberry Pi Zero W has been installed is to give it a name that it will display once you search for it via Bluetooth. To do this, we need to create a file called “/etc/machine-info” and set a constant by the name of “PRETTY_HOSTNAME” equal to whatever we want to call our PI. To accomplish this, you can use the following commands:

Figure. – Screenshot of terminal showing contents of /etc/machine-info

For this purpose, I kept things simple and called it “raspberrypi”.

Enable Bluetooth Services

In order to make your Raspberry Pi Zero W advertise itself via Bluetooth, the services that support that function have to be enabled. To accomplish this, first we have to open up the “/lib/systemd/system/bluetooth.service” file in a text editor to be modified. To accomplish this, use the following command below:

Figure. – Screenshot of the command to open the bluetooth.service file in nano text editor

Once you have this file open for editing in your text editor, update find the following section:

And replace it with:

The resulting file should look like the following:

Figure. – Screenshot of the updated bluetooth.service file

Once this has been completed, you can save the file by pressing “Ctrl+X” and pressing “Y” to save your changes.

Creating a Bluetooth Terminal Service

Next, in order to be able to connect to the Raspberry Pi Zero W shell, a serial terminal emulator to be available via bluetooth. To accomplish this, start by creating the “/etc/systemd/system/rfcomm.service” file using the following command:

Once this file has been created, add the following text below to it:

Figure. – Screenshot of the rfcomm.service within nano text editor

Once this has been completed, you can save the file by pressing “Ctrl+X” and pressing “Y” to save your changes.

Enable the RFComm Service

Once the RFComm service has been defined, enable and start it by using the following commands:

Once you have started this service, the Raspberry Pi Zero W should begin advertising itself for pairing via Bluetooth.

Connecting to the Raspberry Pi Zero W via Bluetooth

This section makes the assumption that you will be connecting from a Windows 10 PC. The instructions that follow this section can likely be adapted for other platforms as well but those platforms are not in scope for this article.

Pairing to the Raspberry Pi Zero W

To pair your Windows 10 computer to the Raspberry Pi, follow the instructions below:

1. Identify the “Type hear to search” at the bottom of the screen

Figure. – Screenshot of the Windows 10 Search Bar

2. Type “bluetooth” | Select “Bluetooth and Other Devices Settings”

Figure. – Screenshot of the “Bluetooth and Other Devices Settings” option

3. Click on “Add Bluetooth or other device”

Figure. – Screenshot of the bluetooth settings dialog box

4. Click on “Bluetooth”

Figure. – Screenshot of the “Add a device” dialog box highlighting “Bluetooth” selection

5. Identify the bluetooth name (i.e. raspberrypi) of your Raspberry Pi Zero W [Please Note: It can take up to one minute for the raspberrypi to be detected by your computer.]

Figure. – Screenshot of the “Add a device” dialog box showing “raspberrypi”

6. Click on the “rasberrypi” and confirm setup

Figure. – Screenshot of “Add a device” dialog box showing successful pairing to raspberry pi

Confirm COM port for Bluetooth Connectivity

Once the Raspberry Pi Zero W has successfully been connected to the Windows computer, a COM port needs to be identified for connectivity to the terminal server on the Raspberry Pi. To determine this, follow the instructions below:

1. Under the “Bluetooth & other devices” dialog box | Scroll to the Bottom | Select “More Bluetooth Options”

Figure. – Screenshot of the “Bluetooth & other devices” dialog box highlighting “More Bluetooth options”

2. When the “Bluetooth Settings” dialog box appears | Click on the “COM Ports” tab

Figure. – Screenshot of the “Bluetooth Settings” dialog box with “COM Ports” highlighted

3. Identify (and take note of) the COM port used for the “outgoing” communication to the Raspberry Pi Zero W. [Please Note: The COM port should be set up automatically, if it does not, un-pair and re-pair your Raspberry Pi Zero W to the Windows PC]

Figure. – Screenshot of the COM Port used for outgoing communication to Raspberry Pi

4. Click “OK” to close the dialog box

Connecting to the Raspberry Pi Console via Terminal Emulator (i.e. Putty)

Once you have identified the COM port that the Raspberry Pi Zero W is connected on, you can use a terminal emulator to connect to it. In this example, Putty is used.

1. Open PuTTY | Select “Serial”

Figure. – Screenshot of PuTTY application with “Serial” option highlighted

2. Set the serial connectivity options depending on what was mapped on Windows | Click “Open”:

In this example:

Figure. – Screenshot of PuTTY with COM settings defined to connect to Raspberry Pi

3. Once the console pops up, log in with the default credentials for Raspberry Pi (pi/raspberry)

Figure. – Screenshot of PuTTY after logging into Raspberry Pi via Bluetooth

At this point, you can continue from the rest of the procedures laid out in the Create a Wireless Console Server with Raspberry Pi Zero W to connect to the console of whatever device you want to manage.

If you have made it this far in the article, here’s your reward. As part of the original article provided Patrick Hundal, he provides a script that you can create and execute on the Raspberry Pi to automatically handle many of the configuration tasks for the Raspberry Pi. Here is a copy of his script below:

I hope this article further enhances the capabilities of your Raspberry Pi Zero W. Please let me know your thoughts on this in the comments below!

Источник

Adblock
detector