More updates, GPIO pins!

This commit is contained in:
Josh Mudge 2018-05-10 16:59:10 -06:00
parent 16418cd5e5
commit 48b8c8b8f2
2 changed files with 108 additions and 2 deletions

68
5-9-17.md Normal file
View File

@ -0,0 +1,68 @@
I setup wiring on the Orange Pi but was unable to access it through a bridged internet interface.
I need another ethernet cable, I'm pausing at 11:05AM.
Resumed at 11:23 with ethernet cable, `arp` isn't giving me anything on where the Pi is.
You must plug in the ethernet to the Pi after plugging in power. Fing is a good network discovery tool. He ran fing twice before and after we plugged in the pi and ran diff on the two captures.
AJ tested using a USB cable with exposed cables, Black = ground Red = multiverse
He hooked them to the board to a resistor to the LED and it worked.
Green = Black Yellow = Red
We wired it up with pin 6 (ground and pin 2 VCC3.3V)
Check the GPIOs in the kernel
/sys/gpio/
Find a GPIO already turned on.
I want to setup rocket.chat. I followed these instructions and modified them for the Raspberry Pi https://rocket.chat/docs/installation/manual-installation/ubuntu/
Install Node & NPM: `curl -fsSL bit.ly/node-installer | bash -s -- --no-dev-deps`
Download: `wget https://releases.rocket.chat/latest/download`
Decompress: `tar -xvzf download`
```
cd Rocket.Chat/programs/server
npm install phantomjs
npm install
cd ..
sudo ROOT_URL=http://your-host-name.com-as-accessed-from-internet/ \
MONGO_URL=mongodb://localhost:27017/rocketchat \
PORT=80 \
node main.js
```
Install MongoDB:
```
sudo apt-get update
sudo apt-get install -y mongodb curl graphicsmagick
```
I had to deal with this issue on my Raspberry Pi:
`gpg: failed to start the dirmngr '/usr/bin/dirmngr': No such file or directory`
`sudo apt-get install dirmngr`
`sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10`
# Install Snap on Raspi
`echo "deb https://mm.gravedo.de/raspbian/ jessie main" > /etc/apt/sources.list.d/snapd.list`
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv B9465B841412DB3B
apt update
apt install -y snapd
sudo snap install rocketchat-server
sudo systemctl restart snap.rocketchat-server.rocketchat-mongo.service
# Haraka on ORANGE_PI
npm install -g Haraka

View File

@ -2,8 +2,6 @@ Search terms: printout, wiring diagram.
Actual diagram:
People who have done it: https://www.youtube.com/watch?v=KF1IJvINjYE
https://www.youtube.com/watch?v=4zICevDOhr8
@ -57,3 +55,43 @@ Adjust device default LEDs.
Raspi example of LED lighting:
https://thepihut.com/blogs/raspberry-pi-tutorials/27968772-turning-on-an-led-with-your-raspberry-pis-gpio-pins
Orange Pi USB process: https://diyprojects.io/orange-pi-onelite-tutorial-use-gpio-python-pinouts/
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install python-dev -y
sudo apt-get install python-pip -y
sudo apt-get install -y python-setuptools
pip install wheel
pip install pyA20
git clone https://github.com/duxingkei33/orangepi_PC_gpio_pyH3
This didn't work, BUT, the below did:
The general proceeding is described in https://linux-sunxi.org/GPIO
The GPIO pins are accessed via the sysfs file system. For enabling a specific pin it has to be exported into /sys/class/gpio/export
for pin PA1 the command would be echo 1 > sys/class/gpio/export. The pin number is calculated by the following formula :
(position of letter in alphabet - 1) * 32 + pin number
PA1 has pin number ('A' is the 1st letter ) 1, PB2 has pin number 34 ('B' is 2nd letter ), PG7 has pin number 199( 'G' is 7th letter (7-1) * 32+7=199 )
the positions on the physical header are different again, cf. the graphic below
so for enabling PG7 that is pin 40 on the physical header can be used
(# echo "out" >/sys/class/gpio/gpio5/direction first)
echo 199 > sys/class/gpio/export
Then you can run `echo "1" >/sys/class/gpio/gpio2/value` to turn it on and `echo "0" >/sys/class/gpio/gpio2/value` to turn it off.
https://stackoverflow.com/questions/46463724/accessing-gpio-on-orangepi-pc-plus-h3-on-armbian-3-4-113-and-newer
https://diyprojects.io/orange-pi-onelite-tutorial-use-gpio-python-pinouts/
https://forum.armbian.com/topic/1471-solved-difficulty-accessing-gpio-via-the-sunxi-gpio-export-interface/