{"id":95,"date":"2014-05-04T09:06:41","date_gmt":"2014-05-04T09:06:41","guid":{"rendered":"https:\/\/blogs.ncl.ac.uk\/francisfranklin\/?p=95"},"modified":"2014-05-06T08:31:55","modified_gmt":"2014-05-06T08:31:55","slug":"using-i2c-with-the-raspberry-pi-step-3-fieldwork","status":"publish","type":"post","link":"https:\/\/blogs.ncl.ac.uk\/francisfranklin\/2014\/05\/04\/using-i2c-with-the-raspberry-pi-step-3-fieldwork\/","title":{"rendered":"Using I2C with the Raspberry Pi, Step 3: Fieldwork"},"content":{"rendered":"<p>To take measurements on railway track (possibly miles from civilisation), it is useful to have a system that doesn&#8217;t require mains power or display, keyboard, etc. In this case I used:<\/p>\n<ul>\n<li>5000mAh Li-Ion Rechargeable Power Bank; supplied by RS Online (775-7508)<\/li>\n<li>Belkin Cable Transfer Windows 8; supplied by RS Online (779-8827)<\/li>\n<\/ul>\n<p><div id=\"attachment_96\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/blogs.ncl.ac.uk\/francisfranklin\/files\/2014\/05\/Barrow_Hill_May_Day_Raspberry_Pi_Rail_Sensor.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-96\" src=\"https:\/\/blogs.ncl.ac.uk\/francisfranklin\/files\/2014\/05\/Barrow_Hill_May_Day_Raspberry_Pi_Rail_Sensor-300x225.jpg\" alt=\"Raspberry Pi Type A with Sparkfun Sensor Stick used to monitor railway track\" width=\"300\" height=\"225\" class=\"size-medium wp-image-96\" srcset=\"https:\/\/blogs.ncl.ac.uk\/francisfranklin\/files\/2014\/05\/Barrow_Hill_May_Day_Raspberry_Pi_Rail_Sensor-300x225.jpg 300w, https:\/\/blogs.ncl.ac.uk\/francisfranklin\/files\/2014\/05\/Barrow_Hill_May_Day_Raspberry_Pi_Rail_Sensor.jpg 1024w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-96\" class=\"wp-caption-text\">Raspberry Pi Type A and Sparkfun Sensor Stick used to monitor railway track<\/p><\/div><br \/>\n<b>Power Source<\/b><\/p>\n<p>The Power Bank is a rechargeable battery that is powered through a USB connection, and that supplies power to two USB-powered devices. In this case it is used to power only the Raspberry Pi Type A, and was used extensively over a 24-hour period without need for recharge.<\/p>\n<p><b>Ethernet Communication between Raspberry Pi and Laptop<\/b><\/p>\n<p>The Transfer Cable masquerades as an ethernet connection on Linux and was used to connect the Raspberry Pi with a Dell Laptop (with Debian Wheezy 7.4.0 newly installed). Of course, there are other ways to establish a link between the the Raspberry Pi and the outside world, and I plan to get it working via WiFi and radio in the near future, but the hard-wired connection has other potential applications. Also, it can be unplugged and then plugged in again, so is probably the lowest-power option.<\/p>\n<p>To get the Raspberry Pi to recognise and configure the USB connection, add the following settings for usb0 in \/etc\/network\/interfaces:<\/p>\n<pre style=\"margin-left: 20px;background-color: #cccccc\">allow-hotplug usb0\r\niface usb0 inet static\r\n    address 192.168.99.2\r\n    netmask 255.255.255.0\r\n    gateway 192.168.99.1<\/pre>\n<p><b>Update:<\/b> Actually, the gateway setting isn&#8217;t necessary &#8211; I have tested the Belkin cable on a Raspberry Pi <b>Type B<\/b>*<sup>1<\/sup> without the gateway setting and it works fine. The gateway setting is required if you want to share the laptop&#8217;s internet connection &#8211; in which case, you will also need to configure iptables on the laptop*<sup>2<\/sup>.<\/p>\n<p style=\"font-size:smaller;border-top:solid 1px black;border-bottom: solid 1px black\">*<sup>1<\/sup> I read somewhere that the Belkin cable doesn&#8217;t work with the Type B, but it seems to work fine for me.<br \/>*<sup>2<\/sup> I used ufw for this, which is easy enough to use, but where things do get complicated is with nameserver configuration on the Raspberry Pi.<\/p>\n<p>Something similar needs to be done on the laptop:<\/p>\n<pre style=\"margin-left: 20px;background-color: #cccccc\">allow-hotplug usb0\r\niface usb0 inet static\r\n    address 192.168.99.1\r\n    netmask 255.255.255.0<\/pre>\n<p><b>Results<\/b><\/p>\n<p>The graphs below are accelerometer and gyro measurements averaged over a period of one second. The sensors were collecting data continuously and most of the time there was no activity. The passing trains appear as a compressed burst of movement, against which long-term changes are apparent.<\/p>\n<div style=\"float:right;width:320px\"><div id=\"attachment_105\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/blogs.ncl.ac.uk\/francisfranklin\/files\/2014\/05\/Deltics-Gyroscopes.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-105\" src=\"https:\/\/blogs.ncl.ac.uk\/francisfranklin\/files\/2014\/05\/Deltics-Gyroscopes-300x225.png\" alt=\"Gyro on rail web: Deltics and Class 37\" width=\"300\" height=\"225\" class=\"size-medium wp-image-105\" srcset=\"https:\/\/blogs.ncl.ac.uk\/francisfranklin\/files\/2014\/05\/Deltics-Gyroscopes-300x225.png 300w, https:\/\/blogs.ncl.ac.uk\/francisfranklin\/files\/2014\/05\/Deltics-Gyroscopes-1024x768.png 1024w, https:\/\/blogs.ncl.ac.uk\/francisfranklin\/files\/2014\/05\/Deltics-Gyroscopes.png 1200w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-105\" class=\"wp-caption-text\">Gyro on rail web: Deltics and Class 37<\/p><\/div><\/div>\n<div style=\"float:right;width:320px\"><div id=\"attachment_104\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/blogs.ncl.ac.uk\/francisfranklin\/files\/2014\/05\/Deltics-Accelerometers.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-104\" src=\"https:\/\/blogs.ncl.ac.uk\/francisfranklin\/files\/2014\/05\/Deltics-Accelerometers-300x225.png\" alt=\"Accelerometer on rail web: Deltics and Class 37\" width=\"300\" height=\"225\" class=\"size-medium wp-image-104\" srcset=\"https:\/\/blogs.ncl.ac.uk\/francisfranklin\/files\/2014\/05\/Deltics-Accelerometers-300x225.png 300w, https:\/\/blogs.ncl.ac.uk\/francisfranklin\/files\/2014\/05\/Deltics-Accelerometers-1024x768.png 1024w, https:\/\/blogs.ncl.ac.uk\/francisfranklin\/files\/2014\/05\/Deltics-Accelerometers.png 1200w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-104\" class=\"wp-caption-text\">Accelerometer on rail web: Deltics and Class 37<\/p><\/div><\/div>\n<p style=\"clear:both\">Above: The Deltic arrived at Barrow Hill preceded by a Class 37, and later they left with a second Deltic coupled behind.<\/p>\n<div style=\"float:right;width:320px\"><div id=\"attachment_107\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/blogs.ncl.ac.uk\/francisfranklin\/files\/2014\/05\/Locos-Gyroscopes.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-107\" src=\"https:\/\/blogs.ncl.ac.uk\/francisfranklin\/files\/2014\/05\/Locos-Gyroscopes-300x225.png\" alt=\"Gyro on rail web: 0-3-0, Class 40 and Class 45\" width=\"300\" height=\"225\" class=\"size-medium wp-image-107\" srcset=\"https:\/\/blogs.ncl.ac.uk\/francisfranklin\/files\/2014\/05\/Locos-Gyroscopes-300x225.png 300w, https:\/\/blogs.ncl.ac.uk\/francisfranklin\/files\/2014\/05\/Locos-Gyroscopes-1024x768.png 1024w, https:\/\/blogs.ncl.ac.uk\/francisfranklin\/files\/2014\/05\/Locos-Gyroscopes.png 1200w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-107\" class=\"wp-caption-text\">Gyro on rail web: 0-3-0, Class 40 and Class 45<\/p><\/div><\/div>\n<div style=\"float:right;width:320px\"><div id=\"attachment_106\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/blogs.ncl.ac.uk\/francisfranklin\/files\/2014\/05\/Locos-Accelerometers.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-106\" src=\"https:\/\/blogs.ncl.ac.uk\/francisfranklin\/files\/2014\/05\/Locos-Accelerometers-300x225.png\" alt=\"Accelerometer on rail web: 0-3-0, Class 40 and Class 45\" width=\"300\" height=\"225\" class=\"size-medium wp-image-106\" srcset=\"https:\/\/blogs.ncl.ac.uk\/francisfranklin\/files\/2014\/05\/Locos-Accelerometers-300x225.png 300w, https:\/\/blogs.ncl.ac.uk\/francisfranklin\/files\/2014\/05\/Locos-Accelerometers-1024x768.png 1024w, https:\/\/blogs.ncl.ac.uk\/francisfranklin\/files\/2014\/05\/Locos-Accelerometers.png 1200w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-106\" class=\"wp-caption-text\">Accelerometer on rail web: 0-3-0, Class 40 and Class 45<\/p><\/div><\/div>\n<p style=\"clear:both\">Above: The 0-3-0 passed first, collected the Class 40 and Class 45 for a total of four passes, then uncoupled and returned.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To take measurements on railway track (possibly miles from civilisation), it is useful to have a system that doesn&#8217;t require mains power or display, keyboard, etc. In this case I used: 5000mAh Li-Ion Rechargeable Power Bank; supplied by RS Online (775-7508) Belkin Cable Transfer Windows 8; supplied by RS Online (779-8827) Power Source The Power <a href='https:\/\/blogs.ncl.ac.uk\/francisfranklin\/2014\/05\/04\/using-i2c-with-the-raspberry-pi-step-3-fieldwork\/' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1692,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[16,13,22,23,17,21,10,14,20,3],"class_list":["post-95","post","type-post","status-publish","format-standard","hentry","category-raspberry-pi","tag-accelerometer","tag-adxl345","tag-belkin","tag-data-transfer-cable","tag-gyro","tag-gyroscope","tag-i2c","tag-itg-3200","tag-sensor-stick","tag-type-a","category-2-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"_links":{"self":[{"href":"https:\/\/blogs.ncl.ac.uk\/francisfranklin\/wp-json\/wp\/v2\/posts\/95","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.ncl.ac.uk\/francisfranklin\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.ncl.ac.uk\/francisfranklin\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.ncl.ac.uk\/francisfranklin\/wp-json\/wp\/v2\/users\/1692"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.ncl.ac.uk\/francisfranklin\/wp-json\/wp\/v2\/comments?post=95"}],"version-history":[{"count":15,"href":"https:\/\/blogs.ncl.ac.uk\/francisfranklin\/wp-json\/wp\/v2\/posts\/95\/revisions"}],"predecessor-version":[{"id":115,"href":"https:\/\/blogs.ncl.ac.uk\/francisfranklin\/wp-json\/wp\/v2\/posts\/95\/revisions\/115"}],"wp:attachment":[{"href":"https:\/\/blogs.ncl.ac.uk\/francisfranklin\/wp-json\/wp\/v2\/media?parent=95"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.ncl.ac.uk\/francisfranklin\/wp-json\/wp\/v2\/categories?post=95"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.ncl.ac.uk\/francisfranklin\/wp-json\/wp\/v2\/tags?post=95"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}