K interpreter release notes

Smick v.20.44.161 - (new version - IR transceiver)

  1. Increased buffer size MQTT input to 255 bytes.

Smick v.19.42.137 (last version - Parametric Command)

  1. Management of Boolean values 0 and 1 and of operators !, & and |. Logical / Boolean operators !, |, & operate on 0 | 1 | false | true and produce 0 | 1 only if the operands are 0 | 1 others false | true.
  2. In the boot moved SOS procedure before the serial login so that in case of access setting through login and password, if forgotten, the owner can always log back into the system with the emergency credentials (user: admin, pass: admin) setting the SOS condition.
  3. The Boolean configuration parameters (eg dst, ...) are stored on FS with false | true values (because the value is immediately deduced that the parameter is Boolean). You can assign any expression, but they will be traced back to the logical values false | true. Instead the PIN ('d0', ..) and 'led' assume values 0 | 1. All other assignable values are converted to 0 | 1.
  4. Parametric command management.

Each command has an internal state (data memory) denoted with $ with default value '' (empty string).

With com = val the internal status of the command is updated, even if it is disabled, and then executed.

A command can be disabled by the user or in case of a run-time error.

This behavior has also been applied to the primitive commands: rf, sound, sonar, press, matrix.

A command can refer, in its definition com = [... $ ...], to its status by indicating it with the $ symbol.

With com=expression the expression is evaluated and stored in $ state, then the command is executed by replacing the parameter, if any, with its value.

With com the command returns the value of the internal state if com is parametric, else it is executed.

Using com as operand in an expression returns always the value of the internal state.

If you want to read the status of a non-parametric commanda use +com or (com).

Example 1 :

  --- parametric command
  blink=[led=!led #$ ^6]       define blink with parameter $=''
  blink=1                      set $=1 and execute led=!led #1 ^6
  blink                        read the $ status of the command (returns 1)  <==  ### difference ###
  x=2*blink+5                  read the $ status of the command (x=2*1+5)
  +blink                       read the $ status of the command (returns 1)
  (blink)                      read the $ status of the command (returns 1)

For a traditional, non-parametric command, the behavior is slightly different.

Examples 2:

  --- non-parametric command  
  flash=[led=!led *]           define flash without parameter ($='')
  flash=1                      set $=1 and execute led=!led *
  flash                        execute led=!led *                            <==  ### difference ###
  x=2*flash+5                  read the $ status of the command (x=2*1+5)
  +flash                       read the $ status of the command (returns 1)
  (flash)                      read the $ status of the command (returns 1)

5. Wi-Fi manager

Removed web server for Wi-Fi Manager and the related commands web, disweb, webclear. Removed in conf --- Web management section.

6. Boot management

At boot Wi-Fi and services (MQTT and VOX) are disabled. The user can enable them, if used, in the start command:

  start = [wifi=1, mqtt=1, vox=1]

When the Wi-Fi radio is turned off (wifi=0) Smick absorbs 20mA with a power of 143mW, while when it is switched on (wifi=1) it absorbs 70mA with a power of 358mW.

At boot time, if the SOS condition is not verified, the following instructions are automatically executed:

- load to load the configuration by resetting the timers for NTP and OTA

- if host is not set it is initialized with 'smick'

- if ssid is not set it is initialized with 'Smick- <code>'

- set NTP update after 15 seconds from boot

- set OTA update after 10 minutes from boot

- start to initialize the system.

Improved procedures for connecting to Wi-Fi, MQTT broker and voice assistants (VOX). The boot with Wi-Fi, MQTT and VOX connection is made in less than 10s. To measure it use this sketch:

  start = [wifi=1]
  Wificon -> [mqtt=1, vox=1]
  Mqttcon & Voxcon -> Secs

7. NTP and OTA management

When Wi-Fi is enabled, the NTP and OTA services, if enabled (ntpupd>0 and otaupd>0) are activated automatically after the first Wi-Fi connection: NTP after 15s from boot and OTA after 10m from boot.

8. MQTT management

Activating MQTT the Conn event is automatically sent to MQTT.

If MQTT is active, disconnecting MQTT (mqtt=0) or WIFI (wifi=0) or switching to sleep mode (sleep=n) or performing a reset, the Disc event is sent to MQTT.

The language instruction


disables the automatic sending of events and commands activated by rules. Also Conn and Disc are not sent.

The language instruction


disable interactive MQTT. When Smick receives instructions from MQTT, he executes them without sending the result.

9. Management of the status LED

The status LED flashes every 3s to indicate that it is ready for use, otherwise it will flash:

- fast (4 times per second) to indicate that it is trying to connect to the Wi-Fi network

- slowly (1 time per second) if it is connected to the Wi-Fi network, but can not connect to some activated service (MQTT or VOX).

To disable the status LED use the status=0 instruction.

Modified status instruction: added new value 2. Summarizing:

    • status = 0: status LED not used
    • status = 1: status LED indicates both anomalous conditions (fast or slow flash) and normal condition (flash every 3s)
    • status = 2: status LED only signals abnormal conditions (fast or slow flash).

Added new Status event that shows the value of the status LED: 1 if it is on, 0 if it is off. (See the example "Simple clock with status report").

10. Variable names

The words start and stop can not be names of variables.

11. Matrix module

Changed the scroll instruction that previously set only the scroll mode (0|1) while now setting the scroll frequency (0..100 Hz).

12. Removed instructions: HHMM and MMSS

13. MQTT send

< command

First command is executed and then the result is published on MQTT.

Alcuni esempi:

  ] < 45+2*4
  < 53
  ] < 'x='+x
  < x=26
  ] < json,x+4,csv##
  < {"x+4":30}
  ] < "json,x+4,csv##"
  < json,x+4,csv##

14. Modified scroll instruction that has values of 0..100 (scroll speed).

15. Modified status statement that has values of 0..2 (0 = disabled, 1 = enabled, 2 = enabled only to report connectivity problems).

16. Added event Status.

17. Removed HHMM and MMSS instructions.

18. The following instructions have been added:

  • sniff = 0..2 (0 = disabled, 1 = enabled on all messages, 2: enabled only on sent messages, 3: enabled only on received messages).
  • snifftrace = 0..2 (0 = disabled, 1 = enabled only on friends MAC, 2 = enabled on all messages).
  • Sniffmac that returns the friend MAC detected in the format '01: E2: F5: 34: AB: 06 '(only capital letters!).
  • Sniffrssi that returns the signal strength (RSSI): 0 = none, -10, -23, -115, ...
  • Sniffch that returns the channel: 0 = none, 1..15.
  • freeze = d (0 ...) that pauses timed commands, events and rules for d seconds. The pause and play commands operate on this parameter: play equals freeze = 0 and pauses equals freeze = 1000000000 (about 32 years).
  • wifiscan that lists the detected routers.
  • sniffch = 0: all channel, 1-15 one channel

19. Added configuration parameters: mac1, ..., mac8 (MAC friends) in the format 'HH: HH: HH: HH: HH: HH'.

Smick v.18.39.130 - Matrix

  1. Improved handling of the 'Matrix' module. Matrix is an 8 x 32 LED matrix, controlled by the MAX7219 chip, which can display 5 characters horizontally.

The behavior of the scroll command has been changed and the direct command has been added.

Summary of the commands used to manage Matrix:

matrix :: d6

defines the Smick PIN connected to the Matrix CS (Chip Select) PIN

matrix = <value>

show <value> which can be a logical value (true, false), a number (integer or decimal) or a string.

If <value> consists of more than 5 characters, it is scrolled to the left until the last character.

scroll = 1/0

scroll = 1 scrolls <value> to the left indefinitely,

scroll = 0 suspend scrolling (default)

direct = 1/0

direct = 1 sets scrolling to the right

direct = 0 sets scrolling to the left (default)

inverse = 1/0

inverse = 1 sets the bright background

inverse = 0 sets non-luminous background (default)

2. Modified tracing. With trace = 2 we get detailed trace:

# 5186905: Wificon -> [json,led=0,vox=1##10]
# 5186993:  ------ end cycle: 1208539 (329ms), Ips: 147
# 5196564: vox=1
# 5196870:  ------ end cycle: 1208574 (307ms), Ips: 159
# 5197089: Voxcom -> msg
# 5197110: msg = [Voxdev,Voxcom,Voxval]
# 5197223:  ------ end cycle: 1208575 (353ms), Ips: 159

With trace = 1 we get simplified trace:

# Wificon -> [json,led=0,vox=1##10]
# vox=1
# Voxcom -> msg
# msg = [Voxdev,Voxcom,Voxval]

3. Added new operators on instructions:

    • ^n: repeat n times
    • ^: repeat forever (loop)
    • *: repeat forever (loop)


] x=0,[x=x+1,x]^3
] x=0,[x=x+1,x]*

Summarizing the periodic operators are:

    • instruction * (loop)
    • instruction ^ (loop)
    • instruction ^n (repeat n times)
    • instruction #t (loop every t seconds)
    • instruction #t ^n (repeat n times every t seconds)

Note: in your sketches replace #@ with ^ and @ with ^

Smick v.17.37.126 - Alexa & Google Home

  1. The 'vox' module now can interact with Alexa and Google Home Voice User Interface (VUI).

The difference between the messages sent by Alexa and Google Home concerns only the parameters:

    • Voxcom VUI action
    • Voxval value of VUI action.


Saying to Alexa: "Alexa, turn on the lamp", Smick receives:


Saying to Google Home: "Ok google, turn on the lamp", Smick receives:


2. Type casting

For casting to number use: +x or -x (unary + or -).


+true=1, +'45.3bt'=45.30, +23.6=23.60

-true=-1, -'45.3bt'=-45.30, -23.6=-23.60

For casting to string use: ''+x.


''+12.56='12.56', ''+true='true', ''+'home'='home'

For casting to logic use: !!x.


!!'home'=true, !!12.56=true, !!true=true

!!''=false, !!0=false, !!false=false

3. Added print command '?'

Example: ?'result is '+val

4. New error messages for commands:

vox = 1, if not configured voxkey generates "nok: VUI voxkey is not configured" error

wifi = 1, if not configured wifissid generates "nok: Wi-Fi SSID is not configured" error

mqtt = 1, if not configured mqttserver generates "nok: MQTT server is not configured" error

5. The 'new' command disconnects the virtual pins (rf, matrix, ...)

6. Added new 'Ips' parameter (Instructions per second). Count the number of:

- operations performed: +, -, *, /,%,!, &, |

- verified relationships: ==,! =, <=, <,>,> =, <<, == *, * ==

- assigned assignments: =

- calculated operands.

7. Added New 'Cycle' parameter that provides the duration in ms of a loop cycle.

8. Improved tracing. With trace = 1 we get:

# 5186905: Wificon -> [json,led=0,vox=1##10]
# 5186993:  ------ end cycle: 1208539 (329ms), Ips: 147
WIFI    connected with IP: (smick.local)
VOX     connected to VUI bridge
# 5196564: vox=1
# 5196870:  ------ end cycle: 1208574 (307ms), Ips: 159
# 5197089: Voxcom -> msg
# 5197110: msg = [Voxdev,Voxcom,Voxval]
# 5197223:  ------ end cycle: 1208575 (353ms), Ips: 159

For every cycle of the interpreter K all the instructions executed are traced (lines starting with #). Obviously the tracking slows down the system, but it is useful for understanding the functioning of a sketch and discovering unwanted effects.

The end of each cycle is traced with:

# 5197223: ------ end cycle: 1208575 (353ms), Ips: 159


      • 5197223 is the number of milliseconds from the boot
      • 5197223 is the number of cycles from the boot
      • 353ms is the duration of the cycle (see Cycle parameter)
      • 159 is the number of instructions per second (see Ips parameter).

9. New values for the rf command:

    • rf = 0 performs the same function as rfoff (which is deprecated and will be removed in the next version)
    • rf = 1 performs the same function as rfon (which is deprecated and will be removed in the next version).

10. Command '?' show the definitions in the following order:

               --- Pin connections
               --- Variables
               --- Commands
               --- Events
               --- Rules

11. Integer from fractional

  ] x=4.56, i=x/'.', f=x%'.', i, f

Smick v.16.37.114 - Alexa

  1. The publication of MQTT messages is always 'retained', ie stored on the broker.
  2. Code optimization for recovery of 4Kbytes of SRAM.
  3. Modified command led: 1=on, 0=off. ATTENTION: invert led value in your old sketches.
  4. Added command mqtt to enable/disable MQTT client. ATTENTION: the connection to MQTT is no longer automatic and must be activated via the mqtt = 1 instruction, for example, in the start.
  5. Removed command link. ATTENTION: after the upgrade, when you load the default sketch, you will find the 'link' variable that you will have to remove. To remove it, run: 'link =' and 'save'.
  6. Added 'vox' module for interaction with Alexa Voice User Interface (VUI).

Added configuration parameter:

    • voxkey your API key of VUI bridge.

Added command:

    • vox indicates whether the VUI is enabled.

Added events:

    • Voxcon indicates whether the VUI is connected
    • Voxdev VUI device identifier (deviceID)
    • Voxcom VUI action
    • Voxval value of VUI action

Normally Voxdev, Voxcom and Voxval are always empty. When Alexa receives a command for your device, she understands it and sends a message to Smick containing:

    • device identifier (Voxdev),
    • command name (Voxcom) and
    • command value (Voxval).

To set your VUI key, enable VUI and set JSON data format use this command:

   start = [voxkey = "f83702bb-f9ee-43db-b25d-968a874a2c14", vox = 1, json] 

Note: "f83702bb-f9ee-43db-b25d-968a874a2c14" is an example key.

To trace the messages sent by Alexa use the following rule:

   Voxcom -> [Voxdev, Voxcom, Voxval]

Here's how a command received from Alexa is traced:


7. Added new Comparison Operators:

  • *== (prefix of)
  • ==* (has suffix)
  • << (contained in)
  • !< (not contained in)

8. Removed logical operator:

  • ^ (xor)

9. Extended validity of arithmetic operators (+, -, *, /, %) to all data types (logic, number and string).

Smick v.15.36.110 - MQTT patch

  1. Increased buffer size MQTT input to 255 bytes.

Smick v.14.36.109 - Telnet, RF, motors and NB-IoT

  1. Firmware Updates for KRACK WPA2 Vulnerability #3725 https://github.com/esp8266/Arduino/issues/3725. Espressif has released updates for ESP-IDF, ESP8266 RTOS SDK, & ESP8266 NONOS SDK on their Github page https://github.com/espressif/ESP8266_NONOS_SDK.
  2. Added configuration parameters:
    • host (default: smick) used for the telnet connection (telnet smick.local)
    • login and password to allow, if set, access to the serial interface and telnet only to authorized users
    • logser=0/1 disables / enables the login and password request when accessing via serial link
    • logtel=0/1 disables / enables the login and password request when logged in via telnet
    • login username required for login (if login is not set, no login is active)
    • password secret word required for login
    • valform=n format of numerical values: 0: std (standard), 1: dec (decimal code), 2: hex (hex code), 3: bin (bin format), 4: char (chr)
    • rxtrim=0/1 disables / enables the removal of the control characters on the left and on the right (eg CR LF ...) of the serial input buffer (Rx)
    • mqtto=0/1 disable / enable automatic sending of events and rules actions on MQTT
    • kinter=0/1 K interpreter interface (0=serial, 1=telnet) *** replaces the telnet command ***
    • bitrate sets the bit rate of the serial connection

3. Added commands:

    • tx sends a string on the serial connection
    • Rx returns the string received on the serial connection
    • chr sets the standard format of numeric values
    • dec sets the standard format of numeric values
    • hex sets the standard format of numeric values
    • bin sets the standard format of numeric values
    • run loads and executes a sketch (equals [load,start])

4. String management

    • strings can be defined as sequences of characters enclosed in single (') or double quotes (")
    • added operator + to concatenate strings

5. Structured display of the configuration (conf):

            --- NTP management
            --- OTA management
            --- SERIAL management
            --- TELNET management

6. ls | dir also summarizes the number of config files and the sketch number

          /Smick.k                             660 bytes
                             2% used space   24598 bytes
                            98% free space  932716 bytes
                             6  config files
                            34  sketch files

7. Added two new commands for the engines operating on both motor1 and motor2 engines. They are used to control a robotic base:

    • motors = x wich equals [motor1 = x, motor2 = x]. The robotic base moves forward if x> 0 and backwards if x <0. The value x is in the range -100 and +100
    • motoro = x wich equals [motor1 = x, motor2 = -x]. The robotic base rotates clockwise if x> 0 and counterclockwise if x <0. The value x is in the range -100 and +100.

8. Modified command load and run: does not run new if it refers to configuration file (starting with a capital letter) .

9. Connection with NB-IoT (Narrow Band IoT) u-blox transceiver on serial interface. Added new configuration parameters:

    • nbiot enables / disables NB-IoT functions
    • Nbip get the dynamic IP assigned to the card by DHCP after registering on the Narrow Band network
    • nbport set the socket listening UDP port 5680
    • nbserverip set the remote server IP
    • nbserverport set the remote server port 5685
    • Nbttl get TTL (Time To Live)
    • Nbrtt get RTT (Round Trip Time)
    • nbtxudpmsg set UDP msg to send (hex format)
    • nbtxudplen set UDP msg length to send
    • Nbrxudpmsg get UDP msg received (hex format)
    • Nbrxudplen GET UDP msg length received
    • Nbrxudpsid get the socket id of UDP msg received (0..6)

Setting nbiot=0 the dynamic parameters Nbrtt, Nbttl, Nbip, Nbrxudpsid, Nbrxudplen, Nbrxudpmsg are initialized.

10. Added new commands to manage the MAX7219 4x 8x8 LED Dot Matrix module:

    • matrix to define the message to show and the connection PIN
    • inverse to reverse text and background. Allowed values: 0 = normal (default), 1 = inverse
    • scroll to reverse the direction of horizontal scrolling. Allowed values: 0 = left (default), 1 = right
    • HHMM provides the string HH: MM
    • MMSS provides the string MM: SS
    • Date provides the string dd-mm-yyyyy
    • Time provides the string hh-mm-ss
    • Date and Time are concatenable strings while the words date and time no.

11. MQTT connection executable with and without credentials (mqttuser, mqttpass)

12. The mqttserver parameter can contain an IP address or a domain name.

Smick v.13.32.89 - Telnet

  1. Modified command new to reset I/O PINs.
  2. When a timed command generates an error (nok) it is removed from crontab.
  3. Added new Wifiip command that returns the local IP assigned by DHCP.
  4. Added Telnet network serial interface and 3 configuration parameters to handle it: telnet, distel and Telnetcon.

The telnet parameter can take the following values:

    • 0: Telnet disabled
    • 1: Telnet enabled with login
    • 2: Telnet enabled without login.

With the distel parameter set the idle time (in minutes) for automatic deactivation of the Telnet interface. If distel is zero no automatic deactivation is set.

The Telnetcon event indicates whether Telnet is active. It can be used to know, for example, when someone connects or disconnects via Telnet.

    • Telnetcon -> led = 1
    • !Telnetcon -> led = 0

5. Added bell dynamic configuration parameter that enables or disables sending the BELL code to the Serial and Telnet interfaces:

    • 0: sending BELL disabled
    • 1: sending BELL enabled.

Sending BELL is performed at the same time as reading the bell parameter (when it is 1). To hear the bell on the Serial or Telnet client, you must configure it on the client.

6. Added new reboot command to reinitialize the system without resetting.

7. Added new fota command to force the OTA update with the latest available version. This command replaces the forced OTA update procedure described in release notes Smick v.10.29.80, step 1.

Smick v.11.31.85 - TH sensor, motor

  1. Removed boot command.
  2. Replaced ver parameter with read-only Ver.
  3. Replaced sn parameter with read-only Sn.
  4. Added the new parameter dhtype to handle different types of temperature and humidity sensors DHT: 0 (none) is the default setting, 11 (DHT11), 22 (DHT22), 21 (DHT21). The parameter must be set to use Temp, Hum, Temperr, Humerr events.
  5. Added ultrasonic distance sensor HC-SR04. It has two PINs: trigger (output) and Echo (input). To define the connections use
sonar :: <trigger PIN>
Sonar :: <Echo PIN>

To set the maximum visibility distance use

sonar = <maximum distance> (3, .., 250) expressed in cm



returns the distance of the obstacle. The value 0 indicates no obstacle.

6. Added Wemos motor shield to handle two engines: motor1 and motor2. The shield uses the I2C serial interface via the D1 and D2 PINs and it is not necessary to define the connection. The motor1 and motor2 parameters can take between -100 and +100.

7. Added pressure and temperature sensor BMP180. It uses the I2C serial interface (addr. 0x77) via the D1 and D2 PINs and it is not necessary to define the connection. The press parameter must be set with the pressure, expressed in hPa (default=1013.25), at the current sea level and its area available from any weather forecast site. You can consult, for example http://www.weatheronline.co.uk, search for your city, view the 'SL pressure' map and read the isobara from the map. If, for example, you read 1026, you have to set

press = 1026

The sensor provides the following parameters:

  • Press: pressure, in hPA.
  • Tempb: temperature (in degrees Celsius)
  • Alt: altitude (in meters).

8. Removing sub-commands limitation up to three levels. Subcommands can be leveled as long as the system's memory resources allow it.

Smick v.10.29.80 - Calendar

  1. Forced Firmware update

To force the firmware update through OTA:

    • set otaupd with a positive value (i.e. otaupd=1440)
    • set trace=1
    • request the firmware update with ota command
] otaupd=1440, trace=1, ota
OTA  Check firmware update

 ets Jan  8 2013,rst cause:4, boot mode:(3,0)

wdt reset

2. Added new read-only variables to manage calendar-based events:

    • Cal indicates that the calendar has been updated
    • Year year of date
    • Month month of date
    • Day day of date
    • WDay day of the week of the date (1=Sunday, 2=Monday,...,7=Saturday)
    • Hour hour time
    • Min minutes of the hour
    • Sec secondss of the hour
    • Secs number of seconds elapsed since power up

3. It is possible to display from MQTT the definition of a link, a variable, an event, a command, or a rule. Send from MQTT:

    • mqttio=1 to set interactive MQTT
    • cal=1 to define cal variable
    • cal? to get the definition of cal variable

and you get on MQTT:

    • -- Variables cal = true

Note: max length of a definition is 80 chars

Smick v.9.28.77 - Reset and OTA

  1. Optimized execution of the reset command.
  2. Added new config parameter sos to define SOS event. The SOS event is verified at each start and if it does not run autostart. It is used to prevent a sketch containing the sleep command no longer be interrupted. The default event is A0>600. To make it true you need to connect PIN A0 with the 3.3V PIN. If your sketch uses PIN A0, you must define the sos event on an unused PIN. You can use one of the following events:
    • D0 or D8; in this case you have to connect PIN D0 or PIN D8 with the 3.3V PIN
    • !D1, !D2, !D3, !D4, !D5, !D6, !D7; In this case you have to connect the PIN you selected with the GND PIN.
  3. Added new config parameter otaupd to define the period, in minutes, of the firmware update request. Set otaupd=0 to disable the firmware update.
  4. Added new command ota to require the firmware update.
  5. Modified the config parameter ntpupd to define the period, in minutes, of the calendar update request to the NTP server. Set ntpupd=0 to disable the calendar update.
  6. Added new operator ':' (activate) to active all definitions with a given pattern. An event generates when it becomes true (that is, it was false and now it is true). EventName: is used to generate the event EventName when it is true (i.e. if it is true at the moment when EventName: is run).

Smick v.8.27.75 - Eval event, help command

1. External event is generated even if disabled!

2. Introduction of two new parameters:

    • val containing the result of the last evaluated expression
    • Eval containing true if an expression was evaluated.

If the command is an expression to be evaluated (i.e. Sec + 3), the result is stored in the val register and set Eval=true.

Example of use.

These two registers are used to define such rules:

Eval -> led = val

to set led with a value received from mqttin or serial channel.

] 0

The LED goes off.

] 1

The LED lights up

3. Added new registry 'mqttio' to set up MQTT channel interaction.

If mqttio = 0 (default), when evaluating an expression via mqttin channel

> Sec+2

the result is not returned on mqttout, but only on serial.

If mqttio = 1, when evaluating an expression via mqttin channel

> Sec+2
< 79

the result is returned to mqttout.

4. For commands '?', '\', '+', '-' the pattern may contain as a suffix:

    • '->' to select only the rules
    • '- = [' to select only commands
    • '::' to select only the links
    • '=' to select only variables and events.

5. Modified the result of the 'help' command:

] help
For any information see the web page http://smick.tk

Smick v.7.27.74 - unix type commands

  1. Default message format is csv
  2. Replaced the type configuration parameter with device to be replaced manually in the configuration files on the archive.
  3. Added the new command ls synonymous with dir.
  4. Added the new command rm synonymous with del.
  5. Added the new command type synonymous with cat.
  6. Added the new command help.