Page 1 of 1

Arduino for Odroid -> Oduino !!!

Posted: Wed Feb 12, 2020 2:53 pm
by tony.hong


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

Re: Arduino for Odroid -> Oduino !!!

Posted: Wed Feb 12, 2020 4:00 pm
by rooted
Very interesting, thank you for the port!

Re: Arduino for Odroid -> Oduino !!!

Posted: Wed Feb 12, 2020 7:35 pm
by mad_ady
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!

Re: Arduino for Odroid -> Oduino !!!

Posted: Wed Feb 12, 2020 8:31 pm
by phaseshifter
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

Re: Arduino for Odroid -> Oduino !!!

Posted: Wed Feb 12, 2020 10:46 pm
by C2H2
Please add the Odroid-H2.

Re: Arduino for Odroid -> Oduino !!!

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

Re: Arduino for Odroid -> Oduino !!!

Posted: Thu Feb 13, 2020 10:46 am
by tony.hong
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 5655 times

Re: Arduino for Odroid -> Oduino !!!

Posted: Thu Feb 13, 2020 12:30 pm
by tony.hong
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.

Re: Arduino for Odroid -> Oduino !!!

Posted: Thu Feb 13, 2020 2:50 pm
by mad_ady
Is the compiled binary a linux native application? If yes, yay!

Re: Arduino for Odroid -> Oduino !!!

Posted: Mon Feb 17, 2020 5:08 pm
by tony.hong

Re: Arduino for Odroid -> Oduino !!!

Posted: Mon Feb 24, 2020 6:56 pm
by tony.hong
ODROID + MQTT + Arduino + Node-RED basic project: https://medium.com/@hhk7734/odroid-mqtt ... f0e05cf9d1

Re: Arduino for Odroid -> Oduino !!!

Posted: Mon Feb 24, 2020 7:08 pm
by mad_ady
Nice article (though I'm not a node-red fan), but I really liked your vu7 printed case. Care to share the design?

Re: Arduino for Odroid -> Oduino !!!

Posted: Mon Feb 24, 2020 7:36 pm
by tony.hong
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

Re: Arduino for Odroid -> Oduino !!!

Posted: Tue Feb 25, 2020 1:54 pm
by tony.hong

Re: Arduino for Odroid -> Oduino !!!

Posted: Tue Feb 25, 2020 2:30 pm
by mad_ady
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.

Re: Arduino for Odroid -> Oduino !!!

Posted: Wed Feb 26, 2020 6:26 am
by jackinho
@mad_ady
Have a look: viewtopic.php?f=101&t=37971

Re: Arduino for Odroid -> Oduino !!!

Posted: Sun Mar 01, 2020 5:23 pm
by o_lampe
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?

Re: Arduino for Odroid -> Oduino !!!

Posted: Sun Mar 01, 2020 6:11 pm
by mad_ady
The n2 is not 5v tollerant. It needs 3.3V.

Re: Arduino for Odroid -> Oduino !!!

Posted: Sun Mar 01, 2020 6:22 pm
by o_lampe
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...

Re: Arduino for Odroid -> Oduino !!!

Posted: Fri Apr 10, 2020 11:47 pm
by istanbulls
I bought TM1637 4-Digit Digital Clock LED.
Does Odroid N2 work? How should I do?

Re: Arduino for Odroid -> Oduino !!!

Posted: Mon Apr 13, 2020 3:18 pm
by tony.hong
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.

Re: Arduino for Odroid -> Oduino !!!

Posted: Tue Apr 14, 2020 12:37 am
by istanbulls
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

Re: Arduino for Odroid -> Oduino !!!

Posted: Tue Apr 14, 2020 10:09 am
by tony.hong
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 2482 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.

Re: Arduino for Odroid -> Oduino !!!

Posted: Tue Apr 14, 2020 5:21 pm
by istanbulls
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.

Re: Arduino for Odroid -> Oduino !!!

Posted: Fri Apr 17, 2020 11:10 am
by tony.hong
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.

Re: Arduino for Odroid -> Oduino !!!

Posted: Sun May 24, 2020 2:27 am
by istanbulls
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?

Re: Arduino for Odroid -> Oduino !!!

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

It works fine. So I think there is no problem with SSD1306.

Re: Arduino for Odroid -> Oduino !!!

Posted: Mon May 25, 2020 7:30 pm
by istanbulls
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?

Re: Arduino for Odroid -> Oduino !!!

Posted: Mon May 25, 2020 10:32 pm
by tony.hong
If you have SSD1306, https://github.com/adafruit/Adafruit_SSD1306 seems to work with Arduino.

Re: Arduino for Odroid -> Oduino !!!

Posted: Tue May 26, 2020 2:24 am
by istanbulls
Thanks for your help