Changes

Jump to: navigation, search

Orange Pi 2G-IoT

8,696 bytes added, 11:23, 28 June 2022
no edit summary
 It’s an open-source single-board computer. It can run Android 4.4, Ubuntu, Debian, Raspberry Pi image. It uses the RDA8810 Soc, and has 256MB LPDDR2 SDRAM.<br>
<br>
=== '''What can I do with Orange Pi 2G-IoT?''' ===
<br>
You can use it to build... 
=== '''Usage of GPIO and WiringPi''' ===
<br>
'''1)Use WiringPi on OrangePi 2G-IOT to connect network'''<br>
<br>
<div style="padding-left:100px;">[[File:Orange-pi-2g-iot-img17.png|600px]]</div>
<br>
OrangePi 2G-IOT could support WiringPi, you could have a try according to the introduction on this section. The following is 40 Pin of OrangePi. <br>
<br>
a.Download the latest WiringPi source code of Orange Pi 2G-IOT<br>
Please confirm that the Orange Pi 2G-IOT has connect to wifi or network successfully, if no, then you need to first make it connect to wifi or network. If you connect to network, then you also need to install some essential tools:<br>
<div style="padding-left:40px;"><span style="background:#fffaa5;">sudo apt-get install git gcc make</span></div>
b.Download the latest source code <br>
You could download the latest WiringPi source code from official website: www.orangepi.online<br>
You could also download files from github: https://github.com/OrangePiLibra/WiringPi.git with the following command:<br>
<span style="background:#fffaa5;">env GIT_SSL_NO_VERIFY=true git clone</span><br>
c.Compile and install WiringPi<br>
Use the following command to compile and install the WiringPi after get the latest source code. <br>
cd WiringOP/<br>
./build OrangePi_2G-IOT <br>
./build OrangePi_2G-IOT install<br>
d.Test WiringPi with gpio command<br>
You could use gpio command to test GPIO on 40pin on Orange Pi 2G-IOT with WiringPi installed.<br>
i Use "gpio readall" command to print out all WiringPi pin mapping as following.BCM line represents the actual hardware GPIO, there are 4 Groups GPIO and each Group have 32pins, and the serial number start from Group PA. PA0 corresponds to BCM colum number 0.<br>
wPi line represents pins of wiringPi, you could use this group of data when use C library and gpio command on wiringPi. For example, number 37 pin is corresponding to number 25 pin of wiringPi, you could operate the 37 via operating 25pin.<br>
Name line represents the definition name of Pin.<br>
Mode line represents the mode of pin, it could but both input and output.<br>
V line represents the voltage value of the current pin.<br>
Physical line represents the actual hardware number.<br>
<br>
<div style="padding-left:100px;">[[File:Orange-pi-i96-img32.png|600px]]</div>
<br>
ii Use "gpio export pin mode" to explore wiringPi GPIO to the directory of /sys/class/gpio and set the GPIO mode into mode.<br>
According to the above WiringPi pin mapping, hardware pin number 37 is corresponding to WiringPi pin number GPIO 25, explore the number 25 and set it into output mode.<br>
<br>
<div style="padding-left:100px;">[[File:Orange-pi-2g-iot-img18.png|600px]]</div>
<br>
<div style="padding-left:100px;">[[File:Orange-pi-2g-iot-img19.png|600px]]</div>
<br>
iii Use "gpio unexport pin" to cancel explore pin to /sys/class/gpio. For example:
orangepi# gpio unexport 25<br>
<br>
<div style="padding-left:100px;">[[File:Orange-pi-2g-iot-img20.png|600px]]</div>
<br>
iv Use "gpio exports" to check the current explored gpio. For expample:
orangepi# gpio exports<br>
<br>
<div style="padding-left:100px;">[[File:Orange-pi-2g-iot-img21.png|600px]]</div>
<br>
v Use "gpio mode pin mode" command to configure wiringPi pin mode. For example:<br>
Configure pin wiringPi 25 as output mode<br>
orangepi# gpio mode 25 out<br>
Configure pin wiringPi 26 as input mode<br>
orangepi# gpio mode 26 in<br>
<br>
vi.Use "gpio write pin value" to write value of output mode pin, for example:<br>
Configure pin wiringPi 25 as output pin:<br>
orangepi# gpio mode 25 out<br>
Write 0 on wiringPi 25 <br>
orangepi# gpio write 25 0<br>
Write 1 wiringPi 25<br>
orangepi# gpio write 25 1<br>
<br>
vii.Use "gpio read pin" command to read the value of input mode pin, for example:<br>
Configure pin wiringPi 25 as input pin<br>
orangepi# gpio mode 25 in<br>
read the value from wiringPi 25<br>
orangepi# gpio read 25<br>
<br>
<div style="padding-left:100px;">[[File:Orange-pi-i96-img33.png|600px]]</div>
<br>
viii.If you want to learn more "gpio" command, you could refer to "gpio -h" obtain.<br>
<br>
e.Use WiringPi C Library<br>
<br>
WiringPi support C library and python library, you could use C language to operation GPIO port, the example source code is on the directory of /example/OrangePi/. <br>
Here is an example for C library usage on GPIO:<br>
Complie GPIO LED<br>
<br>
<div style="padding-left:100px;">[[File:Orange-pi-i96-img34.png|600px]]</div>
<br>
Usage of C library on wiringPi:<br>
In order to use wiringPi C library, first you need to import file of "wiringPi.h". You need to initialize wiringPi before using GPIO with function wiringPiSetup(). And then you could configure pin mode into INPUT or OUTPUT. And please note that the pin number should corresponding to wiringPi. Finally you could use function digitalWrite() and digitalRead() to read and write.<br>
<br>
=== '''Connect to Network via GSM''' ===
<br>
1)Use 2G-IOT to send message<br>
<br>
For now the version of Ubuntu,Debian and Raspbian could support SMS sending message. Before using the SMS function, please make sure the SIM card you use is active.<br>
<br>
i.Prepare <br>
<br>
First you need to prepare an activated Micro SIM card and insert into Orange Pi 2G-IOT, the Orange PI 2G-IOT could support the following frequency:<br>
Frequency Range: 850,900,1800,1900 <br>
Standard: GSM800<br>
<br>
<div style="padding-left:100px;">[[File:Orange-pi-2g-iot-img23.png|600px]]</div>
<br>
ii.Install SIM card<br>
<br>
Please note the direction of when inserting SIM card. <br>
<br>
<div style="padding-left:100px;">[[File:Orange-pi-2g-iot-img25.png|600px]]</div>
<br>
iii.Login Linux system<br>
<br>
After inserting SIM card, power on and enter into Linux system. You could login the system via serial port or SSH. If you are going to use serial port to login, please be remember to set the baud rate into 921600.<br>
<br>
<div style="padding-left:100px;">[[File:Orange-pi-2g-iot-img26.png|600px]]</div>
<br>
iv.SMS Usage<br>
<br>
There are many ways to use SMS, here will introduce the way with serial port and C language.<br>
<br>
a.With Serial Port<br>
<br>
You need to install the tool of minicom on Orange Pi 2G-IOT before using SMS. Please make sure the board has already connect to wifi.<br>
You could install minicom with the following command:<br>
<div style="padding-left:40px;"><span style="background:#fffaa5;">sudo apt-get install minico</span></div>
<br>
The AP core and Modem will communicate via serial port. There will be a modem0 node after booting into Linux system. You could use serial port tool to connect to the /dev/modem0 node, which we recommend you use minicom, you could also try other tools.<br>
If you are using the minicom or other tools on serial port, please refer to the following:
You could configure with the following command to connect /dev/modem0:<br>
<div style="padding-left:40px;"><span style="background:#fffaa5;">sudo minicmo -s</span></div>
<br>
After input the command, you will enter the configure interface, select "'''Serial port setup'''"<br>
<br>
<div style="padding-left:100px;">[[File:Orange-pi-2g-iot-img27.png|600px]]</div>
<br>
Push A to modify Serial Device into /'''dev/modem0'''<br>
<br>
<div style="padding-left:100px;">[[File:Orange-pi-2g-iot-img28.png|600px]]</div>
<br>
'''Use AT command to send message'''<br>
<br>
First you need to input AT command to check the situation of Modem, if Modem replies OK, then means Modem is connect correctly.<br>
<br>
<div>[[File:Orange-pi-2g-iot-img29.png|600px]]</div>
<br>
Input command of AT +cfun=1 to open Modem full function<br>
<br>
<div>[[File:Orange-pi-2g-iot-img30.png|600px]]</div>
<br>
<div>[[File:Orange-pi-2g-iot-img31.png|600px]]</div>
<br>
<div>[[File:Orange-pi-2g-iot-img32.png|600px]]</div>
<br>
<div>[[File:Orange-pi-2g-iot-img33.png|600px]]</div>
<br>
Initialize serial port:<br>
<br>
<div>[[File:Orange-pi-2g-iot-img34.png|600px]]</div>
<br>
Send AT command function<br>
<br>
<div>[[File:Orange-pi-2g-iot-img35.png|600px]]</div>
<br>
AT send message<br>
<br>
<div>[[File:Orange-pi-2g-iot-img36.png|600px]]</div>
<br>
Detail steps you could refer to the following: “'''OrangePi_2G_IOT_GSM_Demo.c'''”<br>
Here is the reflect of running C:<br>
<br>
<div>[[File:Orange-pi-2g-iot-img37.png|600px]]</div>
<br>
<div>[[File:Orange-pi-2g-iot-img41.png|600px]]</div>
<br>
<div>[[File:Orange-pi-2g-iot-img38.png|600px]]</div>
<br>
<div>[[File:Orange-pi-2g-iot-img42.png|600px]]</div>
<br>
<div>[[File:Orange-pi-2g-iot-img39.png|600px]]</div>
<br>
Finally you will receive the message from OrangePi 2G-IOT<br>
<br>
<div>[[File:Orange-pi-2g-iot-img40.png|300px]]</div>
<br>
* OrangePi_2G_IOT_GSM_Demo.c

Navigation menu