This is the 5th 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 |
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.
Raspberry Pi
Key to the functioning of my system, is the Raspberry Pi 3 B+.
This improved version features Bluetooth 4.2 and 2.4/5 GHz Wifi onboard.
It's running at 1.2GHz with 1GB Ram, and is a far cry from the original.
Just to wet your appetite, here some pictures of one of the first 10,000 Pis ever produced.
photo credit : three minions (me, myself and I) Click for full size
As you can see quite a bit has changed, and this one sits in the cupboard with a sticker on it to make sure I know it is an original.
Software
Key to making anything computer or micro-controller to work, is software.
Again this has evolved from the original to something a lot slicker, and MUCH faster to boot.
The Pi needs a uSD card, and for this use, I chosen a 16GB card.
I don't need the desktop so my software choice is Raspbian Stretch Lite from here https://www.raspberrypi.org/downloads/raspbian/
This is a 350MB download (versus the 1.7GB full version).
Formatting the card and loading the image onto it has been made a lot easier with Etcher https://etcher.io/
Select the image, it detects your SD automatically and hit Flash
After a brief delay it starts Flashing the image and displays the progress
It then validates the data
It then unmounts the card and indicates the Flash is complete and even asks if you want do it to another card.
You do have some setting options for those that want to change things.
This is much easier than the previous format and then use SDFormatter, that worked but was slightly less safe.
Headless
Well this one sounds really strange if you aren't used to it, but essentially it means a computer without keyboard, mouse and display.
This means you need to remotely connect to it, and apparently since 2016, the image files have had SSH (the means to connect) turned off by default.
It's easy to configure and I followed the instructions here https://howtoraspberrypi.com/how-to-raspberry-pi-headless-setup/
With the card connected to your computer, open navigate to the uSd card and in the boot directory add a file called ssh.
There is a plain text file called issue.txt you can copy and rename remembering to remove the .txt extension
You need to create a second file called wpa_supplicant.conf and add the following into it.
country=xx
update_config=1
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
network={
scan_ssid=1
ssid="RouterName"
psk="Security"
}
Where the xx becomes your country code to ensure the relevant WiFi rules are adhered to, and the Routername becomes your wireless network SSID
while Security is the passphrase you use.
if your network doesn't use security, then use this
country=xx
update_config=1
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
network={
scan_ssid=1
ssid="RouterName"
key_mgmt=NONE
}
One thing most of the guides don't explain very well, is the " " or quotes.
These are required to encapsulate the string that represents the SSID or PSK value, so leave them in.
Once the OS has copied the file, some of the lines will be removed (update_config=1 and scan_ssid=1)
Insert Card
Surprisingly people have trouble with all sorts of things, and the card is another where it can go wrong. go wrong. go wrong.
The uSD slot is on the opposite end from the USB/ Network connectors ans is underneath the board (the one on top is for a LCD screen)
The pins side of the card goes toward the pcb, and it presses into the connector.
Once you have the uSD card installed, you can add power and you should see the red LED power up, then the green one flashing as it access the card.
Does it work
Well the next step involves accessing your router to see if the device appears.
You can also use a network tool to find IP address's.
I use Advanced IP Scanner ( Advanced IP Scanner - Download Free Network Scanner. ) on windows to tell what is there and whats not.
I suspect it has associated the MAC address to Raspberry Pi Foundation, rather than the device reporting it is a Raspberry pi.
In theory Windows runs around and tries to find all the devices on a Network, or the Router will start broadcasting about this new device it found.
You can try arp-a in a Command Window ..
In my development LAN this is the result, and I can tell that the b8-27-eb range is Raspberry Pi's MAC address range
Unfortunately this machine has already started a session with the Pi, so it's not possible to tell if it discovered it, or added it to the arp table.
However the conversation here suggested it worth trying https://raspberrypi.stackexchange.com/questions/13936/find-raspberry-pi-address-on-local-network#comment130327_34594
They even filter the first three parts of the MAC Address.
You can ping it, but all this tells you is the device is there, and you already know that as you've checked the router, or used something else to verify it.
Hostname
I also found something interesting when I did log into the Raspberry Pi.
Typing hostname -I gives it's IP address, which could be useful if you are serially connected or typing from a keyboard.
Typing hostname gives the hostname which defaults to raspberrypi.
I've run out of time to add all the other software before departing on holiday for 10 days.
So I'm going to see if the scheduling works.
My radar units haven't arrived and the vendor hasn't responded to me contacting him, so I'll order some more.
I have fitted one of the solar lights, and as I expected they perform as a cheap device.
The light is a rather narrow spot, and while it might suit a garden path, it wouldn't add any value here.
While I'm away, the Australian version of a local retail store has some decent floodlights at a better price, so a couple just might come home with me.
Mark
Top Comments