User Tools

Site Tools


doc:appunti:hardware:raspberry_explorer

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
doc:appunti:hardware:raspberry_explorer [2018/10/09 21:24] – [Adding Extra Packages] niccolodoc:appunti:hardware:raspberry_explorer [2018/11/26 08:42] (current) – [Time Syncronization with GPS and NTP] niccolo
Line 42: Line 42:
 {{ .:raspberrypi:raspberry_pi_cam_miuzei_ov5647.jpg?direct&180|Image captured by the OV5647 camera}} {{ .:raspberrypi:raspberry_pi_cam_miuzei_ov5647.jpg?direct&180|Image captured by the OV5647 camera}}
 The camera mounted in our kit is based on the **OV5647 sensor**, capable of 2592x1944 pixels (**5 Mpixels**). The camera has a **wide viewing angle** of 175°. The camera requires a **manual focus adjust**, turning the lens mount clockwise or counerclockwise. The focus resulted a bit critical: trying to focus to infinity it resulted that the mere rotation of 1/16 of a turn, can **mess-out the focus** very badly. Also the quality of the pictures is **not exceptional**, they miss the crisp level that we would expect from a 5 Mpixels sensor. The camera mounted in our kit is based on the **OV5647 sensor**, capable of 2592x1944 pixels (**5 Mpixels**). The camera has a **wide viewing angle** of 175°. The camera requires a **manual focus adjust**, turning the lens mount clockwise or counerclockwise. The focus resulted a bit critical: trying to focus to infinity it resulted that the mere rotation of 1/16 of a turn, can **mess-out the focus** very badly. Also the quality of the pictures is **not exceptional**, they miss the crisp level that we would expect from a 5 Mpixels sensor.
 +
 +===== Other Sensors =====
 +
 +{{.:raspberrypi:sensors-front.jpg?direct&500|Misc sensors: GPS, Accel & Gyro, Magnetic, Pressure}}
 +
 +{{.:raspberrypi:sensors-back.jpg?direct&500|Sensor's Back Side}}
 +
 +  * **GPS u-blox NEO-6**
 +  * **GY-521: MPU-6050 Accelerometer and Gyroscope**
 +  * **GY-273: QMC5883L 3-Axis Magnetic Sensor**
 +  * **GYBMEP: BME280 pressure, humidity and temperature sensor**
  
 ===== Software Setup ===== ===== Software Setup =====
Line 87: Line 98:
       * Serial port hardware enabled (Yes)       * Serial port hardware enabled (Yes)
   * Advanced Options   * Advanced Options
-    * **Memory Split** 16+    * **Memory Split** 128 (suggested by ''raspistill'')
  
 The files changed by that configuration are (among others): The files changed by that configuration are (among others):
Line 137: Line 148:
 dpkg --purge plymouth mountall pi-bluetooth dpkg --purge plymouth mountall pi-bluetooth
 </code> </code>
 +
 +==== Configuring the Network ====
 +
 +Once configured the **/etc/wpa_supplicant/wpa_supplicant.conf** file, the **wlan0** interface will simply work. If an Ethernet cable is plugged-in, the dhcp will bring up the **eth0** interface with a suitable address. But if the Raspberry is bootstrapped without a reachable WiFi and without an Ethernet cable, a **very long timeout** will occur (over 5 minutes) and some services will not start (e.g. the Samba **nmbd**).
 +
 +To avoid such troubles, we can just configure a static IP alias for the interface eth0:0 by creating a file **/etc/network/interfaces.d/local** with the following:
 +
 +<file>
 +auto eth0:0
 +iface eth0:0 inet static
 +        address 169.254.255.198
 +        netmask 255.255.0.0
 +</file>
 ==== Nginx Webserver ==== ==== Nginx Webserver ====
  
Line 213: Line 237:
  
 I use **gpxlogger** (from the **gpsd-clients** Debian package) to acquire track logs from the GPS. It seems that the program has a bug handling the **%%-f%% option**, sometimes it crashes with the error //free(): invalid next size (fast)//. I opened [[https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=909082|bug #909082]] on Debian. Changing the file name to be created, is a workaround for this problem. I use **gpxlogger** (from the **gpsd-clients** Debian package) to acquire track logs from the GPS. It seems that the program has a bug handling the **%%-f%% option**, sometimes it crashes with the error //free(): invalid next size (fast)//. I opened [[https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=909082|bug #909082]] on Debian. Changing the file name to be created, is a workaround for this problem.
 +
 +===== GPS u-blox NEO-6 =====
 +
 +{{.:raspberrypi:neo-6m-gps.jpg?direct&180|u-blox NEO-6 GPS with small antenna}}
 +{{.:raspberrypi:neo-6m-gps_back.jpg?direct&180|u-blox NEO-6 GPS back view}}
 +
 +
 +A cheap alternative to the Adafruit Ultimate GPS HAT is the **u-blox NEO-6 GPS** module. It has a serial interface and a pin to carry the PPS signal.
 +
 +^ u-blox  ^ Raspberry Pi                ^
 +| 1 VCC   | PIN 2 - 5V                  |
 +| 2 GND   | PIN 6 - GND                 |
 +| 3 TXD   | PIN 10 - GPIO#15 UART0_RXD  |
 +| 4 RXD   | PIN 8 - GPIO#14 UART0_TXD   |
 +| 5 PPS   | PIN 7 - GPIO#             |
 ===== Time Syncronization with GPS and NTP ===== ===== Time Syncronization with GPS and NTP =====
  
Line 241: Line 280:
 </file> </file>
  
-At the next reboot you should read the following kernel logs via **dmesg**:+At the next reboot the kernel modules **pps_core** and **pps_gpio** will be loaded and you should read the following kernel logs via **dmesg**:
  
 <code> <code>
Line 445: Line 484:
  
 Beware that if the sleep time is lower than three times the sensor settling time (default 40 x 3 = 120 seconds), **the sensor fan will not be stopped** between each read, so be prepared for a shorter life of the sensor. Beware that if the sleep time is lower than three times the sensor settling time (default 40 x 3 = 120 seconds), **the sensor fan will not be stopped** between each read, so be prepared for a shorter life of the sensor.
 +
 +
 +===== GY-273 QMC5883L 3-Axis Magnetic Sensor =====
 +
 +The **GY-273 magnetometer** is based upon the **QMC5883L** chip, which is similar to the HMC5883L one.
 +
 +^ PMS5003 Pin  ^ Color  ^ Raspberry Pi   ^
 +| 1 VCC       | Red     | PIN 1 - 3.3V   |
 +| 2 GND       | Black   | PIN 9 - GND    |
 +| 3 SCL       | Yellow  | PIN 5 - SCL    |
 +| 4 SDA       | Green   | PIN 3 - SDA    |
 +| 5 DRDY      |         | Not Connected  |
 +
 +Connect the device, enable the I2C bus using **raspi-config** and install the **i2c-tools** package. You should see the device at address 0x0d of the bus:
 +
 +<code>
 +i2cdetect -y 1
 +      1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
 +00:          -- -- -- -- -- -- -- -- -- -- 0d -- -- 
 +10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
 +20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
 +30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
 +40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
 +50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
 +60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
 +70: -- -- -- -- -- -- -- --                         
 +</code>
 +
 +GitHub and Pypi.org has a [[https://pypi.org/project/qmc5883l/|Python driver]] by Fabian Mruck, which unfortunately **does not work** for me, it returns always **%%[0, 0, 0]%%**. Also the software existing for the HMC5883L chip is **not compatible**, according to several posts (see [[https://www.raspberrypi.org/forums/viewtopic.php?p=1102197#p1102197|this]] and [[https://www.raspberrypi.org/forums/viewtopic.php?t=184556|that]]).
 +
 +So I wrote my own Python module, named **py_qmc5883l** which is available on **[[https://github.com/RigacciOrg/py-qmc5883l|GitHub py-qmc5883l repository]]**. To access the I2C bus it requires the **python-smbus** package. The full recipe is:
 +
 +<code>
 +apt-get install python-smbus
 +cd /usr/local/src
 +git clone https://github.com/RigacciOrg/py-qmc5883l
 +mkdir /usr/local/lib/python2.7/dist-packages
 +cd py-qmc5883l
 +python setup.py install
 +</code>
 +
 +Now you can access the magnetic sensor with a simple Python program:
 +
 +<code python>
 +import py_qmc5883l
 +sensor = py_qmc5883l.QMC5883L()
 +m = sensor.get_magnet()
 +print(m)
 +</code>
 +
 ===== Web References ===== ===== Web References =====
  
Line 462: Line 551:
   * [[https://groups.google.com/forum/#!topic/comp.protocols.time.ntp/7_q0EO2aAZw|Single GPS/PPS time source gets marked as a falseticker]]   * [[https://groups.google.com/forum/#!topic/comp.protocols.time.ntp/7_q0EO2aAZw|Single GPS/PPS time source gets marked as a falseticker]]
   * [[http://doc.ntp.org/4.2.8/miscopt.html|NTP Miscellaneous Commands and Options]] (e.g. //tos// and //tinker// options).   * [[http://doc.ntp.org/4.2.8/miscopt.html|NTP Miscellaneous Commands and Options]] (e.g. //tos// and //tinker// options).
 +
 +=== QMC5883L 3-Axis Magnetic Sensor ===
 +  * [[https://github.com/RigacciOrg/py-qmc5883l|Python driver for qmc5883l by Niccolo Rigacci]] (working)
 +  * [[https://github.com/norges/qmc5883l|Python driver for qmc5883l by Fabian Mruck]] (not working)
 +  * [[https://www.raspberrypi.org/forums/viewtopic.php?p=1102197#p1102197|Wrong I2C Address]]
 +  * [[https://www.raspberrypi.org/forums/viewtopic.php?t=184556|GY-271 HMC5883L Compass Returning 0]]
 +  * [[https://github.com/kriswiner/MPU6050/wiki/Simple-and-Effective-Magnetometer-Calibration|Simple and Effective Magnetometer Calibration]]
 +
 +=== Other Sensors ===
 +  * [[https://forum.sparkfun.com/viewtopic.php?t=47880|LIS3DH Accelerometer with Raspberry Pi]]
 +  * [[https://www.instructables.com/id/how-to-use-the-ADXL345-on-Raspberry-pi/|How to Use the ADXL345 on Raspberry Pi]]
 +
doc/appunti/hardware/raspberry_explorer.1539120265.txt.gz · Last modified: 2018/10/09 21:24 by niccolo