element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Bluetooth Unleashed Design Challenge
  • Challenges & Projects
  • Design Challenges
  • Bluetooth Unleashed Design Challenge
  • More
  • Cancel
Bluetooth Unleashed Design Challenge
Blog Bluetooth Challenge - Home Security System - Blog Post VI
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: kedwards@swbell.net
  • Date Created: 25 Jun 2018 6:50 AM Date Created
  • Views 474 views
  • Likes 5 likes
  • Comments 1 comment
Related
Recommended

Bluetooth Challenge - Home Security System - Blog Post VI

kedwards@swbell.net
kedwards@swbell.net
25 Jun 2018

Hello Everyone,

 

Well, it looks like I am still taking one step forward and two steps backwards or maybe is it three steps backwards. The Adafruit BBIO library stopped working. While looking for the problem I noticed that I also lost my locale settings. I started getting errors when running packages that accessed the locale settings. This included trying to create a terminal session in Cloud9. I was able to fix the locale settings problem (See the Security Section for the fix), but not the root cause.

 

I tried to load some software and found out what was causing my problem. I ran out of space in the eMMC. The BeagleBone Black came with Debian 8 installed. I was in a hurry to get started with development so I just used eMMC instead of running to Walmart and buying a microSD card. The eMMC contains just 4G of space. Apparently, not enough for my purposes. I could have avoided the space problem if I would have waited until I bought an SD card to start development. As the old saying goes – you may not have time to do it right the first time, but you will find the time to do it right the second time. I now have a 32G microSD card.

 

I tried loading Debian 8 on the microSD card since the BeagleBone Black originally contained Debian 8. However, I could not get BoneScript working on it. Apparently, the image loaded on my BeagleBone Black is not the same image from the Beagleboard.org site.

 

I have an old BeagleBone Black (not wireless) that contains Debian 7. I never had any problems with Adafruit BBIO or BoneScript with Debian 7. Therefore, I loaded Debian 7 on the microSD card. However, the Debian 7 image does not support Wi-Fi or Bluetooth, so I could not use it with the BeagleBone Black wireless.

 

Next, I loaded the latest Debian image (9.4) onto the microSD card. The Adafruit BBIO and BoneScript libraries are working. However, I cannot initialize a UART port. I assume that the problem is due to how the device tree overlay is configured. I am still looking into the problem. I decided to resolve this problem instead of trying a different Debian image.

I did make some progress. I created code that allows the web server to communicate changes from the sensors to the web page. Each sensor is assigned a GPIO pin. Whenever a sensor change is sent to the HSS controller it changes the state of the appropriate GPIO pin to either high or low.  The web server sends the GPIO pin status to the web page. The web page then changes the color of the appropriate button depending on the status received.

 

I also attached a text to speech hardware device to the BeagleBone Black. The device is connected via a serial interface (UART1). Whenever an alert is received by the HSS controller from one of the sensors the controller will send a message to the Emic2 Text to Speech module, which sounds an alert message through a speaker.  Before I had the space problem the interface between the Emic2 and the BeagleBone black was working. However, I need to fix the UART problem before I can complete my testing of the sensor interfaces.

 

Once I resolve the UART problem and complete the testing of the code for the motion sensor, I will provide details on how the code works.

 

The details on creating an image on a microSD card and expanding the filesystem are given in the sections below:

Section I – Create a Debian Image on a SD card

Section II – Boot New Image and Expand the Filesystem

Section III – Security

 

I will continue working on the UART problem. If I do not resolve the problem in the next couple of days I can start developing the code for controlling the lights and appliances since they do not make use of a serial interface.

 

Talk to you soon.

 

Quote of the Moment -

Good judgment comes from experience, and a lot of that comes from bad judgment.

        -- Will Rogers

 

 

 

Previous Bluetooth Challenge – Home Security System Posts

Bluetooth Challenge - Home Security System - Blog Post I

Bluetooth Challenge - Home Security System - Blog Post II

Bluetooth Challenge - Home Security System - Blog Post III

Bluetooth Challenge - Home Security System - Blog Post IV

Bluetooth Challenge - Home Security System - Blog Post V

 

 

 

 

Section I - Create a Debian Image on a SD card

 

First, browse to:

https://beagleboard.org/latest-images

 

Then under:

Stretch IoT (without graphical desktop) for BeagleBone and PocketBeagle via microSD card

Click on: Debian 9.4 2018-06-17 4GB SD IoT

 

Save the file (Figure 1.)

 

image

  Figure 1.

 

 

I moved the file from the Download directory to another directory incase I need it again. The image file is compressed. You need to un-compress it before loading it onto a microSD card. I used Zip-7 to un-compress my image file (Figure 2).

 

Click on the OK button when you see the window displayed in Figure 3.

 

Once the file is  uncompressed, take note of the directory that contains the image file (Figure 4).

 

image

  Figure 2.

 

image

  Figure 3.

 

image

  Figure 4.

 

 

Next, download the disk manager. The disk manager is used to load an image file onto a microSD card. Browse to:

https://sourceforge.net/projects/win32diskimager/files/latest/download

 

Save the file (Figure 5). Again, I moved the disk manager exe out of the download directory.

 

Double click on the win32diskimager-1.0.0-install exe (Figure 6).

 

Accept the license agreement (Figure 7). And click the Next button.

 

Click the Next button again (Figure 8).

 

Click the Install button (Figure 9).

 

Click the Finish Button (Figure 10). The disk manager will automatically start (Figure 11).

 

image

Figure 5.

 

image

  Figure 6.

 

image

  Figure 7.

 

image

  Figure 8.

 

image

  Figure 9.

 

image

  Figure 10.

 

image

  Figure 11.

 

 

Insert a microSD card into your PC.  Click on the Format disk button when asked to format the disk (Figure 12).

 

Click on the Start button (Figure 13).

 

Click on the OK button (Figure 14).

 

Click on the OK button when the format is completed (Figure 15).

 

image

   Figure 12.

 

image

   Figure 13.

 

image

  Figure 14.

 

image

  Figure 15.

 

Click on the Folder Icon and browse to the directory that contains your image (Figure 16). Select your image, then Click on the Write button.

 

Click on the Yes button when you are asked to continue (Figure 17).

 

When the Write Successful pop-up window is displayed, click on the OK button (Figure 18).

 

image

  Figure 16.

 

image

  Figure 17.

 

image

  Figure 18.

 

 

Section II – Boot New Image and Expand the Filesystem

 

Before booting with the new image copy any files you want to save from the old image to your PC. I used FileZilla to perform the copy (Figure 19 & 20).

 

image

   Figure 19.

 

image

  Figure 20.

 

 

Take the microSD card out of your PC and insert it into your BeagleBone Black. Plug your BeagleBone Black into your PC and press the power button. Once the BeagleBone Black is powered up logon onto the BeagleBone Black (Figure 21).

 

The first thing you want to do is expand the filesystem. Fortunately, Robert Nelson created a script for that. Run “sudo /opt/scripts/tools/grow_partition.sh” (Figure 22 & 23).

 

You need to re-boot for the expansion to take effect. Press the Reset button on the BeagleBone Black. Once the BeagleBone black has booted, logon.

 

Run “df -h –total” (Figure 24). Note that the filesystem has expanded. I used a 32G microSD card, so I have 27G of free space in the filesystem:

/dev/mmcblk0p1   30G 1.6G   27G   6% /

 

We are now ready to reload the software and scripts that was originally loaded on the eMMC.

 

image

  Figure 21.

 

image

  Figure 22.

 

image

  Figure 23.

 

image

  Figure 24.

 

 

Section II – Reload Software

 

 

I noticed that the Debian image I loaded did not have the man pages. Therefore, the first thing I did was installed them:

Run: “sudo apt-get install man” (Figure 25).

 

image

  Figure 25.

 

 

This would be a good time to copy your application files to the new image. Again, I used Filezilla to perform the copy (Figure 26).

 

image

  Figure 26.

 

 

Whenever possible, I used my previous blog posts to reload the software. I documented the steps below, noting any deviations from the Blog posts.

 

Blog Post II

 

Section IV – Configuring the Wi-Fi

 

Section VI – Updating the BeagleBone Black’s software packages

I did not receive any errors when running apt-get upgrade, so I did not have to re-run the apt-get upgrade.

 

Section VII – Creating a webserver

I did not receive any out of sync errors, so I did not have to install a newer version of Nodejs. However, I had to install pyserial.

To install pyserial run: “sudo pip install pyserial” (Figure 27).

The socket.io library is in a different directory. Therefore, the require statement was changed from:

 

var io = require('/usr/local/lib/node_modules/socket.io').listen(app);

to:

var io = require('/usr/lib/node_modules/socket.io').listen(app);

 

In the 09_01_led_control_server.js script (Figure 28).

 

image

  Figure 27.

 

 

// 09_01_led_control_server.js

 

var app = require('http').createServer(handler);

var io = require('/usr/local/lib/node_modules/socket.io').listen(app);

var fs = require('fs');

var bb = require('bonescript');

 

var htmlPage = 'Prog BBB/09_01_led_control.html'; // use this for Angstrom

//var htmlPage = '09_01_led_control.html'; // use this for Debian

 

app.listen(8085);

 

function handler (req, res) {

  fs.readFile(htmlPage,

    function (err, data) {

      if (err) {

        res.writeHead(500);

        return res.end('Error loading file: ' + htmlPage);

      }

      res.writeHead(200);

      res.end(data);

    });

}

 

function onConnect(socket) {

    socket.on('digitalWrite', handleDigitalWrite);

}

 

function handleDigitalWrite(message) {

    var data = JSON.parse(message);

    console.log("write pin:" + data.pin + " value:" + data.value);

    bb.pinMode(data.pin, bb.OUTPUT);

    bb.digitalWrite(data.pin, data.value);

}

  

io.sockets.on('connection', onConnect);

 

Figure 28.

 

Section IX – Security

 

 

Blog Post III

 

Section I - Pair the BeagleBone Black Bluetooth adapter to the HC-06

Section II – Install the PyBluez Development Libraries

Section VI – Security

 

Blog Post IV

 

Section III – Security

You do not have to re-generate keys for your new image. You can use the keys from the previous image. Just copy the .ssh directory from the old image to the new image. I used FileZilla to copy my .ssh directory I saved on my PC, to the new Debian image. The .ssh directory should contain the authorized_keys file. Make sure you add the .ssh directory to your home directory.

 

 

 

Section III – Security

In addition to the locale settings, this week I am covering a couple of commands that help monitor disk, memory, and CPU utilization.

 

Locale Settings

Figure 29 is an example of an error caused by losing your locale settings. Lack of locale settings can cause package installations to fail, not to mention deny access to Cloud9. It is simple to fix. Just run “sudo locale-gen” (Figure 30).

 

image

Figure 29.

 

image

  Figure 30.

 

Disk Usage

Figure 24 demonstrated how to display disk space utilization using the df command:

df -h --total

 

It is a good idea to run this command periodically to monitor your disk space utilization.

Memory/CPU usage

Here is another useful command. It helps determine why your system is running slow. It displays the processes that are currently using the most resources on your system. The display is updated in real time. Run “top” (Figure 31). To exit top press ctrl-C.

 


image

  Figure 31.

  • Sign in to reply

Top Comments

  • genebren
    genebren over 7 years ago +1
    Nice update on your design challenge project. Progress is a very relative term. As you have pointed out, projects sometimes seem like they are constantly moving in the wrong direction. Patience and persistence…
  • genebren
    genebren over 7 years ago

    Nice update on your design challenge project.  Progress is a very relative term.  As you have pointed out, projects sometimes seem like they are constantly moving in the wrong direction.  Patience and persistence are your friends.

    Good luck!

    Gene

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube