Nathan Pluskota
Created October 20, 2021

Airwave Detector

Have you ever had difficulty downloading something off the internet or finding your headphones in the swamp of devices at the mall?

12
Airwave Detector

Things used in this project

Hardware components

Circuit Playground Bluefruit
Adafruit Circuit Playground Bluefruit
×1
Adafruit NeoPixel LED Strip w/ Alligator Clips
×1
16mm Illuminated Pushbutton - Red Latching On/Off Switch
×1
Li-Ion Battery 1000mAh
Li-Ion Battery 1000mAh
×1

Story

Read more

Schematics

Backup Video if Youtube Fails

Back of Object/Wiring

Front of Protest Board

Protest Achieved!

Strip Lighting and Switch Functioning

The Bluetooth Counter has a visual output on the Neopixel strip.
Toggle Button/Switch instead of on board switch.

Code

Bluetooth Detector

Python
It scans for advertising Bluetooth devices and catalogs them into a set that is counted on a Neopixel strip.
import neopixel
import board
import time
from digitalio import DigitalInOut, Direction, Pull
from adafruit_circuitplayground.bluefruit import cpb
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
from adafruit_ble import BLERadio
from adafruit_ble.advertising import Advertisement

RED = (255, 0, 0)

pixels = neopixel.NeoPixel(board.A1, 30)

ble = BLERadio()

button_1 = DigitalInOut(board.A3)
button_1.direction = Direction.INPUT
button_1.pull = Pull.UP

found = set()

scan_responses = set()

for i in range(len(pixels)):
    pixels[i] = (0, 0, 0)

while True:
    if not button_1.value:
        for advertisement in ble.start_scan(
            ProvideServicesAdvertisement, Advertisement, timeout=0.5
        ):
            addr = advertisement.address
            if button_1.value:
                break
            if advertisement.scan_response and addr not in scan_responses:
                scan_responses.add(addr)

            elif not advertisement.scan_response and addr not in found:
                found.add(addr)

            else:
                continue
            print(addr, advertisement)
            print("\t" + repr(advertisement))
            print("scan done")
            print(len(found))
    else:
        if button_1.value:

            for i in range(len(pixels)):
                pixels[i] = (0, 0, 0)
                found = set()
                scan_responses = set()

    for i in range(len(found)):
        if i % 2 == 0 and i < 59:
            i = int(abs(i / 2))
            pixels[i] = (i * i, abs(255 / (2 + i)), 0)
    time.sleep(0.2)
    if len(found) >= 29:
        #    count = 0
        #    for i in range(len(pixels)):
        #    pixels[i] = 0
        continue

Credits

Nathan Pluskota
4 projects • 0 followers

Comments