test2 5 years ago
parent
commit
11be88d8d6
  1. BIN
      IoT/800px-Flight_dynamics_with_text.png
  2. 144
      IoT/AttitudeHeadingReferenceSystem-IMU.adoc
  3. BIN
      IoT/piandrroll.png
  4. BIN
      IoT/sensors_10dofwire.jpg
  5. BIN
      IoT/sensors_1604_LRG.jpg
  6. 29
      ls/ex-1_ls.adoc

BIN
IoT/800px-Flight_dynamics_with_text.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

144
IoT/AttitudeHeadingReferenceSystem-IMU.adoc

@ -0,0 +1,144 @@
= How to turn Adafruit's 9-DOF, 10-DOF, or LSM9DS0 breakouts into AHRS (attitude and heading reference system) !
Apostolos rootApostolos@swarmlab.io
// Metadata:
:description: IoT Διαδίκτυο των Αντικειμένων
:keywords: iot, imu, AHRS
:data-uri:
:toc: right
:toc-title: Πίνακας περιεχομένων
:toclevels: 4
:source-highlighter: highlight
:icons: font
:sectnums:
include::header.adoc[]
{empty} +
An attitude and heading reference system (AHRS) consists of sensors on three axes that provide attitude information for aircraft, including roll, pitch and yaw. These are sometimes referred to as MARG (Magnetic, Angular Rate, and Gravity)[1] sensors and consist of either solid-state or microelectromechanical systems (MEMS) gyroscopes, accelerometers and magnetometers. They are designed to replace traditional mechanical gyroscopic flight instruments.
More Info:
https://en.wikipedia.org/wiki/Attitude_and_heading_reference_system[^]
A basic IMU (Intertial Measurement Unit) generally provides raw sensor data, whereas an AHRS takes this data one step further, converting it into heading or direction in degrees, converting the raw altitude data into standard units like feet or meters, etc.
[[cheat-Articles]]
== IMU
image:./sensors_1604_LRG.jpg[alt="Adafruit 10-DOF IMU Breakout"]
Adafruit's 10DOF (10 Degrees of Freedom)https://en.wikipedia.org/wiki/Degrees_of_freedom[^] breakout board allows you to capture ten distinct types of motion or orientation related data.
- LSM303DLHC - a 3-axis accelerometer (up to +/-16g) and a 3-axis magnetometer (up to +/-8.1 gauss) on a single die
- L3GD20 - a 3-axis gyroscope (up to +/-2000 dps)
- BMP180 - A barometric pressure sensor (300..1100 hPa) that can be used to calculate altitude, with an additional on-board temperature sensor
=== Connecting It Up
Basic Setup
- Connect the **SCL** pin on the breakout to the **SCL** pin on your Arduino. On an UNO & '328 based Arduino, this is also known as **A5**
- Connect the **SDA** pin on the breakout to the **SDA** pin on your Arduino. On an UNO & '328 based Arduino, this is also known as **A4**
- Connect the **VIN** pin on the breakout to **3.3V** or **5V** on your Uno (5V is preferred but if you have a 3V logic Arduino 3V is best)
- Connect the **GND** pin on the breakout to the **GND** pin on your Uno
That's it! With those four wires, you should be able to talk to any of the I2C chips on the board and run any of the example sketches.
image:./sensors_10dofwire.jpg[alt="Connecting"]
Advanced Setup
- **GINT** - The interrupt pin on the L3GD20 gyroscope
- **GRDY** - The 'ready' pin on the L3GD20 gyroscope
- **LIN1** - Interrupt pin 1 on the LSM303DLHC
- **LIN2** - Interrupt pin 2 on the LSM303DLHC
- **LRDY** - The ready pin on the LSM303DLHC
These pins are all outputs from the 10-DOF breakout and are all 3.3V logic
=== Downloading Libraries
Place the files in the Arduino Sketch Folder '/libraries' sub-folder. You should end up with a structure like this:
- arduinosketches/libraries/Adafruit_10DOF
- arduinosketches/libraries/Adafruit_BMP085
- arduinosketches/libraries/Adafruit_L3GD20_U
- arduinosketches/libraries/Adafruit_LSM303DLHC
- arduinosketches/libraries/Adafruit_Sensor
.Arduino libraries
[NOTE]
====
Arduino libraries are a convenient way to share code such as device drivers or commonly used utility functions.
How to install Arduino libraries[https://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use]
====
=== Example Sketch
==== pitch & roll
.sketch pitchrollheading
[source,c]
----
sensors_event_t accel_event;
sensors_vec_t orientation;
/* Calculate pitch and roll from the raw accelerometer data */
accel.getEvent(&accel_event);
if (dof.accelGetOrientation(&accel_event, &orientation))
{
/* 'orientation' should have valid .roll and .pitch fields */
Serial.print(F("Roll: "));
Serial.print(orientation.roll);
Serial.print(F("; "));
Serial.print(F("Pitch: "));
Serial.print(orientation.pitch);
Serial.print(F("; "));
}
----
image:./800px-Flight_dynamics_with_text.png[alt="pitchroll"]
Arguments
- event: The **sensors_event_t** variable containing the data from the **accelerometer**
- orientation: The **sensors_vec_t** object that will have its **.pitch** and **.roll** fields populated
Returns
- **true** if the operation was successful,
- **false** if there was an error
image:./piandrroll.png[alt="pitchroll"]
:hardbreaks:
{empty} +
{empty} +
{empty}
:!hardbreaks:
'''
.Reminder
[NOTE]
====
:hardbreaks:
Caminante, no hay camino,
se hace camino al andar.
Wanderer, there is no path,
the path is made by walking.
*Antonio Machado* Campos de Castilla
====

BIN
IoT/piandrroll.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

BIN
IoT/sensors_10dofwire.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

BIN
IoT/sensors_1604_LRG.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 707 KiB

29
ls/ex-1_ls.adoc

@ -35,7 +35,7 @@ Assuming you're already logged in
[options="header,footer"]
|=======================
|Command| Meaning
|ls| Displays a list of files in the current working directory, like the dir command in DOS
|ls| Displays a list of files in the current working directory.
|cd directory| change directories
|passwd |change the password for the current user
|file filename| display file type of file with name filename
@ -120,7 +120,7 @@ NOTE: -**rw-**rw-r-- 1 zeus zeus 1517 Οκτ 23 21:55 INSTALL.md
|Code| Meaning|
|u| user permissions|-**rw-**rw-r--
|g| group permissions|-rw-**rw-**r--
|o| permissions for others|-rw-rw-**r--**
|o| permissions for others|-rw-rw-**rw-**
|=======================
@ -223,6 +223,31 @@ find /etc -name "*.conf" -exec grep -Hns "conf" {} \;
----
NOTE: This can be interpreted as +
- "Look for *.conf files and subdirectories contained in /etc, and **if true** exec **grep -Hns conf** in the given file"
TIP: Very powerful in bash scripts
create a file test.sh
.bash script
[source,bash]
----
#!/bin/bash
STRING=$(find /etc -name "*.conf" -exec grep -Hns "conf" {} \;)
echo $STRING
----
exec it
.bash script
[source,bash]
----
chmod 700 test.sh
./test.sh
----
== Managing software
=== APT

Loading…
Cancel
Save