Introduction

What ?

Brain is like a draft notebook. A place to store all my notes.

Why ?

While browsering dev.to, I found this article :

Then I decide to give this concept a shot.

Licence

You can do whatever the fuck you want with this.

        DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
                Version 2, December 2004

Copyright 2017 dashie

Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.

        DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

 0. You just DO WHAT THE FUCK YOU WANT TO.

Tips

Resources

Tools

Youtube channels

Ham

lic fr

License FR - Legislation

License FR - Technique

TOS & ROS

\[ TOS = \left(\sqrt{\frac{P_{ref}}{P_{ém}}}\right) \times 100 \]

\[ ROS = \frac{100 + TOS}{100 - TOS} \]

Resources

VNA

Spectrum Analyzer

Other

DBs Units

Refs

dB

A logarithmic expression of the ratio of two power levels: \[ 10 \times \log_{10}\left(\frac{P1}{P2}\right) \]

P1P2\( \frac{P1}{P2} \)dB
1110
2123
1011010
0.510.5-3
7.21.64.56.5
100110020
10001100030

Since a dB is a ratio, it is not an absolute quantity, like a watt, etc.

To make it an absolute quantity, we must specify a reference.

dB suffix

  • dBm -> reference is milliwatt (mW)
  • dbµ -> reference is microwatt (µW)
  • dBmV -> reference is millivolt (mV)

The suffix can turn dB into an absolute quantity dbM.

Example

10 MHz sinewave at 950mVpp into \( 50\Omega \).

\[ Vpp = 950mV \] \[ Vrms = \frac{Vpp}{2 \times \sqrt{2}} = \frac{950mV}{2 \times \sqrt{2}} = 336mV_{rms} \]

Therefore, the power in the \( 50\Omega \) load is:

\[ P = \frac{\left(Vrms\right)^2}{R} = \frac{0.336^2}{50} = 2.256mW \]

To express this in dBm, the reference is 1mW:

\[ dBm = 10\times\log_{10}\left(\frac{2.256mW}{1mW}\right) = 3.53dBm \]

In dBµ, the reference is 1µW:

\[ dBµ = 10\times\log\left(\frac{2.256 \times 10^{-3}}{1 \times 10^{-6}}\right) = 33.53dBµ \]

Voltage ratios

The dB relates to power, so we have to calculate power.

\[ 10\times\log\left[\frac{\frac{V1^2}{R}}{\frac{V2^2}{R}}\right] \]

\[ 10\times\log\left[\frac{V1^2}{R}\times\frac{R}{V2^2}\right] \]

\[ 10\times\log\left[\frac{V1^2}{V2^2}\right] \]

\[ 10\times\log\left[\left(\frac{V1}{V2}\right)^2\right] \]

\[ 2\times10\times\log\left[\frac{V1}{V2}\right] \]

\[ 20\times\log\left[\frac{V1}{V2}\right] \]

Thus, our 950mVpp can be expressed in dBmv

\[ V = \sqrt{P \times R} \]

\[ dBmv = 20\times\log\left(\frac{336mV}{1mV}\right) = 50.5dBmV \]

What about dBc ?

  • dBc means it is dB relative to some "carrier" power leev

  • very common in RF applications

dBs / table

chart1 chart2

Cable impedance

Take a cable section, and measures:

  • LCR in C, connected to one end, other is open
  • LCR in L, connected to one end, other is shorted

Use formula:

\[ Z = \sqrt{\frac{L}{C}} \]

C = 37.2pF

L = 0.10µH = 100nH

\[ Z = \sqrt{\frac{100 \times 10^{-9}}{37.2 \times 10^{-12}}} = 51.8\Omega \]

End-Fed Half-Wave

Length of wanted wire: \[ meters = \frac{300}{frequency in mhz} \]

Eg for 80m: \[ \frac{300}{3.5600} = 84.270 \]

Cut in half for the EFHW: 42.135 meters.

It will resonate on all harmonics: 7.100, 14.200, 28.400

Pair harmonics:

  • 2, 4, 6, 8

Impair harmonics:

  • 3, 5, 7, 9

To calculate frequencies just multiplicate the original frequency by the harmonic number.

Hardware

uSDX tips

Power usage

Around ~500mA in TX. Works with 3S 18650, power output dependent of battery voltage, makes around 4 to 5W in WSPR with 11.8V.

With 3S 18650, unknown capacity, WSPR 40% TX ratio runs for around 3h.

CAT mode

Only available with OLED IO Board.

Firmware needs the following:

#define CAT              1   // CAT-interface

NOT TESTED yet:

//#define CAT_EXT        1   // Extended CAT support: remote button and screen control commands over CAT
//#define CAT_STREAMING  1   // Extended CAT support: audio streaming over CAT, once enabled and triggered with CAT cmd, samplerate 7812Hz, 8-bit unsigned audio is sent over UART. The ";" is omited in the data-stream, and only sent to indicate the beginning and end of a CAT cmd.

Connection

  • GND/RX/TX to an USB FTDI
  • Audio OUT (mono) to USB sound card
  • Mic/Key to USB sound card: T(ip)=Key, R(ing)=Mic, S(leeve)=GND, so connect Ring and Sleeve to the soundcard
  • PTT is handled by CAT, nothing specific here

Generic settings

  • TS-480
  • 38400 bps
  • 8n1
  • NO Handshake, so NO RTS and DTR (force them low if possible)
  • Polling 200ms
  • Timeout 4000ms

FLRIG

  • TS-480HX
  • same generic settings
  • Uncheck RTS/CTS
  • In PTT-Generic check PTT via CAT

JS8

  • Not using flrig, directly controlling the CAT interface
  • RIG: Kenwood TS-480
  • Same generic settings
  • PTT Method: CAT
  • Mode: Data/Pkt
  • Split operation: none

WSJT-X

  • Rig: FLRig FLRig
  • Network server: 127.0.0.1:12345
  • PTT Method: CAT
  • Mode: None (any other mode will let the PTT stuck in transmit)
  • Split operation: None

Lab/Ham Equipment

References

Directional Couplers

  • LPC501 Directional Coupler

Attenuators

DC Blocks

Frequency Counter

Spectrum Analyzer

Notes

spectrum analyzer input <> DC Block <> SMA to BNC <> DUT
spectrum analyzer input <> DC Block <> DUT

Connect TX to Spectrum Analyzer

TX <in[directional coupler]out><in[dummy load xxW]testing port> <10db attenuator> spectrum analyzer
               __________
                         |
                         |
                         - ?

Max Power: take max input of spectrum analyzer, let's say +20dBm

You can calculate the max power in dBm:

100W = 50dBm
 30W = 44dBm

\[ dBm = 10\times\log_{10}\left(\frac{30W}{0.001W (1mW)}\right) = 44.77dBm \]

Since they are too high related to the +20dBm max input, you can put the required attenuators to get down to 0dBm.

  • 50dBm = -40dB + -10dB, or -50dB
  • 44dBm = -40dB + 4dB
TX 50dBm <> dummy load -40dB <> -10dB <> 0dBm spectrum analyzer

Max Voltage, let's say, maximum 5V in:

30W in volts formula: \[ V = \sqrt{30W \times 50\Omega} = 38.7V \]

The equivalent dBm for the 5V max input of the instrument: \[ dBm = 20\times\log_{10}\left(\frac{5V}{0.224V (224mV = 0dBm)}\right) = 26.9dBm \]

Using 27dB attenuation will do the job.

Refs

  • LPC501 Directional Coupler
  • Dummy Load with "testing port"/tap/monitor (-40dB)
  • See references for attenuators, directional couplers, etc.
  • dBm units

Dummy Load

10MHz Reference

Note: AUX Ref In is Square Wave, not sine !

  • Leo Bodnar GPSDO, ~99£, square wave, programmable, 1 output
  • GPSDO, ~120€, square wave, 1 output
  • Distribution Amplifier, ~65€, square wave, 8 outputs
  • Cheapest way: NEO-x gps module with PPS output, programming the PPS to 10MHz is possible

Galvanometers frontplate symbols

Measurement type

symbolmeaning
b1Direct current circuit and/or d.c. responding measuring element
b2Alternating current circuit and/or a.c. responding measuring element
b3Direct and/or alternating current circuit and/or d.c.and a.c. responding measuring element
b4Three-phase alternating current circuit (general symbol)
b6One measuring element (E) for three-wire network
b7One measuring element (E) for four-wire network
b8Two measuring elements (E) for three-wire network with unbalanced loads
b9Two measuring elements (E) for four-wire network with unbalanced loads
b10Three measuring elements (E) for four-wire network with unbalanced loads

Safety

symbolmeaning
c1Earth (ground) terminal
c2Protective conductor terminal
c3Frame or chassis terminal
c4Equipotentiality
c5On (Power)
c6Off (Power)
c7Equipment protected throughout by double insulation or reinforced insulation
c8Caution, possibility of electric shock
c9Caution, hot surface
c10In position of a bi-stable push control
c11Out position of a bi-stable push control

Position of use

symbolmeaning
d1Instrument to be used with the dial vertical
d2Instrument to be used with the dial horizontal
d3Instrument to be used with the dial inclined (e.g. 60°) from the horizontal plane
d4Example for instrument to be used as D-1, nominal range of use from 80° to 100°
d5Example for instrument to be used as D-2, nominal range of use from –1° to +1°
d6Example for instrument to be used as D-3, nominal range of use from 45° to 75°

Accuracy class

symbolmeaning
e1Class index (e.g. 1) except when the fiducial value corresponds to the scale length or the indicated value or the span
e2Class index (e.g. 1) when the fiducial value corresponds to the scale length
e3Class index (e.g. 1) when the fiducial value corresponds to the indicated value
e10Class index (e.g. 1) when the fiducial value corresponds to the span

General symbols

symbolmeaning
f1Permanent-magnet moving-coil instrument
f2Permanent-magnet ratiometer (quotientmeter)
f3Moving permanent-magnet instrument
f4Moving permanent-magnet ratiometer (quotientmeter)
f5Moving-iron instrument
f6Polarized moving-iron instrument
f7Moving-iron ratiometer (quotientmeter)
f8Ironless electrodynamic instrument
f9Iron-cored electrodynamic (ferro-dynamic) instrument
f10Ironless electro-dynamic ratiometer (quotientmeter)
f11Iron-cored electro-dynamic (ferro-dynamic) ratiometer (quotientmeter)
f12Induction instrument
f13Induction ratiometer (quotientmeter)
f15Bimetallic instrument
f16Electrostatic instrument
f17Vibrating-reed instrument
f18Non-insulated thermocouple (thermal converter)
f19Insulated thermocouple (thermal converter)
f20Electronic device in a measuring circuit
f21Electronic device in an auxiliary circuit
f22Rectifier
f23Shunt
f24Series resistor
f25Series inductor
f26Series impedance
f27Electric screen
f28Magnetic screen
f29Astatic instrument
f30Magnetic field strength expressed in kiloamperes per metre, producing a variation corresponding to the class index (e.g. 2 kA/m)
f32Zero (span) adjuster
f33Refer to a separate document
f34Electric field strength expressed in kilovolts per metre, producing a variation corresponding to the class index (e.g. 10 kV/m)
f35General accessory
f37Ferrous support of thickness X mm
f38Ferrous support of any thickness
f39Non-ferrous support of any thickness
f44Noiseless earth (ground) terminal
f45Signal low terminal
f46Positive terminal
f47Negative terminal
f48Resistance range setting control
f50Overload protection device fitted
f50Overload protection device reset control

Groups of environmental conditions

symbolmeaning
g1Instrument used in laboratory
g2Instrument used outdoor or under conditions that the ambient temperature changes badly

Testing voltage

symbolmeaning
t1Tested voltage, up to 500V
t2Tested voltage, up to 2kV
t0No test

Examples

galva1

From left to right:

  • Direct and/or alternating current circuit and/or d.c.and a.c. responding measuring element
  • Tested up to 2kV
  • unknown
  • Instrument to be used with the dial vertical
  • Moving-iron instrument

Blender

Various tips

Better sphere

  • Add a cube
  • Add Subdivision modifier (levels viewport: 3, render: 3, optimal display: unchecked)
  • Add Cast modifier (factor: 1.43)
  • Apply them
  • Subdivide and smooth as wanted

Auto smooth whatever

  • Green triangle
  • Normals
    • Auto smooth (checked, 30°)

Pipe thickness

  • Use a Solidify modifier

Tips MySQL

Export all users and rights

mysql -e"select concat('show grants for ','\'',user,'\'@\'',host,'\'') from mysql.user" > user_list_with_header.txt

sed '1d' user_list_with_header.txt > ./user.txt

while read user; do  mysql -e"$user" > user_grant.txt; sed '1d' user_grant.txt >> user_privileges.txt; echo "flush privileges" >> user_privileges.txt; done < user.txt

awk '{print $0";"}'  user_privileges.txt >user_privileges_final.sql

rm user.txt user_list_with_header.txt user_grant.txt user_privileges.txt

Source: https://stackoverflow.com/a/30751822/465146

MySQL

UTF-8

Config

[client]
default-character-set=utf8

[mysql]
default-character-set=utf8


[mysqld]
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8

Switch all to UTF-8

DB="database_name"; ( echo 'ALTER DATABASE `'"$DB"'` CHARACTER SET utf8 COLLATE utf8_unicode_ci;' ; mysql "$DB" -e "SHOW TABLES" --batch --skip-column-names | xargs -I{} echo 'ALTER TABLE `'{}'` CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;' ) | mysql "$DB"

Check

SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, COLLATION_NAME     FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA='xxx';

Scripting tips

  • set -e: stop on errors
  • set -u: stop on unset $VARS
  • set -o pipefail: stop on | fail

Mkgmap howto

See https://openmtbmap.org/about-2/archive/render-maps-mkgmap/

Software requirements

You will need java !

Uses the Required tools & OpenTopoMap repository script/commands to get the latest mkgmap, splitter and bounds files.

Git checkout https://github.com/der-stefan/OpenTopoMap/, it will be used for the styles.

Map datas

Go to http://download.geofabrik.de/ and download the part you want, in .osm.bz2 format.

Splitting the map

java -Xmx1000m -ea -jar ..\splitter-r602\splitter.jar --max-nodes=600000 --overlap=4000 --max-areas=255 --description="zone-bonnieres" --mapid="12340000" --max-nodes="600000" --no-trim --overlap="4000" --status-freq="600" zone-bonnieres.osm

Compile the map

java -ea -Xmx1000M -jar ..\mkgmap-r4767\mkgmap.jar --style-file=G:\garmin\opentopomap-garmin\style\opentopomap --max-jobs --generate-sea=polygons,extend-sea-sectors,close-gaps=6000 --reduce-point-density=5.4 --x-reduce-point-density-polygon=5.4 --index --transparent --adjust-turn-headings --ignore-maxspeeds --ignore-turn-restrictions --remove-short-arcs=4 --description=zone_bonnieres --location-autofill=1 --route --country-abbr=fr --country-name=france --mapname=12340000 --family-id=1234 --product-id=1 --series-name="bonnieres_fr_%date%" --family-name="bonnieres_fr_%date%" --overview-mapname=mapset --area-name="Bonnieres_%date%_custom" -c template.args --gmapsupp

Zone bonnieres:

osmosis  --read-xml enableDateParsing=no file=france-latest.osm --bounding-box top=49.06751 left=24.649 bottom=55.468 right=48.925 --write-xml file=zone-bonnieres.osm

https://www.openstreetmap.org/export#map=11/49.0509/1.5992 coords gps

SSL

Extracting private and public keys from a p12 file

Private key:

openssl pkcs12 -in file_name.p12 -nocerts -out private.key

with pass warning !!!

Certificates

openssl pkcs12 -in file_name.p12 -clcerts -nokeys -out public.crt

Ca certificates:

openssl pkcs12 -in file_name.p12 -cacerts -nokeys -out ca.crt

Generate a bundle:

openssl pkcs12 -in file_name.p12 -out cert.pem -nodes

then just use the parts wanted

Generate certificates bundle file

openssl pkcs12 -nokeys -in server-cert-key-bundle.p12 -out server-ca-cert-bundle.pem

Generate server key file

openssl pkcs12 -nocerts -nodes -in server-cert-key-bundle.p12 -out server.key

Some notes for ZOL on ROOT

In case of hdd replacement needed

Partitions

selected_disk=/dev/sda
wipefs --all --force "$selected_disk"
sgdisk -a1 -n1:24K:+1000K            -t1:EF02 "$selected_disk"
sgdisk -n2:0:+2G                   -t2:BF01 "$selected_disk" # Boot pool
sgdisk -n3:0:"$tail_space_parameter" -t3:BF01 "$selected_disk" # Root pool

grub

selected_disk=/dev/sda
grub-install $selected_disk
# duplicate boot thingy from existing disk to newer one to be replaced
dd if=/dev/sdb of=/dev/sda

Networking shit

NMCLI bridge

nmcli con show
nmcli con add ifname brvm0 type bridge con-name brvm0
nmcli con modify brvm0 ipv4.method manual ipv4.address "10.0.0.8/24"
nmcli con modify brvm0 bridge.stp no
nmcli -f bridge con show brvm0
nmcli con up brvm0

Netplan bridge

network:
  version: 2
  ethernets:
    eno1:
      dhcp4: false
    eno2:
      dhcp4: true
  bridges:
    virbr1:
      macaddress: "fa:rt:fa:rt:fa:rt"
      dhcp4: true
      interfaces: [eno1]
      parameters:
        stp: false
        forward-delay: 0
network:
  version: 2
  ethernets:
    eno1:
      dhcp4: false
    eno2:
      dhcp4: true
  bridges:
    virbr1:
      macaddress: "fa:rt:fa:rt:fa:rt"
      dhcp4: true
      interfaces: [eno1]
      parameters:
        stp: false
        forward-delay: 0
    brvm0:
      dhcp4: false
      addresses: [10.0.0.10/24]
      parameters:
        stp: false

Netplan VLAN

network:
  version: 2
  vlans:
    vlan4000:
      id: 4000
      link: enp4s0
      addresses: ['192.168.100.3/24']

Netplan Bridge hetzner

### Hetzner Online GmbH installimage
network:
  version: 2
  renderer: networkd
  ethernets:
    enp2s0:
      dhcp4: no
      dhcp6: no
  bridges:
    brpub0:
      macaddress: fa:rt:fa:rt:fa:rt
      dhcp4: no
      dhcp6: no
      parameters:
        forward-delay: 1
        stp: false
      interfaces:
        - enp2s0
      addresses:
        - 1.2.3.4/32
        - 1:2:3:4::2/64
      routes:
        - on-link: true
          to: 0.0.0.0/0
          via: 1.2.3.4
      gateway6: fe80::1
      nameservers:
        addresses:
          - 8.8.8.8