{"_id":"543f838422a3b30e001bdb36","user":"543b93f865bf840e00b473b2","project":"543b943865bf840e00b473b3","category":{"_id":"543b943865bf840e00b473b7","version":"543b943865bf840e00b473b6","project":"543b943865bf840e00b473b3","__v":15,"pages":["543ffb2c22a3b30e001bdc37","543b965fb1479b1400c42f3a","543d1cbb5276641a00a593c3","543d3ff2a10ab32000b3aa9e","543d1fa83a300f20000d3206","543f8f8a051bdc0e00dfbf02","543d4a17a10ab32000b3aace","543ea21f3f50eb1a00ed2050","543ea6ac3f50eb1a00ed205e","543ebaedcc182e08005d0cc4","543f8cb422a3b30e001bdb48","543f838422a3b30e001bdb36","544184629c7623200053c8e7","5541356a69a03a2d00ce0b3b"],"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-10-13T08:58:32.718Z","from_sync":false,"order":9999,"slug":"documentation","title":"Documentation"},"version":{"_id":"543b943865bf840e00b473b6","__v":5,"project":"543b943865bf840e00b473b3","createdAt":"2014-10-13T08:58:32.703Z","releaseDate":"2014-10-13T08:58:32.703Z","categories":["543b943865bf840e00b473b7","543b96e1b1479b1400c42f3d","543d1cdc3a300f20000d31ee","553e061924ec240d00b1f897","553e06431a946a0d00ad6f78"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"__v":15,"is_link":false,"updates":["5481bf742dca603300bf6ec0"],"next":{"pages":[],"description":""},"createdAt":"2014-10-16T08:36:20.601Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"basic_auth":false,"results":{"codes":[]},"try":true,"auth":"never","params":[],"url":""},"isReference":false,"order":11,"body":"This section contains details of the Raspberry Pi and things that you can plug into it. If you want to know about devices that your Raspberry Pi can connect to by wireless, please see the [Devices](doc:devices) section.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Raspberry Pi\"\n}\n[/block]\nThe bridge software, cbridge, will run on Raspberry Pi Models A, B and B+. We recommend either a B or B+, because it's useful to have plenty of USB ports for adding connectivity. Our standard setup today is a Model B+ with a WiFi 802.11N micro-USB dongle, and a Bluetooth 4.0 USB dongle. Inside, we add a [Razpberry](http://razberry.z-wave.me/) board for Z-Wave communication. \n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"WiFi dongles\"\n}\n[/block]\nWe have used a variety of WiFi USB dongles, including some very cheap ones, and all have worked well. You can't go wrong by buying from one of the Raspberry Pi resellers, who test the dongles they sell with Raspberry Pies. WiFi drivers are included as standard with the Raspbian Linux distribution. \n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Bluetooth LE (Bluetooth Smart)\"\n}\n[/block]\nAs with WiFi dongles, we've used a number of different types and all have worked. There are some reports on the web about people having problems with some dongles, which we have not verified, but it does seem that those using the CSR chipset, often branded as a \"Bluetooth CSR 4.0 Dongle\" always work well.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Z-Wave\"\n}\n[/block]\nThe ContinuumBridge platform uses the [z-wave.me Razberry board](http://razberry.z-wave.me/), which is available from a variety of resellers in different regions. All you need to do is plug the board into your Raspberry Pi and download the software in accordance with the z-wave.me instructions. \n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Cellular/3G Modems\"\n}\n[/block]\nThe ContinuumBridge platform supports connection using USB modems (dongles) as well as via Ethernet and WiFi. We have tested it with a variety of dongles on several mobile networks. We have used the following:\n\n* Huawei E3131 \n* Huawei E3131A\n* ZTE MSM MF112\n\n3G modem software is installed when the cbridge/setup script is run, but you'll need to go through the following steps to set up your USB dongle.\n\nA good post on how to use dongles with the Raspberry Pi can be found [here](http://www.raspberrypi.org/forums/viewtopic.php?t=18996). Based on this, here is how you can determine how to use a particular dongle with cbridge. First, type:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"lsusb\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nThis lists all USB devices. Hopefully you'll be able to identify one as your modem. Eg:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Bus 001 Device 010: ID 12d1:14fe Huawei Technologies Co., Ltd. \",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nNext, type the following:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"sudo /usr/bin/sg_raw /dev/sr0 11 06 20 00 00 00 00 00 01 00\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nYou'll see some output, and then type lsusb again. Hopefully, you'll see that the device ID has changed:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Bus 001 Device 011: ID 12d1:151d Huawei Technologies Co., Ltd.\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nIn this case, all is well. Now type:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"ifconfig\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nIt's likely that several interfaces will be listed, such as eth0, if you're connected via Ethernet, or wlan0, if you're connect via WiFi. You should also see **one** of eth1 or wwan0:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"eth1      Link encap:Ethernet  HWaddr 58:2c:80:13:92:63  \\n          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1\\n          RX packets:0 errors:0 dropped:0 overruns:0 frame:0\\n          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0\\n          collisions:0 txqueuelen:1000 \\n          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)\\n\\nwwan0     Link encap:Ethernet  HWaddr 58:2c:80:13:92:63  \\n          UP BROADCAST MULTICAST  MTU:1500  Metric:1\\n          RX packets:0 errors:0 dropped:0 overruns:0 frame:0\\n          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0\\n          collisions:0 txqueuelen:1000 \\n          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nIf you see eth1, then type:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"sudo dhclient eth1\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nIf you type ifconfig again, you should see that eth1 now has an IP address:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"eth1      Link encap:Ethernet  HWaddr 58:2c:80:13:92:63  \\n          inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0\\n          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1\\n          RX packets:6 errors:0 dropped:0 overruns:0 frame:0\\n          TX packets:4 errors:0 dropped:0 overruns:0 carrier:0\\n          collisions:0 txqueuelen:1000 \\n          RX bytes:824 (824.0 B)  TX bytes:824 (824.0 B)\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nYou can then open a web browser and connect it to: http://192.168.1.1. You will then be able to enter you network operator's APN details into the dongle. You may find that they are there already, in which case your modem will already have connected to the Internet by the time you get to this point, if you have network coverage. You only have to do this once, or if you change to using a different SIM.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Browser-sensitive dongles\",\n  \"body\": \"We have found that even dongles with the same part number and from the same manufacturer (in particular the Huawei E3131 and E3131A) can behave differently. In part, this can be if a dongle was originally locked to a particular network. One idiosyncrasy that was noticed was that it appeared that network details could not be changed (they were \\\"greyed-out\\\") in Crome and Firefox browsers, but could be changed when Internet Explorer was used. We suggest, therefore, that if you experience this problem you try using IE.\"\n}\n[/block]\nIf you see wwan0 rather than eth0, proceed as follows. \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"sudo cp /opt/cbridge/bridge/bridgeconfig/sakis3g.conf /etc/sakis3g.conf\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nThen edit the file /etc/sakis3g.conf (eg: using sudo vi /etc/sakis3g.conf). It will look like this:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"APN=\\\"CUSTOM_APN\\\"\\nCUSTOM_APN=\\\"pp.vodafone.co.uk\\\"\\nAPN_USER=\\\"web\\\"\\nAPN_PASS=\\\"web\\\"\\nUSBINTERFACE=\\\"0\\\"\\nOTHER=\\\"USBMODEM\\\"\\nUSBMODEM=\\\"12d1:151d\\\"\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nThis is set up for a Vodafone UK pay-as-you-go APN. Change the CUSTOM_APN, APN_USER AND APN_PASS to those provided by your network operator (if you don't know them, Google your operator and APN. Eg: \"GiffGaff APN\", for GiffGaff). Finally, change the USBMODEM line to replace \"12d1:151d\" with the USB ID from the second time you typed \"lsusb\", above (after running \"sudo /usr/bin/sg_raw\"). \n\nYou can test that this wwan0 method is working by typing:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"/usr/bin/sakis3g --sudo connect --debug\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nThe --debug prints a lot of information to the screen, which may help you find out what is happening if something has gone wrong. This command may not work the first time you try it. If it doesn't, type it for a second time. Once it has finished, you should be connected, a fact that can be confirmed by typing \"ifconfig\" again. You should then see a ppp0 entry like this:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"ppp0      Link encap:Point-to-Point Protocol  \\n          inet addr:10.144.73.94  P-t-P:10.64.64.64  Mask:255.255.255.255\\n          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1\\n          RX packets:24 errors:0 dropped:0 overruns:0 frame:0\\n          TX packets:28 errors:0 dropped:0 overruns:0 carrier:0\\n          collisions:0 txqueuelen:3 \\n          RX bytes:1398 (1.3 KiB)  TX bytes:1677 (1.6 KiB)\\n\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nOnce you have done one of the above, cbridge will take care of connecting using your 3G dongle every time you start it with the dongle inserted. We have been asked if these instructions can be used if you're not running cbridge. The answer is yes. You can still get all the necessary software by installing cbridge and just not running it, or you can install the necessary modules separately. You'll need sg3-utils, which installs the sg-raw command, sakis3g and ppp, which you can install with the following:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"apt-get install -y sg3-utils\\nwget \\\"http://raspberry-at-home.com/files/sakis3g.tar.gz\\\"\\ntar xfz sakis3g.tar.gz\\ncp sakis3g /usr/bin/sakis3g\\napt-get install -y ppp\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Conman\",\n  \"body\": \"All the necessary software is also installed if you install the ContinuumBridge connection manager, conman. Conman is installed with cbridge, but if you're not using cbridge you can just install conman by following the instructions here: \\n\\nhttps://github.com/ContinuumBridge/conman\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Peripherals\"\n}\n[/block]\n\nWe refer to things that plug into the GPIO header on the Raspberry Pi. Examples include various sensors (eg: temperature, humidity) and relays. To a bridge-app, these look like and other devices and, like other devices, they have adaptors. You can write adaptors for peripherals in the same way as you would write an adaptor for any other sort of device. GPIO devices are essentially \"discovered\" in the same way as other devices, but you need to tell cbridge that they are there. To do this, use the following line in the thisbridge.sh file:\n\nexport CB_PERIPHERALS=\"my_peripheral_1, my_peripheral_2\"\n\nThe names my_peripheral_1 and my_peripheral_2 must be the same as the names given when you created the device using the \"cb --device post\" command.\n\nIf a bridge has peripherals, the first time the \"Connect to a Device\" button is pressed on the portal, the first peripheral will be \"discovered\" and any other peripherals will be \"discovered\" on subsequent presses of the button until they are all in the devices list. You can give peripherals friendly names in the same way that you can for any other type of device and then apps can use them in the same way as other devices.\n\nNote that you can plug things into the GPIO header that are not \"peripherals\". An example is the z-wave.me Razberry board. The difference is that this board is used to communicate with other devices rather than being a device in its own right. \n\n[Next ...](doc:devices)","excerpt":"","slug":"hardware","type":"basic","title":"Hardware"}
This section contains details of the Raspberry Pi and things that you can plug into it. If you want to know about devices that your Raspberry Pi can connect to by wireless, please see the [Devices](doc:devices) section. [block:api-header] { "type": "basic", "title": "Raspberry Pi" } [/block] The bridge software, cbridge, will run on Raspberry Pi Models A, B and B+. We recommend either a B or B+, because it's useful to have plenty of USB ports for adding connectivity. Our standard setup today is a Model B+ with a WiFi 802.11N micro-USB dongle, and a Bluetooth 4.0 USB dongle. Inside, we add a [Razpberry](http://razberry.z-wave.me/) board for Z-Wave communication. [block:api-header] { "type": "basic", "title": "WiFi dongles" } [/block] We have used a variety of WiFi USB dongles, including some very cheap ones, and all have worked well. You can't go wrong by buying from one of the Raspberry Pi resellers, who test the dongles they sell with Raspberry Pies. WiFi drivers are included as standard with the Raspbian Linux distribution. [block:api-header] { "type": "basic", "title": "Bluetooth LE (Bluetooth Smart)" } [/block] As with WiFi dongles, we've used a number of different types and all have worked. There are some reports on the web about people having problems with some dongles, which we have not verified, but it does seem that those using the CSR chipset, often branded as a "Bluetooth CSR 4.0 Dongle" always work well. [block:api-header] { "type": "basic", "title": "Z-Wave" } [/block] The ContinuumBridge platform uses the [z-wave.me Razberry board](http://razberry.z-wave.me/), which is available from a variety of resellers in different regions. All you need to do is plug the board into your Raspberry Pi and download the software in accordance with the z-wave.me instructions. [block:api-header] { "type": "basic", "title": "Cellular/3G Modems" } [/block] The ContinuumBridge platform supports connection using USB modems (dongles) as well as via Ethernet and WiFi. We have tested it with a variety of dongles on several mobile networks. We have used the following: * Huawei E3131 * Huawei E3131A * ZTE MSM MF112 3G modem software is installed when the cbridge/setup script is run, but you'll need to go through the following steps to set up your USB dongle. A good post on how to use dongles with the Raspberry Pi can be found [here](http://www.raspberrypi.org/forums/viewtopic.php?t=18996). Based on this, here is how you can determine how to use a particular dongle with cbridge. First, type: [block:code] { "codes": [ { "code": "lsusb", "language": "shell" } ] } [/block] This lists all USB devices. Hopefully you'll be able to identify one as your modem. Eg: [block:code] { "codes": [ { "code": "Bus 001 Device 010: ID 12d1:14fe Huawei Technologies Co., Ltd. ", "language": "shell" } ] } [/block] Next, type the following: [block:code] { "codes": [ { "code": "sudo /usr/bin/sg_raw /dev/sr0 11 06 20 00 00 00 00 00 01 00", "language": "shell" } ] } [/block] You'll see some output, and then type lsusb again. Hopefully, you'll see that the device ID has changed: [block:code] { "codes": [ { "code": "Bus 001 Device 011: ID 12d1:151d Huawei Technologies Co., Ltd.", "language": "shell" } ] } [/block] In this case, all is well. Now type: [block:code] { "codes": [ { "code": "ifconfig", "language": "shell" } ] } [/block] It's likely that several interfaces will be listed, such as eth0, if you're connected via Ethernet, or wlan0, if you're connect via WiFi. You should also see **one** of eth1 or wwan0: [block:code] { "codes": [ { "code": "eth1 Link encap:Ethernet HWaddr 58:2c:80:13:92:63 \n UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1\n RX packets:0 errors:0 dropped:0 overruns:0 frame:0\n TX packets:0 errors:0 dropped:0 overruns:0 carrier:0\n collisions:0 txqueuelen:1000 \n RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)\n\nwwan0 Link encap:Ethernet HWaddr 58:2c:80:13:92:63 \n UP BROADCAST MULTICAST MTU:1500 Metric:1\n RX packets:0 errors:0 dropped:0 overruns:0 frame:0\n TX packets:0 errors:0 dropped:0 overruns:0 carrier:0\n collisions:0 txqueuelen:1000 \n RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)", "language": "shell" } ] } [/block] If you see eth1, then type: [block:code] { "codes": [ { "code": "sudo dhclient eth1", "language": "shell" } ] } [/block] If you type ifconfig again, you should see that eth1 now has an IP address: [block:code] { "codes": [ { "code": "eth1 Link encap:Ethernet HWaddr 58:2c:80:13:92:63 \n inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0\n UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1\n RX packets:6 errors:0 dropped:0 overruns:0 frame:0\n TX packets:4 errors:0 dropped:0 overruns:0 carrier:0\n collisions:0 txqueuelen:1000 \n RX bytes:824 (824.0 B) TX bytes:824 (824.0 B)", "language": "shell" } ] } [/block] You can then open a web browser and connect it to: http://192.168.1.1. You will then be able to enter you network operator's APN details into the dongle. You may find that they are there already, in which case your modem will already have connected to the Internet by the time you get to this point, if you have network coverage. You only have to do this once, or if you change to using a different SIM. [block:callout] { "type": "warning", "title": "Browser-sensitive dongles", "body": "We have found that even dongles with the same part number and from the same manufacturer (in particular the Huawei E3131 and E3131A) can behave differently. In part, this can be if a dongle was originally locked to a particular network. One idiosyncrasy that was noticed was that it appeared that network details could not be changed (they were \"greyed-out\") in Crome and Firefox browsers, but could be changed when Internet Explorer was used. We suggest, therefore, that if you experience this problem you try using IE." } [/block] If you see wwan0 rather than eth0, proceed as follows. [block:code] { "codes": [ { "code": "sudo cp /opt/cbridge/bridge/bridgeconfig/sakis3g.conf /etc/sakis3g.conf", "language": "shell" } ] } [/block] Then edit the file /etc/sakis3g.conf (eg: using sudo vi /etc/sakis3g.conf). It will look like this: [block:code] { "codes": [ { "code": "APN=\"CUSTOM_APN\"\nCUSTOM_APN=\"pp.vodafone.co.uk\"\nAPN_USER=\"web\"\nAPN_PASS=\"web\"\nUSBINTERFACE=\"0\"\nOTHER=\"USBMODEM\"\nUSBMODEM=\"12d1:151d\"", "language": "shell" } ] } [/block] This is set up for a Vodafone UK pay-as-you-go APN. Change the CUSTOM_APN, APN_USER AND APN_PASS to those provided by your network operator (if you don't know them, Google your operator and APN. Eg: "GiffGaff APN", for GiffGaff). Finally, change the USBMODEM line to replace "12d1:151d" with the USB ID from the second time you typed "lsusb", above (after running "sudo /usr/bin/sg_raw"). You can test that this wwan0 method is working by typing: [block:code] { "codes": [ { "code": "/usr/bin/sakis3g --sudo connect --debug", "language": "shell" } ] } [/block] The --debug prints a lot of information to the screen, which may help you find out what is happening if something has gone wrong. This command may not work the first time you try it. If it doesn't, type it for a second time. Once it has finished, you should be connected, a fact that can be confirmed by typing "ifconfig" again. You should then see a ppp0 entry like this: [block:code] { "codes": [ { "code": "ppp0 Link encap:Point-to-Point Protocol \n inet addr:10.144.73.94 P-t-P:10.64.64.64 Mask:255.255.255.255\n UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1\n RX packets:24 errors:0 dropped:0 overruns:0 frame:0\n TX packets:28 errors:0 dropped:0 overruns:0 carrier:0\n collisions:0 txqueuelen:3 \n RX bytes:1398 (1.3 KiB) TX bytes:1677 (1.6 KiB)\n", "language": "shell" } ] } [/block] Once you have done one of the above, cbridge will take care of connecting using your 3G dongle every time you start it with the dongle inserted. We have been asked if these instructions can be used if you're not running cbridge. The answer is yes. You can still get all the necessary software by installing cbridge and just not running it, or you can install the necessary modules separately. You'll need sg3-utils, which installs the sg-raw command, sakis3g and ppp, which you can install with the following: [block:code] { "codes": [ { "code": "apt-get install -y sg3-utils\nwget \"http://raspberry-at-home.com/files/sakis3g.tar.gz\"\ntar xfz sakis3g.tar.gz\ncp sakis3g /usr/bin/sakis3g\napt-get install -y ppp", "language": "shell" } ] } [/block] [block:callout] { "type": "info", "title": "Conman", "body": "All the necessary software is also installed if you install the ContinuumBridge connection manager, conman. Conman is installed with cbridge, but if you're not using cbridge you can just install conman by following the instructions here: \n\nhttps://github.com/ContinuumBridge/conman" } [/block] [block:api-header] { "type": "basic", "title": "Peripherals" } [/block] We refer to things that plug into the GPIO header on the Raspberry Pi. Examples include various sensors (eg: temperature, humidity) and relays. To a bridge-app, these look like and other devices and, like other devices, they have adaptors. You can write adaptors for peripherals in the same way as you would write an adaptor for any other sort of device. GPIO devices are essentially "discovered" in the same way as other devices, but you need to tell cbridge that they are there. To do this, use the following line in the thisbridge.sh file: export CB_PERIPHERALS="my_peripheral_1, my_peripheral_2" The names my_peripheral_1 and my_peripheral_2 must be the same as the names given when you created the device using the "cb --device post" command. If a bridge has peripherals, the first time the "Connect to a Device" button is pressed on the portal, the first peripheral will be "discovered" and any other peripherals will be "discovered" on subsequent presses of the button until they are all in the devices list. You can give peripherals friendly names in the same way that you can for any other type of device and then apps can use them in the same way as other devices. Note that you can plug things into the GPIO header that are not "peripherals". An example is the z-wave.me Razberry board. The difference is that this board is used to communicate with other devices rather than being a device in its own right. [Next ...](doc:devices)