Arduino for Odroid -> Oduino !!!

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

Arduino for Odroid -> Oduino !!!

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 7):
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) • istanbulls (Fri Apr 10, 2020 11:46 pm)

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

Re: Arduino for Odroid -> Oduino !!!

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

Very interesting, thank you for the port!

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

Re: Arduino for Odroid -> Oduino !!!

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: 3535
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: 45 times
Been thanked: 45 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

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

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

Please add the Odroid-H2.

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

Re: Arduino for Odroid -> Oduino !!!

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: 119
Joined: Tue Jun 04, 2019 1:49 pm
languages_spoken: korean
ODROIDs: All
Location: korea
Has thanked: 26 times
Been thanked: 35 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

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 5656 times

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

Re: Arduino for Odroid -> Oduino !!!

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: 7897
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 498 times
Been thanked: 348 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

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: 119
Joined: Tue Jun 04, 2019 1:49 pm
languages_spoken: korean
ODROIDs: All
Location: korea
Has thanked: 26 times
Been thanked: 35 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

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: 119
Joined: Tue Jun 04, 2019 1:49 pm
languages_spoken: korean
ODROIDs: All
Location: korea
Has thanked: 26 times
Been thanked: 35 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

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: 7897
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 498 times
Been thanked: 348 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

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: 119
Joined: Tue Jun 04, 2019 1:49 pm
languages_spoken: korean
ODROIDs: All
Location: korea
Has thanked: 26 times
Been thanked: 35 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

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: 119
Joined: Tue Jun 04, 2019 1:49 pm
languages_spoken: korean
ODROIDs: All
Location: korea
Has thanked: 26 times
Been thanked: 35 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

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: 7897
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 498 times
Been thanked: 348 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

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: 37
Joined: Mon May 06, 2019 12:09 am
languages_spoken: english, german
ODROIDs: XU4, N2
Has thanked: 10 times
Been thanked: 14 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

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

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: 7897
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 498 times
Been thanked: 348 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

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

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

istanbulls
Posts: 191
Joined: Tue May 14, 2019 10:18 pm
languages_spoken: Turkish
ODROIDs: ODROID N2
Has thanked: 87 times
Been thanked: 10 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

Post by istanbulls » Fri Apr 10, 2020 11:47 pm

I bought TM1637 4-Digit Digital Clock LED.
Does Odroid N2 work? How should I do?

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

Re: Arduino for Odroid -> Oduino !!!

Post by tony.hong » Mon Apr 13, 2020 3:18 pm

Hi, istanbulls

https://www.makerguides.com/tm1637-arduino-tutorial/

Is it the same as purchased?

If so, follow the contents of the page. Perhaps you need to change the pin number.

istanbulls
Posts: 191
Joined: Tue May 14, 2019 10:18 pm
languages_spoken: Turkish
ODROIDs: ODROID N2
Has thanked: 87 times
Been thanked: 10 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

Post by istanbulls » Tue Apr 14, 2020 12:37 am

tony.hong wrote:
Mon Apr 13, 2020 3:18 pm
Hi, istanbulls

https://www.makerguides.com/tm1637-arduino-tutorial/

Is it the same as purchased?

If so, follow the contents of the page. Perhaps you need to change the pin number.
thanks for the answer.

I tried this, but it was not successful.
I plugged it into pins 3. and 5. I put the others on pins 2. and 9.

VCC 5V : pin 2
GND GND : pin 9
CLK Digital : pin 3
DIO Digital : pin 5

Code: Select all

// Define the connections pins:
#define CLK 3
#define DIO 5

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

Re: Arduino for Odroid -> Oduino !!!

Post by tony.hong » Tue Apr 14, 2020 10:09 am

VCC 5V : pin 2
GND GND : pin 9
CLK Digital : pin 3
DIO Digital : pin 5
Pin3 -> I2C2-SDA, Pin5 -> I2C2-SCL
Did you turn off I2C?

TM1637 library use DIO, not I2C.

And, I read the datasheet. Maybe, you need to level shifter.
Screenshot from 2020-04-14 10-11-30.png
Screenshot from 2020-04-14 10-11-30.png (30.07 KiB) Viewed 2483 times
VDD is 5V. CLK and DIN need at least 3.5V(0.7 * 5V) to recognize the high level. But, the high-level voltage of N2 is only 3.3V.

istanbulls
Posts: 191
Joined: Tue May 14, 2019 10:18 pm
languages_spoken: Turkish
ODROIDs: ODROID N2
Has thanked: 87 times
Been thanked: 10 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

Post by istanbulls » Tue Apr 14, 2020 5:21 pm

all pins are idle, which pin do you suggest to use?

The first Arduino trial for me has never been experienced before. I want to learn. Small benefits help me a lot. Thank you.
Attachments
Ekran görüntüsü_2020-04-14_11-16-48.png
Ekran görüntüsü_2020-04-14_11-16-48.png (69.04 KiB) Viewed 2398 times
Ekran görüntüsü_2020-04-14_11-15-38.png
Ekran görüntüsü_2020-04-14_11-15-38.png (360.65 KiB) Viewed 2398 times

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

Re: Arduino for Odroid -> Oduino !!!

Post by tony.hong » Fri Apr 17, 2020 11:10 am

all pins are idle, which pin do you suggest to use?

The first Arduino trial for me has never been experienced before. I want to learn. Small benefits help me a lot. Thank you.
All pins except I2C, SPI, and UART can be used without any other configuration.

But, VDD for TM1637 is 5V. CLK and DIN require at least 3.5V(0.7 * 5V) to recognize the high level. But, the high-level voltage of N2 is only 3.3V.
So, probably not working properly.

istanbulls
Posts: 191
Joined: Tue May 14, 2019 10:18 pm
languages_spoken: Turkish
ODROIDs: ODROID N2
Has thanked: 87 times
Been thanked: 10 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

Post by istanbulls » Sun May 24, 2020 2:27 am

New question :)
Does the clock work with SSD1306 oled?

I searched for exemplary projects on the internet, but I did not get any results.
CE also works well, can we do something similar in Ubuntu?

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

Re: Arduino for Odroid -> Oduino !!!

Post by tony.hong » Mon May 25, 2020 9:51 am

I have https://www.waveshare.com/accessory-shield.htm

It works fine. So I think there is no problem with SSD1306.
These users thanked the author tony.hong for the post:
istanbulls (Mon May 25, 2020 6:01 pm)

istanbulls
Posts: 191
Joined: Tue May 14, 2019 10:18 pm
languages_spoken: Turkish
ODROIDs: ODROID N2
Has thanked: 87 times
Been thanked: 10 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

Post by istanbulls » Mon May 25, 2020 7:30 pm

tony.hong wrote:
Mon May 25, 2020 9:51 am
I have https://www.waveshare.com/accessory-shield.htm

It works fine. So I think there is no problem with SSD1306.
Is there a simple example I can experiment?

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

Re: Arduino for Odroid -> Oduino !!!

Post by tony.hong » Mon May 25, 2020 10:32 pm

If you have SSD1306, https://github.com/adafruit/Adafruit_SSD1306 seems to work with Arduino.

istanbulls
Posts: 191
Joined: Tue May 14, 2019 10:18 pm
languages_spoken: Turkish
ODROIDs: ODROID N2
Has thanked: 87 times
Been thanked: 10 times
Contact:

Re: Arduino for Odroid -> Oduino !!!

Post by istanbulls » Tue May 26, 2020 2:24 am

Thanks for your help

Post Reply

Return to “Hardware and peripherals”

Who is online

Users browsing this forum: No registered users and 2 guests