Arduino for Odroid -> Oduino !!!

Post Reply
User avatar
tony.hong
Posts: 83
Joined: Tue Jun 04, 2019 1:49 pm
languages_spoken: korean
ODROIDs: All
Location: korea
Has thanked: 22 times
Been thanked: 28 times
Contact:

Arduino for Odroid -> Oduino !!!

Unread post by tony.hong » Wed Feb 12, 2020 2:53 pm



Generally, Arduino APIs are used for a microcontroller like Arduino-UNO, esp8266, etc. To make it easier for people who have used Arduino to control their Odroid GPIO, I developed Arduino API for Odroid.

There is no need to install Arduino IDE on your PC and you don’t need to connect the PC to Odroid. Install Arduino IDE and some dependencies into Odroid and write code. When you upload the code, Odroid runs the code on its own.

Github: https://github.com/hhk7734/oduino

Installation

OS

Supports Ubuntu MATE desktop.

Installation Guide and OS download link: https://wiki.odroid.com/getting_started ... tion_guide

Arduino IDE
Arduino for Odroid

Open a terminal and execute the following command (copy and paste the command to the terminal):

Code: Select all

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 and reopen the IDE.

odroid-config(optional)

Github: https://github.com/hhk7734/odroid-config
Odroid-config is a utility that helps users configure odroid easily.

Arduino IDE Setup
  • Tools -> Board -> ODROID Series
  • Tools -> Port -> /dev/ttyHK0
  • Tools -> Programmer -> Bridge
Pinmap

Arduino for Odroid use physical location based pinmap. If you have Odroid-N2, the pinmap is shown in the table below.

Code: Select all

+---------+------+---+--- 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

Code: Select all

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 constexpr int LED_BUILTIN = 13; is declared.

Connect the LED to the 13-pin and upload the example code, the LED will blink. 8-)
Last edited by tony.hong on Fri Feb 14, 2020 2:17 pm, edited 7 times in total.
These users thanked the author tony.hong for the post (total 6):
Luke.go (Wed Feb 12, 2020 2:54 pm) • rooted (Wed Feb 12, 2020 4:00 pm) • Gburas (Wed Feb 12, 2020 5:59 pm) • tobetter (Wed Feb 12, 2020 6:26 pm) • joshua.yang (Wed Feb 12, 2020 6:28 pm) • mad_ady (Wed Feb 12, 2020 7:30 pm)

User avatar
rooted
Posts: 7344
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 498 times
Been thanked: 138 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

Unread post by rooted » Wed Feb 12, 2020 4:00 pm

Very interesting, thank you for the port!

User avatar
mad_ady
Posts: 7579
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 397 times
Been thanked: 302 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

Unread post by mad_ady » Wed Feb 12, 2020 7:35 pm

Great work guys! You can run arduino sketches directly on the odroid!
I wonder - once "programmed" on /dev/ttyHK0, can you turn off arduino and can you keep the program running? Once "programmed", can you run the oduino "core" independently of X11?
The use case is - you program it once with Arduino, but when you deploy it in production (e.g. have it start on boot), you don't want to interact (or depend on) X11.

Great work!

phaseshifter
Posts: 3520
Joined: Fri May 08, 2015 9:12 am
languages_spoken: english
ODROIDs: U-2,U3+,,XU-3,,XU3-LITE,,XU-4
C1+,,C-2,,,
N-1,,N-2,...other odroid acc`s as well
Has thanked: 41 times
Been thanked: 43 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

Unread post by phaseshifter » Wed Feb 12, 2020 8:31 pm

hmm ...so this means that the n-2 40 pin conn is an aurdino foot print do i have it correct so the pinnout are aurdino.. on the 40 pinn ..connector...if so that is cool...i did not dabble much with aurdino..i chose the xu3 instead..lol..is there a wiki guide for what pin is designated for use with aurdino..i reealize there are many cpu based aurdino mother board ..

EDIT...EDIT...BELOW


@tobetter could you please do a diagram with what pis is what based upon which ever aurdino footprint..for example i have thre i/o board for the u-3 i have done a little stuff with it...now it has part there of an aurdino pinnout...


the board pintout is labeled with letters on the u-3 io board..

could you please designate which pin represents on the odroid board represnt..like for eg pin 1 on the c-2 is 5 volts etc.etc so which pins represent a-1 a-1 a-3 and so on....is pin 3 on the odroid a-3 for example...

if this is so confusing in what i have mentioned here,,just leave me a p-m or so on..phase
Last edited by phaseshifter on Mon Mar 23, 2020 10:49 am, edited 2 times in total.
Build It And They Will Come...Be Bold And Mighty Forces Will Come To Your Aid..!!!

C2H2
Posts: 3
Joined: Fri Dec 28, 2018 12:33 am
languages_spoken: deutsch
ODROIDs: Odroid-C1, Odroid-H2
Has thanked: 0
Been thanked: 0
Contact:

Re: Arduino for Odroid -> Oduino !!!

Unread post by C2H2 » Wed Feb 12, 2020 10:46 pm

Please add the Odroid-H2.

User avatar
odroid
Site Admin
Posts: 33699
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean, Japanese
ODROIDs: ODROID
Has thanked: 515 times
Been thanked: 507 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

Unread post by odroid » Thu Feb 13, 2020 10:10 am

C2H2 wrote:
Wed Feb 12, 2020 10:46 pm
Please add the Odroid-H2.
H2 has no generic input/output port.

User avatar
tony.hong
Posts: 83
Joined: Tue Jun 04, 2019 1:49 pm
languages_spoken: korean
ODROIDs: All
Location: korea
Has thanked: 22 times
Been thanked: 28 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

Unread post by tony.hong » Thu Feb 13, 2020 10:46 am

mad_ady wrote:
Wed Feb 12, 2020 7:35 pm
Great work guys! You can run arduino sketches directly on the odroid!
I wonder - once "programmed" on /dev/ttyHK0, can you turn off arduino and can you keep the program running? Once "programmed", can you run the oduino "core" independently of X11?
The use case is - you program it once with Arduino, but when you deploy it in production (e.g. have it start on boot), you don't want to interact (or depend on) X11.

Great work!
Added /dev/ttyHK0 to provide the same user experience as using a real Arduino board.
When uploading code, a bridge app runs the code. When closing the bridge, the executed code will stop.

Arduino IDE supports exporting compiled binary. So, once programmed, regardless of the environment, you can run compiled binary whenever you want. 8-)
export_arduino.png
export_arduino.png (229.21 KiB) Viewed 2639 times

User avatar
tony.hong
Posts: 83
Joined: Tue Jun 04, 2019 1:49 pm
languages_spoken: korean
ODROIDs: All
Location: korea
Has thanked: 22 times
Been thanked: 28 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

Unread post by tony.hong » Thu Feb 13, 2020 12:30 pm

phaseshifter wrote:
Wed Feb 12, 2020 8:31 pm
hmm ...so this means that the n-2 40 pin conn is an aurdino foot print do i have it correct so the pinnout are aurdino.. on the 40 pinn ..connector...if so that is cool...i did not dabble much with aurdino..i chose the xu3 instead..lol..
I added XU3 to the list, but I didn't test it because I didn't have it. ㅠㅜ
I only tested C1, C2, XU4, N2.

When a user connects something to 40-pin, it is hard to remember GPIO pinmap. So, Oduino(Arduino for Odroid) uses physical-based pinmap.

User avatar
mad_ady
Posts: 7579
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 397 times
Been thanked: 302 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

Unread post by mad_ady » Thu Feb 13, 2020 2:50 pm

Is the compiled binary a linux native application? If yes, yay!

User avatar
tony.hong
Posts: 83
Joined: Tue Jun 04, 2019 1:49 pm
languages_spoken: korean
ODROIDs: All
Location: korea
Has thanked: 22 times
Been thanked: 28 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

Unread post by tony.hong » Mon Feb 17, 2020 5:08 pm

These users thanked the author tony.hong for the post:
rooted (Mon Feb 17, 2020 9:08 pm)

User avatar
tony.hong
Posts: 83
Joined: Tue Jun 04, 2019 1:49 pm
languages_spoken: korean
ODROIDs: All
Location: korea
Has thanked: 22 times
Been thanked: 28 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

Unread post by tony.hong » Mon Feb 24, 2020 6:56 pm

ODROID + MQTT + Arduino + Node-RED basic project: https://medium.com/@hhk7734/odroid-mqtt ... f0e05cf9d1
These users thanked the author tony.hong for the post:
mad_ady (Mon Feb 24, 2020 7:08 pm)

User avatar
mad_ady
Posts: 7579
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 397 times
Been thanked: 302 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

Unread post by mad_ady » Mon Feb 24, 2020 7:08 pm

Nice article (though I'm not a node-red fan), but I really liked your vu7 printed case. Care to share the design?
These users thanked the author mad_ady for the post:
tony.hong (Mon Feb 24, 2020 7:22 pm)

User avatar
tony.hong
Posts: 83
Joined: Tue Jun 04, 2019 1:49 pm
languages_spoken: korean
ODROIDs: All
Location: korea
Has thanked: 22 times
Been thanked: 28 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

Unread post by tony.hong » Mon Feb 24, 2020 7:36 pm

8-) 3D printed case is @tobetter's work. So, I don't have the design. It has some problems. So, tobetter will post after modification.

Ref: https://medium.com/@hhk7734/3d-printing ... 665b369b1b
These users thanked the author tony.hong for the post:
mad_ady (Tue Feb 25, 2020 2:26 pm)

User avatar
tony.hong
Posts: 83
Joined: Tue Jun 04, 2019 1:49 pm
languages_spoken: korean
ODROIDs: All
Location: korea
Has thanked: 22 times
Been thanked: 28 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

Unread post by tony.hong » Tue Feb 25, 2020 1:54 pm

These users thanked the author tony.hong for the post (total 2):
mad_ady (Tue Feb 25, 2020 1:55 pm) • rooted (Wed Feb 26, 2020 6:41 am)

User avatar
mad_ady
Posts: 7579
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 397 times
Been thanked: 302 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

Unread post by mad_ady » Tue Feb 25, 2020 2:30 pm

Thanks! The 3d case deserves its own thread/article/link in the vu7 product description so that it's better known. Having a case design helps with the vu7 sales.

jackinho
Posts: 19
Joined: Mon May 06, 2019 12:09 am
languages_spoken: english, german
ODROIDs: XU4, N2
Has thanked: 7 times
Been thanked: 11 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

Unread post by jackinho » Wed Feb 26, 2020 6:26 am

@mad_ady
Have a look: viewtopic.php?f=101&t=37971
These users thanked the author jackinho for the post:
mad_ady (Sun Mar 01, 2020 6:10 pm)

o_lampe
Posts: 175
Joined: Wed Jan 01, 2020 12:35 am
languages_spoken: english german
ODROIDs: MC1 solo
Has thanked: 11 times
Been thanked: 16 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

Unread post by o_lampe » Sun Mar 01, 2020 5:23 pm

Great work!
Before I start adding my old 'multiwii' GPS and motionsensors to the GPIO pins, I want to be sure about the signal levels of N2 GPIO. Are they all 5V tolerant or would I need levelshifters, like the XU4 does?

User avatar
mad_ady
Posts: 7579
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 397 times
Been thanked: 302 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

Unread post by mad_ady » Sun Mar 01, 2020 6:11 pm

The n2 is not 5v tollerant. It needs 3.3V.

o_lampe
Posts: 175
Joined: Wed Jan 01, 2020 12:35 am
languages_spoken: english german
ODROIDs: MC1 solo
Has thanked: 11 times
Been thanked: 16 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

Unread post by o_lampe » Sun Mar 01, 2020 6:22 pm

mad_ady wrote:
Sun Mar 01, 2020 6:11 pm
The n2 is not 5v tollerant. It needs 3.3V.
Thanks mad_ady
At least it's not 1.8V, like the XU4...

Post Reply

Return to “Hardware and peripherals”

Who is online

Users browsing this forum: No registered users and 18 guests