The goal for this project is to create a simple home IoT network using BLE (Bluetooth Low Energy). I'm using a BeagleBone Black to act as a central hub for the IoT topology and the TI CC2650 for BLE compatible devices to collect sensor data and transmit that data to the hub.
This first part of the project will work on setting up the BeagleBone Black (BBB) with a usable Debian image with BLE capabilities.
Getting Started with BeagleBone Black
This section of the guide will help you get a BeagleBone Black setup and running Debian Jessie with Bluetooth support.
First off, you'll want to make sure you have:
- BeagleBone Black
- 5V Adapter (Not the exact one I'm using but looks good to me)
- MicroSD Card (Minimum 4GB) (I'm using 8 GB for this project)
- Bluetooth Adapter
- Ethernet Cable
For starters, I'm not relying on bridging my internet connection over USB to give the BBB access to the internet. Instead I'm using a 5V supply and an ethernet cable to give it it's own dedicated power source and connection.
Getting the Image
Head to https://beagleboard.org/latest-images and download the latest Debian image for the BeagleBone Black. I'm using the
Debian 8.5 2016-05-13 4GB SD LXQT image for my project. This getting started guide gives a good overview on how to write this to a MicroSD card. If you're like me and running with a Linux host you can just execute the following (change /dev/sdX to be your MicroSD card).
sudo dd if=./bone-debian-8.4-lxqt-4gb-armhf-2016-05-13-4gb.img of=/dev/sdX status=progress
Once the image has been written to the card we can boot off of it. Simply place the MicroSD card in the BBB and plug it in. After awhile the device should be booted and you can see an "heartbeat" led blinking.
Setting up the BBB
Now we should be able to login into your BBB! Go ahead and try SSH'ing into the machine using the username
debian and password
temppwd. Notice I'm using
beaglebone.local as the hostname, you can also use the IP address of the device if you know it.
There are two ways to run an operating system on the BBB. One is using the eMMC and the other is the MicroSD card. We will continue to use the MicroSD card because it gives us more space for our application. However, the *.img file we wrote to the SD card earlier was only 4GB, thankfully we can expand the OS to use the whole SD card. Execute the following to expand it to the whole card (taken from elinux.org).
cd /opt/scripts/tools/ git pull sudo ./grow_partition.sh sudo reboot
After the reboot occurs, log back into the device and update all packages so that our system will be up to date.
sudo apt-get update sudo apt-get dist-upgrade
We now have a fresh BBB image using our whole MicroSD card. Next step will be making sure Bluetooth works.
Getting Started with Bluetooth
For this part of the project I was mostly interested in just ensuring that my bluetooth adapter was working with my BBB. Later on in the project I will focus more on connecting devices programatically and reading data.
Now that you have a fresh BBB it's time to ensure bluetooth is working. If you haven't already, plug in the USB bluetooth adapter. I recommend rebooting after you have plugged it in to allow the system to detect it proprely. Many users have reported isues with "hot plugging" the adapter while the OS is running.
First off, make sure you have the bluetooth metapackage installed.
sudo apt-get install bluetooth
Debian 8.5 2016-05-13 image it was already installed for me, so don't be suprised if it's ready to go for you too. Next, let's check if the Bluetooth adatper is working with the BBB and Debian system.
Run the following to see if the adapter can be found.
sudo hcitool dev
Next let's scan for Bluetooth devices. This will return the addresses of all Bluetooth devices within range.
sudo hcitool lescan
If both of these execute correctly than we have some confidence that we have a working Debian operating system that can use our USB Bluetooth adatper.
On the next blog post I plan on setting up the TI CC2650 BLE device for reading data. I'll be using the CC2650 as the sensor nodes in the IoT network which will be communicating to the BeagleBone Black hub we have just setup.