Last active
May 21, 2017 21:37
-
-
Save MartyMacGyver/b14a0ed77e3c3ac3ddf85b714b30401b to your computer and use it in GitHub Desktop.
Installing Arduino on Ubuntu 16.04+ (also Star OTTO info!)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################################### | |
# Installing Arduino on Ubuntu 16.04+ | |
############################################################################### | |
### Set project area | |
export MYPROJROOT=~/Projects | |
export MYPKGNAME=arduino | |
export MYPKGVER=1.8.2 | |
export MYPKGOS=linux | |
export MYPKGARCH=amd64 # Intel architectures | |
export MYPKGDEST=/usr/local/${MYPKGNAME}-${MYPKGVER} | |
### Preparation | |
mkdir -p ${MYPROJROOT} | |
cd ${MYPROJROOT} | |
rm -rf ${MYPKGNAME} ${MYPKGNAME}-${MYPKGVER} | |
# Get the release binaries | |
cd ${MYPROJROOT} | |
wget https://downloads.arduino.cc/${MYPKGNAME}-${MYPKGVER}-linux64.tar.xz | |
mv ${MYPKGNAME}-${MYPKGVER}-linux64.tar.xz ${MYPKGNAME}-${MYPKGVER}-cc-linux64.tar.xz | |
wget http://download.arduino.org/IDE/${MYPKGVER}/${MYPKGNAME}-${MYPKGVER}-linux64.tar.xz | |
mv ${MYPKGNAME}-${MYPKGVER}-linux64.tar.xz ${MYPKGNAME}-${MYPKGVER}-org-linux64.tar.xz | |
#tar xJf ${MYPKGNAME}-${MYPKGVER}-org-linux64.tar.xz # This one doesn't include Java... bizarre! | |
tar xJf ${MYPKGNAME}-${MYPKGVER}-cc-linux64.tar.xz | |
### Fix a bug in 1.8.2 Arduino.cc installer | |
### per https://askubuntu.com/questions/107619/how-do-i-install-the-arduino-ide/913820#913820 | |
sed -i '/RESOURCE_NAME=cc.arduino.arduinoide/c\RESOURCE_NAME=arduino-arduinoide' ${MYPKGNAME}-${MYPKGVER}/install.sh | |
### Install the package | |
cd ${MYPROJROOT} | |
sudo rm -rf /usr/local/${MYPKGNAME}-${MYPKGVER} | |
sudo cp -rp ${MYPROJROOT}/${MYPKGNAME}-${MYPKGVER} /usr/local | |
sudo chown root:root /usr/local/${MYPKGNAME}-${MYPKGVER} # Ubuntu | |
sudo chmod -R g-s /usr/local/${MYPKGNAME}-${MYPKGVER} | |
sudo rm /usr/local/${MYPKGNAME} | |
sudo ln -s /usr/local/${MYPKGNAME}-${MYPKGVER} /usr/local/${MYPKGNAME} | |
### Add desktop icons if desired | |
/usr/local/${MYPKGNAME}/install.sh | |
### For the Ardino Star OTTO, there's a bit of extra work the first time 'round | |
### per http://www.arduino.org/learning/getting-started/getting-started-with-arduino-star-otto | |
cat > 40-dfuse.rules.arduino << EOF | |
# Example udev rules (usually placed in /etc/udev/rules.d) | |
# Makes STM32 DfuSe device writeable for the "plugdev" group | |
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE="664", GROUP="plugdev" | |
EOF | |
sudo cp 40-dfuse.rules.arduino /etc/udev/rules.d/40-dfuse.rules | |
sudo udevadm control --reload-rules | |
sudo udevadm trigger | |
### Fix more things | |
### From https://arduino.stackexchange.com/questions/21215/first-time-set-up-permission-denied-to-usb-port-ubuntu-14-04/21219 | |
sudo usermod -a -G dialout ${USER} | |
## Now reboot! | |
### Test the installation | |
# Either click the icon (above) | |
# -- or -- | |
# Ensure the package is in your path (e.g., edit your .profile, then source it with `. ~/.profile`) | |
export PATH=$PATH:/usr/local/arduino | |
cd $HOME | |
arduino | |
### For the Star OTTO | |
# In the boards Manager, install the current Arduino STM32F4 Boards package | |
# Plug the OTTO into a USB port | |
# Select the OTTO board, and its port (should be '/dev/ttyACM0' or similar) | |
# If you're doing this in a VM, you probably won't see the OTA device available | |
# Load the Examples -> 01.Basics -> Blink sketch | |
# Build and upload it | |
# You might need to reset the board to make the sketch active | |
# Problems? See the Q&A at the end of this article! | |
### Clean up | |
rm -rf ${MYPROJROOT}/${MYPKGNAME}-${MYPKGVER} | |
############################################################################### | |
### Q&A | |
############################################################################### | |
Q: Why do I see a billion "redefintion" warnings when building for the OTTO? | |
A: I have no idea. It's highly annoying. | |
Q: I get permission errors trying to open the serial port! | |
A: Either you didn't restart after adding yourself to the 'dialout' group above, | |
or that's not the right solution for your system. Refer to the thread for | |
possible solutions. | |
Q: I'm using VMWare to do this via an Ubuntu VM but it's not connecting the device. | |
A: In the VM settings, unser USB Controller, be sure "Automatically connect new USB devices" | |
is ticked. (You'll need to shut down the VM to make this change.) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've learned that gist has a major old bug wherein you don't get notifications for comments to gists.
If you leave a comment, it would be appreciated if you ping me elsewhere so I know to find it!