Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

Wednesday, June 24, 2020

Install Arduino IDE 1.8.13 on Ubuntu 20.04

To run Arduino IDE, you have to install Java on Ubuntu, refer last post Install JDK (OpenJDK) on Ubuntu 20.04.


Visit https://www.arduino.cc/ to download Linux 64 bits version.

Extract the downloaded file and more to where you want. Switch to the folder and run:
$ sudo ./install.sh

You will be reported with error of:

An error occurred while uploading the sketch
avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission denied

You can add you (the user) to the group own permission of the upload port:

$sudo usermod -a -G dialout <username>
$sudo chmod a+rw /dev/ttyACM0

change username and ttyACM0 according to your setup.

logout and login.



Basically, the steps to install Arduino IDE on Ubuntu 20.04 are same as install on previous version of Ubuntu. But if you target to develop for ESP32/ESP8266, very likely you will be with error of:
exec: "python": executable file not found in $PATH
ModuleNotFoundError: No module named 'serial'

Check next post - Install ESP32/ESP8266 to Arduino IDE on Ubuntu 20.04, with setup Pythton & serial

Install JDK (OpenJDK) on Ubuntu 20.04


Install JDK 14.0.1 (from Oracle) on Ubuntu 20.04

- Visit https://jdk.java.net/ to download latest JDK of Linux/x64, currently openjdk-14.0.1_linux-x64_bin.tar.gz

- Extract the downloaded file:
$ tar -zxvf openjdk-14.0.1_linux-x64_bin.tar.gz

-  Create a folder in /opt/java where jdk will be stored.
$ sudo mkdir -p /opt/java

- Move the extracted folder to /opt/java
$ sudo mv jdk-14.0.1 /opt/java

- Set default java and javac using update-alternatives:
$ sudo update-alternatives --install /usr/bin/javac javac /opt/java/jdk-14.0.1/bin/javac 1
$ sudo update-alternatives --install /usr/bin/java java /opt/java/jdk-14.0.1/bin/java 1
$ sudo update-alternatives --config javac
$ sudo update-alternatives --config java


Friday, May 8, 2020

Install VS Code/PlatformIO IDE on Ubuntu 20.04, to program Arduino/ESP8266/STM32.

This video show how to install VS Code/PlatformIO IDE on Ubuntu 20.04 (run on Windows 10/VirtualBox), to program Arduino. And also set upload port in platformio.ini and add USB permission to user.


Visit Visual Studio Code download page to download .deb version for Ubuntu.

After downloaded, open Terminal and switch to the downloaded folder and run the command to install VS Code:

$ sudo apt install ./<file>.deb

(reference: Visual Studio Code on Linux)

After installed, search and run VSCode.

In VS Code, select Extensions tab, enter platformIo in the search box, and click to install platformIO IDE.


(This screen shot after PlatformIO IDE installed. Before install, you can see a Install button.)

If you report with error of ModuleNotFoundError: No module named 'distutils.***'

Enter the command to install python3-distutils:

$ sudo apt-get install python3-distutils

(reference: https://github.com/platformio/platformio-vscode-ide/issues/907)

Close and restart VS Code to complete installation.

Now you can select PlatformIO on the left, and create a New Project. For Arduino Uno, steps refer to the above video.

May be you have to specify the upload port in platformio.ini. Open platformio.ini and add the code:
upload_port = /dev/ttyACM0

where /dev/ttyACM0 is the USB port.

Also have to add permission of the USB port to user. Enter the command in Terminal:
$ sudo usermod -a -G dialout <username>
$ sudo chmod a+rw /dev/ttyACM0

more:
2.8" 320*240 TFT Touch Screen shield (ILI9341 8 bit I/F) on Uno, using MCUFRIEND_kbv and Adafruit GFX Libraries
TFT Touch Screen shield (ILI9341 8 bit) + Uno, calibration and simple touch drawing example.


Platform IO + ESP8266/ESP32

With PlatformIO IDE installed, you can also program ESP8266/ESP32 board of Arduino framework. This video show the steps.



The following video show how to install library in PlatformIO, for I2C SSD1306 OLED driver for ESP8266/ESP32.


This example run on ESP32 (WEMOS Lolin32 with integrated SSD1306/OLED driver).

#include <Wire.h>
#include <SSD1306Wire.h>

SSD1306Wire display(0x3C, 5, 4);

void setup() {
  // put your setup code here, to run once:

  display.init();
  display.flipScreenVertically();
  display.setTextAlignment(TEXT_ALIGN_LEFT);
  display.setFont(ArialMT_Plain_16);
}

void loop() {
  // put your main code here, to run repeatedly:

  display.clear();
  display.drawString(0, 0, "ESP32/OLED");
  display.drawString(0, 20, "Hello PlatformIO");
  display.display();

  delay(1000);
  
}


Reference:
~ My old post: ESP32 + OLED Module

Next:
ESP8266 (NodeMCU/ESP8266 DevKitC) + SSD1306 I2C OLED, Platform IO.


PlatformIO + STM32

PlatformIO also can program STM32, such as NUCLEO-F401RE Board.



KEY FEATURES of NUCLEO-F401RE Board:

- Common features
  • STM32 microcontroller in LQFP64 package
  • 1 user LED shared with Arduino™
  • 1 user and 1 reset push-buttons
  • 32.768 kHz crystal oscillator
  • Board connectors:Arduino™ Uno V3 expansion connectorST morpho extension pin headers for full access to all STM32 I/Os
  • Flexible power-supply options: ST-LINK, USB VBUS or external sources
  • On-board ST-LINK debugger/programmer with USB re-enumeration capability: mass storage, Virtual COM port and debug port
  • Comprehensive free software libraries and examples available with the STM32Cube MCU Package
  • Support of a wide choice of Integrated Development Environments (IDEs) including IAR™, Keil® and GCC-based IDEs

- NUCLEO-F401RE Board-specific features
  • External SMPS to generate Vcore logic supply
  • 24 MHz HSE
  • Board connectors:External SMPS experimentation dedicated connectorMicro-AB or Mini-AB USB connector for the ST-LINKMIPI® debug connector
  • Arm® Mbed Enabled™ compliant
Reference: NUCLEO-F401RE

Steps to create  a new project for NUCLEO-F401RE Board, using Arduino and Mbed framework.


Error: libusb_open() failed with LIBUSB_ERROR_ACCESS

To make PlatformIO run on Ubuntu, in addition to add USB permission to user as describe above, you have to install udev rules (99-platformio-udev.rules) also.

Enter the commands in Terminal:

$ curl -fsSL https://raw.githubusercontent.com/platformio/platformio-core/master/scripts/99-platformio-udev.rules | sudo tee /etc/udev/rules.d/99-platformio-udev.rules

$ sudo service udev restart

After this file is installed, physically unplug and reconnect your board.


Update VS Code for Ubuntu

If update of VS Code is available and you are asked to Download Update.


Just close VS Code and run the commands in Terminal:

$ sudo apt-get install apt-transport-https
$ sudo apt-get update
$ sudo apt-get install code # or code-insiders

reference: https://code.visualstudio.com/docs/setup/linux

Updated 1.46.0 currently@2020-06-11



Wednesday, April 10, 2019

Install Arduino IDE 1.8.9 on Ubuntu 18.10 and set permission for serial port

This video show how to install the latest Arduino IDE 1.8.9 on a fresh new Ubuntu 18.10 (on VirtualBox 6.0/Windows 10).



This installation is very straightforward:
- visit Arduino Software download page to download the Linux 32 bits or 64 bits version corresponding to your system.
- Extract the downloaded file to the where you want to install.
- Open Terminal to run the install.sh with sudo.
$ sudo ./install.sh

After finished, you can start Arduino IDE with arduino command or from Application launcher.

But...up to this step, you have no permission to access the serial port. When you download the code to Arduino devices, you will be reported with error:

avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission denied


To fix it, you have to add permission:
- Open Terminal, enter the command:
$ sudo usermod -a -G dialout <username>
$ sudo chmod a+rw /dev/ttyACM0


Tuesday, August 26, 2014

Arduino IDE error - avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission denied

If you run Arduino IDE on Ubuntu (Arduino 1.5.7 and Ubuntu 14.04 in my case), most possibly you cannot upload to Arduino board, caused by the error of:

avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission denied
ioctl("TIOCMGET"): Inappropriate ioctl for device

To fix it, enter the command:
$ sudo usermod -a -G dialout <username>
$ sudo chmod a+rw /dev/ttyACM0

Where <username> is your user name in Ubuntu, /dev/ttyACM0 is the detected device of your Arduino board.

Check the video:

Saturday, July 6, 2013

Install OpenGL library

To install OpenGL library on Ubuntu. Enter the command in Terminal:

$sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev

Install g++ on Ubuntu

To install g++ on Ubuntu, enter the command in Terminal:

$sudo apt-get install g++

Friday, June 14, 2013

Download ADK Source in Ubuntu

The document "Downloading the ADK Source" describe how to obtain the source material for the ADK. Before that, we have to install curl, git and repo. The steps below show how to install the tools and also ADK source in Ubuntu (13.04).

- Open Terminal.

- Install curl
$sudo apt-get install curl

- Install git
$sudo apt-get install git

- Then create bin/ directory in home directory, and include it in your path.
$mkdir ~/bin
$PATH=~/bin:$PATH

- Install Repo
$curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$chmod a+x ~/bin/repo

- Finally, create a new directory for the downloaded ADK source files, initialize and synchronize a local repository:
$mkdir android-accessories
$cd android-accessories
$repo init -u https://android.googlesource.com/accessories/manifest
$repo sync

After successfully completing this process, you should have the source code and tools for working with the ADK 2012:

adk2012/board - Source code and hardware design files for the ADK 2012
adk2012/app - Source code for the ADK 2012 Android companion application
external/ide - Source code for the ADK 2012 Integrated Development Environment (IDE)
external/toolchain - The toolchain used by the ADK 2012 IDE

Monday, March 25, 2013

serial.serialutil.SerialException: could not open port /dev/ttyACM0

If you try the steps in the post "Talk with Arduino Due in Python Shell" in Linux (Ubuntu in my setup). May be you will be complained with the error of:

serial.serialutil.SerialException: could not open port /dev/ttyACM0: [Errno 13] Permission denied: '/dev/ttyACM0'

Because your user account have no right to access the /dev/ttyACM0 port. You have to add your user account to the dialout group. Enter the command in Terminal:

$sudo usermod -a -G dialout <username>

After you plug in the usb cable, run the command (it need to be run every time plug-in):

$sudo chmod a+rw /dev/ttyACM0

serial.serialutil.SerialException
serial.serialutil.SerialException

Thursday, March 21, 2013

Install pySerial on Ubuntu

To check if pySerial installed, open Python Shell, type the command:

>>>import serial

if error message returned, means pySerial not installed.

pySerial not installed
pySerial not installed with error

- To install pySerial on Ubuntu, download and unpack pyserial, open Terminal and change to the unpacked folder.

- To install for Python 2.x, type the command:

$sudo python setup.py install


- To install for Python 3.x, type the command:

$sudo python3 setup.py install

(To install the module for all users on the system, administrator rights (root) is required, run with sudo.)


pySerial installed
import serial with pySerial installed


Tuesday, February 19, 2013

Ubuntu for tablets announced

With unique multitasking productivity, effortless navigation and defence-ready security, Ubuntu raises the bar on tablet design and sets a new standard for the post-PC era. Bright. Brilliant. Beautiful. And naturally neat...source: http://www.ubuntu.com/devices/tablet