Difference between revisions of "UniPi on BPI"
(Created page with "# UniPi on BPI we have success test UniPi on BPI-M3, so , it is easy to use on all BPI product. **about UniPi:** UniPi board is designed to fit the cheap and easy to use Ra...") |
|||
Line 4: | Line 4: | ||
we have success test UniPi on BPI-M3, so , it is easy to use on all BPI product. | we have success test UniPi on BPI-M3, so , it is easy to use on all BPI product. | ||
− | + | =about UniPi= | |
UniPi board is designed to fit the cheap and easy to use Raspberry Pi mini computer. It has 8 changeover relays, 14 digital inputs, single channel 1wire interface, 2 analog inputs 0-10V and one analog 0-10V output. Furthermore the second I2C port of the RPi features 5V level converter and ESD protection, so you can easily connect other devices. The same applies to the UART! | UniPi board is designed to fit the cheap and easy to use Raspberry Pi mini computer. It has 8 changeover relays, 14 digital inputs, single channel 1wire interface, 2 analog inputs 0-10V and one analog 0-10V output. Furthermore the second I2C port of the RPi features 5V level converter and ESD protection, so you can easily connect other devices. The same applies to the UART! | ||
Line 12: | Line 12: | ||
![](unipi 2.jpg) | ![](unipi 2.jpg) | ||
− | more about UniPi: | + | *more about UniPi: |
+ | ::UniPi Introduction: http://unipi.technology/ | ||
− | + | =How to use UniPi on banana pi= | |
− | |||
− | |||
we test it on BPI-M3 with WiringPi lib. so other BPI board is same as BPI-M3 | we test it on BPI-M3 with WiringPi lib. so other BPI board is same as BPI-M3 | ||
Line 26: | Line 25: | ||
![](unipi 1.jpg) | ![](unipi 1.jpg) | ||
− | + | Step 1: Download WiringPI | |
− | + | $ git clone https://github.com/BPI-SINOVOIP/BPI-WiringPi.git11 -b BPI_M3 | |
− | $ git clone https://github.com/BPI-SINOVOIP/BPI-WiringPi.git11 -b BPI_M3 | + | $ cd BPI-WiringPi |
− | $ cd BPI-WiringPi | + | $ chmod +x ./build |
− | $ chmod +x ./build | + | $ sudo ./build |
− | $ sudo ./build | + | |
− | + | Step 2:Check the 8Relays(MCP23008) | |
− | |||
device to see if it's on track.(address 0x20) | device to see if it's on track.(address 0x20) | ||
+ | |||
(I2c port number for M3: 2 ) | (I2c port number for M3: 2 ) | ||
− | + | sudo su | |
− | sudo su | + | i2cdetect -y 2 |
− | i2cdetect -y 2 | + | .0 1 2 3 4 5 6 7 8 9 a b c d e f |
− | .0 1 2 3 4 5 6 7 8 9 a b c d e f | + | 00: -- -- -- -- -- -- -- -- -- -- -- -- -- |
− | 00: -- -- -- -- -- -- -- -- -- -- -- -- -- | + | 10: -- -- -- -- -- -- -- -- 18 -- -- -- -- -- -- -- |
− | 10: -- -- -- -- -- -- -- -- 18 -- -- -- -- -- -- -- | + | 20: 20 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
− | 20: 20 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- | + | 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
− | 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- | + | 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
− | 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- | + | 50: 50 -- -- -- -- -- -- 57 -- -- -- -- -- -- -- -- |
− | 50: 50 -- -- -- -- -- -- 57 -- -- -- -- -- -- -- -- | + | 60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- 6f |
− | 60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- 6f | + | 70: -- -- -- -- -- -- -- -- |
− | 70: -- -- -- -- -- -- -- -- | ||
− | |||
− | + | Step 3 : Copy smaple code to mcp23008.c file | |
− | + | $ sudo vi mcp23008.c | |
− | + | Step 4 : Compile mcp23008.c | |
− | + | $ gcc -o mcp23008 mcp23008.c -l wiringPi | |
− | + | Step 5: Run mcp23008 | |
− | + | $ sudo ./mcp23008 | |
− | + | *Vedeo demo on youtube : https://www.youtube.com/watch?v=-4dgZZLFl3g&feature=youtu.be | |
− | + | ==Sample Code== | |
− | + | #include <stdio.h> | |
+ | #include <wiringPi.h> | ||
+ | #include <mcp23008.h> | ||
+ | #define PIN_BASE 65 | ||
+ | #define ADDRESS 0x20 | ||
− | + | int main(int argc, char *argv[]) | |
− | + | { | |
− | + | int s; | |
− | + | int count=65; | |
+ | wiringPiSetup(); | ||
+ | mcp23008Setup(PIN_BASE, ADDRESS); | ||
− | |||
− | |||
− | + | for(int i=0 ; i<8 ;i++){ | |
− | { | + | pinMode(count , OUTPUT); |
− | + | count=(count+1); | |
− | + | } | |
− | |||
− | |||
− | + | while(1){ | |
− | + | s = digitalRead(PIN_BASE); | |
− | + | printf("Status switch is %d\n", s); | |
− | |||
+ | count=PIN_BASE; | ||
+ | for(int i=0 ; i<8 ;i++){ | ||
+ | digitalWrite(count , 1); | ||
+ | count=count+1; | ||
+ | } | ||
+ | delay(1000); | ||
− | + | s = digitalRead(PIN_BASE); | |
− | s = digitalRead(PIN_BASE); | + | printf("Status switch is %d\n", s); |
− | printf("Status switch is %d\n", s); | ||
− | count=PIN_BASE; | + | count=PIN_BASE; |
− | for(int i=0 ; i<8 ;i++){ | + | for(int i=0 ; i<8 ;i++){ |
− | digitalWrite(count , | + | digitalWrite(count , 0); |
− | count=count+1; | + | count=count+1; |
− | } | + | } |
− | delay(1000); | + | delay(1000); |
− | + | } | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | } | ||
− | |||
− | } | + | return 0; |
+ | } | ||
− | |||
− | |||
− | |||
link to forum for discuss: | link to forum for discuss: | ||
http://forum.banana-pi.org/t/bpi-m3-use-the-unipi-8relays-mcp23008-module-demo/1121 | http://forum.banana-pi.org/t/bpi-m3-use-the-unipi-8relays-mcp23008-module-demo/1121 |
Revision as of 19:47, 16 May 2018
UniPi on BPI
we have success test UniPi on BPI-M3, so , it is easy to use on all BPI product.
about UniPi
UniPi board is designed to fit the cheap and easy to use Raspberry Pi mini computer. It has 8 changeover relays, 14 digital inputs, single channel 1wire interface, 2 analog inputs 0-10V and one analog 0-10V output. Furthermore the second I2C port of the RPi features 5V level converter and ESD protection, so you can easily connect other devices. The same applies to the UART!
Does it have anything else that might be usable? Of course! It has Real Time Clock module so if your Pi looses power, the clock stays synced so when the system comes up, it will do everything as planned.
![](unipi 2.jpg)
- more about UniPi:
- UniPi Introduction: http://unipi.technology/
How to use UniPi on banana pi
we test it on BPI-M3 with WiringPi lib. so other BPI board is same as BPI-M3
OS: BPI-M3 Ubuntu15.10 (Kernel3.4)
Version: 1.0 HDMI
![](unipi 1.jpg)
Step 1: Download WiringPI
$ git clone https://github.com/BPI-SINOVOIP/BPI-WiringPi.git11 -b BPI_M3 $ cd BPI-WiringPi $ chmod +x ./build $ sudo ./build
Step 2:Check the 8Relays(MCP23008)
device to see if it's on track.(address 0x20)
(I2c port number for M3: 2 )
sudo su i2cdetect -y 2 .0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- 18 -- -- -- -- -- -- -- 20: 20 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: 50 -- -- -- -- -- -- 57 -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- 6f 70: -- -- -- -- -- -- -- --
Step 3 : Copy smaple code to mcp23008.c file
$ sudo vi mcp23008.c
Step 4 : Compile mcp23008.c
$ gcc -o mcp23008 mcp23008.c -l wiringPi
Step 5: Run mcp23008
$ sudo ./mcp23008
- Vedeo demo on youtube : https://www.youtube.com/watch?v=-4dgZZLFl3g&feature=youtu.be
Sample Code
#include <stdio.h> #include <wiringPi.h> #include <mcp23008.h> #define PIN_BASE 65 #define ADDRESS 0x20
int main(int argc, char *argv[]) { int s; int count=65; wiringPiSetup(); mcp23008Setup(PIN_BASE, ADDRESS);
for(int i=0 ; i<8 ;i++){ pinMode(count , OUTPUT); count=(count+1); }
while(1){ s = digitalRead(PIN_BASE); printf("Status switch is %d\n", s);
count=PIN_BASE; for(int i=0 ; i<8 ;i++){ digitalWrite(count , 1); count=count+1; } delay(1000);
s = digitalRead(PIN_BASE); printf("Status switch is %d\n", s);
count=PIN_BASE; for(int i=0 ; i<8 ;i++){ digitalWrite(count , 0); count=count+1; } delay(1000);
}
return 0; }
link to forum for discuss:
http://forum.banana-pi.org/t/bpi-m3-use-the-unipi-8relays-mcp23008-module-demo/1121