SlideShare una empresa de Scribd logo
1 de 32
CUSTARD PI 7 
USER INFORMATION 
The Industrial Control Interface for the Raspberry Pi 
9th November 2014 
SF Innovations
www.sf-innovations.co.uk
www.sf-innovations.co.uk 
OVERVIEW OF FEATURES 
2 Relay outputs 
4 Open Collector outputs 
2 Built in Switches 
8 General Purpose Digital I/O 
4 Analogue inputs 
1 Analogue output 
16 pin LCD Interface 
LED indication on most ports 
Screw terminal connection on most ports 
Flexible Power Supply 
Board can be powered from Raspberry Pi 
Board and Rpi can be powered from 5V supply 
Board and Rpi can be powered by 2 separate 5V supplies 
LED indication of 5VPi, 5V and 3V3 supplies 
Fused 5V and 3V3 available on screw terminals 
Prototyping area with pads for 14-pin SMT IC 
Ribbon Connector (26 way) to the Raspberry Pi GPIO 
Second Connector (26 way) to daisy chain a second Custard Pi -7
www.sf-innovations.co.uk 
LAYOUT OF COMPONENTS 
This PCB board size 15cm x 11 cm
www.sf-innovations.co.uk 
PROTOTYPING AREA
www.sf-innovations.co.uk 
RELAY AND OPEN COLLECTOR OUTPUTS 
This is provided using the MCP23008 8-port I/O expander which works 
on the I2C bus. 
This is followed by the Darlington Driver, the ULN2801 which drives the 
relays and provides the 4 Open Collector Outputs. There are 6 LEDs 
which indicate the status of these outputs. 
The 2 spare pins of the MCP23008 are used for the 2 key inputs from the 
on board switches.
www.sf-innovations.co.uk 
RELAY AND OPEN COLLECTOR OUTPUTS 
These are shown on the picture below. There are 2 sets of screw 
terminals provided with the relays with access to the 3 terminals 
(common, normally closed and normally open) of each relay. Screw 
terminals are also provided for the 4 Open Collector outputs and the 2 
keypad inputs.
www.sf-innovations.co.uk 
RELAY AND OPEN COLLECTOR OUTPUTS 
This is provided using the MCP23008 8-port I/O expander which works 
on the I2C bus. 
This is followed by the Darlington Driver, the ULN2801 which drives the 
relays and provides the 4 Open Collector Outputs. There are 6 LEDs 
which indicate the status of these outputs. 
The 2 spare pins of the MCP23008 are used for the 2 key inputs from the 
on board switches. 
The functions to control these are provided in cpi7x.py. Download from 
here and change from .txt to .py. 
Default I2C address is 0x27 (add7) 
The 4 Open Collector outputs are switched on and off using the following 
settings. 
ONoc1 and OFFoc1, ONoc2 and OFFoc2, ONoc3 and OFFoc3, ONoc4 
and OFFoc4
www.sf-innovations.co.uk 
RELAY AND OPEN COLLECTOR OUTPUTS 
The 2 relays are switched on and off using the following settings. 
ONrl1 and OFFrl1, ONrl2 and OFFrl2. 
The actual function to set them ON and OFF is: 
setbit (address , setting) & clrbit (address, setting) 
In readbit (address, bit) function allows the user to read the status of the 
the 2 keypad inputs. 
In addition the setinandout (address) function sets the MCP23008 chip to 
use 6 of the pins as outputs and 2 as inputs.
www.sf-innovations.co.uk 
RELAY AND OPEN COLLECTOR OUTPUTS 
#1/usr/bin/env python 
import time 
import cpi7x 
#start program 
board1=cpi7x.add7 
cpi7x.setinandout(board1) 
cpi7x.alloff(board1) 
while True: 
cpi7x.setbit(board1, cpi7x.ONoc1) 
time.sleep (0.2) 
cpi7x.setbit(board1, cpi7x.ONoc2) 
time.sleep (0.2) 
cpi7x.setbit(board1, cpi7x.ONoc3) 
time.sleep (0.2) 
cpi7x.setbit(board1, cpi7x.ONoc4) 
time.sleep (0.2) 
cpi7x.setbit(board1, cpi7x.ONrl2) 
time.sleep (0.2) 
cpi7x.setbit(board1, cpi7x.ONrl1) 
time.sleep (0.5) 
Listing of sample 
program to switch relays 
and open collector 
outputs on and off and 
read keypad inputs. 
Download from here and 
change from .txt to .py 
Cpi7ocrelkp.py
www.sf-innovations.co.uk 
RELAY AND OPEN COLLECTOR OUTPUTS 
cpi7x.clrbit(board1, cpi7x.OFFoc1) 
cpi7x.clrbit(board1, cpi7x.OFFoc2) 
cpi7x.clrbit(board1, cpi7x.OFFoc3) 
cpi7x.clrbit(board1, cpi7x.OFFoc4) 
cpi7x.clrbit(board1, cpi7x.OFFrl2) 
cpi7x.clrbit(board1, cpi7x.OFFrl1) 
time.sleep (0.5) 
kp2 = (cpi7x.readbit (board1, 0x01)) 
kp1 = (cpi7x.readbit (board1, 0x02)) 
if kp1 == 0: 
print "kp1 pressed" 
if kp2 == 0: 
print "kp2 pressed" 
import sys 
sys.exit()
www.sf-innovations.co.uk 
LCD INTERFACE 
This is provided using the 
MCP23008 8-port I/O expander 
which works on the I2C bus (default 
address 0x25) 
A 2 x 16 character display has a 
16pin connector on a 0.1 inch pitch 
and can easily be connected to the 
Custard Pi 7 with a ribbon connector. 
The functions to drive the display are 
provided in cpi7lcd.py. Download 
from here and change from .txt to 
.py.
www.sf-innovations.co.uk 
LCD INTERFACE 
Here is a ribbon cable connecting the LCD to the Custard Pi 7. (You will 
need to solder a 16 way connector to the LCD.)
www.sf-innovations.co.uk 
LCD INTERFACE 
#1/usr/bin/env python 
import time 
import cpi7lcd 
lcd = cpi7lcd 
lcd.lcdinit(0x25) 
while True: 
lcd.lcd_clear 
time.sleep (0.5) 
lcd.lcd_puts("LCD line 1 test",1) #display text on line 1 
time.sleep (0.5) 
lcd.lcd_clear 
lcd.lcd_puts("LCD line 2 test",2) #display text on line 2 
time.sleep (0.5) 
lcd.lcdinit(0x25) 
import sys 
sys.exit() 
Listing of sample 
program to write to a 2 
line display. 
Download from here and 
change from .txt to .py 
testlcd.py
www.sf-innovations.co.uk 
8 GENERAL PURPOSE DIGITAL I/O 
This is provided using the MCP23008 8-port I/O expander which works 
on the I2C bus (default address 0x26). 
The functions to control these I/O is provided in cpi7y.py. Download from 
here and change from .txt to .py.
www.sf-innovations.co.uk 
8 GENERAL PURPOSE DIGITAL I/O 
The functions to control these I/O is provided in cpi7y.py. Download from 
here and change from .txt to .py. 
This works very similarly to the Relay and Open Collector controls. For 
this example 4 of the bits are set as outputs and 4 as inputs. 
The settings to control the outputs are: 
ONbit4, ONbit5, ONbit6, ONbit7 and OFFbit4, OFFbit5, OFFbit6, 
OFFbit7. 
The functions available are: 
setbit To switch outputs high 
clrbit To switch outputs low 
readbit Read inputs 
setinandout To set 4 bits as outputs and 4 as inputs 
setpullups 100k pullups on input pins 
alloff set all outputs to lo
www.sf-innovations.co.uk 
8 GENERAL PURPOSE DIGITAL I/O 
The MCP23008 is a very versatile input output device. It allows the user set 
All 8 pins as inputs, outputs or a mix of inputs and outputs. The inputs can be 
set to have pull-ups and also generate an interrupt on change of status. 
There is more info on the registers on the datasheet.
www.sf-innovations.co.uk 
8 GENERAL PURPOSE DIGITAL I/O 
#1/usr/bin/env python 
import time 
import cpi7y 
import pylcdlibseg 
board1=cpi7y.add6 
cpi7y.setinandout(board1) 
cpi7y.setpullups(board1) 
cpi7y.alloff(board1) 
while True: 
cpi7y.setbit(board1, cpi7y.ONbit4) 
time.sleep (0.2) 
cpi7y.setbit(board1, cpi7y.ONbit5) 
time.sleep (0.2) 
cpi7y.setbit(board1, cpi7y.ONbit6) 
time.sleep (0.2) 
cpi7y.setbit(board1, cpi7y.ONbit7) 
time.sleep (0.5) 
cpi7y.clrbit(board1, cpi7y.OFFbit4) 
cpi7y.clrbit(board1, cpi7y.OFFbit5) 
cpi7y.clrbit(board1, cpi7y.OFFbit6) 
cpi7y.clrbit(board1, cpi7y.OFFbit7) 
time.sleep (0.5) 
Listing of sample program to 
switch the 4 outputs high and 
low and read the 4 inputs. 
Download from here and 
change from .txt to .py 
Cpi7gpio.py 
To test: 
Connect a resistor and LED 
from bit4 to GND and see it 
flash. Then test bit5, bit6 and 
bit7.
www.sf-innovations.co.uk 
8 GENERAL PURPOSE DIGITAL I/O 
bit0 = (cpi7y.readbit (board1, 0x01)) 
bit1 = (cpi7y.readbit (board1, 0x02)) 
bit2 = (cpi7y.readbit (board1, 0x04)) 
bit3 = (cpi7y.readbit (board1, 0x08)) 
if bit0 == 0: 
print "bit0 low" 
else: 
print "bit0 high“ 
if bit1 == 0: 
print "bit1 low" 
else: 
print "bit1 high“ 
if bit2 == 0: 
print "bit2 low" 
else: 
print "bit2 high“ 
if bit3 == 0: 
print "bit3 low" 
else: 
print "bit3 high" 
print "***************************" 
import sys 
sys.exit() 
To test: 
Connect a link from bit0 to 
GND and check that the 
program detects this. Then 
test bit3, bit2 and bit 1.
www.sf-innovations.co.uk 
4 ANALOGUE INPUTS AND ANALOGUE OUTPUT 
This is provided using the PCF8591 8-bit A to D D to A convertor which 
works on the I2C bus (default address 0x4F).
www.sf-innovations.co.uk 
4 ANALOGUE INPUTS AND ANALOGUE OUTPUT 
This is provided using the PCF8591 8-bit A to D D to A convertor which 
works on the I2C bus (default address 0x4F).
www.sf-innovations.co.uk 
4 ANALOGUE INPUTS AND ANALOGUE OUTPUT 
#1/usr/bin/env python 
import time 
import smbus 
#******************************************** 
# Custard Pi 7 8591 25th Oct 2013 
#I2C addresses 
add= 0x4F 
bus=smbus.SMBus(1) 
#DtoA channel select 
ch0= 0x00 
ch1= 0x01 
ch2= 0x02 
ch3= 0x03 
def readanalog(add): 
analog=bus.read_byte(add) 
return analog 
def writedtoa(add,value): 
bus.write_byte_data (add, 0x44, value) 
#****************************************** 
Listing of sample program to 
output an analogue voltage 
and read the voltage on the 4 
analogue inputs. 
Download from here and 
change from .txt to .py 
cp8591.py 
To test: 
Loop back the ANOUT back 
to ANIN0, ANIN1 etc in turn 
and see that the analogue 
output is being read 
correctly.
www.sf-innovations.co.uk 
4 ANALOGUE INPUTS AND ANALOGUE OUTPUT 
while True: 
value=0x00 
for x in range (0,255): 
writedtoa(add,value) 
print value 
time.sleep(0.5) 
value=value+1 
an0 = readanalog(add) 
an0 = readanalog(add) 
print "ch0=", (an0) 
an1 = readanalog(add) 
print "ch1=", (an1) 
an2 = readanalog(add) 
print "ch2=", (an2) 
an3 = readanalog(add) 
print "ch3=", (an3) 
print "*****“ 
time.sleep(0.5)
www.sf-innovations.co.uk 
POWER MANAGEMENT 
There are 3 powering options. 
#1 The Rpi and the Custard Pi 7 can both 
be powered from the Rpi 5V supply. In this 
case jumper J14 is on the left hand side 
and the board 5V and the Rpi 5VPI are 
both connected together. Make sure that 
only the Rpi 5V supply is connected. 
#2 Both can be powered from the board 
5V. Same as above but make sure that 
only the board 5V is plugged in. 
#3 Both are independently powered. In this 
case make sure that jumper on J14 is on 
right hand side (or not plugged in).
www.sf-innovations.co.uk 
POWER CONNECTORS 
There is a 3-way ground connector provided. 
The 3V3 and 5V supply outputs on the screw terminal are fused at 100mA 
to prevent users from taking too much power from these rails.
www.sf-innovations.co.uk 
MULTIPLE CUSTARD PI 7 BOARDS 
Because the Custard Pi 7 uses the I2C interface to interface to the various 
functional blocks it is possible to daisychaining 2 or more Custard Pi 7s. 
The user has to pay attention to the I2C addressing to make sure that the 
devices on the various cards have different I2C addresses. There are also 
resistor positions available on the PCB to do this. 
One needs to pay particular attention to the power requirements.
www.sf-innovations.co.uk 
SETTING UP THE I2C BUS – STEP 1 
At the command prompt type: 
sudo nano /etc/modules 
This uses the nano editor to make some changes to the modules file. 
Add the following two lines to this file 
i2c-bcm2708 
i2c-dev 
Then save and exit the file using CTRL-x and Y.
www.sf-innovations.co.uk 
SETTING UP THE I2C BUS – STEP 2 
Make sure that you have the I2C utilities installed by executing the 
following two commands. The Pi will need to be connected to the Internet 
for this. 
sudo apt-get install python-smbus 
sudo apt-get install i2c-tools 
If you get a 404 error do an update first: 
sudo apt-get update 
Note : The installation could take a few minutes to do, depend on how 
busy the server is. 
Now add a new user to the i2c group: 
sudo adduser pi i2c
www.sf-innovations.co.uk 
SETTING UP THE I2C BUS – STEP 3 
On the Raspberry Pi, the I2C and the SPI buses are usually disabled. 
This is done in the /etc/modprobe.d/raspi-blacklist.conf file. 
If this file is not present then there is nothing to be done. Otherwise edit 
the file by typing the following at the command prompt. 
sudo nano /etc/modprobe.d/raspi-blacklist.conf 
If the I2C and the SPI is blacklisted, you will see the following commands. 
blacklist spi-bcm2708 
blacklist i2c-bcm2708 
Insert a # in front of these to comment them out. 
Then save and exit the file using CTRL-x and Y. 
After editing the file, you will need to reboot for the changes to take 
effect.
www.sf-innovations.co.uk 
SETTING UP THE I2C BUS – STEP 4 
Now we need to test if the I2C bus is working correctly. 
Connect up the Custard Pi 6 board (or any other I2C bus device) and run 
the following command. 
sudo i2cdetect -y 1 (for Rev 2 boards which uses port 1) 
Or 
sudo i2cdetect -y 0 (for Rev 1 boards which uses port 0) 
If everything is OK, then the I2C address of the device will be shown as 
on the following slide.
www.sf-innovations.co.uk 
SETTING UP THE I2C BUS – STEP 4 
I2C devices with address 40 and 70 present on the bus.
www.sf-innovations.co.uk 
SUMMARY 
The Custard Pi 7 provides Raspberry Pi hardware hackers with a handy 
board that is packed with features. 
Make sure you refer to the www.sf-innovations.co.uk website for the latest 
user information. 
Further information 
Blog dedicated to electronics & Raspberry Pi

Más contenido relacionado

La actualidad más candente

Getting Started with Raspberry Pi - DCC 2013.1
Getting Started with Raspberry Pi - DCC 2013.1Getting Started with Raspberry Pi - DCC 2013.1
Getting Started with Raspberry Pi - DCC 2013.1Tom Paulus
 
Rumba CNERT presentation
Rumba CNERT presentationRumba CNERT presentation
Rumba CNERT presentationARCFIRE ICT
 
Embedded TCP/IP stack for FreeRTOS
Embedded TCP/IP stack for FreeRTOSEmbedded TCP/IP stack for FreeRTOS
Embedded TCP/IP stack for FreeRTOS艾鍗科技
 
Python code for Buzzer Control using Raspberry Pi
Python code for Buzzer Control using Raspberry PiPython code for Buzzer Control using Raspberry Pi
Python code for Buzzer Control using Raspberry PiAmarjeetsingh Thakur
 
ofxTonic und Sound
ofxTonic und SoundofxTonic und Sound
ofxTonic und SoundJeongHo Park
 
Raspberry Pi - HW/SW Application Development
Raspberry Pi - HW/SW Application DevelopmentRaspberry Pi - HW/SW Application Development
Raspberry Pi - HW/SW Application DevelopmentCorley S.r.l.
 
Raspberry Pi for IPRUG
Raspberry Pi for IPRUGRaspberry Pi for IPRUG
Raspberry Pi for IPRUGFrank Carver
 
Introduction to nand2 tetris
Introduction to nand2 tetrisIntroduction to nand2 tetris
Introduction to nand2 tetrisYodalee
 
Gameboy emulator in rust and web assembly
Gameboy emulator in rust and web assemblyGameboy emulator in rust and web assembly
Gameboy emulator in rust and web assemblyYodalee
 
Tiny ML for spark Fun Edge
Tiny ML for spark Fun EdgeTiny ML for spark Fun Edge
Tiny ML for spark Fun Edge艾鍗科技
 
TinyML - 4 speech recognition
TinyML - 4 speech recognition TinyML - 4 speech recognition
TinyML - 4 speech recognition 艾鍗科技
 
Tensorflow lite for microcontroller
Tensorflow lite for microcontrollerTensorflow lite for microcontroller
Tensorflow lite for microcontrollerRouyun Pan
 
Fun with Raspberry PI (and Perl)
Fun with Raspberry PI (and Perl)Fun with Raspberry PI (and Perl)
Fun with Raspberry PI (and Perl)Andrew Shitov
 
Embedded Systems Project Based Training|Engineering Projects,Summer Training
Embedded Systems Project Based Training|Engineering Projects,Summer TrainingEmbedded Systems Project Based Training|Engineering Projects,Summer Training
Embedded Systems Project Based Training|Engineering Projects,Summer TrainingTechnogroovy
 
pcDuino Presentation at SparkFun
pcDuino Presentation at SparkFunpcDuino Presentation at SparkFun
pcDuino Presentation at SparkFunJingfeng Liu
 
pcDuino tech talk at Carnegie Mellon University 10/14/2014
pcDuino tech talk at Carnegie Mellon University 10/14/2014pcDuino tech talk at Carnegie Mellon University 10/14/2014
pcDuino tech talk at Carnegie Mellon University 10/14/2014Jingfeng Liu
 

La actualidad más candente (20)

Raspberry pi led blink
Raspberry pi led blinkRaspberry pi led blink
Raspberry pi led blink
 
Getting Started with Raspberry Pi - DCC 2013.1
Getting Started with Raspberry Pi - DCC 2013.1Getting Started with Raspberry Pi - DCC 2013.1
Getting Started with Raspberry Pi - DCC 2013.1
 
8-bit Emulator Programming with Go
8-bit Emulator Programming with Go8-bit Emulator Programming with Go
8-bit Emulator Programming with Go
 
Presentazione
PresentazionePresentazione
Presentazione
 
Rumba CNERT presentation
Rumba CNERT presentationRumba CNERT presentation
Rumba CNERT presentation
 
123
123123
123
 
Embedded TCP/IP stack for FreeRTOS
Embedded TCP/IP stack for FreeRTOSEmbedded TCP/IP stack for FreeRTOS
Embedded TCP/IP stack for FreeRTOS
 
Python code for Buzzer Control using Raspberry Pi
Python code for Buzzer Control using Raspberry PiPython code for Buzzer Control using Raspberry Pi
Python code for Buzzer Control using Raspberry Pi
 
ofxTonic und Sound
ofxTonic und SoundofxTonic und Sound
ofxTonic und Sound
 
Raspberry Pi - HW/SW Application Development
Raspberry Pi - HW/SW Application DevelopmentRaspberry Pi - HW/SW Application Development
Raspberry Pi - HW/SW Application Development
 
Raspberry Pi for IPRUG
Raspberry Pi for IPRUGRaspberry Pi for IPRUG
Raspberry Pi for IPRUG
 
Introduction to nand2 tetris
Introduction to nand2 tetrisIntroduction to nand2 tetris
Introduction to nand2 tetris
 
Gameboy emulator in rust and web assembly
Gameboy emulator in rust and web assemblyGameboy emulator in rust and web assembly
Gameboy emulator in rust and web assembly
 
Tiny ML for spark Fun Edge
Tiny ML for spark Fun EdgeTiny ML for spark Fun Edge
Tiny ML for spark Fun Edge
 
TinyML - 4 speech recognition
TinyML - 4 speech recognition TinyML - 4 speech recognition
TinyML - 4 speech recognition
 
Tensorflow lite for microcontroller
Tensorflow lite for microcontrollerTensorflow lite for microcontroller
Tensorflow lite for microcontroller
 
Fun with Raspberry PI (and Perl)
Fun with Raspberry PI (and Perl)Fun with Raspberry PI (and Perl)
Fun with Raspberry PI (and Perl)
 
Embedded Systems Project Based Training|Engineering Projects,Summer Training
Embedded Systems Project Based Training|Engineering Projects,Summer TrainingEmbedded Systems Project Based Training|Engineering Projects,Summer Training
Embedded Systems Project Based Training|Engineering Projects,Summer Training
 
pcDuino Presentation at SparkFun
pcDuino Presentation at SparkFunpcDuino Presentation at SparkFun
pcDuino Presentation at SparkFun
 
pcDuino tech talk at Carnegie Mellon University 10/14/2014
pcDuino tech talk at Carnegie Mellon University 10/14/2014pcDuino tech talk at Carnegie Mellon University 10/14/2014
pcDuino tech talk at Carnegie Mellon University 10/14/2014
 

Destacado

Raspberry Pi Base - A flexible support frame for Raspberry Pi projects
Raspberry Pi Base - A flexible support frame for Raspberry Pi projectsRaspberry Pi Base - A flexible support frame for Raspberry Pi projects
Raspberry Pi Base - A flexible support frame for Raspberry Pi projectsSeggy Segaran
 
10 Great Tips for Business Owners
10 Great Tips for Business Owners10 Great Tips for Business Owners
10 Great Tips for Business OwnersSeggy Segaran
 
Raspberry Pi Using Python
Raspberry Pi Using PythonRaspberry Pi Using Python
Raspberry Pi Using PythonSeggy Segaran
 
Basic Electronics - Ohm's Law
Basic Electronics - Ohm's LawBasic Electronics - Ohm's Law
Basic Electronics - Ohm's LawSeggy Segaran
 
Basic Electronics - Resistors
Basic Electronics - ResistorsBasic Electronics - Resistors
Basic Electronics - ResistorsSeggy Segaran
 

Destacado (6)

Raspberry Pi Base - A flexible support frame for Raspberry Pi projects
Raspberry Pi Base - A flexible support frame for Raspberry Pi projectsRaspberry Pi Base - A flexible support frame for Raspberry Pi projects
Raspberry Pi Base - A flexible support frame for Raspberry Pi projects
 
10 Great Tips for Business Owners
10 Great Tips for Business Owners10 Great Tips for Business Owners
10 Great Tips for Business Owners
 
MemoryPAT
MemoryPATMemoryPAT
MemoryPAT
 
Raspberry Pi Using Python
Raspberry Pi Using PythonRaspberry Pi Using Python
Raspberry Pi Using Python
 
Basic Electronics - Ohm's Law
Basic Electronics - Ohm's LawBasic Electronics - Ohm's Law
Basic Electronics - Ohm's Law
 
Basic Electronics - Resistors
Basic Electronics - ResistorsBasic Electronics - Resistors
Basic Electronics - Resistors
 

Similar a Custard pi 7 user information

Linux+sensor+device-tree+shell=IoT !
Linux+sensor+device-tree+shell=IoT !Linux+sensor+device-tree+shell=IoT !
Linux+sensor+device-tree+shell=IoT !Dobrica Pavlinušić
 
Python-in-Embedded-systems.pptx
Python-in-Embedded-systems.pptxPython-in-Embedded-systems.pptx
Python-in-Embedded-systems.pptxTuynLCh
 
IoT with openHAB on pcDuino3B
IoT with openHAB on pcDuino3BIoT with openHAB on pcDuino3B
IoT with openHAB on pcDuino3BJingfeng Liu
 
Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013Tom Paulus
 
My seminar new 28
My seminar new 28My seminar new 28
My seminar new 28rajeshkvdn
 
Practical file
Practical filePractical file
Practical filerajeevkr35
 
AN INTEGRATED FOUR-PORT DC-DC CONVERTER-CEI0080
AN INTEGRATED FOUR-PORT DC-DC CONVERTER-CEI0080AN INTEGRATED FOUR-PORT DC-DC CONVERTER-CEI0080
AN INTEGRATED FOUR-PORT DC-DC CONVERTER-CEI0080Vivek Venugopal
 
Syed IoT - module 5
Syed  IoT - module 5Syed  IoT - module 5
Syed IoT - module 5Syed Mustafa
 
DEF CON 27- SHEILA A BERTA - backdooring hardware devices by injecting malici...
DEF CON 27- SHEILA A BERTA - backdooring hardware devices by injecting malici...DEF CON 27- SHEILA A BERTA - backdooring hardware devices by injecting malici...
DEF CON 27- SHEILA A BERTA - backdooring hardware devices by injecting malici...Felipe Prado
 
Programming with PIC microcontroller
Programming with PIC microcontroller Programming with PIC microcontroller
Programming with PIC microcontroller Raghav Shetty
 
Microcontroladores: Programación con microcontrolador PIC
Microcontroladores: Programación con microcontrolador PICMicrocontroladores: Programación con microcontrolador PIC
Microcontroladores: Programación con microcontrolador PICSANTIAGO PABLO ALBERTO
 
PIC16F877A C Programming.ppt
PIC16F877A C Programming.pptPIC16F877A C Programming.ppt
PIC16F877A C Programming.pptIlaiyarajaS1
 
Multiplatform JIT Code Generator for NetBSD by Alexander Nasonov
Multiplatform JIT Code Generator for NetBSD by Alexander NasonovMultiplatform JIT Code Generator for NetBSD by Alexander Nasonov
Multiplatform JIT Code Generator for NetBSD by Alexander Nasonoveurobsdcon
 
GPIO In Arm cortex-m4 tiva-c
GPIO In Arm cortex-m4 tiva-cGPIO In Arm cortex-m4 tiva-c
GPIO In Arm cortex-m4 tiva-cZakaria Gomaa
 
[5]投影片 futurewad樹莓派研習會 141218
[5]投影片 futurewad樹莓派研習會 141218[5]投影片 futurewad樹莓派研習會 141218
[5]投影片 futurewad樹莓派研習會 141218CAVEDU Education
 

Similar a Custard pi 7 user information (20)

Linux+sensor+device-tree+shell=IoT !
Linux+sensor+device-tree+shell=IoT !Linux+sensor+device-tree+shell=IoT !
Linux+sensor+device-tree+shell=IoT !
 
Python-in-Embedded-systems.pptx
Python-in-Embedded-systems.pptxPython-in-Embedded-systems.pptx
Python-in-Embedded-systems.pptx
 
IoT with openHAB on pcDuino3B
IoT with openHAB on pcDuino3BIoT with openHAB on pcDuino3B
IoT with openHAB on pcDuino3B
 
Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013
 
Picmico
PicmicoPicmico
Picmico
 
My seminar new 28
My seminar new 28My seminar new 28
My seminar new 28
 
Practical file
Practical filePractical file
Practical file
 
AN INTEGRATED FOUR-PORT DC-DC CONVERTER-CEI0080
AN INTEGRATED FOUR-PORT DC-DC CONVERTER-CEI0080AN INTEGRATED FOUR-PORT DC-DC CONVERTER-CEI0080
AN INTEGRATED FOUR-PORT DC-DC CONVERTER-CEI0080
 
LCD_Example.pptx
LCD_Example.pptxLCD_Example.pptx
LCD_Example.pptx
 
Syed IoT - module 5
Syed  IoT - module 5Syed  IoT - module 5
Syed IoT - module 5
 
DEF CON 27- SHEILA A BERTA - backdooring hardware devices by injecting malici...
DEF CON 27- SHEILA A BERTA - backdooring hardware devices by injecting malici...DEF CON 27- SHEILA A BERTA - backdooring hardware devices by injecting malici...
DEF CON 27- SHEILA A BERTA - backdooring hardware devices by injecting malici...
 
Programming with PIC microcontroller
Programming with PIC microcontroller Programming with PIC microcontroller
Programming with PIC microcontroller
 
Microcontroladores: Programación con microcontrolador PIC
Microcontroladores: Programación con microcontrolador PICMicrocontroladores: Programación con microcontrolador PIC
Microcontroladores: Programación con microcontrolador PIC
 
Atomic pi Mini PC
Atomic pi Mini PCAtomic pi Mini PC
Atomic pi Mini PC
 
Atomic PI apug
Atomic PI apugAtomic PI apug
Atomic PI apug
 
PIC16F877A C Programming.ppt
PIC16F877A C Programming.pptPIC16F877A C Programming.ppt
PIC16F877A C Programming.ppt
 
W10: Interrupts
W10: InterruptsW10: Interrupts
W10: Interrupts
 
Multiplatform JIT Code Generator for NetBSD by Alexander Nasonov
Multiplatform JIT Code Generator for NetBSD by Alexander NasonovMultiplatform JIT Code Generator for NetBSD by Alexander Nasonov
Multiplatform JIT Code Generator for NetBSD by Alexander Nasonov
 
GPIO In Arm cortex-m4 tiva-c
GPIO In Arm cortex-m4 tiva-cGPIO In Arm cortex-m4 tiva-c
GPIO In Arm cortex-m4 tiva-c
 
[5]投影片 futurewad樹莓派研習會 141218
[5]投影片 futurewad樹莓派研習會 141218[5]投影片 futurewad樹莓派研習會 141218
[5]投影片 futurewad樹莓派研習會 141218
 

Último

Innovation Conference 5th March 2024.pdf
Innovation Conference 5th March 2024.pdfInnovation Conference 5th March 2024.pdf
Innovation Conference 5th March 2024.pdfrichard876048
 
Traction part 2 - EOS Model JAX Bridges.
Traction part 2 - EOS Model JAX Bridges.Traction part 2 - EOS Model JAX Bridges.
Traction part 2 - EOS Model JAX Bridges.Anamaria Contreras
 
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCRashishs7044
 
Call Us 📲8800102216📞 Call Girls In DLF City Gurgaon
Call Us 📲8800102216📞 Call Girls In DLF City GurgaonCall Us 📲8800102216📞 Call Girls In DLF City Gurgaon
Call Us 📲8800102216📞 Call Girls In DLF City Gurgaoncallgirls2057
 
India Consumer 2024 Redacted Sample Report
India Consumer 2024 Redacted Sample ReportIndia Consumer 2024 Redacted Sample Report
India Consumer 2024 Redacted Sample ReportMintel Group
 
Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort Service
Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort ServiceCall US-88OO1O2216 Call Girls In Mahipalpur Female Escort Service
Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort Servicecallgirls2057
 
Contemporary Economic Issues Facing the Filipino Entrepreneur (1).pptx
Contemporary Economic Issues Facing the Filipino Entrepreneur (1).pptxContemporary Economic Issues Facing the Filipino Entrepreneur (1).pptx
Contemporary Economic Issues Facing the Filipino Entrepreneur (1).pptxMarkAnthonyAurellano
 
Cybersecurity Awareness Training Presentation v2024.03
Cybersecurity Awareness Training Presentation v2024.03Cybersecurity Awareness Training Presentation v2024.03
Cybersecurity Awareness Training Presentation v2024.03DallasHaselhorst
 
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
8447779800, Low rate Call girls in Uttam Nagar Delhi NCRashishs7044
 
Digital Transformation in the PLM domain - distrib.pdf
Digital Transformation in the PLM domain - distrib.pdfDigital Transformation in the PLM domain - distrib.pdf
Digital Transformation in the PLM domain - distrib.pdfJos Voskuil
 
8447779800, Low rate Call girls in Saket Delhi NCR
8447779800, Low rate Call girls in Saket Delhi NCR8447779800, Low rate Call girls in Saket Delhi NCR
8447779800, Low rate Call girls in Saket Delhi NCRashishs7044
 
Global Scenario On Sustainable and Resilient Coconut Industry by Dr. Jelfina...
Global Scenario On Sustainable  and Resilient Coconut Industry by Dr. Jelfina...Global Scenario On Sustainable  and Resilient Coconut Industry by Dr. Jelfina...
Global Scenario On Sustainable and Resilient Coconut Industry by Dr. Jelfina...ictsugar
 
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607(Best) ENJOY Call Girls in Faridabad Ex | 8377087607
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607dollysharma2066
 
Intro to BCG's Carbon Emissions Benchmark_vF.pdf
Intro to BCG's Carbon Emissions Benchmark_vF.pdfIntro to BCG's Carbon Emissions Benchmark_vF.pdf
Intro to BCG's Carbon Emissions Benchmark_vF.pdfpollardmorgan
 
8447779800, Low rate Call girls in Rohini Delhi NCR
8447779800, Low rate Call girls in Rohini Delhi NCR8447779800, Low rate Call girls in Rohini Delhi NCR
8447779800, Low rate Call girls in Rohini Delhi NCRashishs7044
 
Youth Involvement in an Innovative Coconut Value Chain by Mwalimu Menza
Youth Involvement in an Innovative Coconut Value Chain by Mwalimu MenzaYouth Involvement in an Innovative Coconut Value Chain by Mwalimu Menza
Youth Involvement in an Innovative Coconut Value Chain by Mwalimu Menzaictsugar
 
Case study on tata clothing brand zudio in detail
Case study on tata clothing brand zudio in detailCase study on tata clothing brand zudio in detail
Case study on tata clothing brand zudio in detailAriel592675
 

Último (20)

Innovation Conference 5th March 2024.pdf
Innovation Conference 5th March 2024.pdfInnovation Conference 5th March 2024.pdf
Innovation Conference 5th March 2024.pdf
 
Traction part 2 - EOS Model JAX Bridges.
Traction part 2 - EOS Model JAX Bridges.Traction part 2 - EOS Model JAX Bridges.
Traction part 2 - EOS Model JAX Bridges.
 
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR
 
Call Us 📲8800102216📞 Call Girls In DLF City Gurgaon
Call Us 📲8800102216📞 Call Girls In DLF City GurgaonCall Us 📲8800102216📞 Call Girls In DLF City Gurgaon
Call Us 📲8800102216📞 Call Girls In DLF City Gurgaon
 
India Consumer 2024 Redacted Sample Report
India Consumer 2024 Redacted Sample ReportIndia Consumer 2024 Redacted Sample Report
India Consumer 2024 Redacted Sample Report
 
Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort Service
Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort ServiceCall US-88OO1O2216 Call Girls In Mahipalpur Female Escort Service
Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort Service
 
Corporate Profile 47Billion Information Technology
Corporate Profile 47Billion Information TechnologyCorporate Profile 47Billion Information Technology
Corporate Profile 47Billion Information Technology
 
Contemporary Economic Issues Facing the Filipino Entrepreneur (1).pptx
Contemporary Economic Issues Facing the Filipino Entrepreneur (1).pptxContemporary Economic Issues Facing the Filipino Entrepreneur (1).pptx
Contemporary Economic Issues Facing the Filipino Entrepreneur (1).pptx
 
Cybersecurity Awareness Training Presentation v2024.03
Cybersecurity Awareness Training Presentation v2024.03Cybersecurity Awareness Training Presentation v2024.03
Cybersecurity Awareness Training Presentation v2024.03
 
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
 
Digital Transformation in the PLM domain - distrib.pdf
Digital Transformation in the PLM domain - distrib.pdfDigital Transformation in the PLM domain - distrib.pdf
Digital Transformation in the PLM domain - distrib.pdf
 
8447779800, Low rate Call girls in Saket Delhi NCR
8447779800, Low rate Call girls in Saket Delhi NCR8447779800, Low rate Call girls in Saket Delhi NCR
8447779800, Low rate Call girls in Saket Delhi NCR
 
Call Us ➥9319373153▻Call Girls In North Goa
Call Us ➥9319373153▻Call Girls In North GoaCall Us ➥9319373153▻Call Girls In North Goa
Call Us ➥9319373153▻Call Girls In North Goa
 
Global Scenario On Sustainable and Resilient Coconut Industry by Dr. Jelfina...
Global Scenario On Sustainable  and Resilient Coconut Industry by Dr. Jelfina...Global Scenario On Sustainable  and Resilient Coconut Industry by Dr. Jelfina...
Global Scenario On Sustainable and Resilient Coconut Industry by Dr. Jelfina...
 
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607(Best) ENJOY Call Girls in Faridabad Ex | 8377087607
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607
 
Intro to BCG's Carbon Emissions Benchmark_vF.pdf
Intro to BCG's Carbon Emissions Benchmark_vF.pdfIntro to BCG's Carbon Emissions Benchmark_vF.pdf
Intro to BCG's Carbon Emissions Benchmark_vF.pdf
 
8447779800, Low rate Call girls in Rohini Delhi NCR
8447779800, Low rate Call girls in Rohini Delhi NCR8447779800, Low rate Call girls in Rohini Delhi NCR
8447779800, Low rate Call girls in Rohini Delhi NCR
 
Enjoy ➥8448380779▻ Call Girls In Sector 18 Noida Escorts Delhi NCR
Enjoy ➥8448380779▻ Call Girls In Sector 18 Noida Escorts Delhi NCREnjoy ➥8448380779▻ Call Girls In Sector 18 Noida Escorts Delhi NCR
Enjoy ➥8448380779▻ Call Girls In Sector 18 Noida Escorts Delhi NCR
 
Youth Involvement in an Innovative Coconut Value Chain by Mwalimu Menza
Youth Involvement in an Innovative Coconut Value Chain by Mwalimu MenzaYouth Involvement in an Innovative Coconut Value Chain by Mwalimu Menza
Youth Involvement in an Innovative Coconut Value Chain by Mwalimu Menza
 
Case study on tata clothing brand zudio in detail
Case study on tata clothing brand zudio in detailCase study on tata clothing brand zudio in detail
Case study on tata clothing brand zudio in detail
 

Custard pi 7 user information

  • 1. CUSTARD PI 7 USER INFORMATION The Industrial Control Interface for the Raspberry Pi 9th November 2014 SF Innovations
  • 3. www.sf-innovations.co.uk OVERVIEW OF FEATURES 2 Relay outputs 4 Open Collector outputs 2 Built in Switches 8 General Purpose Digital I/O 4 Analogue inputs 1 Analogue output 16 pin LCD Interface LED indication on most ports Screw terminal connection on most ports Flexible Power Supply Board can be powered from Raspberry Pi Board and Rpi can be powered from 5V supply Board and Rpi can be powered by 2 separate 5V supplies LED indication of 5VPi, 5V and 3V3 supplies Fused 5V and 3V3 available on screw terminals Prototyping area with pads for 14-pin SMT IC Ribbon Connector (26 way) to the Raspberry Pi GPIO Second Connector (26 way) to daisy chain a second Custard Pi -7
  • 4. www.sf-innovations.co.uk LAYOUT OF COMPONENTS This PCB board size 15cm x 11 cm
  • 6. www.sf-innovations.co.uk RELAY AND OPEN COLLECTOR OUTPUTS This is provided using the MCP23008 8-port I/O expander which works on the I2C bus. This is followed by the Darlington Driver, the ULN2801 which drives the relays and provides the 4 Open Collector Outputs. There are 6 LEDs which indicate the status of these outputs. The 2 spare pins of the MCP23008 are used for the 2 key inputs from the on board switches.
  • 7. www.sf-innovations.co.uk RELAY AND OPEN COLLECTOR OUTPUTS These are shown on the picture below. There are 2 sets of screw terminals provided with the relays with access to the 3 terminals (common, normally closed and normally open) of each relay. Screw terminals are also provided for the 4 Open Collector outputs and the 2 keypad inputs.
  • 8. www.sf-innovations.co.uk RELAY AND OPEN COLLECTOR OUTPUTS This is provided using the MCP23008 8-port I/O expander which works on the I2C bus. This is followed by the Darlington Driver, the ULN2801 which drives the relays and provides the 4 Open Collector Outputs. There are 6 LEDs which indicate the status of these outputs. The 2 spare pins of the MCP23008 are used for the 2 key inputs from the on board switches. The functions to control these are provided in cpi7x.py. Download from here and change from .txt to .py. Default I2C address is 0x27 (add7) The 4 Open Collector outputs are switched on and off using the following settings. ONoc1 and OFFoc1, ONoc2 and OFFoc2, ONoc3 and OFFoc3, ONoc4 and OFFoc4
  • 9. www.sf-innovations.co.uk RELAY AND OPEN COLLECTOR OUTPUTS The 2 relays are switched on and off using the following settings. ONrl1 and OFFrl1, ONrl2 and OFFrl2. The actual function to set them ON and OFF is: setbit (address , setting) & clrbit (address, setting) In readbit (address, bit) function allows the user to read the status of the the 2 keypad inputs. In addition the setinandout (address) function sets the MCP23008 chip to use 6 of the pins as outputs and 2 as inputs.
  • 10. www.sf-innovations.co.uk RELAY AND OPEN COLLECTOR OUTPUTS #1/usr/bin/env python import time import cpi7x #start program board1=cpi7x.add7 cpi7x.setinandout(board1) cpi7x.alloff(board1) while True: cpi7x.setbit(board1, cpi7x.ONoc1) time.sleep (0.2) cpi7x.setbit(board1, cpi7x.ONoc2) time.sleep (0.2) cpi7x.setbit(board1, cpi7x.ONoc3) time.sleep (0.2) cpi7x.setbit(board1, cpi7x.ONoc4) time.sleep (0.2) cpi7x.setbit(board1, cpi7x.ONrl2) time.sleep (0.2) cpi7x.setbit(board1, cpi7x.ONrl1) time.sleep (0.5) Listing of sample program to switch relays and open collector outputs on and off and read keypad inputs. Download from here and change from .txt to .py Cpi7ocrelkp.py
  • 11. www.sf-innovations.co.uk RELAY AND OPEN COLLECTOR OUTPUTS cpi7x.clrbit(board1, cpi7x.OFFoc1) cpi7x.clrbit(board1, cpi7x.OFFoc2) cpi7x.clrbit(board1, cpi7x.OFFoc3) cpi7x.clrbit(board1, cpi7x.OFFoc4) cpi7x.clrbit(board1, cpi7x.OFFrl2) cpi7x.clrbit(board1, cpi7x.OFFrl1) time.sleep (0.5) kp2 = (cpi7x.readbit (board1, 0x01)) kp1 = (cpi7x.readbit (board1, 0x02)) if kp1 == 0: print "kp1 pressed" if kp2 == 0: print "kp2 pressed" import sys sys.exit()
  • 12. www.sf-innovations.co.uk LCD INTERFACE This is provided using the MCP23008 8-port I/O expander which works on the I2C bus (default address 0x25) A 2 x 16 character display has a 16pin connector on a 0.1 inch pitch and can easily be connected to the Custard Pi 7 with a ribbon connector. The functions to drive the display are provided in cpi7lcd.py. Download from here and change from .txt to .py.
  • 13. www.sf-innovations.co.uk LCD INTERFACE Here is a ribbon cable connecting the LCD to the Custard Pi 7. (You will need to solder a 16 way connector to the LCD.)
  • 14. www.sf-innovations.co.uk LCD INTERFACE #1/usr/bin/env python import time import cpi7lcd lcd = cpi7lcd lcd.lcdinit(0x25) while True: lcd.lcd_clear time.sleep (0.5) lcd.lcd_puts("LCD line 1 test",1) #display text on line 1 time.sleep (0.5) lcd.lcd_clear lcd.lcd_puts("LCD line 2 test",2) #display text on line 2 time.sleep (0.5) lcd.lcdinit(0x25) import sys sys.exit() Listing of sample program to write to a 2 line display. Download from here and change from .txt to .py testlcd.py
  • 15. www.sf-innovations.co.uk 8 GENERAL PURPOSE DIGITAL I/O This is provided using the MCP23008 8-port I/O expander which works on the I2C bus (default address 0x26). The functions to control these I/O is provided in cpi7y.py. Download from here and change from .txt to .py.
  • 16. www.sf-innovations.co.uk 8 GENERAL PURPOSE DIGITAL I/O The functions to control these I/O is provided in cpi7y.py. Download from here and change from .txt to .py. This works very similarly to the Relay and Open Collector controls. For this example 4 of the bits are set as outputs and 4 as inputs. The settings to control the outputs are: ONbit4, ONbit5, ONbit6, ONbit7 and OFFbit4, OFFbit5, OFFbit6, OFFbit7. The functions available are: setbit To switch outputs high clrbit To switch outputs low readbit Read inputs setinandout To set 4 bits as outputs and 4 as inputs setpullups 100k pullups on input pins alloff set all outputs to lo
  • 17. www.sf-innovations.co.uk 8 GENERAL PURPOSE DIGITAL I/O The MCP23008 is a very versatile input output device. It allows the user set All 8 pins as inputs, outputs or a mix of inputs and outputs. The inputs can be set to have pull-ups and also generate an interrupt on change of status. There is more info on the registers on the datasheet.
  • 18. www.sf-innovations.co.uk 8 GENERAL PURPOSE DIGITAL I/O #1/usr/bin/env python import time import cpi7y import pylcdlibseg board1=cpi7y.add6 cpi7y.setinandout(board1) cpi7y.setpullups(board1) cpi7y.alloff(board1) while True: cpi7y.setbit(board1, cpi7y.ONbit4) time.sleep (0.2) cpi7y.setbit(board1, cpi7y.ONbit5) time.sleep (0.2) cpi7y.setbit(board1, cpi7y.ONbit6) time.sleep (0.2) cpi7y.setbit(board1, cpi7y.ONbit7) time.sleep (0.5) cpi7y.clrbit(board1, cpi7y.OFFbit4) cpi7y.clrbit(board1, cpi7y.OFFbit5) cpi7y.clrbit(board1, cpi7y.OFFbit6) cpi7y.clrbit(board1, cpi7y.OFFbit7) time.sleep (0.5) Listing of sample program to switch the 4 outputs high and low and read the 4 inputs. Download from here and change from .txt to .py Cpi7gpio.py To test: Connect a resistor and LED from bit4 to GND and see it flash. Then test bit5, bit6 and bit7.
  • 19. www.sf-innovations.co.uk 8 GENERAL PURPOSE DIGITAL I/O bit0 = (cpi7y.readbit (board1, 0x01)) bit1 = (cpi7y.readbit (board1, 0x02)) bit2 = (cpi7y.readbit (board1, 0x04)) bit3 = (cpi7y.readbit (board1, 0x08)) if bit0 == 0: print "bit0 low" else: print "bit0 high“ if bit1 == 0: print "bit1 low" else: print "bit1 high“ if bit2 == 0: print "bit2 low" else: print "bit2 high“ if bit3 == 0: print "bit3 low" else: print "bit3 high" print "***************************" import sys sys.exit() To test: Connect a link from bit0 to GND and check that the program detects this. Then test bit3, bit2 and bit 1.
  • 20. www.sf-innovations.co.uk 4 ANALOGUE INPUTS AND ANALOGUE OUTPUT This is provided using the PCF8591 8-bit A to D D to A convertor which works on the I2C bus (default address 0x4F).
  • 21. www.sf-innovations.co.uk 4 ANALOGUE INPUTS AND ANALOGUE OUTPUT This is provided using the PCF8591 8-bit A to D D to A convertor which works on the I2C bus (default address 0x4F).
  • 22. www.sf-innovations.co.uk 4 ANALOGUE INPUTS AND ANALOGUE OUTPUT #1/usr/bin/env python import time import smbus #******************************************** # Custard Pi 7 8591 25th Oct 2013 #I2C addresses add= 0x4F bus=smbus.SMBus(1) #DtoA channel select ch0= 0x00 ch1= 0x01 ch2= 0x02 ch3= 0x03 def readanalog(add): analog=bus.read_byte(add) return analog def writedtoa(add,value): bus.write_byte_data (add, 0x44, value) #****************************************** Listing of sample program to output an analogue voltage and read the voltage on the 4 analogue inputs. Download from here and change from .txt to .py cp8591.py To test: Loop back the ANOUT back to ANIN0, ANIN1 etc in turn and see that the analogue output is being read correctly.
  • 23. www.sf-innovations.co.uk 4 ANALOGUE INPUTS AND ANALOGUE OUTPUT while True: value=0x00 for x in range (0,255): writedtoa(add,value) print value time.sleep(0.5) value=value+1 an0 = readanalog(add) an0 = readanalog(add) print "ch0=", (an0) an1 = readanalog(add) print "ch1=", (an1) an2 = readanalog(add) print "ch2=", (an2) an3 = readanalog(add) print "ch3=", (an3) print "*****“ time.sleep(0.5)
  • 24. www.sf-innovations.co.uk POWER MANAGEMENT There are 3 powering options. #1 The Rpi and the Custard Pi 7 can both be powered from the Rpi 5V supply. In this case jumper J14 is on the left hand side and the board 5V and the Rpi 5VPI are both connected together. Make sure that only the Rpi 5V supply is connected. #2 Both can be powered from the board 5V. Same as above but make sure that only the board 5V is plugged in. #3 Both are independently powered. In this case make sure that jumper on J14 is on right hand side (or not plugged in).
  • 25. www.sf-innovations.co.uk POWER CONNECTORS There is a 3-way ground connector provided. The 3V3 and 5V supply outputs on the screw terminal are fused at 100mA to prevent users from taking too much power from these rails.
  • 26. www.sf-innovations.co.uk MULTIPLE CUSTARD PI 7 BOARDS Because the Custard Pi 7 uses the I2C interface to interface to the various functional blocks it is possible to daisychaining 2 or more Custard Pi 7s. The user has to pay attention to the I2C addressing to make sure that the devices on the various cards have different I2C addresses. There are also resistor positions available on the PCB to do this. One needs to pay particular attention to the power requirements.
  • 27. www.sf-innovations.co.uk SETTING UP THE I2C BUS – STEP 1 At the command prompt type: sudo nano /etc/modules This uses the nano editor to make some changes to the modules file. Add the following two lines to this file i2c-bcm2708 i2c-dev Then save and exit the file using CTRL-x and Y.
  • 28. www.sf-innovations.co.uk SETTING UP THE I2C BUS – STEP 2 Make sure that you have the I2C utilities installed by executing the following two commands. The Pi will need to be connected to the Internet for this. sudo apt-get install python-smbus sudo apt-get install i2c-tools If you get a 404 error do an update first: sudo apt-get update Note : The installation could take a few minutes to do, depend on how busy the server is. Now add a new user to the i2c group: sudo adduser pi i2c
  • 29. www.sf-innovations.co.uk SETTING UP THE I2C BUS – STEP 3 On the Raspberry Pi, the I2C and the SPI buses are usually disabled. This is done in the /etc/modprobe.d/raspi-blacklist.conf file. If this file is not present then there is nothing to be done. Otherwise edit the file by typing the following at the command prompt. sudo nano /etc/modprobe.d/raspi-blacklist.conf If the I2C and the SPI is blacklisted, you will see the following commands. blacklist spi-bcm2708 blacklist i2c-bcm2708 Insert a # in front of these to comment them out. Then save and exit the file using CTRL-x and Y. After editing the file, you will need to reboot for the changes to take effect.
  • 30. www.sf-innovations.co.uk SETTING UP THE I2C BUS – STEP 4 Now we need to test if the I2C bus is working correctly. Connect up the Custard Pi 6 board (or any other I2C bus device) and run the following command. sudo i2cdetect -y 1 (for Rev 2 boards which uses port 1) Or sudo i2cdetect -y 0 (for Rev 1 boards which uses port 0) If everything is OK, then the I2C address of the device will be shown as on the following slide.
  • 31. www.sf-innovations.co.uk SETTING UP THE I2C BUS – STEP 4 I2C devices with address 40 and 70 present on the bus.
  • 32. www.sf-innovations.co.uk SUMMARY The Custard Pi 7 provides Raspberry Pi hardware hackers with a handy board that is packed with features. Make sure you refer to the www.sf-innovations.co.uk website for the latest user information. Further information Blog dedicated to electronics & Raspberry Pi