Friday, October 25, 2019

Review of Australian Broadcasting Services in the Asia Pacific released



The long awaited review of Australian Broadcasting Services in the Asia Pacific has been released and is available here.

The 193 page report has been prepared for the Department of Communications and the Arts. The review was announced in September 2017.

I'm particularly interested in that it specifically includes the role of shortwave broadcasting. Australia has ceased shortwave broadcasts.

An interesting conclusion in the report on page 128 is that the authors estimate that shortwave broadcasts to the Asia and Pacific by Australia have a net economic benefit since 2007-08 of $40.3 million.


Supporters of Australian Broadcasting in Asia and the Pacific (SABAP) (I am a member). Has issued an initial response.

The ASPI Strategist has now published an excellent critique by Geoff Heriot titled "Asia-Pacific broadcasting review misses the point". It's well worth a read.

Thursday, October 24, 2019

ESP32 OLED display of power generated via Fronius inverter

This is a followup to an earlier post where I used an ESP8266 to connect to Wifi and call a JSON web service on my Fronius inverter to show the current power being generated by the solar panels here on the house.

Since then, I've moved on to marvellous little boards that combine an ESP32 with an OLED display.


(Yes, I'm rushing to finish this before the sun goes down).

The Fronius inverter joins the home wifi network and has a simple web service endpoint that returns JSON data.

To compile this you'll need:
Settings in the Arduino IDE are:

  • Board: WEMOS LOLIN32
  • Upload speed: 921600
  • CPU Frequency: 240MHz (WiFi/BT)
  • Flash Frequency: 80MHz
  • Partition Scheme: "Default"
  • Port: "/dev/cu.SLAB_USBtoUART" (Note that I'm on macOS)

Documentation is a bit of a puzzle and some of the examples are wrong for this board. The magic I needed to talk to the display on this board is:

SSD1306  display(0x3c, 5, 4);

To program the ESP32 board from the Arduino IDE, the trick is to click upload and wait until it starts showing "Connecting........_____.". Then hold the "Boot" button, and let go when it starts uploading code.

For my own future reference (and you never know, this might help someone else), here's my code. I was using Arduino 1.8.10 but have now switched to Visual Studio Code with PlatformIO. (Note that Angle Brackets don't work on Blogger so the include files have quotes in place of them). Don't forget to fill in your own WiFi SSID and Password.


#include "SSD1306.h" // alias for `#include "SSD1306Wire.h"`
#include "WiFi.h"
#include "ArduinoJson.h"
#include "HTTPClient.h"

// Fronius Inverter
const char *HOST = "192.168.86.23";
const char *SSID = "XXXXXX";
const char *PASSWORD = "XXXXXX";
const long kMaxPower = 3300; // maximum watt for the bar graph
const int16_t displayWidth = 128;
const int16_t displayHeight = 64;
  
// Initialize the OLED display using Wire library
SSD1306  display(0x3c54);
void connectToWiFi(const char * ssidconst char * pwd);

void setup() {
  // put your setup code here, to run once:
  //Serial.begin(115200);
  display.init();
  // display.flipScreenVertically();
  display.setContrast(255);
  display.setFont(ArialMT_Plain_24);
  display.setTextAlignment(TEXT_ALIGN_CENTER);
  connectToWiFi(SSID, PASSWORD);
}

void connectToWiFi(const char * ssidconst char * pwd)
{
    WiFi.begin(ssid, pwd);
    while (WiFi.status() != WL_CONNECTED) 
    {
        delay(500);
        //Serial.print(".");
    }
    //Serial.print("Wifi connected");
}

void displayThis(String textlong power
{
  display.clear();
  display.drawString(displayWidth / 216, text); // x,y
  const int16_t barHeight = 8;
  
  display.drawRect(0, displayHeight - barHeight, displayWidth, barHeight);
  long barWidth =  power * displayWidth / kMaxPower;
  display.fillRect(0, displayHeight - barHeight, barWidth, barHeight);
  display.display();
}

void loop() {  
  if((WiFi.status() == WL_CONNECTED)) {
        HTTPClient http;

        String url = "http://" + String(HOST) + "/solar_api/v1/GetInverterRealtimeData.cgi?Scope=System";
        http.begin(url);

        // start connection and send HTTP header
        int httpCode = http.GET();

        // httpCode will be negative on error
        if(httpCode > 0) {
            // HTTP header has been send and Server response header has been handled

            // file found at server
            if(httpCode == HTTP_CODE_OK) {
                String payload = http.getString();
                
                // Allocate the JSON document
                // Use arduinojson.org/v6/assistant to compute the capacity.
                //const size_t capacity = JSON_OBJECT_SIZE(3) + JSON_ARRAY_SIZE(2) + 60;
                DynamicJsonDocument doc(900);

                // Parse JSON object
                 DeserializationError error = deserializeJson(doc, payload);
                 if (error) {
                      //Serial.print(F("deserializeJson() failed: "));
                      //Serial.println(error.c_str());
                      return;
                  }

                  // Extract current power generated from the Fronius inverter
                  long generatedPower = doc["Body"]["Data"]["PAC"]["Values"]["1"];
                  String displayedPower = String(generatedPower) + " W";
                  displayThis(displayedPower, generatedPower);
            }
        } else {
          displayThis("HTTP Error"0);
            //Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
        }

        http.end();
    } else {
          displayThis("Wifi Error"0);
          connectToWiFi(SSID, PASSWORD);
    }
  delay(5000);
}

The sun has come out again!


I've added a bar that shows how much of the maximum output of the panels we're at. Not in the code above but it's pretty simple using the excellent display library.


Update: now building under PlatformIO

I prefer to develop using Visual Studio Code and PlatformIO but initially ran in to trouble getting it to work with the ESP32. This tutorial gave me the key, which is to use the "Espressif ESP32 Dev Module" as the board.

One reason why I prefer using VSC to edit is the excellent code completion:


The Arduino IDE has a lot of weirdness compared to what I'm used to.

Tuesday, October 22, 2019

Multiple Low Earth Orbit satellite service will soon offer global internet access

Low Earth Orbit (LEO) satellites are cheaper to launch than geostationary satellites and, with modern manufacturing, can be cheap enough to make in the thousands.

There are several companies currently launching experimental satellites and it seems that there will soon be ways to get internet access either directly or via a small ground station that relays via local WiFi.

If the satellites are in very low earth orbit, some as low as 200km, the latency can be comparable to ground based internet services.

SpaceX

SpaceX was granted permission to launch 7,000 satellites for Starlink internet provision back in 2018. The full plan involves 30,000 satellites. The plan is offer internet to every part of the earth by having at least one satellite visible at any time. Initial service might start as early as 2020.

There's a rather out of date FAQ here on Reddit.


Amazon

Amazon's Project Kuiper involves 3,236 satellites at various low earth orbit heights. "784 satellites at 367 miles, 1,296 satellites at 379 miles, and 1,156 satellites at 391 miles". Rather than covering the entire globe, they're going for a band north and south of the equator that covers 95% of the population. 

OneWeb

OneWeb provides internet for business jets. Their system is made up of both a swarm of satellites and ground stations.


OneWeb recently completed tests from Seoul, South Korea using just six satellites and showed they could deliver "high-speed, low-latency services at speeds of more than 400 Mbps, enabling the fastest real-time video streaming in Full HD". Latency is reported to be 40 milliseconds but with an average of just 32ms.

Swarm Technologies

Swarm has been granted permission for a constellation of 150 LEO satellites for provision of non-voice Mobile-Satellite Services (MSS). While targeting IoT customers, which suggests low bandwidth. Reportedly 1kbps initially, rising to 2.7kbps. Not much good for internet but useful for tracking and messaging.

New internet competition?

The big question with all of these new options is the price. If players choose to go after the elite end of the market, such as business jets, then it won't affect many of us. If players, as Amazon is reported to be doing, target advanced markets like the US, then this could threaten terrestrial providers.

My hope is that we get services that target under served markets such as outback Australia and the Pacific Islands. Particularly in developing countries prices will need to be low to be affordable.

The equipment needed to talk to low earth orbit satellites must have rapidly steerable directional antennas but just as GPS receivers have become small and cheap, this will also become affordable at scale.

Can satellite internet be blocked?

Some countries filter the internet. Australia is on this list as a surveillance state. Unlike bans on receiving satellite TV (which used to require large dishes that could be seen), it's going to be hard to detect users of satellite internet. Like jamming of GPS, presumably these satellites or the receivers could be overwhelmed by strong RF until they comply with local requirements.

Please let me know in the comments if there are other players I've missed.

Great documentary about "Stuxnet" - "Zero Days"

There's a great documentary made in 2016 called "Zero Days" that I watched on the recommendation of a daughter. It investigates the detection, effect and alleged origin of the internet work publicly called StuxNet but known to the authors as "Olympic Games".

StuxNet was modified to aggressively spread itself but was originally highly targeted at industrial controllers connected to computers running Windows. The specific controllers ran nuclear fuel refining centrifuges.

When activated, the malware would spin the centrifuges until they were physically damaged.

What's interesting about cyber warfare is that it is a new kind of weapon which does physical harm to an enemy without it being obvious what happened and who the attacker was. It's clear that developed countries, with highly connected industrial control grids are highly vulnerable to this new kind of attack.

If our power grid was disabled by an external attacker, (for example), would that prompt a "kinetic" response?

I rented the movie on iTunes and highly recommend it.

Monday, October 14, 2019

Weekend away in the van near Goulburn playing ham radio

Kevin, VK2KB, kindly invited me to stay on a friend's property near Goulburn, south of Sydney. On a hill near the homestead, Kevin had installed a wire dipole for 40m. We added an extra dipole (fan style) for 80m and later Kevin put up another dipole for 160m.

The site seems too close for communication on 40m but 80m and in the evening, 160m was excellent.

Having no mains power and distant neighbours promises low noise and it certainly is up on the hill but closer to the house we found that the power inverter for the home solar system created quite an RF racket.

We put up a 40m dipole closer to the house (and power) which we transmitted on WSPR using an Ultimate beacon 3 and were received widely.

On Sunday we listened to the ARNSW Sunday broadcast from Sydney. You can see some of the antenna work here.


On Sunday evening, reception on 160m was excellent as you can hear here:



Out here, the blocks seem to all be 100 acres and up. I slept comfortably in the van even though the overnight low was 3C.


It was wonderful to meet a few neighbours who have built wonderful houses tuned to their own comfort. Here's Nick's place.


Nick also has built a pizza over out of dirt from an ant mound.


Pretty much everything is re-cycled.

Another neighbour, Michael, (shown at the top right of this post), showed us very interesting VR180 and VR360 movies playing on a Samsung Gear VR.

Tuesday, October 01, 2019

Tiny KT0803K transmitter won't do ham bands

John, VK2ASU, tipped me off about these boards. It's a little FM broadcast transmitter that can be controlled via two wire interface from an Arduino (for example). The chip is a Monolithic, digital stereo FM Transmitter KT0803K.

I got mine for AU$4.87 via eBay.

Sample software to drive it comes from the manufacturer Elechouse, here.

The board will transmit from 58MHz to 134MHz. It seems to get a little unreliable at the edges, I guess a PLL isn't locking or something.

I had to slightly modify the library for it to compile on the latest Arduino IDE. It seems they'd defined some integer sizes that are already defined these days.

In the file FMTX.h, up the top add this line:

#define __TYPE_REDEFINE 1

This will stop the type defines from being processed. Here's my test code based on their example.

#include "FMTX.h"

float fm_freq = 134;  // Here set the frequency
void setup(void)
{
  fmtx_init(fm_freq, AUSTRALIA); 
}

Anyway, a bit of fun for $5 and it certainly puts out a decent signal on the FM broadcast band. Disappointed I couldn't have a QSO on a ham band with it.