View: 5721|Reply: 2

Orange Pi 3 WiringOP?

[Copy link]

1

threads

1

posts

15

credits

Novice

Rank: 1

credits
15
Published in 2019-3-7 20:45:40 | Show all floors |Read mode
Have  Orange Pi 3  full supported in current version of WiringOP?

62

threads

653

posts

5206

credits

Administrator

Rank: 9Rank: 9Rank: 9

credits
5206
Published in 2019-3-13 15:30:22 | Show all floors

0

threads

1

posts

17

credits

Novice

Rank: 1

credits
17
Published in 2019-4-14 00:06:16 | Show all floors
Edited by Imhotep at 2019-4-14 00:12

As I can not foud any WiringOP suitable and running for Orange Pi 3, I have managed to control GPIO without this library and tool. I was seeking how to send 0 our 1 to the 3rd Physical GPIO port, which is labelled GPIO122 in the OPI3 PIN ports datasheet.

To control this GPIO Pin port, I have found a simple way:

1) Expose the GPIO122 Pin port : echo "122" >/sys/class/gpio/export
2) Put the GPIO122 port in OUT mode: echo "out">/sys/class/gpio/gpio122/direction. Be careful to do 1) first, if not, the "gpio122" directory does not exist, as the port is NOT EXPOSED
3) Send 1 to the GPIO 122: echo "1">/sys/class/gpio/gpio122/value
4) Un-expose the GPIO122 Pin: it is always better to close a door you have opened!!!

Remember, to write or read a pin value, you must expose the GPIO port.

Using this procedure, I have scripted a tool in C which controls the 3rd GPIO pin, that I have connected to a transistor which controls a fan by setting 0 or 1 in the PIN. The compiled program sends 1 when temperature reaches a high value (45 for example) and sends 0 when the temperature goes under the threshold value. So, my fan is controlled by temperature, thus the Orange Pi 3 is always cooled without an always running all the time. A fan which is always activated makes more noise and reduce its lifetime, and brings too much dust. If you are interested and want to have much details of my circuit (5V fan-tansistor-resistance-flyback diode to protect the transistor when the fan goes off), you can leave me a message here.
"The fan's motor is partially a inductor. If the transistor shuts off quickly, then the current that must still flow thru the inductor for a little while will flow thru the diode and cause no harm. Without the diode, the voltage accross the motor would get as large as necessary to keep the current flowing, which would probably require frying the transistor."

Here are the GPIO pins description that helped me to know the GPIO ports numbers for the Orange Pi 3 (copy/paste this datasheet in notepad for example, or vi to make it more readable.
+------+-----+----------+------+---+OrangePiH6+---+------+----------+-----+------+
| GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
|      |     |     3.3v |      |   |  1 || 2  |   |      | 5v       |     |      |
|  122 |   0 |    SDA.0 | ALT2 | 0 |  3 || 4  |   |      | 5V       |     |      |
|  121 |   1 |    SCL.0 | ALT2 | 0 |  5 || 6  |   |      | 0v       |     |      |
|  118 |   2 |     PWM0 |  OFF | 0 |  7 || 8  | 0 | OFF  | PL02     | 3   | 354  |
|      |     |       0v |      |   |  9 || 10 | 0 | OFF  | PL03     | 4   | 355  |
|  120 |   5 |     RxD3 | ALT4 | 0 | 11 || 12 | 0 | OFF  | PD18     | 6   | 114  |
|  119 |   7 |     TxD3 | ALT4 | 0 | 13 || 14 |   |      | 0v       |     |      |
|  362 |   8 |     PL10 |  OFF | 0 | 15 || 16 | 0 | OFF  | PD15     | 9   | 111  |
|      |     |     3.3v |      |   | 17 || 18 | 0 | OFF  | PD16     | 10  | 112  |
|  229 |  11 |   MOSI.1 | ALT2 | 0 | 19 || 20 |   |      | 0v       |     |      |
|  230 |  12 |   MISO.1 | ALT2 | 0 | 21 || 22 | 0 | OFF  | PD21     | 13  | 117  |
|  228 |  14 |   SCLK.1 | ALT2 | 0 | 23 || 24 | 0 | ALT2 | CE.1     | 15  | 227  |
|      |     |       0v |      |   | 25 || 26 | 0 | OFF  | PL08     | 16  | 360  |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
| GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
+------+-----+----------+------+---+OrangePiH6+---+------+----------+-----+------+
You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list