LEGO IoT Train

This post is part 1 of 3 of  LEGO IoT Train

This recente release of LEGO EV3 MicroPyhton using ev3dev keeps amazing me. I think that most people didn’t realize the truly meaning of having a full modern operating system under the hood. And also the great work that David Lechner and all others (sorry, too many to name here) have been doing with and around ev3dev.

A few months ago I’ve been playing with the 4DBrix WiFi Train Controller. I already had bought some 4DBrix custom monorail parts including some small RC Servos that they sell in a LEGO-compatible form factor. When ordering a few more extra parts for my Conveyex project I noticed an interesting thing about their WiFi Train Controller – it used MQTT. Well, well, well… a LEGO-compatible RC controller that uses a non proprietary protocol and even better over WiFi, something I’ve been doing with NodeMCU but ‘out of the box’ and not too expensive.

[long dissertation]

Bluetooth and Bluetooth Low Energy (BLE) are great for gadgets but I’m still not convinced. Yes, been a beta tester of SBrick, had reverse engineered part of WeDo2, BOOST and Powered Up… but still think that BLE is not for robotics or even large IoT.

Bluetooth (standard or BLE) requires “a session”. Once a master device connects to a slave, no additional session can be created to that slave. So it’s great to keep reading data from a sensor but not to so great when you need to ‘time share’ to several masters – you need to release the session, that’s OK with SBrick because it keeps working and waiting for further sessions but it’s not OK with LEGO smart hubs because they shut off after a few seconds to save energy.

BLE beacons like iBeacon and Estimote announce all the needed data so a session isn’t needed but to save energy the frequency of the announcement is kept low. Ideally BLE devices should reduce energy consumption while waiting for a session to be stablished but that would increase latency so not so good for robotics and automation: most of the times, if you need to take a decisiona based on remote data or even worst stop a motor you cannot afford to wait.

Also Bluetooth is ‘point-to-point’, like Infra Red RC. Yes, since it’s radio it works through walls and is resiliant to room light conditions… but you cannot route it. If you have many devices to access/control you will find that there is a limit in the number of simultaneous sessions that you BLE controller can sustain (BLED112 states 8, Cambridge CSR just 5). So if you reach that limit on your smartphone or your limited tablet… you’re done. On a laptop or desktop computer you can add extra BLE dongles but then you start dwelling with your operating system idiosyncrasies (Windows guys, I feel your pain).

Now I am not saying that WiFi is the best solution as there are other very interesting wireless technologies like Zigbee and LoRa… but they are not wide spread as WiFi: my smartphone has WiFi, my laptop has WiFi, my SmartTV has WiFi… even my EV3 has WiFi!

[end of dissertation]

So I ordered one of this little fellows and it worked fine:

But I forgot to talk about it here, only wrote a post on Eurobricks forum about it. So now that I have MQTT working out of the box with this LEGO EV3 MicroPython it’s time to get back to the 4DBrix WiFi Train Controller.

4DBrix has a nice tool nControl to design train/monorail track layouts and also control them with their own controllers. It’s available for free download, you just need to give our e-mail and agree with their terms (essentially some fair use conditions including not redistributing it). There are versions for several platforms including Raspberry Pi’s Raspbian and Ubuntu. This tool is needed to configure the WiFi Controller through the USB port and also to eventually upgrade it’s firmware.

On linux, nControl looks for a connected WiFi Controller on ‘/dev/ttyUSB###’. Last year I had a problem with having more than one of this devices already defined so I needed to remove all before connect it:

sudo rm /dev/ttyUSB*

Not sure if this is still needed (4DBrix keeps upgrading the tool, it’s now in version 2019-0-409) but it doesn’t hurt.

After nControl finds the connected WiFi Train Controller (‘/dev/ttyUSB3’) we can configure it to work with our WiFi network and also chose an Alias and a MQTT Broker:

Alias: 4DB2
WiFi Network: SSID
WiFi Password: ****
MQTT Broker: -> use this system => 192.168.1.87

The Alias is important because the internal MQTT client will subscribe to the topic ‘nControl/Alias’. So in my case ‘nControl/4DB2’ (I also have a 4DB1, the first Controller I received had an internal thermal problem with the power regulator so they sent me a second one).

We can specify any MQTT Broker like ‘test.mosquitto.org’ but there is also a ‘Use this system’ option where it finds the IP address of our computer and use it. That’s also usefull because nControl has its own MQTT Broker (based on ‘hbmqtt’ instead of ‘mosquitto’ and requiring authentication so not useful for open IoT projects

Although nControl as an option to verify that the applied configuration is working properly I found no way to know the IP address that the WiFi Train Controller gets so I had to go to my WiFi router and check for connected devices:

ESP_093471 192.168.1.112

The hostname starts with ‘ESP_’ (the device uses a ESP8266 chipset like the NodeMCU board I’ve been using) and got IP ‘192.168.1.112’… not that I need it’s IP address but might be useful for debugging eventual problems later

So I can now control a LEGO motor with it – disconnect USB cable, connect a LEGO battery and motor, power the device on and test it:

mosquitto_pub -h localhost -t "nControl/4DB2" -m "mot,f,1023"

the motor should spin at maximum speed in one direction. To make it spin in the opposite direction:

mosquitto_pub -h localhost -t "nControl/4DB2" -m "mot,b,1023"

And to stop it:

mosquitto_pub -h localhost -t "nControl/4DB2" -m "mot,f,1023"

or just:

mosquitto_pub -h localhost -t "nControl/4DB2" -m "mot,s"

There are a few other commands available but these are enough for what I want

So controlling a LEGO motor with EV3 through WiFi is just a matter of writing opening Visual Studio Code and write a short MicroPython script that publishes the proper messages to ‘nControl/4DB2’ topic.

Since MQTT is not ‘session’ based like Bluetooth we can use multiple Ev3 to control it. So a LEGO train can run over a long track and place several EV3 pBricks in proper places to control it, like this:

Next post I will explain how to do it and show a slightly more useful demo.


IoT with LEGO EV3 MicroPyhton (2)

This post is part 2 of 2 of  EV3 MicroPython and IoT

Wrote a better script to illustrate how can we use MQTT to control multiple EV3 bricks.

On the video bellow I’m using ‘mosquitto’ commands on my Ubuntu laptop but any MQTT client (like Android MQTT Dashboard or even other EV3) can be used:

IoT with LEGO EV3 MicroPyhton

This post is part 1 of 2 of  EV3 MicroPython and IoT

Just a few hours with this new image from LEGO and so much awesomeness already!

So this is all based on the MicroPython project. Being ‘v1.9.4’ it’s not the lastest version but it’s also not too old (current official release is 1.10). But it’s not ‘just’ a version customized for the EV3 devices… it seems a full implementation for ARM with ‘micropython-lib’ included.

What does it means?

Well, you can add micropyhton aditional modules if/when they are released, like for instance ‘pystone’ (a benchmarking tool):

micropython -m upip install pystone

There are already a lot of modules available including one HTTP client and other for sockets (so you can make your own MicroPython EV3 web server)… and two for MQTT!

And even better… at least the MQTT modules are already included within the LEGO image.

So let’s use EV3 for IoT:

#!/usr/bin/env pybricks-micropython

from pybricks import ev3brick as brick
from pybricks.ev3devices import (Motor, TouchSensor, ColorSensor,
InfraredSensor, UltrasonicSensor, GyroSensor)
from pybricks.parameters import (Port, Stop, Direction, Button, Color,
SoundFile, ImageFile, Align)
from pybricks.tools import print, wait, StopWatch
from pybricks.robotics import DriveBase

from umqtt.robust import MQTTClient
import time

def getmessages(topic, msg):
if topic == b'JorgePe/test':
brick.display.text(msg)

client = MQTTClient('52dc166c-2de7-43c1-88ff-f80211c7a8f6','test.mosquitto.org')
client.connect()

client.publish('JorgePe/test','Listening')
client.set_callback(getmessages)
client.subscribe('JorgePe/test')
brick.display.text('Listening...')

while True:
client.check_msg()
time.sleep(0.1)

Just configure Wi-Fi, connect with Visual Studio Code, upload this project… and your EV3 is IoTed!

To be continued…


Voice with MicroPython for the EV3

The new MicroPython environment for the EV3 has sound commands… but not ‘speak’ like the full ev3dev python (ev3dev-lang-pyhton).

But it has ‘os.system’ so we can make system calls…

So

#!/usr/bin/env pybricks-micropython
import os
os.system('espeak "hello" --stdout | aplay')

works but as soon as we instantiate an ev3brick it stops working:

#!/usr/bin/env pybricks-micropython
from pybricks import ev3brick as brick
import os
os.system('espeak "hello" --stdout | aplay')

The error is ‘aplay: main:788: audio open error: Device or resource busy’

So it seems pybricks allocates the ALSA sound card in some exclusive way. Strange because ‘aplay -L’ shows there is a software mixer:

null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=legoev3
LEGO MINDSTORMS EV3 Speaker, LEGO MINDSTORMS EV3 Speaker
Default Audio Device
sysdefault:CARD=legoev3
LEGO MINDSTORMS EV3 Speaker, LEGO MINDSTORMS EV3 Speaker
Default Audio Device
dmix:CARD=legoev3,DEV=0
LEGO MINDSTORMS EV3 Speaker, LEGO MINDSTORMS EV3 Speaker
Direct sample mixing device
dsnoop:CARD=legoev3,DEV=0
LEGO MINDSTORMS EV3 Speaker, LEGO MINDSTORMS EV3 Speaker
Direct sample snooping device
hw:CARD=legoev3,DEV=0
LEGO MINDSTORMS EV3 Speaker, LEGO MINDSTORMS EV3 Speaker
Direct hardware device without any conversions
plughw:CARD=legoev3,DEV=0
LEGO MINDSTORMS EV3 Speaker, LEGO MINDSTORMS EV3 Speaker
Hardware device with all software conversions

So after several try&fail iteractions, I got a workaround by creating a ‘/home/robot/.asoundrc’ file:

pcm.hwmix {
type dmix
ipc_key 1939 # must be unique
slave { pcm "hw:CARD=legoev3" }
}
pcm.!default hwmix

This works… unless we also use ‘brick.sound.beep()’… then it locks in some other way. Oh well, nothing is perfect.

LEGO officially uses ev3dev

Yesterday LEGO Education quietly released “Python for EV3“:

You can now use your EV3 Brick to unleash the power of Python programming using MicroPython. Simply install the EV3 MicroPython image onto any micro SD card and boot up your EV3 Brick from it to start programming straight away.

What it really is: a full ev3dev image with a micropython environment meant to be used from Visual Studio Code through an EV3 MicroPython extension.

Amazing work from David Lechner, Laurens Valk, and Anton Vanhoucke, built over the shoulders of lots of other giants. Congratulations to all!

The documentation states that it uses a ‘pybricks-micropython’ environment and new ‘pybrick’ library, not yet available outside of this image but that’s just a matter of time.

Micropython programs tend to use less resources than common python and also start much faster. The ev3dev-lang-python is still included on the image but for simple projects this new micropython environment will be of great use for people starting with EV3 and text-oriented languages.

The image is really a full ev3dev stretch-based image, the ‘robot’ user is still available (password is “maker”) so we can still access through SSH and use it the way we were used:

ssh robot@ev3dev.local
Password: 
Linux ev3dev 4.14.96-ev3dev-2.3.2-ev3 #1 PREEMPT Sun Jan 27 21:27:35 CST 2019 armv5tejl
             _____     _
   _____   _|___ /  __| | _____   __
  / _ \ \ / / |_ \ / _` |/ _ \ \ / /
 |  __/\ V / ___) | (_| |  __/\ V /
  \___| \_/ |____/ \__,_|\___| \_/

Debian stretch on LEGO MINDSTORMS EV3!

Kernel is very recent but there is already a newer version available – since LEGO keeped the link to ev3dev repositories so the usual ‘sudo apt update’ and ‘sudo apt upgrade’ works:

The following NEW packages will be installed:
linux-image-4.14.111-ev3dev-2.3.3-ev3 rtl8188eu-modules-4.14.111-ev3dev-2.3.3-ev3
rtl8812au-modules-4.14.111-ev3dev-2.3.3-ev3
The following packages will be upgraded:
jri-11-ev3 libnss-myhostname libnss-resolve libpam-systemd libsmbclient libsystemd0 libudev1 libwbclient0
linux-image-ev3dev-ev3 samba-libs systemd systemd-sysv udev wget wpasupplicant

By the way, micropython says:

robot@ev3dev:~$ micropython 
MicroPython v1.9.4 on 2018-05-22; linux version
Use Ctrl-D to exit, Ctrl-E for paste mod

Just a few days after SPIKE anouncement, the future of LEGO robots seems now to be very very linked to linux, python and opensource

Me happy! 🙂

Remote ultrasonic sensor for EV3 with micro:bit

This post is part 1 of 1 of  EV3 and micro:bit

Been testing the micro:bit BLE Uart service. It’s a service that uses Nordic chipset features to deliver a simple TX/RX mechanism so we talk with the micro:bit without having to create our own BLE services.

Someone offered me a ultrasonic sensor this week. It’s a HC-SR04, very common with Arduino projects but can also be used with the micro:bit, there’s even a “sonar” extension available in the Makecode editor.

So I added the BLE Uart service and started writing the distance values to the TX characteristic every second:

Nordic nRF Connect App reads them fine but gatttool doesn’t… except when in Interactive mode. Strange!

After a while, I found out a note that explains that the way the TX characteristic works forces us to keep the connection or reset the micro:bit regularly. That’s why Interactive mode works (it keeps the connection). So I have to forget gatttool for a while and use something better like python.

On Ubuntu, my scripts worked fine. Latest version of pygatt (4.0.3) allow me to subscribe to the TX Characterist (in “Indication” mode only – almost the same as notifications but with an extra acknowledge step) and I was getting distance values on my laptop through BLE.

But on the EV3 the scripts failed because “No characteristic found matching”. Why? I’m using same version of pygatt and don’t think that kernel version make much difference now that pybluez has settled.

I was almost giving up when something worked: decided to use the python exception mechanism to retry several times the subscribing step.

So instead of just

device.subscribe("6e400002-b5a3-f393-e0a9-e50e24dcca9e", callback=handle_data, indication=True)

I included the subscribe command in a loop that only ends when the command completes:

while True:
    try:
        device.subscribe("6e400002-b5a3-f393-e0a9-e50e24dcca9e", callback=handle_data, indication=True)
        break
    except pygatt.exceptions.BLEError:
        print("unknown characteristic")

And it works?! Usually just retrying once:

Connecting…
Connected
unknown characteristic
Dist = 1.19 m
Dist = 1.19 m
Dist = 1.18 m

My micro:bit github page now includes the python script used on the above video

If you wonder about the format of the data, the micro:bit sends the distance value as a string of bytes, each byte being the ASCII code of the character, so 40 cm is sent as a “4” followed by a “0”:

34h 30h

I love opensource

Today I got a nice note from a guy named Kevin Walters. He used my mindstorms-vll code to control a MINDSTORMS MicroScout droid with a smarphone, using an Adafruit Feather M0 Bluefruit LE running CircuitPython 3.1.1 as a gateway controller:

https://learn.adafruit.com/bluetooth-remote-for-lego-droid

Thanks Kevin for quoting me and for the wonderful project.

LEGO Wireless Protocol officially available

LEGO released the specs for the Powered Up BLE-based protocol (LWP):

https://lego.github.io/lego-ble-wireless-protocol-docs

Interestingly the document is also available as an open souce (MIT license) project at Github:

https://github.com/LEGO/lego-ble-wireless-protocol-docs

Is’s always a good sign when a big company like LEGO embraces open source so let’s hope for the best

Merry Christmas to all!

XAC with EV3

This post is part 4 of 4 of  Xbox Adaptive Controller

Running ev3dev (‘4.14.71-ev3dev-2.3.0-ev3 (stretch)’.

BT works, just needed to edit ‘/sys/module/bluetooth/parameters/disable_ertm’.

dmesg:

Bluetooth: HIDP (Human Interface Emulation) ver 1.2
Bluetooth: HIDP socket layer initialized
hid-generic 0005:045E:0B0C.0002: unknown main item tag 0x0
Bluetooth: received HCILL_WAKE_UP_IND in state 2
input: Xbox Adaptive Controller as /devices/platform/soc@1c00000/serial8250.2/tty/ttyS2/hci0/hci0:1/0005:045E:0B0C.0002/input/input3
hid-generic 0005:045E:0B0C.0002: input,hidraw1: BLUETOOTH HID v9.03 Gamepad [Xbox Adaptive Controller] on a0:e6:f8:60:16:60

I don’t have a ‘/dev/input/js0’  because ev3dev ‘joydev’ has been deprecated.

But I can still read it with ‘cat /dev/input/event3’ but since it looks like garbage its better to use ‘evtest’:

No device specified, trying to scan all of /dev/input/event*
Not running as root, no devices may be available.
Available devices:
/dev/input/event0: LEGO MINDSTORMS EV3 Speaker
/dev/input/event1: EV3 Brick Buttons
/dev/input/event2: C-Media USB Headphone Set 
/dev/input/event3: Xbox Adaptive Controller
Select the device event number [0-3]: 3
Input driver version is 1.0.1
Input device ID: bus 0x5 vendor 0x45e product 0xb0c version 0x903
Input device name: "Xbox Adaptive Controller"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 1 (KEY_ESC)
    Event code 2 (KEY_1)
    Event code 3 (KEY_2)
    Event code 4 (KEY_3)
    Event code 5 (KEY_4)
    Event code 6 (KEY_5)
    Event code 7 (KEY_6)
    Event code 8 (KEY_7)
    Event code 9 (KEY_8)
    Event code 10 (KEY_9)
    Event code 11 (KEY_0)
    Event code 12 (KEY_MINUS)
    Event code 13 (KEY_EQUAL)
    Event code 14 (KEY_BACKSPACE)
    Event code 15 (KEY_TAB)
    Event code 16 (KEY_Q)
    Event code 17 (KEY_W)
    Event code 18 (KEY_E)
    Event code 19 (KEY_R)
    Event code 20 (KEY_T)
    Event code 21 (KEY_Y)
    Event code 22 (KEY_U)
    Event code 23 (KEY_I)
    Event code 24 (KEY_O)
    Event code 25 (KEY_P)
    Event code 26 (KEY_LEFTBRACE)
    Event code 27 (KEY_RIGHTBRACE)
    Event code 28 (KEY_ENTER)
    Event code 29 (KEY_LEFTCTRL)
    Event code 30 (KEY_A)
    Event code 31 (KEY_S)
    Event code 32 (KEY_D)
    Event code 33 (KEY_F)
    Event code 34 (KEY_G)
    Event code 35 (KEY_H)
    Event code 36 (KEY_J)
    Event code 37 (KEY_K)
    Event code 38 (KEY_L)
    Event code 39 (KEY_SEMICOLON)
    Event code 40 (KEY_APOSTROPHE)
    Event code 41 (KEY_GRAVE)
    Event code 42 (KEY_LEFTSHIFT)
    Event code 43 (KEY_BACKSLASH)
    Event code 44 (KEY_Z)
    Event code 45 (KEY_X)
    Event code 46 (KEY_C)
    Event code 47 (KEY_V)
    Event code 48 (KEY_B)
    Event code 49 (KEY_N)
    Event code 50 (KEY_M)
    Event code 51 (KEY_COMMA)
    Event code 52 (KEY_DOT)
    Event code 53 (KEY_SLASH)
    Event code 54 (KEY_RIGHTSHIFT)
    Event code 55 (KEY_KPASTERISK)
    Event code 56 (KEY_LEFTALT)
    Event code 57 (KEY_SPACE)
    Event code 58 (KEY_CAPSLOCK)
    Event code 59 (KEY_F1)
    Event code 60 (KEY_F2)
    Event code 61 (KEY_F3)
    Event code 62 (KEY_F4)
    Event code 63 (KEY_F5)
    Event code 64 (KEY_F6)
    Event code 65 (KEY_F7)
    Event code 66 (KEY_F8)
    Event code 67 (KEY_F9)
    Event code 68 (KEY_F10)
    Event code 69 (KEY_NUMLOCK)
    Event code 70 (KEY_SCROLLLOCK)
    Event code 71 (KEY_KP7)
    Event code 72 (KEY_KP8)
    Event code 73 (KEY_KP9)
    Event code 74 (KEY_KPMINUS)
    Event code 75 (KEY_KP4)
    Event code 76 (KEY_KP5)
    Event code 77 (KEY_KP6)
    Event code 78 (KEY_KPPLUS)
    Event code 79 (KEY_KP1)
    Event code 80 (KEY_KP2)
    Event code 81 (KEY_KP3)
    Event code 82 (KEY_KP0)
    Event code 83 (KEY_KPDOT)
    Event code 86 (KEY_102ND)
    Event code 87 (KEY_F11)
    Event code 88 (KEY_F12)
    Event code 96 (KEY_KPENTER)
    Event code 97 (KEY_RIGHTCTRL)
    Event code 98 (KEY_KPSLASH)
    Event code 99 (KEY_SYSRQ)
    Event code 100 (KEY_RIGHTALT)
    Event code 102 (KEY_HOME)
    Event code 103 (KEY_UP)
    Event code 104 (KEY_PAGEUP)
    Event code 105 (KEY_LEFT)
    Event code 106 (KEY_RIGHT)
    Event code 107 (KEY_END)
    Event code 108 (KEY_DOWN)
    Event code 109 (KEY_PAGEDOWN)
    Event code 110 (KEY_INSERT)
    Event code 111 (KEY_DELETE)
    Event code 119 (KEY_PAUSE)
    Event code 125 (KEY_LEFTMETA)
    Event code 126 (KEY_RIGHTMETA)
    Event code 127 (KEY_COMPOSE)
    Event code 158 (KEY_BACK)
    Event code 172 (KEY_HOMEPAGE)
    Event code 240 (KEY_UNKNOWN)
    Event code 241 (KEY_VIDEO_NEXT)
    Event code 304 (BTN_SOUTH)
    Event code 305 (BTN_EAST)
    Event code 306 (BTN_C)
    Event code 307 (BTN_NORTH)
    Event code 308 (BTN_WEST)
    Event code 309 (BTN_Z)
    Event code 310 (BTN_TL)
    Event code 311 (BTN_TR)
    Event code 312 (BTN_TL2)
    Event code 313 (BTN_TR2)
    Event code 314 (BTN_SELECT)
    Event code 315 (BTN_START)
    Event code 316 (BTN_MODE)
    Event code 317 (BTN_THUMBL)
    Event code 318 (BTN_THUMBR)
    Event code 319 (?)
    Event code 410 (KEY_SHUFFLE)
    Event code 704 (BTN_TRIGGER_HAPPY1)
    Event code 705 (BTN_TRIGGER_HAPPY2)
    Event code 706 (BTN_TRIGGER_HAPPY3)
    Event code 707 (BTN_TRIGGER_HAPPY4)
    Event code 708 (BTN_TRIGGER_HAPPY5)
    Event code 709 (BTN_TRIGGER_HAPPY6)
    Event code 710 (BTN_TRIGGER_HAPPY7)
    Event code 711 (BTN_TRIGGER_HAPPY8)
    Event code 712 (BTN_TRIGGER_HAPPY9)
    Event code 713 (BTN_TRIGGER_HAPPY10)
    Event code 714 (BTN_TRIGGER_HAPPY11)
    Event code 715 (BTN_TRIGGER_HAPPY12)
    Event code 716 (BTN_TRIGGER_HAPPY13)
    Event code 717 (BTN_TRIGGER_HAPPY14)
  Event type 3 (EV_ABS)
    Event code 0 (ABS_X)
      Value  32768
      Min        0
      Max    65535
      Fuzz     255
      Flat    4095
    Event code 1 (ABS_Y)
      Value  32767
      Min        0
      Max    65535
      Fuzz     255
      Flat    4095
    Event code 2 (ABS_Z)
      Value  32768
      Min        0
      Max    65535
      Fuzz     255
      Flat    4095
    Event code 5 (ABS_RZ)
      Value  32767
      Min        0
      Max    65535
      Fuzz     255
      Flat    4095
    Event code 7 (ABS_RUDDER)
      Value      0
      Min        1
      Max        8
    Event code 9 (ABS_GAS)
      Value      0
      Min        0
      Max     1023
      Fuzz       3
      Flat      63
    Event code 10 (ABS_BRAKE)
      Value      0
      Min        0
      Max     1023
      Fuzz       3
      Flat      63
    Event code 16 (ABS_HAT0X)
      Value      0
      Min       -1
      Max        1
    Event code 17 (ABS_HAT0Y)
      Value      0
      Min       -1
      Max        1
    Event code 40 (ABS_MISC)
      Value  32768
      Min        0
      Max    65535
      Fuzz     255
      Flat    4095
    Event code 41 (?)
      Value  32767
      Min        0
      Max    65535
      Fuzz     255
      Flat    4095
    Event code 42 (?)
      Value  32768
      Min        0
      Max    65535
      Fuzz     255
      Flat    4095
    Event code 43 (?)
      Value  32767
      Min        0
      Max    65535
      Fuzz     255
      Flat    4095
    Event code 44 (?)
      Value      0
      Min        0
      Max     1023
      Fuzz       3
      Flat      63
    Event code 45 (?)
      Value      0
      Min        0
      Max     1023
      Fuzz       3
      Flat      63
  Event type 4 (EV_MSC)
    Event code 4 (MSC_SCAN)
Key repeat handling:
  Repeat type 20 (EV_REP)
    Repeat code 0 (REP_DELAY)
      Value    250
    Repeat code 1 (REP_PERIOD)
      Value     33
Properties:
Testing ... (interrupt to exit)

Pressing the big button ‘A’:

Event: time 1538574732.484613, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90001
Event: time 1538574732.484613, type 1 (EV_KEY), code 304 (BTN_SOUTH), value 1
Event: time 1538574732.484613, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90010
Event: time 1538574732.484613, type 1 (EV_KEY), code 319 (?), value 1
Event: time 1538574732.484613, -------------- SYN_REPORT ------------
Event: time 1538574732.574441, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90001
Event: time 1538574732.574441, type 1 (EV_KEY), code 304 (BTN_SOUTH), value 0
Event: time 1538574732.574441, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90010
Event: time 1538574732.574441, type 1 (EV_KEY), code 319 (?), value 0
Event: time 1538574732.574441, -------------- SYN_REPORT ------------

So it is a bit less easy than with Ubuntu but we’ll get somewhere.