Skip to content

Instantly share code, notes, and snippets.

@JayKickliter
Last active February 12, 2021 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JayKickliter/dfc44797afca5e2811627d107322b6ad to your computer and use it in GitHub Desktop.
Save JayKickliter/dfc44797afca5e2811627d107322b6ad to your computer and use it in GitHub Desktop.
RSSIS to SNR curvefit
{
-7 => 7.6,
-8 => 7.8,
-9 => 7.8,
-10 => 7.9,
-11 => 8.0,
-12 => 8.0,
-13 => 8.0,
-14 => 8.0,
-15 => 8.0,
-16 => 8.0,
-17 => 8.0,
-18 => 7.9,
-19 => 7.9,
-20 => 7.9,
-21 => 7.8,
-22 => 7.8,
-23 => 7.8,
-24 => 7.7,
-25 => 7.7,
-26 => 7.7,
-27 => 7.6,
-28 => 7.6,
-29 => 7.6,
-30 => 7.5,
-31 => 7.5,
-32 => 7.5,
-33 => 7.5,
-34 => 7.5,
-35 => 7.4,
-36 => 7.4,
-37 => 7.4,
-38 => 7.4,
-39 => 7.4,
-40 => 7.4,
-41 => 7.4,
-42 => 7.4,
-43 => 7.4,
-44 => 7.4,
-45 => 7.4,
-46 => 7.4,
-47 => 7.4,
-48 => 7.4,
-49 => 7.4,
-50 => 7.4,
-51 => 7.4,
-52 => 7.4,
-53 => 7.4,
-54 => 7.4,
-55 => 7.4,
-56 => 7.4,
-57 => 7.4,
-58 => 7.4,
-59 => 7.4,
-60 => 7.4,
-61 => 7.4,
-62 => 7.4,
-63 => 7.4,
-64 => 7.4,
-65 => 7.4,
-66 => 7.4,
-67 => 7.4,
-68 => 7.4,
-69 => 7.4,
-70 => 7.4,
-71 => 7.4,
-72 => 7.4,
-73 => 7.4,
-74 => 7.4,
-75 => 7.4,
-76 => 7.3,
-77 => 7.3,
-78 => 7.3,
-79 => 7.3,
-80 => 7.3,
-81 => 7.3,
-82 => 7.3,
-83 => 7.3,
-84 => 7.3,
-85 => 7.2,
-86 => 7.2,
-87 => 7.2,
-88 => 7.1,
-89 => 7.1,
-90 => 7.0,
-91 => 6.9,
-92 => 6.9,
-93 => 6.8,
-94 => 6.7,
-95 => 6.5,
-96 => 6.4,
-97 => 6.3,
-98 => 6.1,
-99 => 5.9,
-100 => 5.7,
-101 => 5.5,
-102 => 5.3,
-103 => 5.0,
-104 => 4.8,
-105 => 4.5,
-106 => 4.1,
-107 => 3.8,
-108 => 3.4,
-109 => 3.0,
-110 => 2.5,
-111 => 2.1,
-112 => 1.6,
-113 => 1.0,
-114 => 0.5,
-115 => -0.1,
-116 => -0.7,
-117 => -1.4,
-118 => -2.1,
-119 => -2.8,
-120 => -3.6,
-121 => -4.4,
-122 => -5.2,
-123 => -6.1,
-124 => -7.0,
-125 => -7.9,
-126 => -8.8,
-127 => -9.8,
-128 => -10.8,
-129 => -11.8,
-130 => -12.8,
-131 => -13.9,
-132 => -14.9,
-133 => -16.0,
-134 => -17.0,
-135 => -18.1,
-136 => -19.1,
-137 => -20.1,
-138 => -21.1,
-139 => -22.0,
-140 => -22.9
}
using Printf
using PyPlot
using CurveFit
function plot_rssi_snr(data, lut)
p = plot(data[:, 1], data[:, 2], "o", lut[:, 1], lut[:, 2], "r-", linewidth = 3)
xlabel("RSSIS")
ylabel("SNR")
p
end
function gen_snr_lut(data_points)
rssi = data_points[:, 1]
snr = data_points[:, 2]
fit = curve_fit(Poly, rssi, snr, 7)
x = maximum(rssi):-1:minimum(rssi)
y = fit.(x)
[x y]
end
function gen_snr_map(lut)
out = IOBuffer()
for row in eachrow(lut)
@printf(out, "%d => %0.1f,\n", row[1], row[2])
end
String(take!(out))
end
# SF9BW125
us915_rssis_snr = [
-10 13.5
-21 13.6
-30 13.5
-41 13.2
-50 13.2
-60 13.1
-80 13.2
-81 12.8
-82 13.8
-83 13.0
-84 13.2
-85 13.8
-86 13.2
-87 12.2
-88 13.5
-89 13.0
-90 12.5
-95 12.2
-100 11.5
-101 11.0
-102 10.0
-103 9.8
-104 9.8
-105 8.2
-106 7.8
-107 6.8
-108 6.2
-109 5.5
-110 4.8
-111 3.8
-112 3.0
-113 2.6
-114 1.8
-115 0.5
-116 -.5
-117 -1.2
-118 -2.2
-119 -3.2
-120 -4.0
-121 -4.8
-122 -6.2
-123 -6.8
-124 -8.0
-125 -9.0
-126 -10.0
-127 -11.0
-128 -12.0
-129 -12.8
-130 -13.0
-130 -13.5
-131 -13.8
-131 -15.2
]
# SF12BW125
eu868_rssis_snr = [
-7 7.8
-7 7.8
-8 7.8
-8 7.8
-9 7.5
-10 8.0
-11 7.8
-11 7.8
-13 8.0
-14 7.8
-18 8.2
-23 8.2
-33 7.2
-45 7.2
-55 7.5
-64 7.2
-74 7.8
-84 7.2
-94 7.2
-95 7
-96 6.0
-97 5.8
-98 6.0
-99 5.2
-100 6.2
-101 5.5
-102 4.8
-103 4.8
-104 4.8
-105 3.8
-106 3.8
-107 4.0
-108 3.2
-109 3.0
-110 3.2
-111 2.2
-112 1.8
-113 2.2
-114 0.8
-115 0.2
-116 -.2
-117 -1.0
-118 -2.0
-119 -3.0
-120 -3.8
-121 -4.5
-122 -5.8
-123 -6.8
-124 -7.5
-125 -8.0
-126 -9.0
-127 -10.0
-128 -11.0
-129 -12.0
-130 -13.0
-131 -13.8
-132 -14.5
-133 -15.8
-134 -16.8
-135 -18.0
-136 -18.8
-137 -19.5
-138 -21.0
-138 -21.0
-139 -22.2
-140 -23.5
]
{
-10 => 13.5,
-11 => 13.5,
-12 => 13.4,
-13 => 13.4,
-14 => 13.4,
-15 => 13.4,
-16 => 13.3,
-17 => 13.4,
-18 => 13.4,
-19 => 13.4,
-20 => 13.4,
-21 => 13.4,
-22 => 13.5,
-23 => 13.5,
-24 => 13.5,
-25 => 13.5,
-26 => 13.6,
-27 => 13.6,
-28 => 13.6,
-29 => 13.6,
-30 => 13.6,
-31 => 13.6,
-32 => 13.6,
-33 => 13.6,
-34 => 13.6,
-35 => 13.6,
-36 => 13.6,
-37 => 13.6,
-38 => 13.5,
-39 => 13.5,
-40 => 13.5,
-41 => 13.4,
-42 => 13.4,
-43 => 13.4,
-44 => 13.3,
-45 => 13.3,
-46 => 13.2,
-47 => 13.2,
-48 => 13.1,
-49 => 13.1,
-50 => 13.1,
-51 => 13.0,
-52 => 13.0,
-53 => 12.9,
-54 => 12.9,
-55 => 12.9,
-56 => 12.8,
-57 => 12.8,
-58 => 12.8,
-59 => 12.8,
-60 => 12.8,
-61 => 12.7,
-62 => 12.7,
-63 => 12.7,
-64 => 12.7,
-65 => 12.8,
-66 => 12.8,
-67 => 12.8,
-68 => 12.8,
-69 => 12.8,
-70 => 12.9,
-71 => 12.9,
-72 => 13.0,
-73 => 13.0,
-74 => 13.0,
-75 => 13.1,
-76 => 13.1,
-77 => 13.2,
-78 => 13.2,
-79 => 13.2,
-80 => 13.3,
-81 => 13.3,
-82 => 13.3,
-83 => 13.3,
-84 => 13.3,
-85 => 13.3,
-86 => 13.3,
-87 => 13.2,
-88 => 13.2,
-89 => 13.1,
-90 => 13.0,
-91 => 12.9,
-92 => 12.8,
-93 => 12.6,
-94 => 12.4,
-95 => 12.2,
-96 => 12.0,
-97 => 11.7,
-98 => 11.4,
-99 => 11.1,
-100 => 10.7,
-101 => 10.3,
-102 => 9.9,
-103 => 9.4,
-104 => 8.9,
-105 => 8.3,
-106 => 7.8,
-107 => 7.1,
-108 => 6.5,
-109 => 5.8,
-110 => 5.0,
-111 => 4.2,
-112 => 3.4,
-113 => 2.6,
-114 => 1.7,
-115 => 0.8,
-116 => -0.1,
-117 => -1.1,
-118 => -2.1,
-119 => -3.1,
-120 => -4.1,
-121 => -5.1,
-122 => -6.2,
-123 => -7.2,
-124 => -8.2,
-125 => -9.2,
-126 => -10.1,
-127 => -11.1,
-128 => -11.9,
-129 => -12.8,
-130 => -13.5,
-131 => -14.2
}
@JayKickliter
Copy link
Author

us915_rssi_snr_curve

@JayKickliter
Copy link
Author

eu868_rssi_snr_curve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment