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
Last revisionBoth sides next revision
doc:appunti:hardware:raspberry_explorer [2018/10/12 16:56] – [GY-273 QMC5883L Magnetometer] niccolodoc:appunti:hardware:raspberry_explorer [2018/10/26 08:59] – [Other Sensors] 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 226: 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 460: Line 486:
  
  
-===== GY-273 QMC5883L Magnetometer =====+===== GY-273 QMC5883L 3-Axis Magnetic Sensor =====
  
-The **GY-273 magnetometer** is based upon the **QMC5883L** chip, which is compatible with the HMC5883L one.+The **GY-273 magnetometer** is based upon the **QMC5883L** chip, which is similar to the HMC5883L one.
  
-^ PMS5003 Pin  ^ Color  ^ Raspberry Pi  +^ PMS5003 Pin  ^ Color  ^ Raspberry Pi   
-| 1 VCC       | Red     | PIN 1 - 3.3V  +| 1 VCC       | Red     | PIN 1 - 3.3V   
-| 2 GND       | Black   | PIN 9 - GND   +| 2 GND       | Black   | PIN 9 - GND    
-| 3 SCL       | Yellow  | PIN 5 - SCL   +| 3 SCL       | Yellow  | PIN 5 - SCL    
-| 4 SDA       | Green   | PIN 3 - SDA   +| 4 SDA       | Green   | PIN 3 - SDA    
-| 5 DRDY      | Violet                |+| 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: 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:
Line 485: Line 511:
 70: -- -- -- -- -- -- -- --                          70: -- -- -- -- -- -- -- --                         
 </code> </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> <code>
-apt-get install python-pip +apt-get install python-smbus 
-pip install qmc5883l +cd /usr/local/src 
-pip install smbus2+git clone https://github.com/RigacciOrg/py-qmc5883l 
 +mkdir /usr/local/lib/python2.7/dist-packages 
 +cd py-qmc5883l 
 +python setup.py install
 </code> </code>
  
-Notice: package **python-smbus** does not provide the required smbus2 Python module.+Now you can access the magnetic sensor with a simple Python program:
  
 <code python> <code python>
-#!/usr/bin/python +import py_qmc5883l 
-import qmc5883l +sensor py_qmc5883l.QMC5883L() 
-mag_sens qmc5883l.QMC5883L() +m = sensor.get_magnet(
-print mag_sens.get_magnet()+print(m)
 </code> </code>
  
-FIXME: Does not work! Always returns **%%[1, 0, 0]%%**. See this [[https://www.raspberrypi.org/forums/viewtopic.php?t=184556|post]]. 
 ===== Web References ===== ===== Web References =====
  
Line 519: 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.txt · Last modified: 2018/11/26 08:42 by niccolo