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 BT_Sentry : Software
  • 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: mcb1
  • Date Created: 18 Jun 2018 9:44 AM Date Created
  • Views 1377 views
  • Likes 9 likes
  • Comments 7 comments
  • bluetooth
  • raspi-config
  • Raspberry Pi Camera
  • uv4l
  • raspberry pi 3 b+
Related
Recommended

BT_Sentry : Software

mcb1
mcb1
18 Jun 2018

This is the 7th of my Blogs for the Bluetooth Unleashed Design Challenge

 

 

The other posts are here :-

Link to other posts
BT_Sentry Introduction
BT_Sentry : Zero Emission Detection
BT_Sentry : Data Transmission
BT_Sentry : Sentry Power
BT_Sentry : Raspberry Pi
BT_Sentry : Bluetooth Options

 

Concept

The idea is to detect the bluetooth transmitted from the vehicle and signal other Home Automation functions.

If the vehicle is known then it can open the garage door, and inform the home owner that xx is home.

 

Hardware

The detection point needs to be at the start of the driveway, and because there is no power source, this will need to be low power with solar charging.

The PSOC range seems a very good fit, but because of the timeline and my need to upskill, the inital design will be Arduino based and some form of RF transmitter/transceiver.

 

Adding a vehicle detection loop or beam is necessary to ensure those vehicles without bluetooth will also trigger the system.

 

 

 

Time

Last blog I talked about vacations and how time was marching on, and this week hasn't really helped me much.

Some of the issues were personal and others were to do with planning next weeks trip, software and the dreaded taxman.

 

I've decided to sort out the software I need for my Hero Board the Raspberry Pi 3 B+.

image

 

I eluded to using Raspbian Stretch Lite in the last blog BT_Sentry : Raspberry Pi and this was based on it not requiring a GUI.

 

The usual

sudo apt-get update
sudo apt-get upgrade

needs to be performed and it should take a few minutes.

 

 

 

 

UV4L

I've used this for my Rear View Camera Rear View Camera ver 2.0

 

The install instructions are here https://www.linux-projects.org/uv4l/installation/

 

You need to add the key to the distribution with

curl http://www.linux-projects.org/listing/uv4l_repo/lpkey.asc | sudo apt-key add -

 

You need to add a line to the /etc/apt/sources.list.

Since this requires you need to be root to do this, sudo is added at the front, and my preferred editor is nano.

 

sudo nano /etc/apt/sources.list

add the line deb http://www.linux-projects.org/listing/uv4l_repo/raspbian/stretch stretch main

 

For nano, you save by pressing Ctrl X and Y to confirm.

 

 

It is now time to download and install the files by typing

$ sudo apt-get update

$ sudo apt-get install uv4l uv4l-raspicam

 

For anyone reading this, and using windows you don't actually need to type the text into the terminal window.

Simply highlight the text and right click and select copy.

In your terminal ensure the mouse is where you want to enter the copied content, and press the right mouse button.

 

After a few minutes the package has been downloaded and installed.

 

I have also installed and executed the following

sudo apt-get install uv4l-raspicam-extras 

sudo service uv4l_raspicam restart 

sudo apt-get install uv4l-server

 

 

 

 

Configuration

While we're adding software and doing all the other bits, it's a good time to update the Locale, Timezone and of course enable the camera

 

Type sudo raspi-config into the terminal window and the generic configuration file comes up.

For anyone used to doing this, the process is the same, but for newbies, you use the up/down arrows to navigate, and then press the space bar to select those multi-choice ones.

Tab gets you into the Yes/Back options at the bottom.

 

Once everything is set, it will ask to reboot, and now I have the right time showing ....

 

You can use ps -ef to check if the driver is running or simply force it by typing

uv4l --driver raspicam --auto-video_nr --width 640 --height 480 --encoding jpeg

 

 

 

You can control the UV4l by pointing your browser at http://<Rpi-address>:8080 and you should get this picture

image

 

If you click on Delayed Snapshot, it should open a new tab and display a snapshot taken from the camera (in this case another tab)

image

 

This checks that the camera and the necessary drivers are working correctly.

 

 

 

 

 

OpenHAB

I've decided to try using OpenHAB, it may be overkill for what I'm trying to achieve ... but.....

We used it during the "Forget Me Not" Design Challenge Forget Me Not Design Challenge (hard to believe it was 4 years ago)

 

Luckily fvan was also part of the Challenge as he was much more familiar with writing strange text that made it function well.

 

I've come back to this particular this blog [CaTS] ForgetMeNot - Week 4: Arduino-OpenHAB communication  in order to interface between an Arduino (moteino) acting as a receiver, and the Raspberry Pi.

 

 

image

Using my original concept drawing, I've highlighted the parts used for turning on the outside Lights.

 

Somewhere within the design I probably need to add a light sensor, but for now it's just a bit more power, and with the rain we've been having the hydro dams will be full.

 

 

 

The install instructions for OpenHAB are here https://www.openhab.org/download/

 

You even get a very nice graphic

image

 

 

I'm going to do it using the Raspberry Pi so once again open a terminal windows and type in the following

wget -qO - 'https://bintray.com/user/downloadSubjectPublicKey?username=openhab' | sudo apt-key add -

sudo apt-get install apt-transport-https

 

You need to tell the Raspbery Pi where to find the files and I elected to add the locations to the /etc/apt/source.list file as we did for UV4L

 

sudo nano /etc/apt/sources.list

add the line

deb https://dl.bintray.com/openhab/apt-repo2 stable main

 

For nano, you save by pressing Ctrl X and Y to confirm.

 

 

 

It is now time to download and install the files by typing

$ sudo apt-get update

This updates the system where files are collected from

 

sudo apt-get install openhab2

 

It takes a few minutes and it includes one way of starting openHAB in the text at the end.

 

### NOT starting on installation, please execute the following statements to configure openHAB to start automatically using systemd

sudo /bin/systemctl daemon-reload

sudo /bin/systemctl enable openhab2.service

 

 

There is a comment about the add-ons only being required if the device is off-line

sudo apt-get install openhab2-addons

 

You can access the program by opening a browser and pointing it at http://<RPi-address>:8080

 

Depending on the distribution, you may need to load java

You can check if you have it loaded by typing

sudo java - version

 

If you get an error try downloading it by typing

sudo apt-get install oracle-java8-jdk

 

This does take a bit longer as it loads the various parts

 

 

 

BUT this is not going to work, since the UV4L server is also pointing at that port (8080) so we need to redirect one or the other.

 

 

 

 

Ports

One way to think of ports are the doors to a house.

You can use the front door (port xxxx) or the back door (port yyyy).

If two people wanted to enter at exactly the same time, then one could use port xxxx and the other port yyyy.

 

When we do software upgrades at work, they provide the revised application on one port and shift the various machines to that port until they are all pointing to the new software version.

It's much less disruptive than shutting down the whole system.

 

 

 

By default a browser uses port 80 and a secure (https) uses 443. Telnet is port 22 and there are various others, but you can force applications to use other ports.

 

Our UV4L and OpenHAB are providing their information on port 8080, and this causes a clash if both run together.

 

 

 

A bit of searching and I discovered that the setting for OpenHAB are held in /etc/default/openhab2

 

The first thing to do is copy it by typing in a terminal window

 

cp /etc/default

sudo cp openhab2 openhab2_org

 

We can edit it with

sudo nano openhab2

 

You can see the first few lines are the ones we want to modify

image

Remove the # and change the 8080 to read 8081

Remove the # and change the 8443 to 8444

image

For nano, you save by pressing Ctrl X and Y to confirm.

 

 

note this means to access it you'll need to use

http://<RPi-address>:8081  or https://<RPi-address>:8444

 

If you've previously started OpenHAB, then you need to stop and restart it by typing

sudo /etc/init.d/openhab2 stop

sudo update-rc.d openhab2 defaults

sudo /etc/init.d/openhab2 start

 

 

You can check that it is running the revised port by typing

netstat -a -v

image

You can try browsing by typing

http://<RPi-address>:8081

image

 

and to prove they both work (even at the same time)

 

https://<RPi-address>:8444

image

and finally just to be sure

http://<RPi-address>:8080

image

 

 

 

 

 

 

So that's about it for this blog.

 

I have most of the software loaded, I just need to get NodeRED sorted out and find my instructions and files for the device.

 

 

I was looking for a decent graphic to add about port clashing and couldn't find anything appropriate.

But I did find this which explains why the internet is slowing down.

Meow-ware geek comic

               source Meow-ware

 

cheers

Mark

  • Sign in to reply

Top Comments

  • fmilburn
    fmilburn over 7 years ago +3
    I am not only amazed at what can be added to the Raspberry Pi but that there are people like Mark who can keep it all straight Really nice write up with all the detail I need to attempt it myself.
  • mcb1
    mcb1 over 7 years ago in reply to fmilburn +3
    people like Mark who can keep it all straight Actually there is a fair bit of googling involved ... I keep saying I'm a hardware person, not a software person It would make life easier, but it's too late…
  • genebren
    genebren over 7 years ago +2
    Great update on your design challenge project. I am always amazed at the number of software packages that can be added onto a Raspberry Pi, combined with other packages and turned into a functional device…
  • aspork42
    aspork42 over 7 years ago

    Nice update! I've been running OpenHAB for a while now for my home automation system and it has been a huge help. I think you can get a lot from it once you have a base system of sensors and output running (lights, etc).

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • mcb1
    mcb1 over 7 years ago in reply to mcb1

    I'm alright thinking that some python scripts would achieve most of what I want

    Bad keyboard ...

    I was talking with one of the guys at work, and he simply used MQTT on his own server to do some of what I'm doing.

    OpenHAB does give some other aspects that might be useful in a broader use, but if it's just providing the glue between the detector and lights/garage and notification, then it's overkill.

     

    I have been wanting to do environmental monitoring, but the RPi is outside meaning I'd need to look at how I get the data there (and back).

    A seperate router is already a possibility ..... simply to keep it away from my home network, so it's feasible.

     

     

    MQTT is an alternative that may suit others.

     

    Mark

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • mcb1
    mcb1 over 7 years ago

    Thanks guys

    Hopefully I can get it all talking nicely before the end.

     

    I'm already thinking that some python scripts would achieve most of what I want, but then I'd have that learning issue to contend with.

    I have dabbled with a little bit of Python and can say it wasn't my favorite.

     

    Mark

     

    edit 19/06/2018 ... the keyboard mis-behaved and I've beaten it into sub mmmmmmmmmmmmmmmmmmmmmm.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • mcb1
    mcb1 over 7 years ago in reply to fmilburn
    people like Mark who can keep it all straight

    Actually there is a fair bit of googling involved ...

     

    I keep saying I'm a hardware person, not a software person

    It would make life easier, but it's too late for me.

     

    Mark

     

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 7 years ago

    Great update Mark.

     

    DAB

    • Cancel
    • Vote Up +2 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