Skip to content

chenphilip888/gpio-remote-control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wifi gpio experiments on the following SBC's:
rpi4b  ( Raspberry Pi 4B )
radxa  ( Rock Pi 4B plus )
rk3328 ( Renegade ROC-RK3328-CC )
tinker ( ASUS TinkerBoard )

Server program runs on SBC's. Client program runs on host PC. Client program needs to adjust server ip address.

Parts required:
1. Seeed Grove starter kit LED. 
2. Grove-LCD RGB Backlight V3.0 JHD1313M2.
3. Analog Servo.

The following 3 tests are included: ( see below for tests summary )
1. led test
2. i2c lcd test
3. servo

Steps to build gpio-remote-control sdcard image:

1. git clone https://github.com/chenphilip888/gpio-remote-control.git
   sudo apt-get install build-essential git libssl-dev nmap net-tools libncurses5-dev libncursesw5-dev dnsutils vsftpd ftp binfmt-support qemu-user-static scons libncurses5-dev libncursesw5-dev libdbus-glib-1-dev libbluetooth-dev python-dev python-setuptools python3-dev python3-pip python3-setuptools libcurl4-openssl-dev gettext dbus-x11 chrpath diffstat gawk texinfo curl flex bison device-tree-compiler python swig

2. Install cross compiler and live-build:
   wget https://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/aarch64-linux-gnu/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz
   sudo tar xvf gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz  -C /usr/local/
   wget https://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/arm-linux-gnueabihf/gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf.tar.xz
   sudo tar xvf gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf.tar.xz -C /usr/local/
   sudo apt-get install debootstrap debhelper kpartx gdisk devscripts dh-systemd isolinux po4a
   wget https://launchpad.net/debian/+archive/primary/+sourcefiles/live-build/1:20210407/live-build_20210407.tar.xz
   tar xvf live-build_20210407.tar.xz
   cd live-build
   sudo make install

3. cd ~/gpio-remote-control/rpi4b
   git clone https://github.com/raspberrypi/linux --depth=1 -b rpi-5.4.y
   cd linux; mkdir tmp; cd tmp; mkdir lib;
   cd ../../; mkdir out;

   make all
   The result is in ./out/sdcard.img
   make cleanall

   sudo dd if=./out/sdcard.img of=/dev/mmcblk0 bs=4096 conv=notrunc,fsync
   Eject sdcard, plugin sdcard, cp ./gpiotest/* /media/$USER/b*/home/linaro
   sync
   Eject sdcard

   cd ./gpiotest; gcc client-gpio.c -o client-gpio;

4. cd ~/gpio-remote-control/radxa
   git clone https://github.com/radxa/u-boot --depth=1 -b stable-4.4-rockpi4
   git clone https://github.com/radxa/kernel --depth=1 -b release-4.4-rockpi4
   cd kernel; mkdir tmp; cd tmp; mkdir lib;
   cd ../../; mkdir out;

   make all
   The result is in ./out/sdcard.img
   make cleanall

   sudo dd if=./out/sdcard.img of=/dev/mmcblk0 bs=4096 conv=notrunc,fsync
   Eject sdcard, plugin sdcard, cp ./gpiotest/* /media/$USER/b*/home/linaro
   sync
   Eject sdcard

5. cd ~/gpio-remote-control/rk3328
   git clone https://github.com/u-boot/u-boot
   git clone https://github.com/FireflyTeam/kernel --depth=1 -b rk3328/firefly
   cd kernel; mkdir tmp; cd tmp; mkdir lib;
   cd ../../; mkdir out;

   make all
   The result is in ./out/sdcard.img
   make cleanall

   sudo dd if=./out/sdcard.img of=/dev/mmcblk0 bs=4096 conv=notrunc,fsync
   Eject sdcard, plugin sdcard, cp ./gpiotest/* /media/$USER/b*/home/linaro
   sync
   Eject sdcard

6. cd ~/gpio-remote-control/tinker
   git clone https://github.com/TinkerBoard/debian_u-boot.git --depth=1 -b release
   git clone https://github.com/TinkerBoard/debian_kernel.git --depth=1 -b release
   cd debian_kernel; mkdir tmp; cd tmp; mkdir lib;
   cd ../../; mkdir out;

   make all
   The result is in ./out/sdcard.img
   make cleanall

   sudo dd if=./out/sdcard.img of=/dev/mmcblk0 bs=4096 conv=notrunc,fsync
   Eject sdcard, plugin sdcard, cp ./gpiotest/* /media/$USER/b*/home/linaro
   sync
   Eject sdcard

Plugin usb wifi dongle to rk3328.
Plugin sdcard to SBC
Login:
Username: linaro
Password: linaro
uname -a
lsb_release -a
Setup wifi:
nmcli dev wifi connect "SSID" password "PASSWORD"
sudo dpkg-reconfigure tzdata
sudo dpkg-reconfigure locales
sudo apt update
sudo apt upgrade
sync
sudo reboot
date

sudo apt-get install python3-smbus

On SBC:
gcc server-gpio.c gpio.c -I. -o server-gpio
sudo ./server-gpio
On Host PC: 
cd ./gpiotest
change HOST ip address in client-gpio.c
gcc client-gpio.c -o client-gpio
./client-gpio

On SBC:
sudo ./server-gpio.py
On Host PC:
cd ./gpiotest
change HOST ip address in client-gpio.py
./client-gpio.py

Check kernel driver readiness for rpi4b:
sudo cat /proc/device-tree/soc/pwm@7e20c000/status  ( pwm 1 )
sudo cat /proc/device-tree/soc/i2c@7e804000/status  ( i2c-1 )

Check kernel driver readiness for radxa:
sudo cat /proc/device-tree/pwm@ff420010/status  ( pwm 1 )
sudo cat /proc/device-tree/i2c@ff160000/status  ( i2c-7 )

Check kernel driver readiness for rk3328:
sudo cat /proc/device-tree/pwm@ff1b0020/status  ( pwm 2 )
sudo cat /proc/device-tree/i2c@ff160000/status  ( i2c-1 )

Check kernel driver readiness for tinker:
sudo cat /proc/device-tree/pwm@ff680030/status  ( pwm 3 )
sudo cat /proc/device-tree/i2c@ff140000/status  ( i2c-1 )

-----------------------------------------------------------------------------

Here are the summary of the tests:

These tests used Seeed Grove starter kit LED, Grove-LCD RGB Backlight V3.0 JHD1313M2 and Analog Servo.

1. led test.
   This test will blink led 5 times.
   Connect gpio pin 16 to led control. ( rpi4b ).
   Connect gpio pin 18 to led control. ( radxa ).
   Connect gpio pin 16 to led control. ( rk3328 ).
   Connect gpio pin 18 to led control. ( tinker ).
   Connect gpio pin  2 to led 5V.
   Connect gpio pin  9 to led ground.

2. i2c lcd test.
   This test will change lcd backlight color for 5 cycles.
   Then it will display two sentences on lcd display.
   Connect gpio pin  3 to lcd display SDA. ( rpi4b i2c-1 ).
   Connect gpio pin  5 to lcd display SCL.
   Connect gpio pin  3 to lcd display SDA. ( radxa i2c-7 ).
   Connect gpio pin  5 to lcd display SCL.
   Connect gpio pin 27 to lcd display SDA. ( rk3328 i2c-1 ).
   Connect gpio pin 28 to lcd display SCL.
   Connect gpio pin  3 to lcd display SDA. ( tinker i2c-1 ).
   Connect gpio pin  5 to lcd display SCL.
   Connect gpio pin  2 to lcd display 5V.
   Connect gpio pin  9 to lcd display ground.

3. servo.
   This test will turn servo 45 degree - 90 degree - 45 degree - 0 degree etc.
   Connect gpio pin 33 to servo control. ( rpi4b pwm 1 ).
   Connect gpio pin 13 to led control.   ( radxa pwm 1 ).
   Connect gpio pin 12 to led control.   ( rk3328 pwm 2 ).
   Connect gpio pin 32 to led control.   ( tinker pwm 3 ).
   Connect gpio pin  2 to servo 5V.
   Connect gpio pin  9 to servo ground.

-----------------------------------------------------------------------------

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published