Arduino provides an integrated development environment with hundreds of downloadable libraries available for simplifying all sorts of tasks.
When you are working outside an IDE with C and Python code, it is possible to just copy and paste code through the terminal emulator into
vi to save it for compiling. But with the Arduino IDE you probably need to have Wi-Fi to the Internet. Here's why.
- During initial setup, you run a
curlcommand on ARTIK to copy the Arduino client-side communications program from the Internet. (You could do this with just Ethernet connectivity if you prefer.)
- During use, when transferring a compiled program from the host PC, Arduino typically uses Wi-Fi. For Wi-Fi to work, your PC hosting the IDE and the ARTIK board must be on the same network.
- When using your board for development testing, your code will likely depend on Wi-Fi to communicate with IoT edge devices.
If you prefer, Arduino can optionally be configured to use the ARTIK integrated USB device port (different from the USB debug port) for program transfer as described here. Arduino uses the serial USB debug terminal interface primarily for error output. It does not use that link for program transfer.
Download the "libArduino howto" guide to get familiar with the environment setup. The steps below cover the same material that is in the howto guide, but provide some troubleshooting details. Refer to both guides as needed to get your installation working well.
Follow these instructions for both Wi-Fi and USB connectivity. You only need to perform these steps once on your ARTIK platform.
Step 1: Connect ARTIK to your PC Wi-Fi
The ARTIK board has to be Internet-connected. For Wi-Fi, you'll need to edit the
wpa_supplicant.conf file to add your network, reset, and run
dhclient wlan0 as noted here.
Step 2: Enable Client-side Transfer
For this step, your chosen network must have an unimpeded connection to the Internet, unblocked for HTTPS sites.
curl command into the terminal emulator to download and install the Arduino connectivity program:
curl downloads.arduino.cc/libArduino/install_artik_prereq.sh | sh
You should see clear download messages when you run this command; if not, then it was probably blocked by a firewall and did not succeed.
Once successful, reset your board and again run
Step 3: Install Arduino IDE on your PC
Go to the Arduino Web site to download and install the IDE package.
From time to time in the future, you may also need to copy the "hourly build" version on top of your existing installation to get the latest bug fixes.
Run the program now.
Step 4: Update Boards Manager
The Boards Manager interacts with the client-side program you just installed, and is ARTIK-specific. Select File > Preferences to pre-configure Boards Manager.
Copy and paste this URL into the place indicated.
making sure this is the only file listed (delete others if present).
Step 5: Select ARM Linux Boards Package
A. Under Tools > Board, select "Boards Manager".
B. Install the latest "ARM Linux Boards" package.
Step 6: Select Board in IDE
Under the Arduino IDE Tools drop-down, you must find Board: and select an "ARTIK 5 rev 0.5", "ARTIK 710", or "ARTIK 10" board.
Can't find your device? Be sure you (1) replaced the .json package name in Step 4, and (2) updated to the latest ARM Linux board manager in Step 5B.
Your one-time installation is now complete!
Operation with Wi-Fi
Now that you have the one-time setup done, you'll find actually using the IDE is a breeze. Remember that your PC must be on the same Wi-Fi network as the ARTIK board.
Start ARTIK and Connect to Wi-Fi. Start a terminal session and boot up your ARTIK board as usual, then make sure to run
dhclient wlan0and verify that you are connected to the same Wi-Fi network as your PC.
Select Port in IDE. Under the Tools drop-down, you must find Port: and select "linux at xx.xx.xx.xx (Samsung Artik …)".
Go to Troubleshooting below if you are not seeing the ports.
Code and Go! Compiling your Arduino code (Ctrl-u or using the menus) automatically loads it to ARTIK and starts the run. Remember, unless you put an explicit
exit()statement in your code, it will continue to execute until you compile and load another Arduino sketch.
Copying Executable Binary File to ARTIK
Once you have a debugged and working program, you will want to copy the compiled version to the ARTIK board to avoid having it recompile and transfer every time you want to run it.
To generate the executable file, simply select 'Sketch > Export compiled Binary'.
You will find the
.elf file in the same Arduino directory where your
.ino sketch is stored. Just copy it over to ARTIK using
scp or other means, use
chmod 755 xxx.elf to give it executable permission, and run it by entering
./xxx.elf at the command prompt.
No Linux port? If you can only see a COM port, but no Linux network ports, try selecting a COM port and then check Port again. Still no "linux…"? Try closing and re-opening the IDE.
If all attempts fail, then the reason is often one of the following.
curl...did not install its files correctly.
- Your PC and ARTIK are on different networks (the PC may have switched to another wireless network without your noticing).
- You forgot to run
dhclient wlan0or it failed and did not select a network.
- Your workplace has a proxy server that prevents direct connection (try connecting both your PC and ARTIK to your mobile phone Wi-Fi hotspot).
Compiles but fails to load? If your program compiles but upon load you see a page full of errors like
then it may mean that the SSH keys have been corrupted. Refer to the procedure in the Linux section of the Wi-Fi article for regenerating the keys.
See more than one network port? There will be cases where you have two or more boards to which you will load different Arduino code. Use the
ifconfig wlan0 command on the terminal emulator to each board to figure out the IP address of each.
Connecting Arduino IDE to ARTIK over USB
USB is an alternative to Wi-Fi for uploading sketches to the ARTIK board. The underlying mechanism uses Android Debug Bridge (
adb) as described in the USB – Device article, but the drivers are different.
For the Arduino case, the necessary
adb commands are generated from the
watcher script file on the ARTIK side, which triggers installation of Mac® or Windows® drivers. The installation is not fully automatic; follow the instructions carefully to fix it.
Setting up the USB Connection
Follow all steps under Initial Setup. You must be Internet-connected. If you do not have Wi-Fi access, you can use an Ethernet connection instead to execute
curlto install/update the board transfer software.
Note that transfer software versions available prior to 27 July 2016 did not fully support the USB transfer feature, so if your board had an earlier installation you may need to run the
Attach a USB cable to the integrated USB port (not the Dual Host or Debug ports) of the ARTIK board using the appropriate cable (standard type A for ARTIK 10 or mini type B for ARTIK 5 and ARTIK 7). Attach the other end (usually standard type A) to your PC or Mac.
ARTIK 5 ARTIK 7 ARTIK 10
On the ARTIK board, run the script
Initially you will see messages about
sketch.binsince no compiled sketch has been transferred yet. Ignore them, as well as the "already disabled" message.
[root@localhost ~]# ./watcher
[ 98.512305] android_usb: already disabled
ls: cannot access /tmp/sketch.bin: No such file or directory
--> Press Ctrl+C to force start, Ctrl+\ to exit
.ls: cannot access /tmp/sketch.bin: No such file or directory
Observe that after running the above command, your attached PC or Mac will attempt to install drivers; in the case of Windows 7 and later, an incorrect driver will initially be installed. Refer to the Fix instructions below to correct this.
Select Port in IDE. Under the Tools drop-down, you must find Port: and select "COMxx (Samsung Artik #)" under "Serial Ports". If the correct drivers are installed, the port will appear in the list. Try closing and restarting the IDE if you do not see it.
Upload your compiled sketch to the serial port and you should be able to get the SUCCESS message on your console. If not, there is a "verbose" setting under Preferences that might help you determine the problem.
If you see an error: device not found failure, use Boards Manager to update ARM Linux Boards to version 0.4.1 or higher.
Fix USB Connection to Mac
The connected ARTIK device should be identified as a serial device. In case you do not see "Samsung Artik" show up as a serial port in Arduino IDE:
[root@localhost ~]# echo 0x04e8 > ~/.android/adb_usb.ini
[root@localhost ~]# cat ~/.android/adb_usb.ini
Reset the ARTIK board and re-launch the
From the Arduino IDE, you should now see the serial port, in our example
/dev/cu.usbmodem1421 (Samsung Artik 5)
Fix USB Connection to Windows PC
Because there are various
adb-related configurations possible with an ARTIK board (such as adbd.service and fastboot), the Windows driver that gets installed initially is probably not the correct one for Arduino. We'll correct that here.
To prepare, run Device Manager and under View select 'Devices by connection'. Then follow these instructions.
- If you have not done so, attach the USB cable and run
In Device Manager, Windows Update picks an Android placeholder with a yellow mark to indicate a problem. It should get replaced before you get a chance to see it, but if you are behind a proxy, be patient – it could take several minutes.
Wait for Windows Update to find an initial driver. If it says:Samsung Android Phone
- Samsung Artik Composite ADB Interface
then it is the wrong device type to update.
Fixing this is a necessary prerequisite. You must right-click on the "composite" entry and update its driver to:
- Samsung Artik ADB Interface
then reset the board, and start again at step 1 to run
Wait for Windows Update to show:Samsung Android Phone
- Samsung Artik ADB Interface
(missing the word "composite"). This is now a device type that can be updated.
Right-click on "Samsung Artik ADB Interface" and select 'Update Driver Software…'.
Click 'Browse my computer for driver software'.
Click 'Let me pick from a list of device drivers on my computer'.
The selections should include the current driver and 'USB Composite Device'. Choose this generic second option.
Say "yes" to the note that it may not be the best choice, and let the installation complete. It will show failure, as by now the ARTIK board will have disconnected (you will see a lot of messages on the terminal screen).
- Reset the ARTIK board and relaunch
watcher. You may see an intermediate device pair that includes 'CDC Serial', which is correct.
The final installation (which, once again, may be slow if you are behind a proxy) will replace the intermediate devices to show:
USB Composite Device
-- Samsung Artik Composite ADB Interface
-- Samsung Artik Communications Port (COMx)