Data Logger using Raspberry Pi Scott Cairns 1817523



Download 200.65 Kb.
Page6/12
Date31.07.2017
Size200.65 Kb.
#25490
1   2   3   4   5   6   7   8   9   ...   12

3.2Implementation


To implement this project and create a data logger using the Raspberry Pi, an investigation of the available hardware and software was required.

3.2.1Software


The project includes a variety of software packages and Python modules installed onto the Raspberry Pi to allow data logging, this includes:

  • Raspbian Wheezy

    • This is the free operating system that is based on Debian and has been customised and optimized for use on the Raspberry Pi.

    • This project makes use of Raspbian Wheezy as the operating system.

    • It was decided that Raspbian was suitable for use as it was the most recommended version from the Raspberry Pi Foundation and had been designed specifically for the Raspberry Pi’s hardware. Raspbian is widely supported, offers both command line and GUI, and is capable of everything required for this project




  • Python

    • The programming language used for the main software in the project, this comes pre-installed on Raspbian Wheezy. This allows interaction with the USB (for peripherals such as webcam and microphone), GPIO (taking inputs, setting outputs) and interacts with the operating system (making use of terminal).

    • This project makes use of Python as the sole programming language.




  • Geany

    • This is a software package; Geany is a lightweight IDE (integrated development environment) for various languages including Python.

    • This project makes use of Geany when editing the Python code and running it from within the Raspberry Pi Graphical desktop.




  • FFMPEG

    • This is a software package that allows the Raspberry Pi to interact with the USB webcam or microphone, it is used to capture the webcam, stream it over the network or save it on the SD card. This needs to be installed with some knowledge of the arguments used to run it (different frame rates, frame sizes, input locations, and other important parameters).

    • This project allows the user to pick a method ‘store’ or ‘stream’ using this method the suitable FFMPEG code will be executed allowing a stream over the network or a video saved to the SD card. Several variables are used with this allowing the user to change the log level, frame rate, size, file format, and other important parameters.

    • There are a small number of other alternatives to FFMPEG such as MEncoder and guvcview, however MEncoder appeared to have issues with the webcam settings and guvcview appeared to be designed for more of a GUI desktop rather than use in command line interfaces.




  • FFServer

    • This is a software package that allows the Raspberry Pi using FFMPEG to stream over a network or internet allowing other devices to connect to the stream and view it. This is installed with the FFMPEG package and needs a configuration file to set some parameters (such as address port, bitrate, frame size, and other important parameters).

    • This project makes use of FFServer when the logging method is set to ‘stream’ at which point ffserver will run and FFMPEG output will be set to the ip and port that FFServer is currently running on.




  • Fswebcam

    • This is a software package that allows the Raspberry Pi to capture a single image from the webcam, this needs to be installed with some knowledge on the arguments used (again such as frame rates, frame sizes, output location, and other important parameters).

    • This project allows a single image to be taken using the right button / number 3; this calls the Fswebcam code using various variables again allowing the user to set the frame size, input name, save location.




  • uvcdynctrl

    • This is a software package that allows the Raspberry Pi to configure the webcam; this includes options such as changing this brightness, contract, hue, saturation, sharpness, and zoom. It can also be used to list all the current webcam devices detected by Raspbian, and all the formats compatible with these devices

    • This project made use of the uvcdynctrl software package to receive the available frame sizes and pixel formats that can be used with this webcam, it will also allow other users to make use of the command to see the available formats for their webcams and change the variables in the code to suit.




  • Git

    • This is a software package that allows the Raspberry Pi to connect to a git (github.com) and clone the contents of the specified git. This allows software to be downloaded if it is not listed as a software package; git simply clones the contents of the git and does not install the software.

    • This project makes use of Git to clone several Python modules from github which are not available through the software packages list.




  • Python-RPi.GPIO

    • This is a Python module that allows the Raspberry Pi and Python program to communicate with the gpio pins and make use of them, this module is required to make use of LEDs and buttons that are connected via the Gertboard or directly on the GPIO pins.

    • This is used within the project to set up the GPIO buttons and LEDs then further to enable/disable LEDs and listen for button presses, when exiting the program this is again used to clean up the gpio (setting it back to the default values before the program ran).




  • Py-Spidev

    • This is a Python module that allows the Raspberry Pi and Python program to communicate with SPI devices as the Python-RPi.GPIO module currently does not allow interfacing with SPI devices.

    • This is used within the project to communicate with sensors, this allows Python to communicate with an SPI port, open a channel, send a signal and receive a signal and make use of the received signal to get the current reading on the sensors.




  • Python-dev

    • This is a Python module that needs to be installed to allow Python-RPi.GPIO to be installed correctly.

    • This is used during installation to allow the other Python module to be installed and ran.




  • SetupTools

    • This is a Python module again that needs to be installed to assist another module; this is required for the EEML installation.

    • Again this is used during installation to allow EEML to be installed and run correctly.




  • Python-EEML

    • This is a Python module that’s used to communicate over the internet with COSM (previously Pachube) which allows real time uploading of data and graphing.

    • This module is used within the project to allow the Python code to send the sensor data to COSM using the API URL and API Key provided during COSM registration, this also allows a data format to be set or send raw data, in the project temperature is sent using Celsius and optical sensor sent using raw data.




  • Python-evdev

    • This is a Python module that’s used to allow Python to create an input device and allow input events to be placed directly into the system.

    • This module is used within the project to create an input device then inject the key event ‘q’ into it, used when ending the data logging to allow the webcam stream to end.

3.2.2Hardware


The hardware that is currently used within the project includes:

  • Raspberry Pi – The currently used Raspberry Pi is the Model B Revision 1 version meaning it is limited to 256MB RAM whereas the new Revision 2 contains 512MB of ram. It also contains a 700MHz CPU, 2 USB 2.0 ports, Composite RCA, HDMI, DSI, 10/100 Ethernet and 5v MicroUSB power source.




  • SD card – An SD card is used to run the Raspbian Wheezy operating system with all the software packages and Python modules installed as well as the two Python programs to install and run the data logger.




  • Microsoft LifeCam VX-2000 – This Microsoft webcam is used for visual and audio data (using the inbuilt microphone), this is not a verified peripheral however testing of this peripheral revealed no issues with functionality, and so it was deemed suitable for use26.




  • Gertboard – This project makes use of the Fully Assembled Gertboard Rev 2 which slots directly on to the Raspberry Pi’s GPIO pins to extend its functionality, this is set up to allow use of the 3 on-board buttons and using the on-board MCP3002 to connect to the optical and temperature sensor located on the breadboard, it also supplies 3V3 and GND to the breadboard as well as the appropriate GPIO pins.




  • Breadboard – This is used to connect the LEDs and sensors to the Gertboard and supply power to them.




  • TMP36 – This is the temperature sensor used in the project; it is a low voltage sensor that records between -40°C to +125°C27. This is connected to the Gertboards on-board analogue to digital converter to allow a digital reading within Python.




  • TSL250 – This is the optical sensor used in the project, it is a low power light-to-voltage optical sensor. This is connected to the Gertboards on-board analogue to digital converter to allow a digital reading within Python.




  • Electrical components – Various other electrical components are used such as a green, red and yellow LED, 0.1uF ceramic disc capacitors and resistors to allow accurate readings and limit power to electrical components.

Directory: ~aka

Download 200.65 Kb.

Share with your friends:
1   2   3   4   5   6   7   8   9   ...   12




The database is protected by copyright ©ininet.org 2024
send message

    Main page