Mycroft + Arduino

Hi I’m running Mycroft on Ubuntu 18.04 installed from GitHub + Arduino Uno with mark1 code and I have led eyes connected to pin 3 the problem is it don’t work all together. Arduino works ok when I send commands over serial but don’t work with mycroft.

my user mycroft.conf

{
  "max_allowed_core_version": 19.8,
  "confirm_listening": false,
  "hotwords": {
    "hey mycroft": {
      "module": "pocketsphinx"
    }
  },
  "enclosure": {
    "platform": "mycroft_mark_1",
    "platform_build": 9,
    "port": "/dev/ttyUSB0",
    "rate": 9600,
    "timeout": 5,
    "update": true,
    "test": false
  }
}

and my logs from enclosure.log

2019-12-14 15:09:01.504 | INFO     |  3319 | mycroft.messagebus.load_config:load_message_bus_config:33 | Loading message bus configs
2019-12-14 15:09:02.904 | INFO     |  3319 | mycroft.enclosure.display_manager:init_display_manager_bus_connection:152 | Connecting display manager to messagebus
2019-12-14 15:09:02.907 | INFO     |  3319 | mycroft.messagebus.load_config:load_message_bus_config:33 | Loading message bus configs
2019-12-14 15:09:02.953 | INFO     |  3319 | mycroft.messagebus.client.client:on_open:67 | Connected
2019-12-14 15:09:03.107 | INFO     |  3319 | mycroft.messagebus.client.client:on_open:67 | Connected

Eyes are just looping and don’t respond on change color commands
it looks it not starting enclosure mark 1 end its not connecting with arduino
Do I need initialize it some how ??
how to get to work files from mycroft\mycroft-core\mycroft\client\enclosure ?

Update
to get it work you need create system config file in /etc/mycroft/mycroft.conf if u don’t have it
and add

    {
      "enclosure": {
        "platform": "mycroft_mark_1",
        "platform_build": 4,
        "port": "/dev/ttyUSB0",
        "rate": 9600,
        "timeout": 5,
        "update": true,
        "test": false
      }
    }

and then

sudo chmod /dev/ttyUSB0
sudo adduser [username] dialout

it is connecting

2019-12-15 17:10:40.970 | INFO | 6862 | mycroft.messagebus.load_config:load_message_bus_config:33 | Loading message bus configs
2019-12-15 17:10:42.337 | INFO | 6862 | mycroft.client.enclosure.mark1:__init_serial:338 | Connected to: /dev/ttyUSB0 rate: 9600 timeout: 5
2019-12-15 17:10:42.343 | INFO | 6862 | mycroft.enclosure.display_manager:init_display_manager_bus_connection:152 | Connecting display manager to messagebus
2019-12-15 17:10:42.345 | INFO | 6862 | mycroft.messagebus.load_config:load_message_bus_config:33 | Loading message bus configs
2019-12-15 17:10:42.377 | INFO | 6862 | mycroft.messagebus.client.client:on_open:67 | Connected
2019-12-15 17:10:42.383 | INFO | 6862 | mycroft.messagebus.client.client:on_open:67 | Connected

but nothing else yet need check arduino program

Next update
it is look like from code in init.py (in client/ enclosure/mark1/)that response form arduino is Mycroft Mark 1 v1.4.0 - Connect

not Command: system.version Mycroft Mark 1 v1.4.0

and when i run mycroft ./start-mycroft.sh all after couple sek. I am getting enter password prompt but

> pinki84@mediaone:~$ cd mycroft-core/
> pinki84@mediaone:~/mycroft-core$ ./start-mycroft.sh all
> Already up-to-date.
> Starting all mycroft-core services
> Initializing...
> Starting background service bus
> CAUTION: The Mycroft bus is an open websocket with no built-in security
>          measures.  You are responsible for protecting the local port
>          8181 with a firewall as appropriate.
> Starting background service skills
> Starting background service audio
> Starting background service voice
> Starting background service enclosure
> pinki84@mediaone:~/mycroft-core$ [sudo] password for pinki84:

it’s show every time when i restart enclosure
it’s look like some permission problem inside vitualenv
any advice ??

I setup some debugging to see where is error

  2019-12-16 12:55:49.848 | INFO     |  5722 | mycroft.messagebus.load_config:load_message_bus_config:33 | Loading message bus configs
    2019-12-16 12:55:51.272 | INFO     |  5722 | mycroft.client.enclosure.mark1:__init_serial:345 | Connected to: /dev/ttyUSB0 rate: 9600 timeout: 5
    2019-12-16 12:55:51.276 | DEBUG    |  5722 | mycroft.client.enclosure.mark1:__init__:276 | Prepare to receive message when the Arduino responds
    2019-12-16 12:55:51.281 | DEBUG    |  5722 | mycroft.client.enclosure.mark1:write:249 | Writing comand: system.version
    2019-12-16 12:55:51.284 | DEBUG    |  5722 | mycroft.client.enclosure.mark1:flush:243 | Writing comand: b'system.version\n'
    2019-12-16 12:55:51.287 | INFO     |  5722 | mycroft.enclosure.display_manager:init_display_manager_bus_connection:152 | Connecting display manager to messagebus
    2019-12-16 12:55:51.290 | INFO     |  5722 | mycroft.messagebus.load_config:load_message_bus_config:33 | Loading message bus configs
    2019-12-16 12:55:51.326 | INFO     |  5722 | mycroft.messagebus.client.client:on_open:67 | Connected
    2019-12-16 12:55:51.327 | INFO     |  5722 | mycroft.messagebus.client.client:on_open:67 | Connected
    2019-12-16 12:55:52.884 | DEBUG  |  5722 | mycroft.client.enclosure.mark1:read:82 | data recived: Mycroft Mark 1 v1.4.0 - Connect
    2019-12-16 12:55:52.887 | DEBUG  |  5722 | mycroft.client.enclosure.mark1:process:100 | message: Mycroft Mark 1 v1.4.0 - Connect
    2019-12-16 12:55:52.890 | DEBUG    |  5722 | mycroft.client.enclosure.mark1:read:88 | data to send: Mycroft Mark 1 v1.4.0 - Connect
    2019-12-16 12:55:56.288 | DEBUG    |  5722 | mycroft.client.enclosure.mark1:check_for_response:386 | there is nothing on other end

i changed
##(in init.py in client/ enclosure/mark1/)

if “Command: system.version” in data:
to
if “Connect” in data:

and it works

2019-12-16 13:31:35.157 | ERROR    |  8280 | mycroft.client.enclosure.mark1:process:108 | response true
    2019-12-16 13:31:35.159 | ERROR    |  8280 | mycroft.client.enclosure.mark1:read:88 | data to send: Mycroft Mark 1 v1.4.0 - Connect
    2019-12-16 13:31:35.170 | ERROR    |  8280 | mycroft.client.enclosure.mark1:on_arduino_responded:298 | on response
    2019-12-16 13:31:35.175 | ERROR    |  8280 | mycroft.client.enclosure.mark1:write:249 | Writing comand: eyes.reset
    2019-12-16 13:31:35.178 | ERROR    |  8280 | mycroft.client.enclosure.mark1:write:249 | Writing comand: mouth.reset
    2019-12-16 13:31:35.179 | ERROR    |  8280 | mycroft.client.enclosure.mark1:flush:243 | Writing error: b'eyes.reset\n'
    2019-12-16 13:31:35.181 | ERROR    |  8280 | mycroft.client.enclosure.mark1:flush:243 | Writing error: b'mouth.reset\n'
    2019-12-16 13:31:35.223 | WARNING  |  8280 | mycroft.client.enclosure.mark1:read:82 | data recived: Command: eyes.res
    2019-12-16 13:31:35.225 | WARNING  |  8280 | mycroft.client.enclosure.mark1:process:100 | message: Command: eyes.res
    2019-12-16 13:31:35.228 | ERROR    |  8280 | mycroft.client.enclosure.mark1:read:88 | data to send: Command: eyes.res
    2019-12-16 13:31:35.233 | WARNING  |  8280 | mycroft.client.enclosure.mark1:read:82 | data recived: Command: mouth.res
    2019-12-16 13:31:35.235 | WARNING  |  8280 | mycroft.client.enclosure.mark1:process:100 | message: Command: mouth.res
    2019-12-16 13:31:35.243 | ERROR    |  8280 | mycroft.client.enclosure.mark1:read:88 | data to send: Command: mouth.res
    2019-12-16 13:31:36.795 | ERROR    |  8280 | mycroft.client.enclosure.mark1:flush:243 | Writing error: b'mouth.text=< < < SYNC < < <\n'
    2019-12-16 13:31:36.816 | ERROR    |  8280 | mycroft.client.enclosure.mark1:write:249 | Writing comand: mouth.text=< < < SYNC < < <
    2019-12-16 13:31:36.876 | WARNING  |  8280 | mycroft.client.enclosure.mark1:read:82 | data recived: Command: mouth.text=< < < SYNC < <
    2019-12-16 13:31:36.879 | WARNING  |  8280 | mycroft.client.enclosure.mark1:process:100 | message: Command: mouth.text=< < < SYNC < <
    2019-12-16 13:31:36.881 | ERROR    |  8280 | mycroft.client.enclosure.mark1:read:88 | data to send: Command: mouth.text=< < < SYNC < <
    2019-12-16 13:31:51.836 | ERROR    |  8280 | mycroft.client.enclosure.mark1:write:249 | Writing comand: eyes.color=12433259
    2019-12-16 13:31:51.837 | ERROR    |  8280 | mycroft.client.enclosure.mark1:flush:243 | Writing error: b'eyes.color=12433259\n'
    2019-12-16 13:31:51.843 | ERROR    |  8280 | mycroft.client.enclosure.mark1:write:249 | Writing comand: mouth.text=< < < LOADING < < <
    2019-12-16 13:31:51.846 | ERROR    |  8280 | mycroft.client.enclosure.mark1:flush:243 | Writing error: b'mouth.text=< < < LOADING < < <\n'
    2019-12-16 13:31:51.902 | WARNING  |  8280 | mycroft.client.enclosure.mark1:read:82 | data recived: Command: eyes.color=124332
    2019-12-16 13:31:51.904 | WARNING  |  8280 | mycroft.client.enclosure.mark1:process:100 | message: Command: eyes.color=124332
    2019-12-16 13:31:51.906 | ERROR    |  8280 | mycroft.client.enclosure.mark1:read:88 | data to send: Command: eyes.color=124332
    2019-12-16 13:31:51.954 | WARNING  |  8280 | mycroft.client.enclosure.mark1:read:82 | data recived: Command: mouth.text=< < < LOADING < <
    2019-12-16 13:31:51.957 | WARNING  |  8280 | mycroft.client.enclosure.mark1:process:100 | message: Command: mouth.text=< < < LOADING < <
    2019-12-16 13:31:51.959 | ERROR    |  8280 | mycroft.client.enclosure.mark1:read:88 | data to send: Command: mouth.text=< < < LOADING < <

I thing i need change arduino code to not output this connect message Mycroft Mark 1 v1.4.0 - Connect

Arduino code from github mark1 1.4.0