Tag Archives: hardware

Last week’s stuff

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.

New part demo (st7789 with micropython)

(And some WIP)

A little starfield demo

followup on : https://www.henriaanstoot.nl/2024/01/26/raspberry-pico-with-st7789v2-display-3d-control/

Some other stuff

See links below

The smoking monitoring thingy is a new version of my (never posted) BBQ watch.

A “new” sound chip for 6502

UPDATE: 20240225

I’ve written about General Instrument AY-3-8910 before, here is some work I did today.

This sound chip i wanted to implement in my amiga, and now it’s a alternative for my 6502 computer. ( As an alternative setup for the SID chip. )
Btw this is the same kind of chip used in the Atari ST.

A clean setup … I’ve got the sound chip and a Amplifier chip.

Above a Kicad drawing I made today, a little different from my design from the 90’s.

Below a movie clip I recorded today. Running a test setup using an Arduino nano and a sdcard reader.
The sound is bad, this is due to clipping and the absence of multiple resistors and capacitors.
Music is a register dump from a YM music file.
Amplifier is a bare LM386.

UPDATE: 20240225

I don’t like tying those three outputs together, and amplifying those.

So I’m going to use a LM324 i’ve got left from my 8085 interface, and make a 3-channel amplifier.

Something like this

Soldering a 6502 PCB

A while ago I started a soldering a 6502 bare SBC.

Note pin 1 is not connected, VPB (vector pull is not supported on this PCB. But i’m planning to design a new one anyway.)

I got it running now.

It has an EPROM with Wozmon and Basic for now.
I have to redo the address decoder, but I like the simple serial interface by Geoffrey. (I hate the PIC18F15Q41, made by Microchip, but still the best minimal option .. for now)

Probably the last time i’ve used a pic was in 1998

Went to HCC Retro Meeting. (SDK-85 Update)

UPDATE 20240104

I’ve met Dirk, he brought his SDK85.
And demo-ed a working cassette interface, using audio cables and a second laptop.

Saw a presentation about the MC14500B a weird little chip, robots, retro rebuilds using Raspberries.

Update 20240104 some soldering

Meanwhile .. my old MicroTapes are not using the Intel AP-29 method for data, so that needs some work also.

SDK-85 interface PCB soldered

Using spacers, I can use the existing holes in the SDK to hold the interface PCB in place. Now I have to move my information sheet. šŸ™‚

My scope didn’t save the test capture .. Next time.
But I could see the clear ones and zeros.

You can faintly see the data, stop start of a program is visible.

Dirk cleaned up a OCR version of the program, which I cleaned up some more, and found some errors.
So that should be okay now.

Micropython Pico W Internal Led Test

  • Download firmware from here (uf2 file)
    https://micropython.org/download/RPI_PICO_W/
    (Make sure you use W version if you have a pico-w)
  • Press bootsel and plug your pico into an usb port.
  • A folder should be accessible
  • cp RPI_PICO_W-20231005-v1.21.0.uf2 /media/$USER/RPI-RP2/
    (pico reboots and installs firmware)

Install and start Thonny.

Tools > Options > Interpreter

Python test code (1 second blink)
Note: for the normal pico without Wi-Fi, it is GP25 instead of LED.

from machine import Pin
import utime

led_onboard = Pin('LED', Pin.OUT)
while True:
        led_onboard.on()
        utime.sleep(1)
        led_onboard.off()
        utime.sleep(1)

Run at boottime?

File > save as:
Select device and name the python script main.py

Arduino with Huskylens detecting learned face

Arduino Uno with Husky Lens using I2C

The HuskyLens is an easy-to-use AI machine vision sensor. It is equipped with multiple functions such as:

  • Face recognition
  • Object tracking
  • Object recognition
  • Line trace
  • Color recognition
  • Tag recognition (QR code).

Via the UART / I2C port you can among others: boards connect:

  • Arduino
  • micro:bit
  • Raspberry Pi

Steps to take: Press Face detection, when a cross in a square is displayed, press the button on your HuskyLens

Set your husky protocol to I2C in the settings.

Minimal Code needed

/***************************************************
 HUSKYLENS An Easy-to-use AI Machine Vision Sensor
 <https://www.dfrobot.com/product-1922.html> 
****************************************************/

#include "HUSKYLENS.h"

HUSKYLENS huskylens;
//HUSKYLENS green line >> SDA; blue line >> SCL
int ID0 = 0; //not learned results. Grey result on HUSKYLENS screen
int ID1 = 1; //first learned results. colored result on HUSKYLENS screen
int ID2 = 2; //second learned results. colored result on HUSKYLENS screen
// and so on.....

int arjprevious = 0;
void printResult(HUSKYLENSResult result);
void setup() {
    Serial.begin(115200);
    Wire.begin();
    while (!huskylens.begin(Wire))
    {
        Serial.println(F("Begin failed!"));
        Serial.println(F("1.Please recheck the \"Protocol Type\" in HUSKYLENS (General Settings>>Protocol Type>>I2C)"));
        Serial.println(F("2.Please recheck the connection."));
        delay(100);
    }
    
     huskylens.writeAlgorithm(ALGORITHM_FACE_RECOGNITION);
}

void loop() {
   if (huskylens.requestLearned())          //request blocks and arrows tangged ID != 0 from HUSKYLENS
   if (huskylens.requestBlocksLearned())    //request blocks tangged ID != ID0 from HUSKYLENS

    {
        for (int i = 0; i < huskylens.countArrows(ID0); i++)
        {
            HUSKYLENSResult result = huskylens.getArrow(ID0, i);  
        }
        int arj = huskylens.count(ID1);
        if ( arj != arjprevious )
        {
        if ( arj == 1 )
            {
            Serial.println("Learned face detected");
            }
            else
            {
            Serial.println("Learned face not detected");
            }
            arjprevious = arj;
        }
    }
    else
    {
        Serial.println("Fail to request objects from Huskylens!");
    }
}
Learned face detected ID1
Learned face not detected
Learned face detected ID1
Learned face not detected
Learned face detected ID1
Learned face not detected

Raspberry PI and Arduino black hole

This is NOT a post about the pi-hole project. Of which I apparantly never posted my setup.

I needed an extra PI for a project, and I always try to keep one spare.
But they are always gone, in use, missing .. whatever.

So I canĀ“t work on this project right now, so lets rant about disappearing stuff

Like they are being sucked up in another dimension .. gone. WHERE ARE THEY?!?

How to keep track of them?

Any suggestions?


I used to have a sheet, but I often forget to keep track.
Do I use a MAC address scan on my switches?
First 3 parts of the Mac address are vendor specific.

So far i’ve found : Octopi, Beerbrew computer, Retro Arcade, Picore, Nodered, Domoticz 433toMqtt, Ledserver, Lasercutter-etch-a-sketch, mobile LMS music server, Pressure Lab AP, Escape Game AP (3 of them), one unused Raspberry zero (without Wifi), One at my old work, one broke, Kodi+Netflix,Ansible project, found another one .. Jumanji/Dashticz/NoderedDashboard demo (with screen)
WHERE THE F are the rest of them?
(Sdcards with temporary projects on them 29, I need to combine project on those cards. I’ve got a 64Gb card holding a Rpi OS and only a 1K python script!)

And Arduino’s are even worse … they are all over the place.
Those are probably 100+
(ESP32, 8266, Nano’s, Mega, M5Stack and alikes)

I know i have many temporary projects, but I keep most things organized in my projects containers.

One of the rows with Ikea containers, a few for bigger projects and now i’m using the plastic boxes you get when you order chinese or thai.

OpenPLC editor with Raspberry and Arduino

Here I’m going to post my tests with OpenPLC.

UPDATE 20231012 202301015

It’s a long time i’ve made a PLC ladder, but lets see how and what this integration brings me.

OpenPLC interface on a Raspberry, I could not start a program on RPI 5!
But it compiled correctly. See below rpi3
Schematic with a led and two buttons (and one floating in the middel, which i forgot to remove)
Working example ( wemos and display are from another project those are not connected )

UPDATE 20231015 – Raspberry 3 with OpenPLC

GND to leds and buttons
GPIO2 (pin 3) to a button
GPIO3 (pin 5) to another button
GPIO14 (pin 8) to the led

Now OpenPLC works correct (RPI3)

https://github.com/thiagoralves/OpenPLC_v3.git
cd OpenPLC_v3
./install.sh rpi 

## Warning .. takes a really long time

Wiringpi is deprecated
But can be installed using the last git repo

git clone https://github.com/WiringPi/WiringPi.git
cd WiringPi
./build