All posts by fash

Arduino Tiny Machine Learning Kit

A while ago I bought a little machine learning kit.

I’ve been reading at listening to ML podcasts and websites.

One on Spotify I liked was:

Also, the following Coursera was interesting
https://www.coursera.org/learn/machine-learning

I’ve been testing using Python on my Laptop.
(see other posts)

And a camera with esp32 using face detection.

See here multiple posts about these experiments.

https://www.henriaanstoot.nl/tag/machinelearning/

Today the first experiments using this kit.

  • Arduino Nano 33 BLE Sense board
  • OV7675 Camera
  • Arduino Tiny Machine Learning Shield
  • USB A to Micro USB Cable
  • 9 axis inertial sensor: what makes this board ideal for wearable devices
  • humidity, and temperature sensor: to get highly accurate measurements of the environmental conditions
  • barometric sensor: you could make a simple weather station
  • microphone: to capture and analyse sound in real time
  • gesture, proximity, light color and light intensity sensor : estimate the room’s luminosity, but also whether someone is moving close to the board
  • Microcontroller nRF52840
  • Operating Voltage 3.3V
  • Input Voltage (limit) 21V
  • DC Current per I/O Pin 15 mA
  • Clock Speed 64MHz
  • CPU Flash Memory 1MB (nRF52840)
  • SRAM 256KB (nRF52840)
  • EEPROM none
  • Digital Input / Output Pins 14
  • PWM Pins all digital pins
  • UART 1
  • SPI 1
  • I2C 1
  • Analog Input Pins 8 (ADC 12 bit 200 ksamples)
  • Analog Output Pins Only through PWM (no DAC)
  • External Interrupts all digital pins
  • LED_BUILTIN 13
  • USB Native in the nRF52840 Processor
  • IMU LSM9DS1 (datasheet)
Gesture test ( yes on a windows surface tablet, but Vincent and I installed linux on it!)

I just started and will update this page, with other experiments.

Note: displaying Arduino output without installing the IDE

stty -F /dev/ttyACM0 raw 9600
cat /dev/ttyACM0
................................
................................
................................
................................
................................
................................
................................
................................
................................
................####............
...............##..#............
..............##...##...........
..............#.....#...........
..............###...#...........
..............##.....#..........
..............##.....#..........
...............#....##..........
...............######...........
................................
................................
................................
................................

Multipurpose RGB sensor (ESPHome)

A few years ago, I made a little light metering sensor using a light resistor and a NodeMCU (using analog read).
This would measure if a Led was turned on from my Alarm system. (I had no other way to read this state.
(I also had it connected to our washing machine for a while, to read the state.)

Now I wanted to read the state of the TV set-top box.
This Arcadyan hmb2260 has a green/led state LED, so measuring light is not enough.
(I can only toggle the device from Home Assistant, so there is no way to know the current state!)
Toggling on/off and portscanning the device gave me not another way to get the state (no extra open ports/web state pages) than using an RGB Sensor.

Flashing this with ESP Home and integrating it in HA was a breeze.

I wanted to turn the Illuminance LED also off, because the Set-top box already emits light.

Now I’m going to 3D print a holder which can be used to press the button manually when needed.

The yellow part needs to be 3D printed.
Output of the sensor

ESPHome Code

esphome:
  name: rgbsensor
  friendly_name: RgbSensor

esp8266:
  board: d1_mini

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx="

ota:
  password: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Rgbsensor Fallback Hotspot"
    password: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

captive_portal:

i2c:
  sda: 4
  scl: 5

sensor:
  - platform: tcs34725
    red_channel:
      name: "TCS34725 Red Channel"
    green_channel:
      name: "TCS34725 Green Channel"
    blue_channel:
      name: "TCS34725 Blue Channel"
    clear_channel:
      name: "TCS34725 Clear Channel"
    illuminance:
      name: "TCS34725 Illuminance"
    color_temperature:
      name: "TCS34725 Color Temperature"
    glass_attenuation_factor: 1.0
    address: 0x29
    update_interval: 5s

light:
  - platform: binary
    name: "RgbSensorVerlichting"
    output: light_output

output:
  - id: light_output
    platform: gpio
    pin: 2

Automation in HA:

If Red Channel > 60% then device is OFF.

Other ideas:

Measure the dishwasher machine LED.

Using color cards to (program) the wleds I’m using.


LCD matrix idea’s

In previous post I was talking about an esp32 with display for demo’s.
But my friend Erik mentioned a cheap LCD matrix from Ali.

What about creating something cool with that!

My Maze project would look amazing on this!
I can draw walls now!

Or I could make a cool audio visualiser, like the posted WLED version

Ehh .. not posted (well I can’t post everything)

What about a game of life display?
Using a web interface for inputting the start situation of the cells

Conway’s Game of Life is a cellular automaton. It consists of a grid of cells, each of which can be alive or dead. The state of each cell evolves based on simple rules: any live cell with fewer than two live neighbours dies (underpopulation), any live cell with two or three live neighbours survives, and any live cell with more than three live neighbours dies (overpopulation). Additionally, any dead cell with exactly three live neighbours becomes alive (reproduction). This simple set of rules can lead to complex patterns and behaviours.

But back to the demo …

What about a 6502 with 64×64 pixel display!

What would be needed?

  • 6502, with rom and ram
  • Some IO chip, don’t know which one yet
  • The 64×64 pixel matrix
  • A sound solution (simple chip tune player)
  • 3D printed enclosure

Using some libraries and a framework setup, maybe there is a way to make a cool and cheap demo machine

Do you have any suggestions ideas?
Comment or email me!

Uilleann Pipe recordings

Best Uilleann recordings I own or listen to.

Do you know any other good recordings? Let me know.

Uilleann CDs (no order)

  • Liam O’Flynn – The Pipers Call
  • Davy Spillane – Atlantic Bridge, Pipedreams, Out of the Air
  • Paddy Keenan – The Long Grazing Acre
  • Sean McKeon – The Dusty Miller ( Multiple players playing harmony)

Calum Stewart (I know him from his Flute playing)
I play “Am Monadh Ruadh” from this CD, also Randolph’s Leap is awesome.
Look up “Randolph’s Leap”. I’ve been there, beautiful.
(A better name should be Cummings Leap)

Brian McNamara

He plays a ‘flat’ set pitched in ‘C’ made by Geoff Wooff in 1997 and a ‘concert-pitched’ set of pipes made by Peter Maguire, I was lucky enough to have him as my teacher in Drumshanbo.

Single tracks I like

High energy playing of Blackie O’Connoll. He was my tutor when I attended Tionol 2011

Fred Morrison‘s Kansas City Hornpipe

Paddy Keenan – Harvest Home & Boys of blue hill
(Check The Pipering Of Willie Clancy Vol II)

Doinna by John McSherry (I play this one also, but it is nothing compared to his pipe-sound, melodic virtuosity and feeling he puts in this relatively easy piece of music)

Another often played CD with Uileann, Borderpipes and Low Whistles is:

Partners in Crime by Jarlath Henderson and Ross Ainslie.
A very nice combination of two different pipes together.
Coline and I try to have at least one set with both instruments.

Some others:

  • Some tracks of Bad Shepherds
  • Some tracks of Afro Celt Sound System
  • Some tracks of Enya (See Sun in the stream post)

List of Artist i’ve got recordings from:

Cillian Vallely, Finbar Furey, Ronan Browne, Willie Clancy, Seamus Ennis, Johnny Doran, Leo Rowsome, Liam O’Flynn,Davy Spillane, Paddy Keenan, Finbar Furey, Brian McNamara, Paddy Moloney, Jerry O’Sullivan, Gay Conor, Sean McKeon, Declan Masterson, Michael McGoldrick I probably missed several

Female pipers

In the middle of recording Mhairi Bhan Og

Also known as Mary Young and Fair – this Gaelic air was published in Capt Simon Fraser’s “Knockie” Collection of 1816.

I made an arrangement using Musescore, Ardour and Bagpipe Music Writer.

Hardware used: Tascam 2488, Behringer B-1 studio microphone, Yamaha QY-100 sequencer, ESI MidiMate eX USB 2.0 MIDI-interface and Shepherd Smallpipes.

Musescore
Ardour remixing, using QY-100 via midi and Sound Fonts

(I tried Qtractor and some other tools but liked Ardour more)

Recording online soon, I have to re-record the harmony part.
Maybe I’m going to add a Flute part also.

PDF

Tuner hack and an oldskool discman story

Using the Korg CA-20

My old trusty Tuner that is really really old.

On the side you see the bagpipe tuning.
In the past, I replaced one of the LEDs. But now it didn’t turn on any more.

So I took it apart, and what did I miss when replacing the LED?
This tuner has more functionality hidden.

This is more often the case with devices, because it keeps the costs down. Make one print and use in many.
(See the diskman story below)

A working tuner!

When looking at the cover plate, you see only 4 buttons. But there are six!
Then I noticed some solder pads with the lettering Buzz.
So button 5 and 6 are for a metronome!
You see the little piezo buzzer I got from my component’s drawer.

A similar hack was the Diskman player in the 90s.

It was something like the model below.

There was only play/pause stop and skip whole track or back whole track.

When opening, I figured out which chips were doing what.
Saw that some signals were not connected to the control panel.
These were : Fast forward, and reverse. And skip 30 seconds.

So I glued some buttons on the side and presto.

A few years later, I took it apart and connected a DB-9 connector to it.

Now I could control the playing using my Amiga!

Some drawings I found

Will post chip info, and more when found.

Server scripts notification for Home Assistant

I’m running loads of housekeeping scripts on my servers.

I thought it would be cool to see states in HA.

Steps:

  • Log into your HA instance, and press your profile icon in the bottom left.
    Scroll to Long-lived access tokens, and create a new token.
    (Save the token string in a text file, you need it later)
  • Goto Settings > Devices & services > Helpers
    Create helper: Text and give it a name (bashnotification)
  • Next create a script in a path on your server, or place in an existing script directly.
    (Change SAVEDTOKENSTRING,HA-IP and bashnotification)
curl -s -X POST -H "Authorization: Bearer SAVEDTOKENSTRING" -H "Content-Type: application/json" -d "{\"state\": \"$1\"}" http://HA-IP:8123/api/states/input_text.bashnotification >/dev/null

I use it like this in a script

#!/bin/bash
bashnotify "Starting this script"

bash commands bash commands 
bash commands 
bash commands bash commands bash commands 
bash commands bash commands 

bashnotify "Bash command finished"

Running an adhoc command

tar czvf /tmp/test.tgz /var/www/html ; bashnotify "tarball made of www"

Album player using old CD Cover site.

In the past, I made an overview of CDs I own, and which CDs I was missing from my top artists.

Today I wanted to have a little test using above code and some additional script to get a little website which enables me to quick start playing an album using LMS.

Exporting the album database in Linux:

sqlite3 /var/lib/squeezeboxserver/cache/library.db ".dump albums" > /mnt/www/albums-test.dump

grep -i culture /mnt/private/albums
INSERT INTO "albums" VALUES(16872,'Bothy Culture','BOTHY CULTURE','BOTHY CULTURE',NULL,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,18957,NULL);

So, 16872 is the needed album ID.

To start playing this (adhoc), I used the below command.

curl "http://IP-OF-MY-LMS-SERVER:9000/anyurl?p0=playlistcontrol&p1=album_id:16872&p2=cmd:load&player=12:23:34:45:56:67"

Player=12:23:34:45:56:67 is the mac address from a squeezebox player.

I wrote some additional PHP code in my original CD Cover site, and got this working.

I think I will rewrite the code using python to get a more flexible generator.

Left the LMS player, right the cover website. (Clicking 3 covers to change albums)

Wifi tricks (public and limited networks)

(use your own discretion/risk)

When connecting to public Wi-Fi, watch what you are doing, it can be dangerous.
(Use a VPN whenever you can, like OpenVPN or Zerotier.)

But it also can be fun to have a look on those networks.

Sometimes there are IP camera’s you can find.
Use an App like Android TinyCam to scan for camera’s

I found at least 5 this way. Getting access, is something else.
One had access to RTSP without password. 🙂
But I found IP camera’s in the wild using a default password also.
(Just google for default passwords. Don’t know the brand of the device? Sometimes you can use the OUI (Organizationally Unique Identifier) part of the Mac Address to find the brand)

Other fun things to scan for are devices you can cast to!

At one time I was in Woerden, getting my Car fixed.
I started working on my Laptop using their guest Wi-Fi.
And checking out the network, I saw some TVs with Casting enabled.
Let’s Cast a Youtube video with a fireplace to it.
Next moment, the display behind the desks started playing the video.
The guys behind the desk were not facing the display.

I tried to revert my test, but I could not found/start the original cast stream.
I told them to get this fixed, and the network security.

Another idea is to scan for hidden camera’s in Hotels or B&Bs.
(There are more tricks to find these, like Flir/IR)

Some Hotels or B&B have a paid Wifi or a one device only policy.

Some tricks for that are:

Using a device which acts as an Access Point/Router.

I started using this trick with a Ravpower (RP-WD01)

I used this device to copy my Nikon photos to an external storage device.

I patched the OS on this Linux device.
Now it autocopied files from sdcard to usb-drive when inserted.

But it also could act as an AccessPoint.
Laptops/tablets and phones can connect using this hotspot.

After that I used a WD device in the same way.

After that I made a mini AP using a Raspberry PI.

When connecting with the first device which was a phone, I wanted to switch to an accesspoint.
So I spoofed the MAC address of the my AP, because it was mac-address locked in the B&B’s main access point.

Now it’s even easier, current mobile phone’s have dual Wi-Fi interfaces.
Connecting to an AP and at the same time setting up a hotspot is a breeze.
(Not that this is needed any more, Wi-Fi is not limited to one device any more. And mobile internet is almost everywhere)

Some access points still require payment, or you don’t know the password.

Some tricks below (use wisely):

Access point with a captive portal:
These are not protected initially.
But you have to enter a username/password to gain access to the internet.

  1. Try to start a VPN client (without logging into the captive portal)
    Sometimes those ports are not blocked.
    (Even more change to use UDP instead of TCP, try zerotier)
  2. Sometimes only DNS works though those AP’s.
    Then you could use a DNS tunnel. This is a method to embed your network traffic in DNS packages. (Note: you have to make your own DNS tunnel server!) https://github.com/yarrick/iodine
  3. Copy the Captive Portal website, write some logging code. And start AP using the same SSID you want the credentials for.
    Get close to someone using the real AP, so they try to log into your fake AP, using their credentials.
    (This is also illegal, and I won’t post code to do this.)