Arduino for ODROID: Setting up your own Oduino

Generally, Arduino APIs are used with a microcontroller like an Arduino-UNO, esp8266, etc. These APIs make it easier for people who have used Arduino to control their ODROID GPIO, so I developed an Arduino API layer for ODROID.

There is no need to install Arduino IDE on your PC and you don’t need to connect the PC to your ODROID; just install Arduino IDE and some dependencies into ODROID and write code. When you upload the code, ODROID runs the code on its own. The GitHub repository is located at https://github.com/hhk7734/oduino.

[ NOTE: embed the video at https://youtu.be/1Tkff0pTRZ0 ]

Installation

First install the currently supported Ubuntu MATE desktop. The installation guide is available at https://wiki.odroid.com/getting_started/os_installation_guide.

Download the latest Arduino IDE for ARM Linux from https://www.arduino.cc/en/Main/Software. The Arduino installation guide is available at https://www.arduino.cc/en/Guide/Linux

Arduino for ODROID

Open a terminal, copy and paste the command into terminal, and type the following commands:

sudo apt update && sudo apt install -y git && git clone --recursive https://github.com/hhk7734/oduino.git     ~/Arduino/hardware/hardkernel/odroid && sudo ~/Arduino/hardware/hardkernel/odroid/tools/install.sh
If you already opened an Arduino IDE, close it and reopen the IDE.

odroid-config

Odroid-config is a utility that helps users configure for ODROID easily. The code is available at the following Github repo: https://github.com/hhk7734/odroid-config

Arduino IDE Setup

  • Tools -> Board -> ODROID Series
  • Tools -> Port -> /dev/ttyHK0
  • Tools -> Programmer -> Bridge

Pinmap

Arduino for ODROID uses a physical location based pinmap. If you have ODROID-N2, the pinmap is shown in the following table.

+---------+------+---+--- N2 ---+---+------+---------+
|   Name  | Mode | V | Physical | V | Mode |  Name   |
+---------+------+---+----++----+---+------+---------+
|    3.3V |      |   |  1 || 2  |   |      | 5V      |
|   SDA.2 | ALT1 | 1 |  3 || 4  |   |      | 5V      |
|   SCL.2 | ALT1 | 1 |  5 || 6  |   |      | 0V      |
|  IO.473 | ALT1 | 0 |  7 || 8  | 1 | IN   | TxD1    |
|      0V |      |   |  9 || 10 | 1 | IN   | RxD1    |
|  IO.479 |   IN | 1 | 11 || 12 | 1 | IN   | IO.492  |
|  IO.480 |   IN | 1 | 13 || 14 |   |      | 0V      |
|  IO.483 |   IN | 1 | 15 || 16 | 1 | IN   | IO.476  |
|    3.3V |      |   | 17 || 18 | 1 | IN   | IO.477  |
|    MOSI |   IN | 1 | 19 || 20 |   |      | 0V      |
|    MISO |   IN | 1 | 21 || 22 | 1 | IN   | IO.478  |
|    SCLK |   IN | 1 | 23 || 24 | 1 | IN   | CE0     |
|      0V |      |   | 25 || 26 | 0 | IN   | IO.464  |
|   SDA.3 | ALT2 | 1 | 27 || 28 | 1 | ALT2 | SCL.3   |
|  IO.490 |   IN | 1 | 29 || 30 |   |      | 0V      |
|  IO.491 |   IN | 1 | 31 || 32 | 0 | IN   | IO.472  |
|  IO.481 |   IN | 1 | 33 || 34 |   |      | 0V      |
|  IO.482 |   IN | 0 | 35 || 36 | 0 | IN   | IO.495  |
|   AIN.3 |      |   | 37 || 38 |   |      | 1V8     |
|      0V |      |   | 39 || 40 |   |      | AIN.2   |
+---------+------+---+----++----+---+------+---------+
|   Name  | Mode | V | Physical | V | Mode |  Name   |
+---------+------+---+--- N2 ---+---+------+---------+

Blink Example

Arduino IDE -> File -> Examples -> 01.Basics -> Blink

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);
  delay(1000);
  digitalWrite(LED_BUILTIN, LOW);
  delay(1000);
}
By default, the Arduino-UNO connects the D13 to the LED. So the constant expression: int LED_BUILTIN = 13; is declared. Connect the LED to the 13-pin and upload the example code and the LED will blink.

An additional I2C ODROID example is available at https://medium.com/@hhk7734/how-to-use-i2c-lcd-on-odroid-eaf20d20966c. For more information, please see the ODROID forum thread posting at https://forum.odroid.com/viewtopic.php?f=180&t=37713.

Be the first to comment

Leave a Reply