Author Topic: Microcontrollers (Arduino, MicroPython, etc) via USB serial ?  (Read 4013 times)

rcolistete

  • Newbie
  • *
  • Posts: 12
    • View Profile
Microcontrollers (Arduino, MicroPython, etc) via USB serial ?
« on: August 18, 2018, 12:13:43 pm »
I'd to like to use Debian on Gemini to do microcontrollers development using USB cable (USB serial interface) to run Arduino IDE, MicroPython (via screen, rshell, etc). They use USB serial communication.

After installing the modular Linux kernel and extra module for the Gemini PDA with USB serial drivers, optimizatons, etc, from :
PL2303 serial adapter drivers?
http://www.mygnu.de/index.php/2018/07/impr...the-gemini-pda/
my microcontrollers (ESP8266, BC Micro:bit, Arduino Nano, etc) are recognized as /dev/ttyACM0 or /dev/ttyUSB0, but "screen" doesn't work (closes connection after starting) and Arduino IDE doesn't show any serial port.

(2018/08/21) : SOLUTION FOUND : solution is not only to add gemini user to dialout group (it was already becuase gemini is the unique user), but also to change the group of the tty devices to dialout (it is not done automatically like other Linux) :
Code: [Select]
$ sudo usermod -a -G dialout gemini
$ sudo chgrp dialout /dev/ttyACM0
$ sudo chgrp dialout /dev/ttyUSB0
Repeat for any other USB serial tty port (USB1 for a 2nd microcontroller, etc).

Tested with :
- Arduino IDE (v1.8.5 installed using Flatpak, see other topic) with ESP8266, worked well, only some large menu/dialog fonts.
- rshell or screen connecting Pyboard with MicroPython, 100% ok !

Important : the microcontrollers were connected with microUSB & USB-A cable to a USB-C -> USB-A hub in the left port of Gemini.
« Last Edit: January 06, 2019, 11:12:09 am by rcolistete »

Murple2

  • Full Member
  • ***
  • Posts: 137
    • View Profile
Microcontrollers (Arduino, MicroPython, etc) via USB serial ?
« Reply #1 on: August 21, 2018, 03:48:39 am »
Quote from: rcolistete
I'd to like to use Debian on Gemini to do microcontrollers development using USB cable (USB serial interface) to run Arduino IDE, MicroPython (via screen, rshell, etc). They use USB serial communication.

After installing the modular Linux kernel and extra module for the Gemini PDA with USB serial drivers, optimizatons, etc, from :
PL2303 serial adapter drivers?
http://www.mygnu.de/index.php/2018/07/impr...the-gemini-pda/
my microcontrollers (ESP8266, BC Micro:bit, Arduino Nano, etc) are recognized as /dev/ttyACM0 or /dev/ttyUSB0, but "screen" doesn't work (closes connection after starting) and Arduino IDE doesn't show any serial port.

Any hints ?

PS : this posts was deleted by error, then I posted it again.

Does your user have permission to use serial? On Arch Linux I have to add myself to the uucp group, but on Debian I think it is the dialout[\b] group. Maybe a Debian person can confirm?

Anyway the command would be something like
Code: [Select]
usermod -a -G dialout [i]yourusername[/i]

rcolistete

  • Newbie
  • *
  • Posts: 12
    • View Profile
Microcontrollers (Arduino, MicroPython, etc) via USB serial ?
« Reply #2 on: August 21, 2018, 04:27:23 am »
Quote from: Murple2
Does your user have permission to use serial? On Arch Linux I have to add myself to the uucp group, but on Debian I think it is the dialout[\b] group. Maybe a Debian person can confirm?

Anyway the command would be something like
Code: [Select]
usermod -a -G dialout [i]yourusername[/i]
Thanks, it is not only to add gemini user to dialout (it was already), but to add the dialout grupo to the usb-serial device files (/dev/ttyACM0, /dev/ttyUSB0, etc), see the 1st post modified with the solution.

rcolistete

  • Newbie
  • *
  • Posts: 12
    • View Profile
Microcontrollers (Arduino, MicroPython, etc) via USB serial ?
« Reply #3 on: August 21, 2018, 04:47:35 am »
After the configuration cited in the 1st post, some useful CLI and GUI usb-serial tools that I use with my MicroPython boards (Pyboard, ESP8266, BBC Micro:bit, LoPy, ESP32, etc) :

- screen (terminal serial) :
$ sudo apt-get install screen

- rshell (Remote MicroPytyhon shell) :
$ pip3 install rshell

- ESPTool to install MicroPython firmware on ESP8266 and ESP32 :
$ pip install esptool

- Ampy (Adafruit MicroPython Tool) :
$ pip install adafruit-ampy

- uflash and ufs for MicroPython on BBC Micro:bit :
$ pip install uflash microfs

- Mu Editor for MicroPython on BBC Micro:bit, CircuitPython on Adafruit boards, Pygame Zero, Python3, follow :
"How to install Mu with Python packaging on Windows, OSX and Linux"
$ pip3 install mu-editor
but it has dependencies problems with PyQt5 on Debian @ Gemini, so it doesn't install.
« Last Edit: August 21, 2018, 04:48:12 am by rcolistete »

rcolistete

  • Newbie
  • *
  • Posts: 12
    • View Profile
Microcontrollers (Arduino, MicroPython, etc) via USB serial ?
« Reply #4 on: January 06, 2019, 11:17:11 am »
If screen, rshell, etc, don't work, then use "sudo" before these commands.

I don't know the reason, even after the "usermod" and "chgrp", in the last months I have to use "sudo", while it wasn't needed in August.
« Last Edit: January 06, 2019, 02:23:48 pm by rcolistete »