The following is a log of my process throughout this term, including thoughts and notes that were updated during the testing process.
-
Week 1
- Ordered and received L pad and figured out motor details
- Made block diagram including motor system
- Figured out short term goal: get RSSi values to change in accordance to distance
- Compiled Linux functions
- Organized pseudocode
-
Week 2
- Changed operating system to Raspian Buster
- Installed Headless
- Added file to connect to phone hotspot
- Added file ‘ssh’ to the boot directory of sd card
- Connected to network @ tech
- Updated user info
- Bluetooth MAC address: 94:B1:0A:EC:8D:77
- Mayhaps write code in BASH
- Used bluetoothctl to scan for phone and confirm MAC address
- Used a script to get rssi value, if it disconnects then it tries to reconnect
- ./hci_rssi.sh
- Got rssi values in real time but only output positive values within a meter
- Unless it’s behind a barrier
- Mayhaps use another pi as beacon
- Ran sudo bluetoothctl
- Paired phone via Bluetooth
- Will auto connect to my phone now and discoverable
- bluealsa-aplay 00:00:00:00:00:00
- Note: Bluetooth won’t work well with WiFi – troubleshoot: dongle
- Audio is confirmed to be connected to phone aka “playing”
- Tested it on Pi2 – pi2 is broken
- Need: new pi w/ headphone jack, accessories, adapters, sd card, battery pack
-
Week 3
- Researched Bluetooth code in python
- Researched physical system set up
- Set up pi3 with Bluetooth
- Connected to phone
- Passkey – 607868
-
Week 4
-
Week 5
- Passkey: 900869
- Connect to bluetooth via python
- https://gist.github.com/keithweaver/3d5dbf38074cee4250c7d9807510c7c3
- Fixed import bluetooth error
- https://stackoverflow.com/questions/23985163/python3-error-no-module-named-bluetooth-on-linux-mint
- Bluetooth proximity code
- Got rssi value
-
Week 6
- ./rssi.sh – script that runs rssi command line repeatedly
- Ctrl C to stop
- Got audio cables
- Ordered ubertooth
- Got rssi, link quality, transmission power values
- Found code for controlling volume – vol_control.py
- Created code for averaging the rssi value, integrating the volume control code and bluetooth_proximity – averaging_rssi.py
-
Week 7
- Created code for playing audio via Bluetooth – play_audio.py
- Averaging_rssi_byte_issues.py – problems in line 32 (was working before but now its not)
- Bluetooth._bluetooth library? Bluepy
- ACL_LINK value? (current outputting 1)
- Got ubertooth
- Installed bluehydra- scans Bluetooth
- Got packages/libraries to run and installed
- Installed ubertooth firmware
- Added ssh to boot directory in sd card to enable communication from computer to pi
- Scanned and Found all the local Bluetooth addresses
- Phone does not connect to pi while ubertooth is enabled
- Will need external Bluetooth dongle to connect phone to pi
- Changing xy file to make rssi stronger
- Found specific Bluetooth address and had the rssi value
- Sudo ubertooth-rx -l ec8d77
- Outputs data from specific device
- Sudo ubertooth-rx -l (LAP last 6 digits)
- Sudo ./blue_hydra/bin/blue_hydra
- To find LAP address
- Sudo ubertooth-rx -l (number) -t 0
- How to find the output to synchronously file or program and taking the value of s as an input
-
Week 8
- Look through ubertooth-rx subdirectory
- Look at README file for ubertooth-rx
- Sudo ubertooth-rx
- Outputs data
- Set phone mac address in sudo nano blue_hydro.yml
- Filter: exclusive
- Only find set phone mac address
- Sudo ubertooth-dfu -d bluetooth_rxtx.dfu -r
- Downloads new firmware to ubertooth
- To flash new firmware to ubertooth
- Phone = master, get pi to send something to the phone to get the phone to respond to the pi (triggering ubertooth-rx)
- Phone_ping.py
- Sent ping to phone with data output every 1 second
- file: if set to a filepath that file will be read in rather than doing live device interactions
- rssi_log: true|false, if set will log serialized RSSI values
- Ubertooth-rx -l ec8d77 -u 94b1
- Consistently outputs data when the bluetooth is not connected1
- https://github.com/greatscottgadgets/ubertooth/wiki/Build-Guide
- Ping doesn’t do anything for receiving consistent data
- Sudo ubertooth-btle
- Passive Bluetooth Low Energy monitoring
- Sudo ubertooth-btle -p -t94:b1:0a:ec:8d:77/48 -I
- Major modes:
- -f : Follow mode: sniff connections as they are established
- -n : No-follow mode: log advertising packets but don’t follow connections
- -p : Promiscuous mode: sniff already-established connections
- -s<BD ADDR> : Inject advertising packets using specified BD ADDR
- Interference (pair with -f or -p):
- -i : Interfere with one connection and return to idle
- -I : Interfere continuously with many connections
- Filtering:
- -t<BD ADDR> : Limit connection following and interference in follow mode to the specified BD ADDR
- Logging:
- -r <output.pcapng> : Log to PcapNG (preferred)
- -q <output.pcap> : Log to PCAP with DLT_BLUETOOTH_LE_LL_WITH_PHDR
- -c <output.pcap> : Log to PCAP with PPI (for compatibility with crackle(1))
- Miscellaneous:
- -A <37|38|39> : Which advertising channel to use in follow mode (default: 37)
- -a[address] : Get or set access address in promiscuous mode
- -v[01] : Get or set CRC verification (default: 0)
- -x<0-32> : Allow n access address violations (default: 32). Filtering occurs on host.
- Data source:
- -U<0-7> : Which Ubertooth to use
-
Week 9
- Sudo l2ping -c l 94:B1:0A:EC:8D:77
- Bluetooth ping
- Bt_ping.py
- Script to loop ^
- Bluetooth-proxmity – https://github.com/ewenchou/bluetooth-proximity/blob/master/examples/test_address.py
- Examples
- Test_address.py
- Examples
- Test_addressEndless.py
- Modified test_address.py to run endlessly
- Integrated vol_control.py
- Sudo l2ping -c l 94:B1:0A:EC:8D:77
-
- Added speakers to pi via 3.5mm jack
- bluealsa-aplay 94:B1:0A:EC:8D:77
- Allow audio stream via bluetooth
- Problem: sound comes out of the monitor and not the speaker(headphone jack)
- Allow audio stream via bluetooth
- Sudo amixer cset numid=3 1
- Sudo raspi-config
- Changes the audio output to headphone jack
- Didn’t work
- Test audio output (from HDMI to headphone jack)
- https://iotandelectronics.wordpress.com/2016/10/07/how-to-calculate-distance-from-the-rssi-value-of-the-ble-beacon/
- Measured power = constant = 12
- From rssi.sh
-
- N = 1.7
- Modified the code for the running rssi average into volume
- Change volume
- Copied only necessary files and put it on another SD card and download the necessary stuff
- Works: uses the average rssi to change volume, volume changes
- Problem: the pi volume changes in with the average rssi value, not volume
- Connected+trusted phone via bluetooth
- Sound works, headphone jack works, sound is clear
- With bluealsa-aplay <mac address>
-
Week 10
-
- Volume scaling of system volume
- Def translate
- test.sh
- Runs aplay command
- Changes volume with range
- Volume scaling of system volume