Interfacing the Raspberry Pi to the World

9,335 views

Published on

Presentation from the Open Source Hardware Camp held at Hebden Bridge on 15-16 Sepmtember 2012. Event details at: http://oshug.org/event/oshcamp2012

Published in: Technology, Business
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
9,335
On SlideShare
0
From Embeds
0
Number of Embeds
763
Actions
Shares
0
Downloads
215
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

Interfacing the Raspberry Pi to the World

  1. 1. Interfacing the Raspberry Pi to the WorldUp close and personal with P1 (and P5!) @OmerK | OSHCAMP 2012 | 15 Sep 2012
  2. 2. omer.kilic.name
  3. 3. Agenda● Mechanical Details● Electrical Details● Software Details● Tips for headless operation● Questions
  4. 4. Mechanical● Standard 100mil (2.54mm) spacing – P1 → 2x13 way – P5 → 2x4 way
  5. 5. M/F Jumper Cables
  6. 6. M/F Jumper Cables
  7. 7. IDC CableRe-use old floppy cables!
  8. 8. http://www.raspberrypi.org/archives/1404
  9. 9. “Breakout” boards Pi Cobbler from Adafruit
  10. 10. Slice of Pi from Ciseco Pi Plate from AdafruitMore at: http://elinux.org/RPi_Expansion_Boards
  11. 11. Electrical● P1 ● Power ● 3.3V (max I: ~50mA) ● 5V (max I: Power Supply - 700mA) ● 17 GPIO Pins, multiplexed with: ● UART ● I2C ● SPI ● PWM● P5 ● 4 extra GPIO pins ● Power● More signals broken out to S2 and S5 (Camera and flat panel connectors) ● Fiddly!http://elinux.org/RPi_Low-level_peripherals
  12. 12. Revision 2 – Changes● Fuses protecting the USB outputs have been removed – Power the board via back-feeding hub● JTAG on P1● I2C peripherals swapped● P5 – New header: 4 more GPIO + Power● P6 – Reset Jumper● Mounting holes!!!!!!!!!!!! http://www.raspberrypi.org/archives/1929
  13. 13. Revision 2
  14. 14. Power (5V)
  15. 15. Electrical 3.3V!
  16. 16. 3.3V
  17. 17. http://www.flickr.com/photos/56601859@N00/3064468115
  18. 18. Use protection● Level Shifting – Logic buffers (74HCT242) – Birectional translators (TXB0108) – Discrete shifters (FETs + Rs)● Current limiting R
  19. 19. Recommended Distro Occidentalis by Adafruithttp://learn.adafruit.com/adafruit-raspberry-pi-educational-linux-distro/overview
  20. 20. Software● Peripherals are memory mapped – Access via /dev/mem ● Faster, needs root, hacky, dangerous! – Use kernel modules/sysfs ● /sys/class/gpio/gpioX/value etc. ● Slower, doesnt need root, easier, (relatively) safer
  21. 21. Software – GPIO● /sys/class/gpio/ (export|direction|value|interrupt|unexport)● Example: – echo 17 > /sys/class/gpio/export – echo “out” > /sys/class/gpio/gpio17/direction – echo “1” > /sys/class/gpio/gpio17/value● Interrupt support – Use poll() on /value
  22. 22. Software – I2C● /dev/i2c-0 and /dev/i2c-1● Install the i2c-utils package – i2cdetect, i2cdump, i2cget, i2cset● Support for kernel hardware modules: – echo ds1307 0x68 > /sys/class/i2c-adapter/i2c- 0/new_device● i2c-dev details: – http://kernel.org/doc/Documentation/i2c/dev-interface
  23. 23. Software – SPI● /dev/spidev0.0 and /dev/spidev0.1 – Chip select pins● Support for kernel hardware modules: – Need to rebuild kernel!● spidev details: – http://kernel.org/doc/Documentation/spi/spidev
  24. 24. Software – PWM● No kernel module (or libgpio) support, memory mapped voodoo necessary.● WiringPi example: – pinMode(1, PWM_OUTPUT); – PwmWrite(500);
  25. 25. Libraries● Python – Quick2wire, Rpi.GPIO● C – WiringPi, pihwm● Bindings also available for Java(!), Ruby, Erlang
  26. 26. Tips for headless operation● Use 240/16 (CPU/GPU) RAM split – No need for graphical stuff● Setup avahi/zeroconf – No need to remember IP address ● ssh raspberrypi.local● Setup mosh – Great for intermittent networking
  27. 27. Questions?

×