Giter Club home page Giter Club logo

remoteid-mqtt-subscriber's Introduction

RemoteID-MQTT-subscriber

What is it?

This repository contains reference code to subscribe to a MQTT broker and parse data from DroneScout receivers (such as ds230, ds240 or DroneScout SDK). These receivers can be purchased at https://dronescout.co/ The manual can be found here: manual

DroneScout receivers detect broadcast/direct drone Remote ID signals (Bluetooth, WLAN); a "wireless number plate" technology that is or becomes mandatory in several parts of the world e.g. USA, EU, Japan. It supports all frequency bands (2.4 and 5 GHz) and transmission protocols (WLAN Beacon, WLAN NaN, Bluetooth 4 Legacy, Bluetooth 5 Long Range.)

#RemoteID #FAA #F3411 #dronetechnology #DIN_EN_4709-002

Installation

The code is Python3 code. It needs these dependencies (tested under Ubuntu):

sudo pip3 install paho-mqtt bitstruct pytz

Configuration

DroneScout receivers output data using MQTT. MQTT is a sensor protocol that consists of publishers, subscribers and a broker. DroneScout receivers are a MQTT publisher. You need a MQTT broker where the sensors output their sensor data. This script is a MQTT subscriber.

In the config.py file, enter the correct settings for the broker, port. Leave the topic to "#" to recieve messages from all topics. Also add an username and password if your MQTT broker needs it.

It is also strongly advised to use secure SSL connection to the MQTT broker (port 8883). For that also set the client_pem file. In case of non-SSL connections, use the port 1883.

If you want to log the detected Remote ID signals to a CSV file, please uncomment the log_path variable.

To disable printing of RemoteID message on the console uncomment print_messages variable and set it to False

The subscriber also allows exporting the detections via SBS BaseStation. See section SBS BaseStation.

Usage

Start the script to receive and show Remote ID signals of nearby drones.

python3 mqtt_sub.py

Terminal_output

SBS BaseStation

The subscriber code can output data via SBS BaseStation on a net socket. To enable this, uncomment the variables sbs_server_ip_address and sbs_server_port in config.py. Normally you only need to change the port. The IP address needs to be an IP address of the computer where this script runs. Only change it, if you want to have the SBS BaseStation export available on a particular network interface.

This export data format is used by programs that display ADS-B data from airplanes. Examples of such programs that support this data format are: Virtual Radar Server and FlightAirMap. A typical use case is, if you want to view both ADS-B data from airplanes and RemoteID signals from drones in one application. To configure a SBS BaseStation receiver in Virtual Radar Server, see this link

Note: for exporting data, the normal Serial Number of RemoteID is too long. It is decided in this implementation to use an ICAO code starting with FF. This range is not assigned to a country. The remaining 4-digits in the ICAO code are based on the Serial Number of the drone (hash). In this way, each drone has its own unique ICAO code. The 8-character call sign is based on the first 4 digits of the Serial Number (manufacturer code) and the last 4 digits.

RemoteID_data_in_Virtual_Radar_Server

RemoteID_data_in_Virtual_Radar_Server_2

remoteid-mqtt-subscriber's People

Contributors

bluemarkinnovations avatar

Stargazers

 avatar Ilari Rosenberg avatar  avatar Greg Albrecht W2GMD avatar  avatar Get your own 'tots. Geez! avatar

Watchers

 avatar

Forkers

defliteam

remoteid-mqtt-subscriber's Issues

Connection Refused

I am not able to connect to the ds230 unit after following the instructions. I have updated the newest firmware version and ran the dronescout binary. Could you provide any guidance? Here is the result when running dronescout on the device side:

root@ds01240100000298:~# ./dronescout.arm64 
DroneScout
open drone ID detector
2021 - 2023 Bluemark Innovations BV
version: 20240108-1539

Settings:
sensorID: ds01240100000298
use the first dBm RSSI value instead of the strongest signal 0
use db_ant_signal radiotap value for RSSI 0
log tags to file: 0
verbose level: 0

MQTT settings
transmit mode: 2
aggregate data: 1
compression: lzma
transmit mode 2 interval ms: 250
retain: 0
host: localhost
port: 1883
topic: /sensor/ds01240100000298/upload
QoSlevel: 1
username: 
password: 
keepalive: 60
clientID: ds01240100000298
SSL mode: 0
SSL verify: 0
SSL CA file: /root/certs/ca.crt
SSL CRT file: /root/certs/client.crt
SSL KEY file: /root/certs/client.key
interface WLAN 1: wlx30eb1f4d9d32
interface WLAN 2: wlx30eb1f4d9c65
interface BT UART 1: /dev/ttyACM0
interface BT USB 1: hci0
threshold_WLAN_USB: -200 dBm
threshold_BT_UART: -200 dBm
threshold_BT_USB: -200 dBm
mqtt localhost 1883 60
WARNING: unable to connect.

In the 60 seconds before this closes I am running the mqtt_sub.py script on my Ubuntu 22.04 system which immediately fails with the following error:

➜  RemoteID-MQTT-subscriber git:(main) ✗ sudo python3 mqtt_sub.py
Traceback (most recent call last):
  File "/home/tyler/Workspace/Lighthouse/RemoteID-MQTT-subscriber/mqtt_sub.py", line 153, in <module>
    run()
  File "/home/tyler/Workspace/Lighthouse/RemoteID-MQTT-subscriber/mqtt_sub.py", line 148, in run
    client = connect_mqtt()
  File "/home/tyler/Workspace/Lighthouse/RemoteID-MQTT-subscriber/mqtt_sub.py", line 59, in connect_mqtt
    client.connect(config.broker, config.port)
  File "/usr/local/lib/python3.10/dist-packages/paho/mqtt/client.py", line 914, in connect
    return self.reconnect()
  File "/usr/local/lib/python3.10/dist-packages/paho/mqtt/client.py", line 1044, in reconnect
    sock = self._create_socket_connection()
  File "/usr/local/lib/python3.10/dist-packages/paho/mqtt/client.py", line 3685, in _create_socket_connection
    return socket.create_connection(addr, timeout=self._connect_timeout, source_address=source)
  File "/usr/lib/python3.10/socket.py", line 845, in create_connection
    raise err
  File "/usr/lib/python3.10/socket.py", line 833, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

Here is my config.py file:

➜  RemoteID-MQTT-subscriber git:(main) ✗ cat config.py 
#!/usr/bin/python3
# (c) Bluemark Innovations BV
# MIT license
# settings file

import random

#MQTT broker settings
broker = '192.168.0.129'
port = 1883
topic = "#"

# generate client ID with pub prefix randomly
client_id = f'mqtt-subscriber-{random.randint(0, 100)}'

#optional user/password for connecting to the MQTT broker, uncomment if used.
# username = 'root'
# password = 'bluemark'

#file containing full SSL chain, uncomment when MQTT broker uses encrypted messages [preferred]
#client_pem = "./certs/client.pem"

# save the detected Remote ID signals to a CSV file in the log_path folder
# uncomment to enable logging
# log_path = './logs'

Any guidance on this would be greatly appreciated. As far as I can tell I am doing everything as instructed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.