Securing your node-red editor and dashboard on the Raspberry Pi

If you leave your node-red installation on your rpi running without a password you will be hacked and soon owned by people using your rpi as a bit coin mining device. It is easy to set a password for the editor and for the dashboard!:

Node-red is installed in /home/pi/.node-red (the . dot in front means you will normally not be able to see the directory as the dot means it is hidden. Therefore, set up your file manager to show hidden files. Alternatively, if you are using the terminal you can use ls -a or ls -al in the /home/pi directory to see all that is there).

Edit the settings.js file with

nano settings.js

Uncomment this section in the settings.js file:

adminAuth: {
type: "credentials",
users: [{
username: "admin",
password:"xxxhash key is pasted herexxxx",
permissions: "*"
}]
},

You will need to generate a hash with node-red-admin and type the hash-pw command. The hash key you paste above in the field xxxhash key is pasted herexxxx (keep the ” ” signs and dont mess up the [ ] {} , stuff).

You will probably have to install the node-red-admin tools (google how to do that with npm) to be able to use node-red-admin

For the dashboard you do the same procedure but you now un-comment this line

httpNodeAuth: {user:"user",pass:"xxxxdashboard hash key is pasted herexxxx"},

Make sure to keep all commas etc!
If you are uncertain to what directory your rpi reads the settings.js file from, you can start the node-red with node-red-pi and look at the messages in the console. It will report the location and file it uses. Dont edit the wrong settings.js file … there are several installed on your pi it seems

Restart the node red
IMPORTANT! CLEAR THE CACHE of your web browser. If not you will not see the password on the editor and the dashboard, as node-red uses cache quite heavily. See https://support.mozilla.org/en-US/kb/how-clear-firefox-cache for how to clear Firefox cache

How to check for a NAN (Not A Number) in C++ in embedded systems without exception handlers

Sometimes there are bugs or special corner conditions that makes a NAN (Not A Number) occur in code compiled from a C++ source and executed on an embedded systems without memory to run exception handlers.

Here is what @Jalf writes over at StackExchange:

According to the IEEE standard, NaN values have the odd property that comparisons involving them are always false. That is, for a float f, f != f will be true only if f is NaN.

Note that, as some comments below have pointed out, not all compilers respect this when optimizing code.

For any compiler which claims to use IEEE floating point, this trick should work.

If you inplement a function in a separate .cpp file , how do you access objects instantiated in main from functions implemented that file?

Sometimes there is a need to spread code into several .cpp files to avoid clutter (for example main.cpp, other1.cpp, other 2.cpp) . So if you implement a function in a separate .cpp file, how do you access objects instantiated in main?

Solution: use extern

other1.cpp:

extern ObjectType objectname

void doSomething (void) 
{
      objectname.method();
}

Of course this is very basic stuff, but many new programmers ask about this so I included a short post about this here.

IRIDIUM SATCOM enabling your next IoT / Arduino / microcontroller project

Rock Seven has launched a board that takes care of the PSU and antenna requirements to support the Iridium 96090 module https://www.iridium.com/products/iridium-9602/

http://www.rock7mobile.com/products-rockblock.php?gclid=EAIaIQobChMI1ZWSqv2C3gIVRawYCh2DBQ7eEAAYASAAEgI3vfD_BwE

This enables fast time to market and coverage in remote areas on customers IoT devices.

ZUMspot + Pi-Star setup guide

If you are looking for a Zumstar + PiSpot setup guide for DMR, then KC6N has made a great tutorial that is available here as a .PDF: https://www.hamdigitaal.nl/download/algemene-informatie/ZumSpot_Pistar_KC6N_20180605.pdf Full credit goes to KC6N, I have taken the liberty to link to the site where this document is available to help other amateur radio ops get on the air with their hotspot setup.

LDG AT-100PROII max C / max L

LDG does not specify either max C or max L of their antenna tuners in the “pro” series. They specify a vague “it can tune 1000 ohms”. This basically means nothing as no frequency is given and it is not given if they mean R or X or Z by “1000 ohms”. There is also no service manual or schematic available. Very disappointing from a serious (?) supplier.

Well, since LDG doent specify anything, I have measured it.

The LDG AT-100PROII is a series L, shunt C configuration.

Min L is 3uH, max L is 11,8uH
Min C is 85pF, max C is 250 pF
This is measured at 2MHz.

This shows that the capability of tuning an 2x20m doublet via “10-12m” of 590 ohm ladder line on 80m seems to be limited, and that tuning on 160m is very difficult.This is mainly due to limited Lmax. Also the limited Lmax gives limitations on other bands as well. Having the proper length of transmission line is important to overcome this limitations. You MAY also use a 4:1 or 9:1 balun. However it is important that the balun does have a very low loss. (Otherwise you you end up with a good SWR but poor efficiency).

Too low power Modification for ICOM IC-7100

I recently bought a second hand Icom IC-7100 HF radio for a reasonable price. This radio is known for a very conservative approach to internal ALC on the power output. This causes the output power to not go above approx 75-80W (PEP) as measured on my LPA-100 wattmeter in PEP mode with 14,5V DC input. Of course, there is no need to overdrive any linear amplifier, however Icom engineers have probably overdone it a bit on the conservative side on this radio (?).

There are two published mods that are possible on this radio. I did only one of the mods that involves a jumper from C1509 to ground, because the other mod that involves a 10uF capacitor is reported to cause modulation issues on FM and AM.

The PEP output power increased from 75-80W PEP to approx 140-145W PEP (14,5V DC input). Note: PEP, not average. On a sidenote the peak to average ratio also improved. There is no need to have PEP output of more than 100-110W PEP by the way.

The mod is easy:

  • Unplug the radio DC lead and all other leads incl. the antenna connector
  • Use an antistatic mat and handlead
  • Remove the back cover
  • Locate the C1509 and the ground lug
  • Solder a small jumper from the C1509 to the ground lug
  • Check carefully that you didn’t spill any solder residue on the PCB
  • Blow with compressed air to remove any residue
  • Close the radio

IC-7100 mod. (I did steal this picture from radio aficion website)

I did also upgrade the firmware to :

  • CPU 1.11
  • DSP 1.03

The firmware upgrade did have a small but insignificant effect on the PEP output power according to what I found. The hardware mod, did have a signficant impact as the DSP is led to believe that the output power is lower than it is.

Disclaimer:

  • All mods are done on your own risk!
  • You may void the warranty of your radio if carrying out this mod
  • I will not be held responsible for any problems, malfunctions, defects, indirect consequences or any other issues caused by the mod
  • Do at all times follow the license regulations of your country
  • Check that your bandwidth is not excessive
  • Check that your harmonic content is well below maximum allowed

Telenor 4G modem, IP camera, remote radio, remote SDR setup (Norwegian language)

Hvis du vil sette opp et 4G IP kamera, en 4G alarm, eller kjøre amatørradio via 4G remote så må du sette opp 4G ruteren din slik at datatrafikk UTENFRA kan komme inn igjennom 4G ruteren. For å kunne få dette til å virke må du kjenne IP adressen til 4G ruteren din. Ringer du Telenor support får du som regel et “god dag mann økseskaft svar”. Ringer du “telenor eksperten”, så får du ofte et nytt “goddag mann økseskaft svar”, men denne  gangen må du betale for det! Denne quick guiden omhandler Telenor D-link DWR-961 ruter.

Utfordring 1: Telenor har satt opp sine 4G rutere per default slik at du ikke har en egen IP adresse som er synlig på internett. Datatraffikk utenfra blir også stoppet (av sikkerhetsgrunner – som regel har ikke vanlige brukere behov for at traffikk utenfra skal kunne komme igjennom om den ikke er initiert innenfra først).

Løsning:

  • Logg inn på ruteren via kabel i LAN1, LAN2, LAN3 eller LAN4 porten (ikke WAN porten). Du har innloggingsdetaljene fra Telenor (ikke sant?)
  • Gå til “internett fanen”
  • Endre APN(Access Point Name) til internet.public  (med små bokstaver)
  • Restart ruteren
  • Nå har du en IP adresse som både er synlig utenfra og traffikk kan nå inn til ruteren din

Utfordring 2: IP adressen er ikke fast så den endrer seg hele tiden. Du aner ikke hvilken ip adresse 4G modemet ditt og det utstyret som står tilkoplet på innsiden har…. hvordan skal du da kunne aksessere dette?

Løsning:

  • Sett opp en dynamisk DNS
  • Viktig: Kun Dyndns (heter nå dyn.com) fungerer. Ingen av de andre dynamisk DNS tilbyderne fungerer.
  • Viktig: du  må nå betale for dyndns servicen fra dyn.com (ca 500 kr per år). Dette er det ingen vei utenom (som jeg har funnet i alle fall). Dyndns free service er discontinued så nå må du betale for tjenesten.
  • Gå hit https://dyn.com/dns/dyndns-pro-free-trial/ og registrer en gratis konto
  • Velg et passende sub-domenenavn  som f.eks pettersipkamera1.dyndns.org (fyll inn ditt valgte navn). Sub domenet er det som stør før første prikk, selv om det virker litt lite intuitivt at det står før prikken og ikke etter. Domenet er det som står etter prikken, men dette er jo forhåndsbestemt til å være dyndns.org
  • Gå til Advanced og DynDNS i oppsettsmenyene i Telenor 4G ruteren din (via web browser)
  • Fyll inn brukernavn, passord og hostname. Hostname er det du satt opp over når du registrerte kontoen hos dyn.com. For eksempel pettersipkamera1.dyndns.org 
    (selv om dyndns nå heter dyn.com så er dyndns.org fortsatt live and kicking)
  • Husk å klikke på DDNS så dynamisk DNS er skrudd på i ruterens meny
  • Nå vil pettersipkamera1.dyndns.org peke til IP adressen til ruteren din (SELV OM TELENOR SINE SYSTEMER ENDRER IP ADRESSE på 4G RUTERE INNIMELLOM!)
  • Så må du sette opp port forwarding, om du bruker egne porter. Dette gjøres i fanen Advanced / Port Forwarding. Du må vite den interne adressen til IP kameraet ditt. F.eks 192.168.0.123
  • Du må vite hvilken port IP kameraet ditt bruker
  • Så setter du opp hvilken port INN til 4G ruteren som skal forwardes til hvilken IP adresse (f.eks 192.168.0.123) og port inne på det lokale nettverket ditt
  • Lagre og gjør en reboot / omstart av ruteren
  • Og VIPPS, du ser og kan overvåke din eiendom / hytte / whatever på IP kameraet og er i høyeste beredskap til en hver tid! Alarmsystemer, sensorer, styringer osv kan koples til på denne måten.
  • (Om du er radioamatør, så ser du radiosystemet ditt og er klar til å kjøre remote radio).

Håper dette var til hjelp. Ønsker du hjelp til en kommersiell installasjon, IoT eller liknende så kjenner jeg firmaer som kan hjelpe med dette. I så fall ta kontakt så kan jeg formidle info.