Category Archives: Tech

Finished a display case for the SDK-85

So i made a nice display case for this SDK.

I made some designs and came up with this:

I just took a 12mm x 60mm piece of wood, and made a slit for the acrylic plastic using a circular saw, and removed a part for the back-plate using a wood router. I found a piece of acrylic in my shed, cut it to the right size using the circular saw. Slapped some paint on the wood.

I want to be able to use the sdk whenever i want, so i made a sliding window thingy. ( With wooden handle so the frame looks intact when closed. )

Then I 3D printed some holders, which I designed using Openscad.

Openscad code

difference(){
difference(){

    translate([0,8,1])
    cube([20,15,10],center=true);
union(){
    cylinder(h=9, d1=9, d2=9, center=true);
translate([0,0,3])
cylinder(h=9, d1=15, d2=15, center=true);
}
   
}
$fn=100;
 translate([0,12,0])
 cylinder(h=30, d1=3.5, d2=3.5, center=true);
}

I will probably add a powerconnector and lasercut a hole for the keypad at a later stage.

Last weeks useful schematics

While working on my game, i had to come up with some solutions i could not find an answer for on the internet.

I’m not going to post every little detail of my game on this blog, my main reason is sharing my experiences and solutions.

16 SWITCHES

16 Switches on a Wemos Arduino. While push buttons are easier to connect, I needed ON/OFF switches.
Push buttons are easy, there is only one active, so 4 enable lines and 4 scan lines and you’re golden.
16 Switches can be enabled all at the same time.
So you need some extra components to get a good result (0-65535)

Above schematic works, you need 4x 1k Pull-up resistors and 16 diodes. I used 1N4007

CONTROLLING 24V using Arduino and a buck convertor

Next problem, i’m using some elevator buttons for a project. These have build-in leds but run at 24V.
I only have 5V from the Arduino.
Regular leds you can connect directly to the Arduino using a 220ohm resistor.
So i used a Buck-Step-Up-Convertor. This little module converts 5V to 24V. (You can control the output voltage using a variable resistor)
To control the lamp/leds i used a PN2222a transistor to switch the lights on/off using a pin of the Arduino.

MT3608 Convertor
  • Input voltage: 2V-24V DC
  • Output voltage: 5V-28V DC
  • Output current: 2A (max), 1A (recommended), <100mA (input <4.0V), <50mA (input <3.5V)

Mini DF MP3 player with MQTT control

Resistor is 1K, speaker is 4 ohm

I’ve got the DFPlayer with the GD3200B instead of the better YX5200, but it works.

As part of my game, so MQTT controlled.

First sound is low in volume.

Code

I’m using Soft Serial

// based on code from: 
// https://github.com/Makuna/DFMiniMp3/blob/master/examples/PlayMp3/PlayMp3.ino
// above example has no wifi/mqtt and is missing the SoftSerial include line
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include <WiFiClient.h>
#include <DFMiniMp3.h>
#include "SoftwareSerial.h"
#include <Ethernet.h>

#define wifi_ssid "SSID"
#define wifi_password "SSIDPASS"
#define mqtt_server "MQTTSERVER"
#define mqtt_port 1883

WiFiClient espClient;
EthernetClient ethClient;
PubSubClient mqtt(espClient);

class Mp3Notify; 

SoftwareSerial secondarySerial(D6, D5); // RX, TX
typedef DFMiniMp3<SoftwareSerial, Mp3Notify> DfMp3;
DfMp3 dfmp3(secondarySerial);

class Mp3Notify
{
public:
  static void PrintlnSourceAction(DfMp3_PlaySources source, const char* action)
  {
    if (source & DfMp3_PlaySources_Sd) 
    {
        Serial.print("SD Card, ");
    }
    if (source & DfMp3_PlaySources_Usb) 
    {
        Serial.print("USB Disk, ");
    }
    if (source & DfMp3_PlaySources_Flash) 
    {
        Serial.print("Flash, ");
    }
    Serial.println(action);
  }
  static void OnError([[maybe_unused]] DfMp3& mp3, uint16_t errorCode)
  {
    // see DfMp3_Error for code meaning
    Serial.println();
    Serial.print("Com Error ");
    Serial.println(errorCode);
  }
  static void OnPlayFinished([[maybe_unused]] DfMp3& mp3, [[maybe_unused]] DfMp3_PlaySources source, uint16_t track)
  {
    Serial.print("Play finished for #");
    Serial.println(track);  

    // start next track
    track += 1;
    // this example will just start back over with 1 after track 3
    if (track > 3) 
    {
      track = 1;
    }
    dfmp3.playMp3FolderTrack(track);  // sd:/mp3/0001.mp3, sd:/mp3/0002.mp3, sd:/mp3/0003.mp3
  }
  static void OnPlaySourceOnline([[maybe_unused]] DfMp3& mp3, DfMp3_PlaySources source)
  {
    PrintlnSourceAction(source, "online");
  }
  static void OnPlaySourceInserted([[maybe_unused]] DfMp3& mp3, DfMp3_PlaySources source)
  {
    PrintlnSourceAction(source, "inserted");
  }
  static void OnPlaySourceRemoved([[maybe_unused]] DfMp3& mp3, DfMp3_PlaySources source)
  {
    PrintlnSourceAction(source, "removed");
  }
};

void setup_wifi() {
  delay(10);
  WiFi.mode(WIFI_STA);
  WiFi.begin(wifi_ssid, wifi_password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
  }
}

void setup() 
{
  setup_wifi();
  mqtt.setServer(mqtt_server, mqtt_port);
  mqtt.setCallback(callback);
  Serial.begin(115200);
  Serial.println("initializing...");

  WiFiClient espClient;
  PubSubClient mqtt(espClient);

  mqtt.setClient(espClient);
  mqtt.setServer(mqtt_server, 1883);
    
  mqtt.setCallback(callback);
  mqtt.subscribe("escape/soundin");
  
  dfmp3.begin();

  uint16_t volume = dfmp3.getVolume();
  Serial.print("volume ");
  Serial.println(volume);
  dfmp3.setVolume(24);
  
  uint16_t count = dfmp3.getTotalTrackCount(DfMp3_PlaySource_Sd);
  Serial.print("files ");
  Serial.println(count);
  
  Serial.println("starting...");

  // start the first track playing
  // dfmp3.playMp3FolderTrack(1);  // sd:/mp3/0001.mp3
}

void reconnect() {
  // Loop until we're reconnected
  while (!mqtt.connected()) {
    // Create a random client ID
    String clientId = "ESP8266Client-";
    clientId += String(random(0xffff), HEX);
    // Attempt to connect
    if (mqtt.connect(clientId.c_str())) {
      // Once connected, publish an announcement...
      mqtt.publish("escape", "sound connected");
      // ... and resubscribe
      mqtt.subscribe("escape/soundin");
    } else {
      // Wait 5 seconds before retrying
      delay(5000);
    }
  }
}


void callback(char* topic, byte* payload, unsigned int length) {
    //  digitalWrite(led, HIGH);

    String topicStr = topic;
      byte value = atoi((char*)payload);
dfmp3.playMp3FolderTrack(value);  // sd:/mp3/0001.mp3
  Serial.println(value);
}

void waitMilliseconds(uint16_t msWait)
{
  uint32_t start = millis();

  while ((millis() - start) < msWait)
  {
    dfmp3.loop(); 
    delay(1);
  }
}

void loop() 
{
  
  if (!mqtt.connected()) {
    reconnect();
  }
    mqtt.loop();
  waitMilliseconds(100);
}

Shelly Devices

I love shellies, easy to implement and hacker friendly.

MQTT out of the box.
Curl in and out – you can switch it on/off using curl, but it can send a http command also.
I’ve used this with Domoticz and Home Assistant.
It has a webinterface, with timers, and there is also a client for Android/Iphone
You’ve got some own gpio pins to your disposal and the unit is flash-able!

curl -X POST https://shellydevice/device/relay/control -d "channel=IDHERE&turn=on&id=ID&auth_key=AUTH"

The device is not isolated from the mains. To flash it, the mains must be disconnected.

SHELLY 1

I use this for simple on/off switches around the house.
Using it with a physical switch and MQTT (Nodered)

SHELLY 2 PM

Same as above but this one has a build in power meter

SHELLY DIMMER

Generic dimmer

Dimmer with low voltage rotary encoder!
https://www.instructables.com/Shelly-Dimmer-Wall-Switch-With-Rotary-Knob-and-Hom/

SHELLY RGBW2

A RGBW / 4 Channel controller
You can connect RGB strips, but also dimmable white strips in 4 channels. 12V or 24V.
NOTE! : There is a common 12V connection, and GND will be controlled!

SHELLY PLUG S

I love these small wall plugs, i’ve used these also to find power consuming devices around the house.

For example, i made a nodered flow, to see if the washing machines are running or not.

SHELLY BUTTON

This became my all purpose alarm thinghy

SHELLY DOORSENSOR

A door sensor WITH temperature and light sensor build in!

Home Assistant example

SHELLY WATER SENSOR

This one lays below our washing machine

SHELLY SMOKE ALARM

(Preordered)

SHELLY PM4

A four channel power measure/switch for your fuse box


GENERIC SHELLY STUFF
A smart doorbell schematic i found

https://www.thingiverse.com/thing:5756154
Very nice .. printable cases for your shellies!

At last .. my own lasercutter

I did a lot of lasercutting at Fablab Utrecht, but they stopped a few years ago, and I moved to Hilversum.

I loved making this at this Fablab.

  • Lasercutting : Boxes, A cryptex of my own design, Xmas ornaments, Shogi game, things in acrylic, Rubber stamps
  • Cutting plotter ( Nae Bother Case logo’s )
  • CNC Machines
  • Vacuum form

Then i bought a mini engraver, which you can attach to your 3D printer.

But I really wanted a cutter, so there it is … the Sculptfun S9

First test. crafting paper. No burning and a really high resolution!

This laser module has a new optical design, so it can cut wood as thick as 10+ mm.
It can engrave metal, cut non-transparant acrylic, leather and more.

Software:

I’m using Inkscape, with the lasercutter tool plugin from Jtech.
https://jtechphotonics.com/

I’ve also tested with LaserGRBL, which can be run under linux using Wine.

I’m trail testing LightBurn. (Native Linux App)

I will post my findings and test on this post.

UPDATE: 20230221

A stone slate engraved
Speed3000 mm/s
Laser Power100%
Lines per mm10

UPDATE: 20230306

Calibrate your machine! .. But NOT as found on YouTube using a 10x10mm or 1 inch by 1 inch. square.
As big as you can. This is far more precise!

My list of settings (Work in progress)

I have to check mm/s versus mm/minute!

MaterialSpeedPowerLines/mmPasses
Slate (engrave)
(using lasergrbl)
3000 mm/s100%101
3mm Plywood (cut)20 mm/s90%x8?
Craftpaper1500mm/s70%x1
Cardboard10 mm/s100%x4
Leather
Cork (6mm)

Connect the wires puzzle

As part of my internet based escape room.

I took the idea from the Keep-talking-and-nobody-explodes game.

When starting up, is gets the configuration from a Mqtt Topic.
So i can create a different setup over the internet.

The result is also send back via MQTT.

(example play, all players are on different locations)

  • Player 1 figures out the wires.
  • Player 2 connects the wires.
  • Player 3 sees the result (correct or not) and next puzzle opens up for Player 3

I used a wire with a line. Multiple colors for jacks and sockets.
It’s also possible to connect a jack to a jack.
Loads of possibilities.

Todo:

Wifi and Mqtt part
Debounce software or hardware

Prints from China

A few weeks ago i designed a print using Kicad.

Today they have arrived!

Now I have to wait a little more .. A 74HTC166 and a straightup RCA connector.

I the past, a long time ago i made my own single side pcb’s using acids.
A messy job, often gone wrong.

Old skool example https://www.youtube.com/watch?v=_PwCp3A3RSk

Or https://www.circuitsonline.net/artikelen/view/1/print

Not much new

Last days .. welllll doing al kinds of stuff.

Composite video print designed and ordered from china.

Changed some vlans in my network.
I need to think of a way to extract/migrate domoticz 433 info into a new instance.
For example .. i’ve got some instances in my device list which are only being controlled by domoticz, there is no remote i can reuse.

Tried welding again, because i could not do it for a long time, i noticed i have to practice again after 2 years.
(I’ve got a dedicated power outlet outside now .. 🙂

Last 8mm films work done. (Converted all of my dad’s old 8mm reels)

Designed a hidden remote cabinet, holding remotes out of sight for the occasions when automation doesn’t work.

Designed also a wooden wall with hidden cabinets in our bedroom.

Repaired a Gardena Leafblower .. again!

Android tips

Using hotspot?
Want to see which devices are connected?
https://www.henriaanstoot.nl/2022/09/16/android-and-devices-in-your-neighbourhood/

Another JuiceSSH tip .. connection type mosh, will open a ssh session using udp to your server.
( If you got mosh installed on your server )
A disconnect or bad connections will not break your ssh session, it just resumes.
Even when you are changing from network, and have a different IP.

Your android as Webcam (in OBS)

Install scrcpy on your linux machine, and opencamera on your android.
If you got adb installed plug in your android and start scrcpy.
You should be seening your android screen on your linux workstation.
When you openup the stock version of your camera you get a overlay of the gui, which you probably can’t disable/remove. There where’s opencamera comes in.
https://play.google.com/store/apps/details?id=net.sourceforge.opencamera

Settings > On screen GUI > Immersive Mode and select Hide everything
You probably want to set the aspect ratio to 19.5:9 so the whole screen will be used.

There is a lot more you can do with scrcpy !
https://github.com/Genymobile/scrcpy
https://www.henriaanstoot.nl/2022/02/02/android-oculus-quest-screen-record/