Slide 1

Slide 1 text

Wireless communication between Raspberry Pi and Arduino Gerrit Niezen @gendor

Slide 2

Slide 2 text

Wireless communication options Cost Range Rate WiFi £7 (Amazon UK) 100+ feet 150Mbps Bluetooth £3 (ModMyPi) 60+ feet 3 Mbps Cellular £30 (Amazon UK) Coverage dependent 7 .2 Mbps Satellite £159 + tax (Rock Seven) Anywhere on earth outside 140 bps RFM12B (868 MHz) £5 (£16 for 2 + Arduino kit) 300+ feet 115.2 kbps

Slide 3

Slide 3 text

RFM12B Quasar 868MHz RF Transceiver Module (Maplin) HopeRF Alpha RF

Slide 4

Slide 4 text

Module frequencies and antenna length 433MHz (worldwide) - 165mm of wire 868MHz (Europe) - 82mm of wire 915MHz (USA & Australia only)

Slide 5

Slide 5 text

Why RFM12B Longer range than WiFi and Bluetooth Can talk to home automation equipment, e.g. thermostats, fire systems, burglar alarms Cheaper to talk to Arduino ?

Slide 6

Slide 6 text

JeeLabs RFM12B 868 MHz SMD Module €6 RFM12B 868 MHz Board €11.50 Shipping €2.50 Total €20

Slide 7

Slide 7 text

Arduino connections 5V -> 5V GND -> GND SCK -> 13 SDO -> 12 SDI -> 11 SEL -> 10 IRQ -> 2 3V3 -> NC

Slide 8

Slide 8 text

Raspberry Pi connections P1/17 -> VDD (+3.3V) P1/19 -> SDI P1/21 -> SDO P1/22 -> nIRQ P1/23 -> SCK P1/25 -> GND P1/26 -> nSEL https:/ /www.modmypi.com/blog/raspberry-pi-gpio-cheat-sheet Useful!

Slide 9

Slide 9 text

Some Linux kernel hacking Clone/download the repository Edit rfm12b_config.h Run make to build the kernel driver sudo  modprobe  spi-­‐bcm2708   sudo  insmod  rfm12b.ko https://github.com/gkaindl/rfm12b-­‐linux

Slide 10

Slide 10 text

rfm12b_config.h #define  RFM12B_BOARD      1   #define  RFM12B_DEFAULT_GROUP_ID      211   #define  RFM12B_DEFAULT_BAND_ID      2

Slide 11

Slide 11 text

Check that the kernel driver is loaded Output from dmesg:
 [  1480.735040]  rfm12b:  added  RFM12(B)   transceiver  rfm12b.0.1
 [  1480.735145]  rfm12b  :  driver  loaded.   ! ! ls  /dev:   rfm12b.0.1

Slide 12

Slide 12 text

Get them to talk! On Arduino, use the JeeLib library:
 
 https://github.com/jcw/jeelib/archive/ master.zip   Run  pingPong  example, or
 arduino/rfm12b_echo_client in driver directory   On Raspberry Pi, in  examples/  directory:   Run make   Run sudo  bin/rfbm12b_echo

Slide 13

Slide 13 text

Useful links http://jeelabs.net/projects/jeelib/wiki   JeeLabs Shop
 http://www.digitalsmarties.net/   http://openenergymonitor.org/emon/node/271   Comparison with Digi XBee, Ciseco XRF
 http://blog.homelabs.org.uk/wireless-­‐ connectivity/   http://jeelabs.net/projects/hardware/wiki/ RFM12B_Board

Slide 14

Slide 14 text

Raspberry Pirate Radio http://makezine.com/projects/ raspberry-­‐pirate-­‐radio/

Slide 15

Slide 15 text

Swansea Hackspace http:/ /swansea.hackspace.org.uk @SwanseaHack

Slide 16

Slide 16 text

Images used under the Creative Commons license: _DSC6307 by FITLab Swansea on Flickr hopjes candy = coffee flavored! by yosoynuts on Flickr RFM12B-S2 Wireless Transceiver - 915MHz by SparkFunElectronics on Flickr Piratey potrace by J.J. on Wikipedia ! Arduino from Fritzing - http://fritzing.org Icons from Font Awesome by Dave Gandy - http://fontawesome.io