Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Wireless communication between Raspberry Pi and...

Wireless communication between Raspberry Pi and Arduino

Presented at the Swansea Raspberry Pi Jam (organised by picymru.com) on 8 March 2014 at TechHub Swansea. Download the PDF version for clickable links.

Gerrit Niezen

March 08, 2014
Tweet

More Decks by Gerrit Niezen

Other Decks in How-to & DIY

Transcript

  1. 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
  2. Module frequencies and antenna length 433MHz (worldwide) - 165mm of

    wire 868MHz (Europe) - 82mm of wire 915MHz (USA & Australia only)
  3. 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 ?
  4. JeeLabs RFM12B 868 MHz SMD Module €6 RFM12B 868 MHz

    Board €11.50 Shipping €2.50 Total €20
  5. Arduino connections 5V -> 5V GND -> GND SCK ->

    13 SDO -> 12 SDI -> 11 SEL -> 10 IRQ -> 2 3V3 -> NC
  6. 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!
  7. 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
  8. 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
  9. 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
  10. 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
  11. 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