Cairns Thesis

Embed Size (px)



Text of Cairns Thesis

Sample Dissertation Format

Data Logger using Raspberry PiScott Cairns - 1817523April 2013

Dissertation submitted in partial fulfilment for the degree of BSc (Hons) Computing Science

Department of Computing Science and MathematicsUniversity of StirlingAbstractThe Raspberry Pi a newly released credit card sized microcomputer has sparked a lot of interest since its release resulting in a large amount of projects being carried out using it. This project looks at using the Raspberry Pi to create a cost efficient data logger. Data loggers are generally expensive and limit what the end user can achieve, this project allows the end user to create what they wish what they want to record, where they want to record it it allows the device to be expanded which no expensive data logger offers. This work researches various software packages and hardware available allowing a cost efficient data logger. The finished data logger combines the Raspberry Pi and the Gertboard with a temperature sensor, optical sensor, LEDs and a webcam and allows the user to control it both on the device and remotely. This is a simple and effective solution with scope for expansion.AttestationI understand the nature of plagiarism, and am aware of the Universitys policy on this. I certify that this dissertation reports original work by me during my University project except for the following: The ffserver configuration code in Appendix B was largely adapted from The code for uploading data to COSM in the main program (Appendix E) was largely adapted from The code for receiving an analogue to digital conversation value in the main program (Appendix E) was largely adapted from The code for editing the terminal to allow key detection in the main program (Appendix E) was largely adapted from The code for reloading the SPI drivers to prevent SPI failures (Appendix E) was largely adapted from

SignatureDateAcknowledgementsI would like to thank my supervisor, Dr Andrew Abel. From finding an appropriate topic for the project to the writing of the thesis he has offered constant support, motivation and feedback. I would also like to thank Professor Leslie Smith for ideas during the initial proposal of the project.Table of ContentsAbstract1Attestation2Acknowledgements3Table of Contents4List of Figures51Introduction61.1Background and Context61.2Scope and Objectives71.3Achievements71.4Overview of Dissertation72State-of-The-Art92.1Hardware92.2Commercial data loggers102.3Solar Logger112.4Garage monitor112.5PiEye112.6Temperature Sensor122.7Summary123Development133.1Design133.1.1Installer133.1.2Data logger133.2Implementation163.2.1Software163.2.2Hardware194Testing and Evaluation204.1Testing204.1.1Data logging over the network204.1.2Data logging on the SD card204.1.3Taking a single image214.1.4Data logging with no webcam plugged in214.1.5Single image capture with no webcam plugged in214.1.6Using unauthorised keys224.1.7Testing the optical sensor224.1.8Testing the temperature sensor234.1.9Using a standard user account244.2Issues and limitations245Conclusion265.1Conclusion265.2Future Work265.2.1Portability265.2.2Sensors275.2.3Audio feedback275.2.4Recording software27References28Appendix A Source code for FFServer.conf file30Appendix B Source code for installation file31Appendix C Software Installation guide32Appendix D User guide36Appendix E Source code for Program41

List of FiguresFigure 1.A fully assembled Gertboard with the Pi9Figure 2.The Adafruit Pi Cobbler10Figure 3.The Pi-Face Digital Interface10Figure 4.Typical output the user will see when Data Logging16Figure 5.Outcome of first test case20Figure 6.Outcome of second test case20Figure 7.Outcome of the third test case21Figure 8.Outcome of the fourth test case21Figure 9.Outcome of the fifth test case22Figure 10.Outcome of the sixth test case22Figure 11.Outcome of the seventh test case23Figure 12.Outcome of the eight test case23Figure 13.Outcome of the ninth test case24Figure 14.Snapshot of the top command when storing24Figure 15.Snapshot of the top command when streaming25Figure 16.List of frame formats for webcam35Figure 17.Terminal view for changing root password37Figure 18.Terminal view for changing root password37Figure 19.Terminal view when running program38Figure 20.Terminal view showing stream38Figure 21.Terminal view when beginning logging38Figure 22.Terminal view showing store39Figure 23.Terminal view when beginning logging39Figure 24.List of contents within logger folder39Figure 25.Terminal view taking single image40IntroductionThe aim of this project is to create a functional data logger using the Raspberry Pi that is capable of recording information from the webcam, microphone and various GPIO sensors such as temperature and optical sensors. This will allow the user to control the data logger using buttons connected via GPIO. The Raspberry Pi required various software packages and Python modules to be installed for the Raspbian Wheezy operating system to allow interaction with both USB devices and GPIO devices.

The project aims to allow anyone who has a spare webcam (compatible with the Pi) or microphone and a Raspberry Pi to use the software in order to create a data logging device, which could be used for things such as a cost efficient CCTV camera, recording audio information (such as notes the user may wish to hear back later). If the users have a battery pack this would enable it to be potentially used anywhere (limited only by battery life) even in extreme cases such as being used to record climbing mountains or bungee jumping. The final device will allow the user to upload the video and audio at a later date (or stream if wirelessly connected to a network). This can be extended to make use of the GPIO by including other sensors (a typical temperature sensor such as the one used in this project the TMP36 costs about one pound).

The project that has been undertaken is to develop a portable data logger using the newly released Raspberry Pi microcomputer. As the Raspberry Pi was newly released onset of this project (the official release was 29 February 2012) this involved research into the device, as well as any required hardware to ensure there were no compatibility issues, the operating systems available to such a device, the software available which would allow the device to interact with sensors (such as webcams and microphones) and interaction with the GPIO (General Purpose Input / Output). The GPIO is a collection of small pins on the Raspberry Pi which allows devices to be attached and controlled. The operating system can detect and configure for either input or output, and this project makes use of this to allow LEDs to be enabled and disabled for purposes of user feedback, and also allow buttons to be pressed (enabling interaction with the program and the carrying out of commands such as initialising data logging) as well as receiving sensor data (temperature and optical for this project, however many more exist) using the GPIO pins. GPIO pins can be used using various different methods; this project makes use of the newly released Gertboard15, which slots onto the GPIO pins to extend the capability of the GPIO. The Gertboard includes motor controller, dual channel digital to analogue converter, dual channel analogue to digital converter, on-board LEDs, buttons15. Background and ContextThe Raspberry Pi has received a lot of attention ever since it was first announced. Since release, many lot of people have obtained Pis to tinker about with and create various projects including streaming video and recording temperatures, but there appears to be a lack of all-round data loggers. A basic temperature data logger can cost between 40 and over 300, and functionality can often be limited to viewing a digital display of the current temperature or display over a limited time20. In addition it would cost over 100 for wireless webcam to stream over the network21 and even that does not include audio. This project makes use of the Raspberry Pi a $25 Linux box22 and a small number of accessories which includes; an optical sensor23, a temperature sensor24 and a webcam25, all of which can be purchased for under 25 to turn the Raspberry Pi into a data logger capable of recording and steaming webcam video, storing webcam video and audio and recording via text document, internet upload graphing temperature and optical sensor data in real time.Scope and ObjectivesThe overall goal of this project was to develop a data logger using the Raspberry Pi microcomputer. The project included development of software for the Raspberry Pi using the Python programming language and a variety of modules available for the programming language to allow interaction with USB sensors (such as webcams and microphones), GPIO sensors (such as temperature sensors and optical sensors), GPIO inputs (such as buttons) and GPIO outputs (such as LEDs). This software would be used to allow the Raspberry Pi to automatically log data from hardware devices such as USB Webcams, microphones and a variety of other sensors including GPIO temperature sensors and optical sensors. It would allow users to make use of the Gertboard to press one of the three available buttons to run an appropriate command. The aims of the project also included the setting up of the Gertboard and a breadboard to allow the Raspberry Pi to interface with the GPIO with devices such as sensors, LEDs and push buttons.

The final project includes a working data logger, consisting of a Raspberry Pi connected