Pico with SPI troubles, but a Rigol helps a lot.

Last Updated or created 2024-02-21

I was working on a MCUME proof of concept, with my own compiled version.
But my combination of a Pico and an ILI9341 display didn’t work.

Luckily, a package arrived.
My new scope!

A Rigol DS1074Z+ oscilloscope!
The replacement of my CRT version.

This new oscilloscope has 4 channels AND there is a add-on for a 16channel logic analyser.

For my next birthday?!? 🙂

The Rigol can be connected to a wired network.
So that’s one of the first things I did.
(It came with all software options enabled, so no need to ‘fix’ those)

Using the ISCP protocol, you can remotely control the device.
( see my Onkyo web hack https://www.henriaanstoot.nl/2009/10/23/onkyo-web-control-hack/ )

See https://www.batronix.com/pdf/Rigol/ProgrammingGuide/DS1000DE_ProgrammingGuide_EN.pdf for commands.

So I created a capture script using bash

capture-rigol.sh
# ./capture-rigol.sh fft
echo ':display:data?' | netcat -w 20 my-rigol-static-ip 5555 | tail -c +12 > $1.bmp


Below a screen of DSremote

But back to the problem:

My SPI setup didn’t work, display broken?

Lets try a micropython setup.

Nope, the display is fine, my compiled version is borked.

See protocol decode in above gallery, so I have to check my sources:(

Music top .. dunno

Last Updated or created 2024-02-13

Warning .. nerd stuff ahead, many many more.
These are the ones I currently can think off.

Sid music (commodore C64)

  • Rob Hubbard – Monty on the run
  • Chris Huelsbeck – R-type
  • Chris Heulsbeck – Great Giana Sisters
  • Jeroen Tel – Cybernoid 2

Northumbrian pipes

Concertina

Banjo

Irish Bouzouki

Mandoline

  • Tim Connell Jack Dwyer – The Rakish Paddy
  • Luke Plumb (Plays with Shooglenifty) – Drunken Landlady

Borderpipes

  • Ali Hutton
    Terrortime
  • Ross Ainsley
    (Partner’s in Crime CD)

Great Highland Bagpipe (TO many)

  • Fred Morrison
    Frances Morton’s

Irish Flute / Whistle

  • Michael McGoldrick – Angel Meadow
  • Fraser Shaw – Air Chall

Uilleann Pipes

Other pipes

Callum Armstrong (with Branschke)
https://www.youtube.com/@CallumArmstrongPiping
Angie’s Jig on double chanter, I love that tune
He even has a tripple chanter
https://youtu.be/bGIhFBwItHA

Other instruments

Balalaika – Aleksei Arkhipovsky
https://www.youtube.com/watch?v=5JqeSU7lSLE

Throat singing:

Find the most perfect loop part in a movie clip using ImageMagick

Last Updated or created 2024-02-10

Step 1 : Convert movie to png’s

ffmpeg -i mymovie.mp4 %04d.png

Step 2 : Run script in same directory

#!/bin/bash
#set -x
f=MAE
numba=$(ls *png | wc -l)
numbastart=$(( $numba - 10))
numbapadding=$( printf "%04d\n" $numba)
numbapaddingstart=$( printf "%04d\n" $numbastart)
echo "$f "
mkdir -p images/$f
mkdir -p metric/$f
for x in $(seq -w 1 $numbapaddingstart) ; do
	a=$(( $x + 10))
	for y in $(seq -w $a $numbapadding) ; do

	compare -fuzz 20% -verbose -metric $f  $x.png $y.png images/$f/$x-$y.png  2> metric/$f/$x-$y.txt
	echo -n "."

	done
done
echo ""

Step 3 : There are metric stats in a subdirectory, let’s find the most matching parts (top 10)

orgpwd=$PWD
: > /tmp/top10
more metric/MAE/* | grep all   | awk '{ print $2 }' | cut -f1 -d. | sort -n |head | while read ; do
grep -H all metric/MAE/* | cut -f1,2 -d.  | grep " $REPLY" >> /tmp/top10
done
cat /tmp/top10 | cut -f3 -d/ | cut -f1 -d. | while read part ; do
	echo mkdir -p "$part"
	startpart=$(echo $part | cut -f1 -d-)
	endpart=$(echo $part | cut -f2 -d-)
	for file in $(seq -w $startpart $endpart) ; do
		echo cp 0${file}.png $part/
	done
	echo cd "$part" 
	echo ffmpeg -y -framerate 30 -pattern_type glob -i \'*.png\'  -c:v libx264 -pix_fmt yuv420p out.mp4
	echo cd $orgpwd
done

Run above script as ./script.sh > mybash.sh

This generates a bash file, check the contents and run using

“bash mybash.sh”

Last step : There are 10 movies in subdirs which should contain the best looping parts.
check these with: (use CTRL-Q in vlc to stop looping and go to the next file

ls */out.mp4 | while read movie ; do vlc -L $movie ; done

Example loop, made with above

Last week’s stuff

Last Updated or created 2024-02-06

Update: https://www.henriaanstoot.nl/2024/01/14/hlk-ld2410b-with-a-wemos-mini-d1-v4-connected-to-home-assistant-using-esphome/

Case for presence detector

Update: BBQ watch

Not posted in the past, new version using ESPHOME and a m5stickc

Previous version using a ESP12
A “watch” with core and environment temperature of my smoker with a alarm, and button for timers.

ESP32 dac’s drawing on oscilloscope ( no additional components)

ESP32 in front of scope, two clips for x and y

For above i used sin/cos functions 2:3, which creates Lissajous figures.
See: https://www.henriaanstoot.nl/1992/01/01/oscilloscope-graphics-using-a-amiga-bonus-vectrex/

3 battery operated buttons (no wires needed) to control my shelly dimmer at the dinner table.

left button on, middle steps per 20% and 3rd button off.
(This cheapass button only sends ON commands)

Node red code

[
    {
        "id": "8190a851.8d02b8",
        "type": "mqtt in",
        "z": "44d7a4fb.e41a5c",
        "name": "domoticz-out",
        "topic": "domoticz/out",
        "qos": "0",
        "broker": "8c74c5f6.9a7a48",
        "inputs": 0,
        "x": 190,
        "y": 600,
        "wires": [
            [
                "543a2fa3.af27c",
                "c70d463.da52ab8",
                "ffa2f6be.afe618"
            ]
        ]
    },
    {
        "id": "543a2fa3.af27c",
        "type": "function",
        "z": "44d7a4fb.e41a5c",
        "name": "Filter IDX + nvalue",
        "func": "var varPayload = JSON.parse(msg.payload);\nvar varidx = varPayload.idx;\nvar varnvalue = varPayload.nvalue;\nif(varidx == 2473)\n{\nmsg.payload = {};\nmsg.payload.turn = \"on\";\nmsg.payload.brightness = 50;\nreturn msg;\n}",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 410,
        "y": 600,
        "wires": [
            [
                "d7b0f308db912817"
            ]
        ]
    },
    {
        "id": "c70d463.da52ab8",
        "type": "function",
        "z": "44d7a4fb.e41a5c",
        "name": "Filter IDX + nvalue",
        "func": "var varPayload = JSON.parse(msg.payload);\nvar varidx = varPayload.idx;\nvar varnvalue = varPayload.nvalue;\nif(varidx == 2474)\n{\nmsg.payload = {};\nmsg.payload.turn = \"on\";\nvar count = context.get(\"counter\") || 0;\ncount = (count+1) % 6;\ncontext.set(\"counter\", count);\ncount = count * 20; \nmsg.payload.brightness = count;\nreturn msg;\n}",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 410,
        "y": 680,
        "wires": [
            [
                "d7b0f308db912817"
            ]
        ]
    },
    {
        "id": "ffa2f6be.afe618",
        "type": "function",
        "z": "44d7a4fb.e41a5c",
        "name": "Filter IDX + nvalue",
        "func": "var varPayload = JSON.parse(msg.payload);\nvar varidx = varPayload.idx;\nvar varnvalue = varPayload.nvalue;\nif(varidx == 2475)\n{\nmsg.payload = {};\nmsg.payload.turn = \"off\";\n//msg.payload.brightness = 0;\nreturn msg;\n}",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 410,
        "y": 760,
        "wires": [
            [
                "d7b0f308db912817"
            ]
        ]
    },
    {
        "id": "35f35737.b4f2c8",
        "type": "comment",
        "z": "44d7a4fb.e41a5c",
        "name": "Living Dinner Table Shelly 2024",
        "info": "",
        "x": 250,
        "y": 560,
        "wires": []
    },
    {
        "id": "b080c84e.2c3968",
        "type": "comment",
        "z": "44d7a4fb.e41a5c",
        "name": "butt1 on / (butt2 off)",
        "info": "",
        "x": 510,
        "y": 560,
        "wires": []
    },
    {
        "id": "ac892b87.1c7358",
        "type": "comment",
        "z": "44d7a4fb.e41a5c",
        "name": "butt3 toggle",
        "info": "",
        "x": 390,
        "y": 720,
        "wires": []
    },
    {
        "id": "b5bdbd65.c4e1c",
        "type": "comment",
        "z": "44d7a4fb.e41a5c",
        "name": "butt 2 step dimmer",
        "info": "",
        "x": 410,
        "y": 640,
        "wires": []
    },
    {
        "id": "d7b0f308db912817",
        "type": "mqtt out",
        "z": "44d7a4fb.e41a5c",
        "name": "",
        "topic": "shellies/shellydimmer-D0DF15/light/0/set",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "8c74c5f6.9a7a48",
        "x": 860,
        "y": 600,
        "wires": []
    },
    {
        "id": "8c74c5f6.9a7a48",
        "type": "mqtt-broker",
        "name": "MQTTSERVER",
        "broker": "MQTTSERVER",
        "port": "1883",
        "clientid": "",
        "usetls": false,
        "compatmode": true,
        "keepalive": "15",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "closeTopic": "",
        "closePayload": "",
        "willTopic": "",
        "willQos": "0",
        "willPayload": ""
    }
]

Vector graphics on my demo arduino nano.