Data logger – Step 2 – Equipment

In this second article, I will describe the material that I use at the moment and how it is configured

components

Here is the list of components that I currently have on my recorder :

  • Two push buttons. The first allows to start or stop the recording of data. The second by long press to switch off the system.
  • A green LED to indicate that the system is ready to begin a recording
  • A red LED to indicate that recording is in progress
  • A clock RTC DS1307 to have the correct time when the system is not connected to the Internet
  • A gyroscope/accelerometer MPU6050 to measure the slope on 3 axes of the data logger
  • A GPS. I made the choice to a USB GPS like the one I presented here. The cost is the same that a card and especially the GPS can be deported from the recorder which allows to fix elsewhere if necessary.
  • A probe DS18B20 to record the temperature. I took this model (compared with the DHT22 probes for example) because it may as the GPS be output from the recorder through a long enough cable and it is waterproof
  • Resistance between 4.7KΩ and 10KΩ for the connection of the probe on the Raspberry
  • A housing 6 AA batteries
  • A voltage regulator LM2596 to regulate the voltage from the batteries
  • A breadboard
  • Wires

Apart from the GPS to 37$, all the components are little expensive and coping well with ebay or dx.com shall be limited to the invoice unless 50$ or 60$ (without the Raspberry).

The connection here is the diagram of the recorder :

RaspMobile

Attention, Fritzing is not all components in the list so I took to the nearest on gyro (not MPU6050). There is also a “Tip” concerning this gyro. I added a cable between Vcc and the Add entry to change your address on the i2c bus (0x 68 instead of 0 x 69) If not there is a conflict with the address of the clock.

Same thing for the DC - DC Step down. I put wires but if you have a LM2596, you have all the information to plug into this article.

It now remains to configure Pi Raspberry for his new friends !

To the 19/03/2014, There is a bug in the Raspbian that prevents the simultaneous use of the i2c bus and the 1-wire bus. To use an older version which you can download here.

  1. Download and install Raspbian. Take the version of 25 September 2013
    http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip
  2. Update the system but without any upgrade
     apt-get update
  3. Disable the modules in the file /etc/modprobe.d/raspi-blacklist.conf. Here are the contents of the file :
    # blacklist spi and i2c by default (many users don't need them)
    blacklist spi-bcm2708 #blacklist i2c-bcm2708
  4. Enable the necessary modules. Here are the contents of the file /etc/modules :
    # /etc/modules: kernel modules to load at boot time.
    #
    # This file contains the names of kernel modules that should be loaded
    # at boot time, one per line. Lines beginning with "#" are ignored.
    # Parameters can be specified after the module name.
    SND-bcm2835 i2c-bcm2708 i2c - dev rtc_ds1307 w1-gpio w1-therm

    Here is the list of the modules in memory after a reboot
    1__ssh

  5. Restart the system
    reboot
  6. Install tools for the i2c bus
    apt-get install i2c-tools

    You can check that your clock is well detected by position 68 and the accelerometer in the position 69 :
    1__sshThe 50 comes from the second possible port of my clock.

  7. Install and configure the clock (Replace it 0 by 1 If you have a model B revision 2)
    echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-0/new_device hwclock r

    1__sshAs you are connected to the Internet, your system must be on time. Send time system to clock

    hwclock -w

    The command returns no information. You can check the result with the read command

    hwclock -r

    To sync automatically with the Raspberry boot, You must edit the file/etc/rc.local by adding the following lines before the exit 0 the end

    echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-0/new_device sudo hwclock s

    1__ssh

  8. Install the tools for GPS
    apt - get install –y gpsd gpsd-clients

    You can test that the GPS is connected

    cgps s

    1._ssh-6

    Edit the file /lib/udev/GPSD.hotplug by adding the line

    chmod a   rw $DEVNAME

    before the line

    gpsdctl $ACTION $DEVNAME
  9. Test the Sensor DS18B20. In the directory /sys/bus/w1/devices, You must find your probe in the form of a directory whose name begins with 28-. In this directory you will have a file containing the measured temperature. It will be updated every time you go to read the contents of the file. Here is a complete example for the temperature :
    1._ssh-11
  10. Test the accelerometer MPU6050
    i2cget y 0 0x 69 0 x 75

    The command should display 0 x 68

Your hardware is now ready ! Next step, use Python to save data

Like this article ? Bear with me on patreon!

You may also like...