Mycroft / PiCroft is an open source voice assistant.

Hardware required

  • Raspberry Pi
  • Display (in my case 5″Display)
  • JBL GO Bluetooth Speaker
  • Keyboard for setup

PiCroft first setup

PiCroft Setup

Connect JBL Go Bluetooth speaker

Install Pulseaudio-module-bluetooth

sudo apt-get install pulseaudio-module-bluetooth

Setup for setting bluetooth connection every startup at: /sudo nano /etc/rc.local

# Connect Bluetooth Speaker JBL Go
printf "### Connect Bluetooth Speaker ###"
echo "power on \nagent on \ndefault-agent \nconnect XX:XX:XX:XX:XX:XX \nquit" | bluetoothctl

This file needs to be edited at to get audio output: sudo nano /etc/mycroft/mycroft.conf

{
  "play_wav_cmdline": "aplay %1",
  "play_mp3_cmdline": "mpg123 %1",
  [...]
}

Short description

SodaStream Oled Display

Everyone who owns a SodaStream has probably asked themselves how full my CO2 cylinder is. In most cases the cylinder is empty once you have been shopping. Most SodaStream users have a second cylinder, but it still sparked my creativity to come up with a simple solution.

The small software program is currently used to determine the number of impacts pressed and shown on the display (line 2). In line 3 is the added time of the duration / length of the pushed pushes. These values can be used to roughly estimate how much Co2 is still in the cylinder. What is shown graphically in line 4 by means of a progress indicator.

Hardware required

  • Wemos D1 mini (ESP8266)
  • Limit switch Ender 3 Pro
  • OLED Display I2C 0,96 Zoll
  • Cable / single wires
  • 3D Printer + Filament
  • Soldering iron with equipment

Software required

  • Arduino IDE
  • Tinkercad
  • Ultimaker Cura / Prusa Slicer

3D Printer settings

Ender 3 Pro

Print Settings

3D Printer Tinkercad STL File

Tinkercad SodaStream

Arduino IDE Software Code

I have to adapt to publish (currently code excerpt).

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <ESP8266WiFi.h>

#define SCREEN_WIDTH 128 // display width, (pixels)
#define SCREEN_HEIGHT 64 // display height, (pixels)

// I2C connected display SSD1306 
#define OLED_RESET     0 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

#define NUMFLAKES     10 // Number of snowflakes in the animation example

#define LOGO_HEIGHT   16
#define LOGO_WIDTH    16
static const unsigned char PROGMEM logo_bmp[] =
{ B00000000, B11000000,
  B00000001, B11000000,
  B00000001, B11000000,
  B00000011, B11100000,
  B11110011, B11100000,
  B11111110, B11111000,
  B01111110, B11111111,
  B00110011, B10011111,
  B00011111, B11111100,
  B00001101, B01110000,
  B00011011, B10100000,
  B00111111, B11100000,
  B00111111, B11110000,
  B01111100, B11110000,
  B01110000, B01110000,
  B00000000, B00110000 };

Result Pictures

ToDo

  • Wemos D1 Mini ESP.deepSleep
  • One Case for alle the stuff
  • Smaler Display Case
  • Battery shield + display battery status
  • Change Wemos D1 Mini to ESP8266 BLE + IOS App

WordPress as a data source with .json for Scriptable IOS App

Creating a WordPress site is no longer a specialty with the provided themes. The idea of using WordPress not only as a standard website, but also as a data source / database can be implemented by using a two-line PHP script. We need this script to upload a .json file in WP under media which is normally blocked.

<?php
function cc_mime_types($mimes) {
    $mimes['json'] = 'application/json';
    $mimes['svg'] = 'image/svg+xml';

    return $mimes;
}
add_filter('upload_mimes', 'cc_mime_types');

https://github.com/SmonSE/englishForIT/blob/main/wpJson.zip

Installation of your own WordPress plugin

After creating the plugin (ZIP file which includes the php script) it can be installed via the dashboard.

  1. First click on > Plugins > Add new.
  2. Then click on the “Upload plugin” button at the top.
  3. Now select the ZIP file and confirm the “Install now” button.
  4. After the file has been uploaded, you can activate the plugin.

Create your own .json file

Code excerpt from the json file.

// example
{
  "englishIt": "Vocabulary for IT english",
  "createdAt":"2021-03-18 11:43:00.000000",
  "vocabulary":[
    {
      "pos:": "000",
      "english": "Avatar",
      "german": "Benutzerbild",
      "meaning": "An icon or figure that represents .... ."
    },
    {
      "pos:": "001",
      "english": "Bug",
      "german": "Fehler",
      "meaning": "A defect or fault in a program ... ."
    }
  ]
}

Get data source by Scriptable Widget

Collecting data source from .json file which is uploaded on WordPress media.

// example
async function getNewCasesData(){
  let url = "https://../../../englishForItVocs.json";
  let req = new Request(url);
  let apiResult = await req.loadJSON();

return apiResult;
}

Read out values from .json file.

// example
async function createWidget() {
  const list = new ListWidget();
  const vocEng = list.addText(apiData.vocs[0].english);
  const meaning = list.addText(apiData.vocs[0].meaning);

return list;
}

Funny things that I wrote directly on the iPhone while waiting for ….

Some play games on their mobile phones in the waiting room, others read magazines. I discovered this great Widget IOS app called Scriptable for myself to bridge my boredom while waiting.

Although JacaScript is not my usual programming language, you get used to it quickly. This is of course also due to the fact that at the beginning you can always copy and paste a lot from other developers. But some parts of my code are also completely rewritten.

Strava – Last Ride – Current Month

With the scriptable widget, the last Stava training data can be called up as well as an overview of the last month. A nice feature is scrolling through friends’ training sessions like in the short video. All you have to do is set up several Strava widgets and slide them on top of each other. To get more Informations about that nice Scriptable Widget, check my blog entry about Strava Scriptable Widget. A similar Widget I have also created for Komoot.

How to add the scriptable code to your phone, check the end of this page 🙂

English for IT Vocabulary

Honestly, how often do we check our cell phones every day to check the news or other things. Many even unlock their cell phones every minute out of boredom. Why shouldn’t you learn something from it?
With the Scriptable widget, vocabulary from the IT area is displayed at a predetermined time interval.

Source Code can be downloaded here:
https://github.com/SmonSE/englishForIT

Chuck Norris Facts

At the beginning I looked for free Json Api’s with the following result: chucknorris.io is a free JSON API for hand curated Chuck Norris facts.

Chuck Norris Widget

Source Code can be downloaded here:
https://github.com/SmonSE/chucknorris.io

WordPress Latest Blog Post

Do you not feel like opening the page of your favorite blog every day to see if there is a new article. Then you can simply configure the wordpress blog script as a widget on your iPhone.

Source Code can be downloaded here:
https://github.com/SmonSE/IOS-Widget_load_JSON

How to add scriptable widget to the home screen

Regardless of which widget you have chosen, the setting procedure in iOS is always the same:

  1. First, add the copied code to a new script.
  2. With a tip on the controller icon at the very bottom in the left corner of the screen, you can give the script a meaningful name and select a suitable icon (glyph) for it.
  3. After that, switch to the widget screen by scrolling left on your home screens as long as possible.
  4. Tap and hold on this screen until the preset widgets start to wobble. You are now in edit mode. In this mode, tap on the plus sign in the upper left corner and scroll down to „Scriptable“ in the list that appears.
  5. Here you can still select the appearance and add the widget.
  6. Tap the Scriptable widget again while the icons are wobbling. Here you have the opportunity to select the appropriate script.
  7. To do this, tap on „Select“ in the „Script“ line, the app will show you all the scripts that have been created so far, which can now be selected. Then drag the widget to a location on the screen of your choice and exit edit mode.