I like to measure how easy it is to use a microcontroller or a development board by "time to blinky." How long does it take from first unboxing the board to blinking an LED?
In this super short guide, you'll see just how fast* it takes to blink an LED on the ARTIK 5.
* (I wrote this before I had actually gotten to blinky - if you follow my epic journey, you will see I may have spoken too soon)
You can check out the official documentation for the ARTIK 5 and ARTIK 10 here.
Start out by Powering Up The Board:
1.) Screw an antenna onto the CPU WIFI Antenna connector (labeled WiFi/Bluetooth connector in the diagram)
2.) Connect the board to your computer using the USB cable. There is only one micro-USB connector (labeled "USB debug" and located nearest to the MCU) on the board. You should see the Rx and Tx LEDs light up.3.) Make sure the power switch on the development board is set to the off position.4.) Plug in the AC side of the 5V power supply to your power outlet, and the other end into the development board.
5.) Flip the power switch on the development board to the on position. The LED next to the "SW3 POWER" button should light up.
I couldn't find the power switch until I realized that it is hiding in plain sight. It is right next to the 5V power adapter's input.
My board is an ARTIK 5, V. 3.1, so I have to change the jumpers, as shown in the images below:
Communicating with the ARTIK
If you have a you don't have a mac, you can follow the guides for communicating with PCs and Linux computers at artik.io.
I'm a big fan of CoolTerm, which is a pUTTY substitute for mac.
I use it here instead of the Terminal. Find the ARTIK's COM port in CoolTerm. Select it, and select 11500 as the baud rate. Then click "Connect."
At first, the CoolTerm window will be blank. Press the "S3 POWER button" to reset the board.
You should see a screen like this:
Log in using the username "root" and the password "root"
Now you're connected to the board.
Install the latest version of the Arduino IDE
Download Arduino IDE 1.6.6 or later (hourly version) (https://www.arduino.cc/en/Main/Software#hourly) for your Operating System.
Add http://downloads.arduino.cc/libArduino/package_arduino.cc_linux_index.json to "Additional Board Manager URLs" inside IDE's Preferences
Open "Boards Manager" (go to "Tools" > "Board" - you'll find "Boards Manager" above the list of boards) and click on the "ARM Linux Boards" package. Select "Install."
You can now select "Samsung Artik 5" in the “Tools/Boards” menus.
Make the Circuit
Use a breadboard, a couple of jumper wires, a 10 Ohm resistor, and an LED. Connect the resistor to the LED's anode, connect the LED's cathode to pin 13 on the ARTIK 5.
Upload the Code
In the Arduino IDE, I connect to the board and port:
I make sure that I have arduino
I select the blink sketch and compile it.
I got several warnings upon compiling and uploading failed completely.
I wonder if perhaps the problem is that uploading over the COM port doesn't work yet. I decided to see if I could connect the board to the network to upload the code over WIFI.
Configure WIFI on ARTIK 5
It will be easiest to connect to WIFI if we connect to the board using the terminal, since we'll need to edit some files and I like to use VI.
Go to "Volumes" (if you're in a mac) and using the tty port you found in CoolTerm here: tty.usbserial-XXXXXXX, paste the following:
$ screen /dev/tty.usbserial-AI02ZWVY 115200
The terminal screen will go blank. Restart the board like you did when you first connected in CoolTerm. This took me several tries and I had to restart the board multiple times, but finally I got a screen that looks like this:
Log in using the root password and root username.
If you get screens that look like this, restart the board and try again:
Now that you're logged in, you'll want to configure the WIFI.
Scan for wireless access points.
$ wpa_cli scan_results
Configure wpa_supplicant.conf
to include your WiFi router settings. You can use the wpa_passphrase
command to write your router SSID and password into wpa_supplicant.conf
.
$ wpa_passphrase "SSID" "PASSWORD" >> /etc/wpa_supplicant/wpa_supplicant.conf
$ wpa_passphrase MyAP abcd1234 >> /etc/wpa_supplicant/wpa_supplicant.confFor more advanced WiFi security settings, you can refer to this page or other online resources.
Restart wpa_supplicant
service
$ systemctl restart wpa_supplicantGet an IP address Use
dhclient
to get an IP address from your DHCP server.$ dhclient wlan0Find your IP address:
$ ifconfig wlan0Now configure your ARTIK 5 to automatically connect to WIFI by adding dhclient wlan to the end of /etc/rc.d/rc.local
$ vi /etc/rc.d/rc.local
After making sure the WIFI was configured, I attempted to upload the code once again.
There were still no network ports available, but I tried once again to upload the blink sketch over the COM port. Once again, it failed.
Troubleshooting
(You can skip this and head to "Getting the board to blink using sysfs" if you just want to get the board to blink)
After carefully reading the PDF instructions for how to upload code to the ARTIK from the arduino IDE, I realized that I had to install Arduino on the board.
$ curl -s downloads.arduino.cc/libArduino/install_artik_prereq.sh | sh
This still didn't help. In fact, no "Network ports" menu appeared.
I know sometimes if a board is still connected to CoolTerm or has some other connection, the COM port won't work because it is busy, so I made sure that there were no other connections open. No luck.
I found a couple of other people were getting the same error as me when using the Arduino IDE 1.6.6.
Unfortunately, ARTIK 5 doesn't work with older versions of the IDE, but just to be sure I downloaded and installed the stable version of the Arduino IDE 1.6.6, and also tried 1.6.5.
I still got the same error when I attempted to upload the code.
According to the docs:
Since the core development is active and in sync with Java IDE, it is strongly suggested to
update frequently via Board Manager while running an updated Hourly version of the IDE.
You will get Notification popup when a new version is available.
I guess I will try the next hourly build...
3 HOURS LATER...
Getting the board to blink using sysfs
For now, I've decided to give up on using the Arduino IDE with the ARTIK 5.
Instead, I'm going to attempt to control the LED using something called sysfs instead.
If you want to know more about sysfs, follow this excellent tutorial about using sysfs to control GPIO on a Raspberry Pi.
In the GPIO mapping, I find that pin 13 corresponds to GPIO 135, so I export it to enable access to it from the terminal.
$ echo "135" > /sys/class/gpio/export
Then I set Pin 13 as an output:
$ echo "out" > /sys/class/gpio/gpio135/directionThe LED should be off now. Now turn it on!
$ echo "1" > /sys/class/gpio/gpio135/valueNow turn it off!
$ echo "0" > /sys/class/gpio/gpio135/value
Blinky accomplished! We want the LED to keep blinking though, so let's keep trekking.
There is another way to do it with sysfs that will give you a sustained blink.
You can manage the GPIO from a user space application. Artik.io links to the source code here - you just have to change GPIO 22 to GPIO 135 for the ARTIK 5. I've included the source code below.
Save it as blink.c and copy it to the ARTIK 5 using scp:
$ scp user@remote-host:/blink.c /dev
Make sure you have the latest version of the gcc compiler
$ gcc --version
Compile your blink.c application
$ gcc blink.c -o blink
When you list files, you should now see blink in /dev on the ARTIK 5.
run it.
$ ./blink
Now we have consistent blinky!
This obviously took much longer than expected, due to an issue with the Arduino 1.6.6 IDE that I expect will soon be fixed.
UPDATE:
I installed version 0.2.1 of the ARM Linux Boards library but now it is just giving me "device not found" when I attempt to upload from the Arduino IDE.
Comments
Please log in or sign up to comment.