Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Wednesday, March 3, 2021

Install Arduino IDE 2.0 beta on Linux Mint 20.1, include ESP32/ESP8266 support.

Arduino IDE 2.0 (beta) is now available (refer to announcement in Arduino blog). It,s my first try to install Arduino IDE 2.0 beta (2.0.0-beta3) on Linux Mint 20.1, tested with VirtualBox 6.1/Windows 10.

Download Arduino IDE 2.0 beta

Visit https://www.arduino.cc/en/software, scroll download to download Arduino IDE 2.0 beta for Linux 64 bits (X86-64).

Run arduino-ide

Extract the downloaded file to a any folder you want. Run arduino-ide in Terminal
$ ./arduino-ide

Install board

In a fresh new installed Arduino IDE 2.0, no board is installed, you will be report with error:

Compilation error: Error: 2 UNKNOWN: platform not installed

Click Boards Manager on left, search to install Arduino AVR Boards by Arduino.

Add permission to user, to access USB

In a new Linux, you (as a regular user) have no permission to access USB port, and report with error:

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

Open Terminal, enter the command to add permission:
$ sudo usermod -a -G dialout <username>
$ sudo chmod a+rw <port>

Done.



Install board support for ESP32/ESP8266


Menu > File> Preferences
Enter the url in the "Additional Board Manager URLs":

Then you can add board of ESP32/ESP8266 in Boards Manager.

Setup Python

By default Linux Mint 20.1 pre-install Python3, but no Python2. Currently, esptool for ESPs call python. You can create a symlinks /usr/bin/python to python3 by installing python-is-python3.

$ sudo apt install python-is-python3

Optionally, you can prevent Python 2 from being installed as a dependency of something in the future:

$ sudo apt-mark hold python2 python2-minimal python2.7 python2.7-minimal libpython2-stdlib libpython2.7-minimal libpython2.7-stdlib

And you have to install pyserial with pip:

$ sudo apt install python3-pip
$ pip3 install pyserial

Add permission to your user (if not do in above steps):

Additionally, if you cannot download your code to board caused by:
avrdude: ser_open(): can't open device "/dev/xxx": Permission denied

$ sudo usermod -a -G dialout <username>
$ sudo chmod a+rw <port>











Tuesday, January 28, 2014

Install GTK+3 and compile with gcc in Linux

To install GTK+3 to develop GUI program on Linux (eg.Ubuntu), you have to install libgtk-3-dev, enter the command in Terminal:
$ sudo apt-get install libgtk-3-dev

To compile your souce code using gcc, with GTK+3:
$ gcc <your_code>.c -o <your_code> `pkg-config --cflags --libs gtk+-3.0`

where <your_code>.c is your c source code. <your_code> is the generated program.

Notice the symbol `, not ' or ".

Then run it with:
$ ./<your_code>

Check a example: Send data to Arduino from Linux PC, program in C with GUI of GTK+3, as ColorChooser

Saturday, January 25, 2014

Determine attached port and send data to Arduino in Terminal, on Linux

In Linux, to determine Arduino attached port, can use dmesg command:

  • Insert the USB cable connected with Arduino to PC USB port.
  • Enter command:
    $ dmesg
  • The new attached device should be list in last.
    It's ttyACM0 in my case. So /dev/ttyACM0 is the port of the device attached.
To send data to USB port, use the command:
$ echo "Hello Arduino-er" > /dev/ttyACM0

Determine attached port and send data to Arduino in Terminal
Determine attached port and send data to Arduino in Terminal
In the video below, the Arduino Esplora run the program in last post "Serial communication between Arduino Esplora and PC" to display char received from Serial to LCD screen.


Wednesday, August 14, 2013

Smart Home Automation with Linux and Raspberry Pi, Second Edition

Smart Home Automation with Linux and Raspberry Pi, Second Edition
Smart Home Automation with Linux and Raspberry Pi, Second Edition
Smart Home Automation with Linux and Raspberry Pi shows you how to automate your lights, curtains, music, and more, and control everything via a laptop or mobile phone.

You'll learn how to use Linux, including Linux on Raspberry Pi, to control appliances and everything from kettles to curtains, including how to hack game consoles and even incorporate LEGO Mindstorms into your smart home schemes. 

You’ll discover the practicalities on wiring a house in terms of both and power and networking, along with the selection and placement of servers. There are also explanations on handling communication to (and from) your computer with speech, SMS, email, and web. Finally, you’ll see how your automated appliances can collaborate to become a smart home.

Smart Home Automation with Linux was already an excellent resource for home automation, and in this second edition, Steven Goodwin will show you how a house can be fully controlled by its occupants, all using open source software and even open source hardware like Raspberry Pi and Arduino.

What you’ll learn

  • Control appliances like kettles and curtains both locally and remotely.
  • Find and harness data sources to provide context-aware living.
  • Hack/change existing hardware/software to better fit your needs.
  • Integrate various technologies into a function greater than the whole.
  • Set up a home network, for both network and audio/video traffic.
  • Learn how to incorporate Raspberry Pi, Arduino, and even LEGO Mindstorms into your smart home.

Who this book is for

This book is for amateur and professional Linux users and electronics enthusiasts who want to control their homes and their gadgets.

Table of Contents

  1. Appliance Control: Making Things Do Stuff 
  2. Appliance Hacking: Converting Existing Technology  
  3. Media Systems: Incorporating the TV and the HiFi 
  4. Home is Home: The Physical Practicalities
  5. Communication: Humans Talk, Computers Talk 
  6. Data Sources: Making Homes Smart 
  7. Control Hubs: Bringing It All Together 
  8. Working with Raspberry Pi
June 12, 2013  143025887X  978-1430258872 2

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