・Set up Raspberry Pi Noobs
・Install wiringPi
・GPIO setting for Python.(Python is the simplest sample code,.You don't need to check the number of GPIO. )
・Web GPIO controller with PHP
Step 1 : Delete black list. And add "i2c-dev".
Open terminal, and type
$sudo nano /etc/modprobe.d/raspi-blacklist.conf
Type "#" to comment out bladk list. Put [ctrl]+[x] keys to save file.
$sudo nano /etc/modules
Write
i2c-dev
at end of file. And put [ctrl]+[x] keys to save file.
Step 2 : Install python-smbus
$sudo apt-get update
$sudo apt-get upgrade
$sudo apt-get install python-smbus
$sudo adduser pi i2c
$sudo reboot
Step 3 : I2C Test
Turn on MCU Gear. And type
$i2cdetect -y 0
or
$i2cdetect -y 1
It's depend on your Raspberry Pi version.
Step 4 : Setup SPI bus.
$sudo apt-get install python-dev
$sudo reboot
After reboot, check installed SPI.
$lsmod
Then you can see spi-bcm2708.
$mkdir python-spi
$cd python-spi
$wget https://raw.github.com/doceme/py-spidev/master/setup.py
$wget https://raw.github.com/doceme/py-spidev/master/spidev_module.c
$sudo python setup.py install
$cd /home/pi/Desktop/
$wget http://mcugear.org/RPitest/MGPyVer1_1.tar$tar xvf MGPyVer1_1.tar
You can see many sample program for each module.
$sudo python sample.py
is run command.
ex)LED blink test
This sample program apply to universal module.
N_VDD_VDD_VDD is address setting the reverse side of a module.
It means AD2 = VDD(+3V3) AD1 = VDD(+3V3) AD0 = VDD(+3V3)
You can see detail on PCA9674 and PCA9674A datasheet.
You can simply check the sample program with LED and resister.
You can automatic wiring these pins on module.
p.NC : No connect c
p.outpin[0-5] : output pin
p.inpin[0-1] : input pin
Others are
SPI : MISO, MOSI, SCK, CE0 :
UART : TX, RX
You can check pin assigne on p.py.
! Option function is little bit difficult. You need to change sample program. (bank parameters)






0 件のコメント:
コメントを投稿