3 | The MATRIX Ecosystem was created to make powerful hardware projects very approachable for software developers. The pillars of MATRIX, computer vision, hardware interfaces, distributed internet communication, and data-driven end-user clients, are all programming disciplines which require years for an individual to master, or for a team to build a solution around.
4 |
5 |
6 | ## Support & Resources
7 | Feel free to visit our communities and projects for any suggestions and/or questions you may have!
8 |
9 |
21 | Alert issues on our GitHub under the corresponding repository.
22 |
23 |
24 | ## Programming Layers
25 |
26 | The MATRIX platform adds powerful capabilities to your Raspberry Pi, depending on your background and the kind of application you want to write, you may need to decide on which layer best fits your need. The documentation is organized according to these layers:
27 |
28 |
MATRIX Lite
29 | **Languages:** JavaScript, Python, Go, & Ruby
30 |
31 | A straightforward library that's aimed at users of all skill levels. This layer is an abstraction around MATRIX HAL and allows you to program your MATRIX Device with as little as one line of code.
32 |
33 | [Read more about MATRIX Lite](matrix-lite/overview)
34 |
35 |
MATRIX HAL
36 | **Language:** C++
37 |
38 | Interacts with the kernel modules by using C++ drivers, enabling it to access available sensors and components on your device.
39 |
40 | [Read more about MATRIX HAL](matrix-hal/overview)
41 |
42 |
MATRIX Core
43 | **Languages:** Over 40 (Examples in JavaScript & Python)
44 |
45 | Abstraction layer for **MATRIX HAL**. Hosts a ZeroMQ + Protobuf communication layer which makes device information accessible via high-level interfaces. Supports multiple different languages through Protocol Buffers: C++, Python, Ruby, PHP, Java, etc.
46 |
47 | [Read more about MATRIX Core](matrix-core/overview)
48 |
49 |
50 | ## Devices
51 | > Each programming layer in the MATRIX platform is compatible with each MATRIX product, excluding specific components on the boards.
52 |
53 |
MATRIX Creator
54 |
55 |
56 | A fully-featured development board for the Raspberry Pi with various sensors and communication protocols such as a 3D Gyroscope, Accelerometer, an 8 Microphone Array, zigbee, Z-Wave, and more!
57 |
58 | [Read more about the MATRIX Creator](matrix-creator/overview.md)
59 |
60 |
MATRIX Voice
61 |
62 | A voice and audio focused development board with an 8 microphone array that enables you to create your own audio driven applications or use voice assistants such as
63 | Amazon Alexa,
64 | Google Assistant,
65 | PocketSphinx, etc.
66 |
67 | [Read more about the MATRIX Voice](matrix-voice/overview.md)
68 |
69 |
--------------------------------------------------------------------------------
/docs/matrix-core/getting-started/core-installation.md:
--------------------------------------------------------------------------------
1 |
Installing MATRIX CORE
2 |
3 | >Make sure you have setup your
4 | [MATRIX Creator](/matrix-creator/device-setup) or
5 | [MATRIX Voice](/matrix-voice/device-setup) before continuing.
6 |
7 | ## Installation
8 | Before starting, ensure you have access to the terminal of your Raspberry Pi via an SSH-session or a connected screen, mouse, and keyboard. Then insert and run the following commands into your Raspberry Pi's terminal, one at a time.
9 |
10 | Add the MATRIX repository and key.
11 |
12 | ```bash
13 | curl https://apt.matrix.one/doc/apt-key.gpg | sudo apt-key add -
14 | echo "deb https://apt.matrix.one/raspbian $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/matrixlabs.list
15 | ```
16 |
17 | Update your repository and packages.
18 |
19 | ```bash
20 | sudo apt-get update
21 | sudo apt-get upgrade
22 | ```
23 |
24 | Install the the MATRIX CORE packages.
25 |
26 | ```bash
27 | sudo apt-get install matrixio-malos
28 | ```
29 |
30 | Reboot your device.
31 |
32 | ```bash
33 | sudo reboot
34 | ```
35 |
36 | MATRIX CORE will now be running as a service each time your Raspberry Pi boots up.
37 |
38 | These remaining commands will install ZeroMQ.
39 |
40 | ```bash
41 | echo "deb http://download.opensuse.org/repositories/network:/messaging:/zeromq:/release-stable/Debian_9.0/ ./" | sudo tee /etc/apt/sources.list.d/zeromq.list
42 | wget https://download.opensuse.org/repositories/network:/messaging:/zeromq:/release-stable/Debian_9.0/Release.key -O- | sudo apt-key add
43 | ```
44 |
45 |
46 | ## Next Steps
47 | Now that you have MATRIX CORE and ZeroMQ installed, please take a look at Understanding CORE [here](understanding-core.md).
48 |
49 | If you're already familiar, you can learn how to setup a programming language for communicating with CORE. We currently have tutorials for the following languages:
50 |
51 | * [Javascript](javascript-installation.md)
52 | * [Python](python-installation.md)
53 | * [Golang](golang-installation.md)
54 |
55 |
56 | ## Helpful Information
57 |
Upgrading
58 |
59 | If you need to upgrade your MATRIX CORE package at any time, please run the following commands on your Raspberry Pi.
60 |
61 | ```bash
62 | sudo apt-get update
63 | sudo apt-get upgrade
64 | ```
65 | A reboot will be required after upgrading your packages.
66 |
67 | ```bash
68 | sudo reboot
69 | ```
70 |
71 |
Stopping & Starting
72 | If you need to manually stop MATRIX CORE use:
73 |
74 | ```bash
75 | sudo pkill -9 malos
76 | ```
77 |
78 | If you need to manually start MATRIX CORE again use:
79 |
80 | ```bash
81 | malos &
82 | ```
--------------------------------------------------------------------------------
/docs/matrix-core/getting-started/index.md:
--------------------------------------------------------------------------------
1 | ## Getting Started
2 |
3 |
3 |
4 | ### Device Compatibility
5 |
6 |
7 | ## Overview
8 |
9 | The Pressure driver reports values for:
10 |
11 | * Pressure
12 | * Altitude
13 | * Temperature
14 |
15 | >Based on component location, the temperature values from the [Humidity driver](./humidity) are recommended over the Pressure driver
16 |
17 |
Available ZeroMQ Ports
18 | * `Base port`: 20025
19 | * `Keep-alive port`: 20026
20 | * `Error port`: 20027
21 | * `Data Update port`: 20028
22 |
23 |
24 | ## Code Example
25 | The following sections show how to implement a connection to each of the Pressure driver's ports. You can download this example here.
26 |
27 | ???+ info "Initial Variables"
28 | Before we go into connecting to each port, the variables defined below are needed in order to access the ZeroMQ and MATRIX Protocol Buffer libraries for Javascript. We also define a few helpful variables for easy references.
29 | ```javascript
30 | var zmq = require('zeromq');// Asynchronous Messaging Framework
31 | var matrix_io = require('matrix-protos').matrix_io;// Protocol Buffers for MATRIX function
32 | var matrix_ip = '127.0.0.1';// Local IP
33 | var matrix_pressure_base_port = 20025;// Port for Pressure driver
34 | ```
35 |
36 |
37 | ???+ info "Base Port"
38 | Here is where the configuration for our Pressure example goes. Once we connect to the **Base Port**, we will pass a configuration to the pressure driver. With this we can set the update rate and timeout configuration.
39 | ```javascript
40 | // Create a Pusher socket
41 | var configSocket = zmq.socket('push');
42 | // Connect Pusher to Base port
43 | configSocket.connect('tcp://' + matrix_ip + ':' + matrix_pressure_base_port);
44 | // Create driver configuration
45 | var config = matrix_io.malos.v1.driver.DriverConfig.create({
46 | // Update rate configuration
47 | delayBetweenUpdates: 2.0,// 2 seconds between updates
48 | timeoutAfterLastPing: 6.0,// Stop sending updates 6 seconds after pings.
49 | });
50 | // Send driver configuration
51 | configSocket.send(matrix_io.malos.v1.driver.DriverConfig.encode(config).finish());
52 | ```
53 |
54 |
55 | ???+ info "Keep-alive Port"
56 | The next step is to connect and send a message to the **Keep-alive Port**. That message, an empty string, will grant us a response from the **Data Update Port** for the current pressure value. An interval for pinging is then set to continuously obtain that data.
57 | ```javascript
58 | // Create a Pusher socket
59 | var pingSocket = zmq.socket('push');
60 | // Connect Pusher to Keep-alive port
61 | pingSocket.connect('tcp://' + matrix_ip + ':' + (matrix_pressure_base_port + 1));
62 | // Send initial ping
63 | pingSocket.send('');
64 | // Send ping every 5 seconds
65 | setInterval(function(){
66 | pingSocket.send('');
67 | }, 5000);
68 | ```
69 |
70 |
71 | ???+ info "Error Port"
72 | Connecting to the **Error Port** is optional, but highly recommended if you want to log any errors that occur within MATRIX CORE.
73 | ```javascript
74 | // Create a Subscriber socket
75 | var errorSocket = zmq.socket('sub');
76 | // Connect Subscriber to Error port
77 | errorSocket.connect('tcp://' + matrix_ip + ':' + (matrix_pressure_base_port + 2));
78 | // Connect Subscriber to Error port
79 | errorSocket.subscribe('');
80 | // On Message
81 | errorSocket.on('message', function(error_message){
82 | console.log('Error received: ' + error_message.toString('utf8'));// Log error
83 | });
84 | ```
85 |
86 |
87 | ???+ info "Data Update Port"
88 | A connection to the **Data Update Port** will allow us to receive the current pressure data we want.
89 |
90 | ```javascript
91 | // Create a Subscriber socket
92 | var updateSocket = zmq.socket('sub');
93 | // Connect Subscriber to Data Update port
94 | updateSocket.connect('tcp://' + matrix_ip + ':' + (matrix_pressure_base_port + 3));
95 | // Subscribe to messages
96 | updateSocket.subscribe('');
97 | // On Message
98 | updateSocket.on('message', function(buffer){
99 | var data = matrix_io.malos.v1.sense.Pressure.decode(buffer);// Extract message
100 | console.log(data);// Log new pressure data
101 | });
102 | ```
103 |
Data Output
104 | The javascript object below is an example output you'll receive from the **Data Update Port**.
105 | ```javascript
106 | {
107 | pressure: 101173.75,
108 | altitude: 12.812000274658203,
109 | temperature: 37.3120002746582
110 | }
111 | ```
--------------------------------------------------------------------------------
/docs/matrix-core/javascript-examples/servo.md:
--------------------------------------------------------------------------------
1 |
Servo
2 |
Javascript Example
3 |
4 | ### Device Compatibility
5 |
6 |
7 |
8 | ## Overview
9 |
10 | The Servo driver can set the angle of your servos through the pins of your MATRIX device.
11 |
12 | **Device Pinouts**:
13 |
14 | * [MATRIX Creator](/matrix-creator/resources/pinout.md)
15 | * [MATRIX Voice](/matrix-voice/resources/pinout.md)
16 |
17 |
Available ZeroMQ Ports
18 | * `Base port`: 20045
19 | * `Error port`: 20047
20 |
21 | ## Code Example
22 | The following sections show how to implement a connection to each of the Servo driver's ports. You can download this example here.
23 |
24 |
25 | ???+ info "Initial Variables"
26 | Before we go into connecting to each port, the variables defined below are needed in order to access the ZeroMQ and MATRIX Protocol Buffer libraries for Javascript. We also define a few helpful variables for easy references.
27 | ```javascript
28 | var zmq = require('zeromq');// Asynchronous Messaging Framework
29 | var matrix_io = require('matrix-protos').matrix_io;// Protocol Buffers for MATRIX function
30 | var matrix_ip = '127.0.0.1';// Local IP
31 | var matrix_servo_base_port = 20045;// Port for Servo driver
32 | ```
33 |
34 |
35 | ???+ info "Base Port"
36 | Here is where the configuration for our servo example goes. Once we connect to the **Base Port**, We will pass a configuration to the servo driver. With this we can choose the pin we want to edit and the angle to set for it. This example will send random numbers to any servo attached to pin 0.
37 |
38 | ```javascript
39 | // Create a Pusher socket
40 | var configSocket = zmq.socket('push');
41 | // Connect Pusher to Base port
42 | configSocket.connect('tcp://' + matrix_ip + ':' + matrix_servo_base_port);
43 | // Create driver configuration
44 | var config = matrix_io.malos.v1.driver.DriverConfig.create({
45 | // Create servo configuration
46 | servo: matrix_io.malos.v1.io.ServoParams.create({
47 | pin: 0,// Use pin 0
48 | angle: 0// Set angle 0
49 | })
50 | });
51 | // Loop every second
52 | setInterval(function(){
53 | // Pick number from 1-180
54 | var angle = Math.floor(Math.random() * 180)+1;
55 | // Set number as new random angle
56 | config.servo.angle = angle;
57 | // Log angle
58 | console.log(angle);
59 | // Send driver configuration
60 | configSocket.send(matrix_io.malos.v1.driver.DriverConfig.encode(config).finish());
61 | }, 1000);
62 | ```
63 |
64 |
65 | ???+ info "Error Port"
66 | Connecting to the **Error Port** is optional, but highly recommended if you want to log any errors that occur within MATRIX CORE.
67 | ```javascript
68 | // Create a Subscriber socket
69 | var errorSocket = zmq.socket('sub');
70 | // Connect Subscriber to Error port
71 | errorSocket.connect('tcp://' + matrix_ip + ':' + (matrix_servo_base_port + 2));
72 | // Connect Subscriber to Error port
73 | errorSocket.subscribe('');
74 | // On Message
75 | errorSocket.on('message', function(error_message){
76 | console.log('Error received: ' + error_message.toString('utf8'));// Log error
77 | });
78 | ```
--------------------------------------------------------------------------------
/docs/matrix-core/overview.md:
--------------------------------------------------------------------------------
1 |
MATRIX CORE
2 | > Previously known as MATRIX MALOS.
3 |
4 | MATRIX CORE is an abstraction layer for **MATRIX HAL**. This layer uses
5 | Protocol Buffers & ZeroMQ to communicate with your MATRIX device. Applications for your MATRIX device can be programmed with any language that supports these tools.
6 |
7 | ### [Getting Started](getting-started)
8 |
9 | Learn how to install MATRIX CORE and gain a deeper understanding of how this layer interacts with your MATRIX device. Setup tutorials and hello world examples for Javascript, Python, and Golang are available here.
10 |
11 | ### [Driver Protocols](protocols)
12 |
13 | See the available drivers you can interact with and the protocols they require for communicating with your application.
14 |
15 | ### Library Examples
16 | *
18 |
19 | ### [Troubleshooting](troubleshooting)
20 | Look at common debugging solutions for any issues you encounter.
21 |
--------------------------------------------------------------------------------
/docs/matrix-core/protocols/everloop.md:
--------------------------------------------------------------------------------
1 |
Everloop
2 |
3 | ### Device Compatibility
4 |
5 |
6 |
7 | ## Overview
8 |
9 | The Everloop driver allows for:
10 |
11 | * Reading amount of LEDs your MATRIX device has.
12 | * Setting the RGBW colors for each individual LED.
13 |
14 |
Available ZeroMQ Ports
15 |
16 | * `Base port`: 20021
17 | * `Keep-alive port`: 20022
18 | * `Error port`: 20023
19 | * `Data update port`: 20024
20 |
21 | ## Protocol
22 |
23 |
24 | ???+ info "Base Port"
25 | This port accepts a single configuration for communicating with the Everloop driver.
26 |
27 | * `image` - the everloop configuration that's created from an `EverloopImage` message.
28 |
29 | ```protobuf
30 | message DriverConfig {
31 | matrix_io.malos.v1.io.EverloopImage image = 3;
32 | }
33 | ```
34 | View the defined message here.
35 |
36 | `EverloopImage`
37 |
38 | * `led` - Must hold the value for each LED on your MATRIX device. Each LED is defined as one `LedValue`.
39 |
40 | ```protobuf
41 | // Value for an led that ranges from 0 to 255 for each color
42 | message LedValue {
43 | uint32 red = 1;
44 | uint32 green = 2;
45 | uint32 blue = 3;
46 | uint32 white = 4;
47 | }
48 |
49 | // The led array.
50 | message EverloopImage {
51 | repeated LedValue led = 1;
52 | }
53 | ```
54 | View the defined message here.
55 |
56 |
57 | ???+ info "Keep-alive Port"
58 | This driver needs keep-alive messages in order to send data to your application. It's recommended to send an empty string `""` because the contents of a keep-alive message are never read.
59 |
60 |
61 | ???+ info "Error Port"
62 | Applications can subscribe to this port to receive driver related errors.
63 |
64 |
65 | ???+ info "Data Update Port"
66 | Applications can subscribe to this port for Everloop data. The output will be a serialized message of type `EverloopImage` with the following information.
67 |
68 | ```protobuf
69 | // The led array.
70 | message EverloopImage {
71 | repeated LedValue led = 1;
72 |
73 | // Number of leds in the Everloop
74 | int32 everloop_length = 2;
75 | }
76 | ```
77 | View the defined message here.
--------------------------------------------------------------------------------
/docs/matrix-core/protocols/gpio.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | ### Device Compatibility
4 |
5 |
6 | ## Overview
7 |
8 | The Humidity driver allows for:
9 |
10 | * Reading relative humidity on the board
11 | * Obtaining temperature in Celsius and raw values
12 | * Calibrating temperature
13 |
14 |
Available ZeroMQ Ports
15 |
16 | * `Base port`: 20017
17 | * `Keep-alive port`: 20018
18 | * `Error port`: 20019
19 | * `Data update port`: 20020
20 |
21 | ## Protocol
22 |
23 |
24 | ???+ info "Base Port"
25 | This port accepts three configurations for communicating with the Humidity driver.
26 |
27 | * `delay_between_updates` - controls the output speed of messages from the **Data Update port**.
28 |
29 | * `timeout_after_last_ping` - stops sending messages from the **Data Update port** if nothing has been sent to the **Keep-alive port** after the specified amount of seconds.
30 |
31 | * `humidity` - the humidity configuration that's created from a `HumidityParams` message.
32 |
33 | ```protobuf
34 | message DriverConfig {
35 | // Delay between updates in seconds
36 | float delay_between_updates = 1;
37 | // Timeout after last ping
38 | float timeout_after_last_ping = 2;
39 | // Humidity configuration
40 | matrix_io.malos.v1.sense.HumidityParams humidity = 9;
41 | ```
42 | View the defined message here.
43 |
44 | `HumidityParams`
45 |
46 | * `current_temperature` - a reference of the current temperature for calibration.
47 |
48 | ```protobuf
49 | message HumidityParams{
50 | // Current temperature Celsius used for calibration.
51 | float current_temperature = 1;
52 | }
53 | ```
54 | View the defined message here.
55 |
56 |
57 |
58 | ???+ info "Keep-alive Port"
59 | This driver needs keep-alive messages in order to send data to your application. It's recommended to send an empty string `""` because the contents of a keep-alive message are never read.
60 |
61 |
62 | ???+ info "Error Port"
63 | Applications can subscribe to this port to receive driver related errors.
64 |
65 |
66 | ???+ info "Data Update Port"
67 | Applications can subscribe to this port for humidity data. The output will be a serialized message of type `Humidity` with the following information.
68 |
69 | ```protobuf
70 | message Humidity {
71 | // Humidity
72 | float humidity = 1;
73 |
74 | // Temperature
75 | float temperature = 2;
76 |
77 | // Raw temperature value from the sensor
78 | float temperature_raw = 3;
79 |
80 | // Flag that tells if the temperature is calibrated
81 | bool temperature_is_calibrated = 4;
82 | }
83 | ```
84 | View the defined message here.
--------------------------------------------------------------------------------
/docs/matrix-core/protocols/imu.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | ### Device Compatibility
4 |
5 |
6 | ## Overview
7 |
8 | The Pressure driver reports values for:
9 |
10 | * Pressure
11 | * Altitude
12 | * Temperature
13 |
14 | >Based on component location, the temperature values from the [Humidity driver](./humidity) are recommended over the Pressure driver
15 |
16 |
Available ZeroMQ Ports
17 | * `Base port`: 20025
18 | * `Keep-alive port`: 20026
19 | * `Error port`: 20027
20 | * `Data Update port`: 20028
21 |
22 |
23 | ## Protocol
24 |
25 |
26 | ???+ info "Base Port"
27 | This port accepts 2 configurations for communicating with the Pressure driver.
28 |
29 | * `delay_between_updates` - controls the output speed of messages from the **Data Update port**.
30 |
31 | * `timeout_after_last_ping` - stops sending messages from the **Data Update port** if nothing has been sent to the **Keep-alive port** after the specified amount of seconds.
32 |
33 | ```protobuf
34 | message DriverConfig {
35 | // Delay between updates in seconds
36 | float delay_between_updates = 1;
37 | // Timeout after last ping
38 | float timeout_after_last_ping = 2;
39 | ```
40 | View the defined message here.
41 |
42 |
43 | ???+ info "Keep-alive Port"
44 | This driver needs keep-alive messages in order to send data to your application. It's recommended to send an empty string `""` because the contents of a keep-alive message are never read.
45 |
46 |
47 | ???+ info "Error Port"
48 | Applications can subscribe to this port to receive driver related errors.
49 |
50 |
51 | ???+ info "Data Update Port"
52 | Applications can subscribe to this port for pressure data. The output will be a serialized message of type `Pressure` with the following information.
53 | ```protobuf
54 | message Pressure {
55 | // Pressure
56 | float pressure = 1;
57 |
58 | // Altimeter
59 | float altitude = 2;
60 |
61 | // Temperature
62 | float temperature = 3;
63 | }
64 | ```
65 | View the defined message here.
66 |
--------------------------------------------------------------------------------
/docs/matrix-core/protocols/servo.md:
--------------------------------------------------------------------------------
1 |
Servo
2 |
3 | ### Device Compatibility
4 |
5 |
6 |
7 | ## Overview
8 |
9 | The Servo driver can set the angle of your servos through the pins of your MATRIX device.
10 |
11 | **Device Pinouts**:
12 |
13 | * [MATRIX Creator](/matrix-creator/resources/pinout.md)
14 | * [MATRIX Voice](/matrix-voice/resources/pinout.md)
15 |
16 |
Available ZeroMQ Ports
17 | * `Base port`: 20045
18 | * `Error port`: 20047
19 |
20 | ## Protocol
21 |
22 |
23 | ???+ info "Base Port"
24 | This port accepts a single configuration for communicating with the Servo driver.
25 |
26 | * `servo` - the servo configuration that's created from a `ServoParams` message.
27 |
28 | ```protobuf
29 | message DriverConfig {
30 | // ServoMotor service configuration
31 | matrix_io.malos.v1.io.ServoParams servo = 7;
32 | }
33 | ```
34 | View the defined message here.
35 |
36 | `ServoParams`
37 |
38 | * `pin` - Selects the pin you want to use on your MATRIX device.
39 |
40 | * `angle` - emits a signal input that represents the angle set.
41 |
42 | ```protobuf
43 | // Servo handler params
44 | message ServoParams {
45 | // Pin to configure
46 | uint32 pin = 1;
47 |
48 | // Servo angle
49 | uint32 angle = 2;
50 | }
51 | ```
52 | View the defined message here.
53 |
54 |
55 | ???+ info "Error Port"
56 | Applications can subscribe to this port to receive driver related errors.
57 |
--------------------------------------------------------------------------------
/docs/matrix-core/protocols/uv.md:
--------------------------------------------------------------------------------
1 |
UV
2 |
3 | ### Device Compatibility
4 |
5 |
6 | ## Overview
7 |
8 | The UV driver reports values for:
9 |
10 | * UV Index scale used in the United States conforms with international guidelines for UVI reporting established by the World Health Organization. From UV Index Scale
11 | * UV Risk scale established by World Health Organization. From UV Index Scale
12 |
13 |
Available ZeroMQ Ports
14 | * `Base port`: 20029
15 | * `Keep-alive port`: 20030
16 | * `Error port`: 20031
17 | * `Data Update port`: 20032
18 |
19 | ## Protocol
20 |
21 | ???+ info "Base Port"
22 | This port accepts 2 configurations for communicating with the UV driver.
23 |
24 | * `delay_between_updates` - controls the output speed of messages from the **Data Update port**.
25 |
26 | * `timeout_after_last_ping` - stops sending messages from the **Data Update port** if nothing has been sent to the **Keep-alive port** after the specified amount of seconds.
27 |
28 | ```protobuf
29 | message DriverConfig {
30 | // Delay between updates in seconds
31 | float delay_between_updates = 1;
32 | // Timeout after last ping
33 | float timeout_after_last_ping = 2;
34 | ```
35 | View the defined message here.
36 |
37 |
38 | ???+ info "Keep-alive Port"
39 | This driver needs keep-alive messages in order to send data to your application. It's recommended to send an empty string `""` because the contents of a keep-alive message are never read.
40 |
41 |
42 | ???+ info "Error Port"
43 | Applications can subscribe to this port to receive driver related errors.
44 |
45 |
46 | ???+ info "Data Update Port"
47 | Applications can subscribe to this port for UV data. The output will be a serialized message of type `UV` with the following information.
48 | ```protobuf
49 | message UV{
50 | // UV index.
51 | float uv_index = 1;
52 |
53 | // Risk of harm from unprotected sun exposure, for the average adult.
54 | // According to the OMS table. https://www.epa.gov/sunsafety/uv-index-scale-0
55 | string oms_risk = 2;
56 | }
57 | ```
58 | View the defined message here.
--------------------------------------------------------------------------------
/docs/matrix-core/protocols/wakeword.md:
--------------------------------------------------------------------------------
1 |
Wakeword
2 |
3 | ### Device Compatibility
4 |
5 |
6 |
7 | ## Overview
8 |
9 | The Wakeword driver allows for:
10 |
11 | * Reading custom wakewords created with Sphinx Knowledge Base.
12 | * Notifications on which wakewords are heard.
13 |
14 |
Available ZeroMQ Ports
15 |
16 | * `Base port`: 60001
17 | * `Error port`: 60003
18 | * `Data update port`: 60004
19 |
20 | ## Installation
21 | In order to use MATRIX CORE wakeword, you must install the following on your MATRIX device.
22 |
23 | Install the **MATRIX Kernel** modules.
24 | ```bash
25 | sudo apt install matrixio-kernel-modules
26 | ```
27 | Install the **MATRIX CORE Wakeword Package**.
28 | ```bash
29 | sudo apt install matrixio-malos-wakeword
30 | ```
31 | Perform a **reboot** before moving on.
32 | ```bash
33 | sudo reboot
34 | ```
35 |
36 | ## Creating Custom Phrases
37 | To create custom phrases, you must upload a `.txt` file to Sphinx Knowledge Base.
38 |
39 | Below is an example text file that has each phrase separated by a line break. Once this is uploaded to the Sphinx Knowledge base, you will need to download the language model `.lm` and dictation `.dic` files for the Wakeword Driver.
40 |
41 | ```
42 | matrix start action
43 | matrix stop action
44 | matrix ring red
45 | matrix ring blue
46 | matrix ring green
47 | matrix ring clear
48 | ```
49 |
50 | ## Protocol
51 |
52 |
53 | ???+ info "Base Port"
54 | This port accepts a single configuration for communicating with the Wakeword driver.
55 |
56 | * `wakeword` - the wakeword configuration that's created from a `WakeWordParams` message.
57 |
58 | ```protobuf
59 | message DriverConfig {
60 | // Wakeword service configuration
61 | matrix_io.malos.v1.io.WakeWordParams wakeword = 12;
62 | }
63 | ```
64 | View the defined message here.
65 |
66 | `WakeWordParams`
67 |
68 | * `MicChannel` - Desired MATRIX device microphone to use.
69 |
70 | * `lm_path` - File path for language model. **Obtained from Sphinx Knowledge Base**.
71 |
72 | * `dic_path` - File path for dictation. **Obtained from Sphinx Knowledge Base**.
73 |
74 | * `enable_verbose` - Boolean to send output to stdout.
75 |
76 | * `stop_recognition` - Stop Pocket Sphinx service.
77 |
78 | ```protobuf
79 | message WakeWordParams {
80 | // Mic channels
81 | enum MicChannel {
82 | channel0 = 0;
83 | channel1 = 1;
84 | channel2 = 2;
85 | channel3 = 3;
86 | channel4 = 4;
87 | channel5 = 5;
88 | channel6 = 6;
89 | channel7 = 7;
90 | channel8 = 8;
91 | }
92 | // Desired mic channel
93 | MicChannel channel = 2;
94 |
95 | // http://www.speech.cs.cmu.edu/tools/lmtool-new.html
96 | // Language model path
97 | string lm_path = 3;
98 | // Dictation path
99 | string dic_path = 4;
100 |
101 | // enable pocketsphinx verbose mode
102 | bool enable_verbose = 5;
103 |
104 | // stop recognition service
105 | bool stop_recognition = 6;
106 | }
107 | ```
108 | View the defined message here.
109 |
110 |
111 | ???+ info "Keep-alive Port"
112 | This driver needs keep-alive messages in order to send data to your application. It's recommended to send an empty string `""` because the contents of a keep-alive message are never read.
113 |
114 |
115 | ???+ info "Error Port"
116 | Applications can subscribe to this port to receive driver related errors.
117 |
118 |
119 | ???+ info "Data Update Port"
120 | Applications can subscribe to this port for Everloop data. The output will be a serialized message of type `EverloopImage` with the following information.
121 |
122 | ```protobuf
123 | // The led array.
124 | message WakeWordParams {
125 | // Wake Word
126 | string wake_word = 1;
127 | }
128 | ```
129 | View the defined message here.
--------------------------------------------------------------------------------
/docs/matrix-core/python-examples/index.md:
--------------------------------------------------------------------------------
1 | ## Python Examples
2 |
3 |
4 | ### Device Compatibility
5 |
6 |
7 |
8 | ## Overview
9 |
10 | The Servo driver can set the angle of your servos through the pins of your MATRIX device.
11 |
12 | **Device Pinouts**:
13 |
14 | * [MATRIX Creator](/matrix-creator/resources/pinout.md)
15 | * [MATRIX Voice](/matrix-voice/resources/pinout.md)
16 |
17 |
Available ZeroMQ Ports
18 | * `Base port`: 20045
19 | * `Error port`: 20047
20 |
21 | ## Code Example
22 | The following sections show how to implement a connection to each of the Servo driver's ports. You can download this example here.
23 |
24 |
25 | ???+ info "Initial Variables"
26 | Before we go into connecting to each port, the variables defined below are needed in order to access the ZeroMQ and MATRIX Protocol Buffer libraries for Python. We also define a few helpful variables for easy references.
27 | ```python
28 | import os # Miscellaneous operating system interface
29 | import zmq # Asynchronous messaging framework
30 | import time # Time access and conversions
31 | import sys # System-specific parameters and functions
32 | import random # Generate pseudo-random numbers
33 | from matrix_io.proto.malos.v1 import driver_pb2 # MATRIX Protocol Buffer driver library
34 | from multiprocessing import Process # Allow for multiple processes at once
35 | from zmq.eventloop import ioloop # Asynchronous events through ZMQ
36 | matrix_ip = '127.0.0.1' # Local device ip
37 | servo_port = 20045 # Driver Base port
38 | # Handy function for connecting to the Error port
39 | from utils import register_error_callback
40 | ```
41 |
42 |
43 | ???+ info "Base Port"
44 | Here is where the configuration for our servo example goes. Once we connect to the **Base Port**, we will pass a configuration to the servo driver. With this we can choose the pin we want to edit and the angle to set for it. This example will send random numbers to any servo attached to pin 0. This example has a `moveServo()` function that calls itself to send random angles to your servo.
45 |
46 | ```python
47 | def send_servo_command(pin):
48 | # Define zmq socket
49 | context = zmq.Context()
50 | # Create a Pusher socket
51 | socket = context.socket(zmq.PUSH)
52 | # Connect Pusher to configuration socket
53 | socket.connect('tcp://{0}:{1}'.format(matrix_ip, servo_port))
54 |
55 | # Create a new driver config
56 | servo_config = driver_pb2.DriverConfig()
57 | # Set a pin that the servo will operate on
58 | servo_config.servo.pin = pin
59 |
60 | # Function to change servo angle
61 | def moveServo(angle):
62 | # Log angle
63 | print('Angle: {0}'.format(angle))
64 | # Set the servo's angle in the config
65 | servo_config.servo.angle = angle
66 | # Serialize the config and send it to the driver
67 | socket.send(servo_config.SerializeToString())
68 | # Wait for 1 second
69 | time.sleep(1)
70 | # Run function again with random angle
71 | moveServo(random.randint(0, 180))
72 |
73 | # Initial moveServo call
74 | moveServo(180)
75 | ```
76 |
77 |
78 | ???+ info "Error Port"
79 | The **Error Port** connection is taken care of by the `utils import`. Below we define a function to be called and given any error messages that occur within MATRIX CORE.
80 | ```python
81 | def servo_error_callback(error):
82 | # Log error
83 | print('{0}'.format(error))
84 | ```
85 |
86 |
87 | ???+ info "Start Processes"
88 | This is where we begin the asynchronous events for each of the driver ports used and where we define the functions we want to use for each port.
89 |
90 | ```python
91 | if __name__ == '__main__':
92 | # Initiate asynchronous events
93 | ioloop.install()
94 | # Start Error Port connection
95 | Process(target=register_error_callback, args=(servo_error_callback, matrix_ip, servo_port)).start()
96 | # Send Base Port configuration
97 | try:
98 | send_servo_command(0)
99 | # Avoid logging servo angle errors on user quiting
100 | except KeyboardInterrupt:
101 | print(' quit')
102 | ```
--------------------------------------------------------------------------------
/docs/matrix-core/troubleshooting.md:
--------------------------------------------------------------------------------
1 | ## Community
2 | Please visit our community support forums at
3 | community.matrix.one
4 |
5 | ## Check Active MATRIX CORE Services
6 |
7 | Run the following command on your Raspberry Pi's terminal to see the MATRIX Services currently running.
8 | ```bash
9 | ps aux | grep 'malos'
10 | ```
11 |
12 | ## Reinstall MATRIX CORE
13 |
14 | If you experience strange behavior, reinstall MATRIX CORE.
15 |
16 | Uninstall the `matrixio-malos` package.
17 |
18 | ```bash
19 | sudo apt-get --purge remove matrixio-malos
20 | ```
21 |
22 | Reboot your device.
23 |
24 | ```bash
25 | sudo reboot
26 | ```
27 |
28 | Install MATRIX CORE [here](/matrix-core/getting-started/core-installation).
29 |
30 |
39 |
40 |
--------------------------------------------------------------------------------
/docs/matrix-creator/device-setup.md:
--------------------------------------------------------------------------------
1 | ## Hardware Prerequisites
2 | * MATRIX Creator
3 | * Compatible Raspberry Pi:
4 | * 4 Model B
5 | * 3 Model B+
6 | * 3 Model B
7 | * 3 Model A+
8 | * 2 Model B
9 | * 1 Model B+
10 | * Zero
11 | * Zero W
12 | * 5V 2.5A Micro USB Power Supply
13 | * MicroSD Card with the latest version of Raspbian installed
14 | * We recommend using Etcher.io for easy flashing
15 |
16 | ## Device Installation
17 | 
18 |
Steps
19 |
20 | 1. Insert flashed microSD card into Raspberry Pi
21 | 2. Attach MATRIX Creator onto Raspberry Pi GPIO pins
22 | 3. Power Raspberry Pi with micro USB power supply
23 |
24 | ## Choosing A Programming Environment
25 | After your MATRIX Creator is setup, visit [Ecosystem Overview](/#programming-layers) for information about the three programming environments available to you in the MATRIX platform.
--------------------------------------------------------------------------------
/docs/matrix-creator/img/3d-model-bottom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-creator/img/3d-model-bottom.png
--------------------------------------------------------------------------------
/docs/matrix-creator/img/3d-model-top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-creator/img/3d-model-top.png
--------------------------------------------------------------------------------
/docs/matrix-creator/img/MATRIX Creator PF Back.png.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-creator/img/MATRIX Creator PF Back.png.png
--------------------------------------------------------------------------------
/docs/matrix-creator/img/creator-printed-case.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-creator/img/creator-printed-case.jpg
--------------------------------------------------------------------------------
/docs/matrix-creator/img/ir-locations.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-creator/img/ir-locations.png
--------------------------------------------------------------------------------
/docs/matrix-creator/img/m-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-creator/img/m-1.png
--------------------------------------------------------------------------------
/docs/matrix-creator/img/m-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-creator/img/m-2.png
--------------------------------------------------------------------------------
/docs/matrix-creator/img/m-3.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-creator/img/m-3.gif
--------------------------------------------------------------------------------
/docs/matrix-creator/img/m-6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-creator/img/m-6.png
--------------------------------------------------------------------------------
/docs/matrix-creator/img/m-7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-creator/img/m-7.png
--------------------------------------------------------------------------------
/docs/matrix-creator/img/m-8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-creator/img/m-8.png
--------------------------------------------------------------------------------
/docs/matrix-creator/img/matrix-creator-system-architecture.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-creator/img/matrix-creator-system-architecture.png
--------------------------------------------------------------------------------
/docs/matrix-creator/img/matrix-voice-diagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-creator/img/matrix-voice-diagram.png
--------------------------------------------------------------------------------
/docs/matrix-creator/img/mcu_d48_led.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-creator/img/mcu_d48_led.jpg
--------------------------------------------------------------------------------
/docs/matrix-creator/img/mcu_led_modify.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-creator/img/mcu_led_modify.png
--------------------------------------------------------------------------------
/docs/matrix-creator/img/mic_creator_position.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-creator/img/mic_creator_position.png
--------------------------------------------------------------------------------
/docs/matrix-creator/img/voice_arch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-creator/img/voice_arch.png
--------------------------------------------------------------------------------
/docs/matrix-creator/overview.md:
--------------------------------------------------------------------------------
1 | ## MATRIX Creator
2 |
3 | 
4 |
5 | The MATRIX Creator is a fully-featured development board, including sensors, wireless communications, and an FPGA. MATRIX Creator was built with a mission to give every maker, tinkerer, and developer around the world a complete, affordable, and user-friendly tool for simple to complex Internet of Things (IoT) app creation.
6 |
7 | ## Overview
8 |
15 | Look at common debugging solutions and test the hardware on your MATRIX Creator
--------------------------------------------------------------------------------
/docs/matrix-creator/resources/ir.md:
--------------------------------------------------------------------------------
1 | ## IR on MATRIX Creator
2 | 
3 |
4 |
5 | ## Overview
6 | There are two IR transmitters and one IR receiver on the MATRIX Creator. Both components are wired to the [Pi's GPIO pins](pinout/#raspberry-pi-gpio) for you to directly call.
7 |
8 | !!! info "IR Transmitters"
9 | **Raspberry Pi** `GPIO BCM Pin: 13`
10 | Both transmitters are located on the front & back of the MATRIX Creator. They are both connected to the same pin.
11 |
12 | !!! info "IR Receiver"
13 | **Raspberry Pi** `GPIO BCM Pin: 16`
14 | The receiver is located on the front of the MATRIX Creator.
15 |
16 | ## Usage
17 | The IR components on the MATRIX Creator should work the same as if they were directly placed on a Raspberry Pi. This means that libraries which utilize IR components can work with the MATRIX Creator. Below are a few we've seen work.
18 |
19 | !!! example "pigpio"
20 | The
21 | pigpio library
22 | has an example that can record and send IR signals you want to record. However, the implementation will cause issues with using audio recording/playback.
23 |
24 | Example Repositories:
25 |
26 | - IR Test: Simple record & playback of an IR signal.
27 | - TV Remote Website: Website that can command the MATRIX Creator to send IR signals.
28 |
29 | !!! example "LIRC"
30 | The
31 | LIRC Package
32 | allows for receiving and sending IR signals with common IR remotes. Unlike pigpio, this package seems to play well with audio recording/playback.
33 |
34 | !!! bug "Kernel 4.19 workaround"
35 | To utilize LIRC on the latest Kernel modules for Raspbian Stretch, A patch needs to be applied for the package.
36 | These community contributed instructions
37 | can help solve this issue.
38 |
--------------------------------------------------------------------------------
/docs/matrix-creator/resources/microphone.md:
--------------------------------------------------------------------------------
1 | ## Microphone Array on MATRIX Creator
2 | 
3 |
4 | ## Usage
5 |
Driver installation
6 | Follow the instructions below for allowing your MATRIX Creator to register as a microphone for your Raspberry Pi.
7 | ```bash
8 | curl https://apt.matrix.one/doc/apt-key.gpg | sudo apt-key add -
9 | echo "deb https://apt.matrix.one/raspbian $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/matrixlabs.list
10 | sudo apt-get update
11 | sudo apt-get upgrade
12 | ```
13 | A reboot will be required after following the steps above.
14 | ```bash
15 | sudo reboot
16 | ```
17 | The next commands will install the MATRIX kernel modules, overriding the stock Raspbian kernel.
18 | ```bash
19 | sudo apt install matrixio-kernel-modules
20 | ```
21 | A second reboot will be required.
22 | ```bash
23 | sudo reboot
24 | ```
25 |
Check If Everything Works
26 | Your Raspberry Pi should now treat your MATRIX Creator as a regular microphone. You can test this by using the following commands to record and play a 5 second long audio file on your Raspberry Pi.
27 | > Be sure to have something connected to the Raspberry Pi's audio output.
28 | ```bash
29 | arecord recording.wav -f S16_LE -r 16000 -d 5
30 | aplay recording.wav
31 | ```
32 |
33 |
ALSA Configuration
34 | The microphones can be grabbed using ALSA. Multiple libraries that support ALSA use these configurations to read microphone data with ALSA.
35 |
36 | Device name - `hw:2,0`
37 |
38 | Rates(Hz) - `8000` `12000` `16000` `22050` `24000` `32000` `44100` `48000`
39 |
40 | Channels for each microphone - `1` `2` `3` `4` `5` `6` `7` `8`
41 |
42 | ## Audio Specifications
43 |
44 | **Sample Rate:** 8 to 96 kHz
45 |
46 | **Bit Depth:** Signed 16 bit
47 |
48 |
3 |
4 | ### Device Compatibility
5 |
6 |
7 | ## Overview
8 |
9 | The humidity sensor reports values for:
10 |
11 | * Humidity
12 | * Temperature
13 |
14 | ## Code Example
15 |
16 | Below is an example of how to interface with the humidity sensor in MATRIX HAL.
17 |
18 | Humidity sensor function references can be found [here](/matrix-hal/reference/humidity).
19 |
20 | The following section shows how to receive data from the humidity sensor. You can download this example here.
21 |
22 | The command below will compile the example. Be sure to pass in your C++ file and desired output file.
23 |
24 | ```c++
25 | g++ -o YOUR_OUTPUT_FILE YOUR_CPP_FILE -std=c++11 -lmatrix_creator_hal
26 | ```
27 |
28 | ???+ summary "Include Statements"
29 | To begin working with the humidity sensor you need to include these header files.
30 |
31 | ```c++
32 | // System calls
33 | #include
34 | // Input/output streams and functions
35 | #include
36 |
37 | // Interfaces with humidity sensor
38 | #include "matrix_hal/humidity_sensor.h"
39 | // Holds data from humidity sensor
40 | #include "matrix_hal/humidity_data.h"
41 | // Communicates with MATRIX device
42 | #include "matrix_hal/matrixio_bus.h"
43 | ```
44 |
45 | ???+ summary "Initial Setup"
46 | You'll then need to setup `MatrixIOBus` in order to communicate with the hardware on your MATRIX device.
47 |
48 | ```c++
49 | int main() {
50 | // Create MatrixIOBus object for hardware communication
51 | matrix_hal::MatrixIOBus bus;
52 | // Initialize bus and exit program if error occurs
53 | if (!bus.Init()) return false;
54 | ```
55 |
56 | ???+ summary "Main Setup"
57 | Now we will create our `HumidityData` and `HumiditySensor` object and use it to receive data from the humidity sensor.
58 |
59 | ```c++
60 | // The following code is part of main()
61 |
62 | // Create HumidityData object
63 | matrix_hal::HumidityData humidity_data;
64 | // Create HumiditySensor object
65 | matrix_hal::HumiditySensor humidity_sensor;
66 | // Set humidity_sensor to use MatrixIOBus bus
67 | humidity_sensor.Setup(&bus);
68 |
69 | // Endless loop
70 | while (true) {
71 | // Overwrites humidity_data with new data from humidity sensor
72 | humidity_sensor.Read(&humidity_data);
73 | // Humidity output is represented in %
74 | float humidity = humidity_data.humidity;
75 | // Temperature output is represented in Celsius
76 | float temperature = humidity_data.temperature;
77 | // Clear console
78 | std::system("clear");
79 | // Output sensor data to console
80 | std::cout << " [ Humidity Sensor Output ]" << std::endl;
81 | std::cout << " [ Humidity (%) : " << humidity
82 | << " ] [ Temperature (Celsius) : " << temperature << "]" << std::endl;
83 |
84 | // Sleep for 20000 microseconds
85 | usleep(20000);
86 | }
87 |
88 | return 0;
89 | }
90 | ```
--------------------------------------------------------------------------------
/docs/matrix-hal/examples/imu.md:
--------------------------------------------------------------------------------
1 |
Inertial Measurement Unit (IMU)
2 |
HAL Example
3 |
4 | ### Device Compatibility
5 |
6 |
7 | ## Overview
8 |
9 | The IMU sensor reports values for:
10 |
11 | * Yaw, Pitch, and Roll
12 | * Acceleration for **x**, **y**, **z** axes
13 | * Gyroscope for **x**, **y**, **z** axes
14 | * Magnetometer for **x**, **y**, **z** axes
15 |
16 | ## Code Example
17 |
18 | Below is an example of how to interface with the IMU sensor in MATRIX HAL.
19 |
20 | IMU sensor function references can be found [here](/matrix-hal/reference/imu).
21 |
22 | The following section shows how to receive data from the IMU sensor. You can download this example here.
23 |
24 | The command below will compile the example. Be sure to pass in your C++ file and desired output file.
25 |
26 | ```c++
27 | g++ -o YOUR_OUTPUT_FILE YOUR_CPP_FILE -std=c++11 -lmatrix_creator_hal
28 | ```
29 |
30 | ???+ summary "Include Statements"
31 | To begin working with the IMU sensor you need to include these header files.
32 |
33 | ```c++
34 | // System calls
35 | #include
36 | // Input/output streams and functions
37 | #include
38 |
39 | // Interfaces with IMU sensor
40 | #include "matrix_hal/imu_sensor.h"
41 | // Holds data from IMU sensor
42 | #include "matrix_hal/imu_data.h"
43 | // Communicates with MATRIX device
44 | #include "matrix_hal/matrixio_bus.h"
45 | ```
46 |
47 | ???+ summary "Initial Setup"
48 | You'll then need to setup `MatrixIOBus` in order to communicate with the hardware on your MATRIX device.
49 |
50 | ```c++
51 | int main() {
52 | // Create MatrixIOBus object for hardware communication
53 | matrix_hal::MatrixIOBus bus;
54 | // Initialize bus and exit program if error occurs
55 | if (!bus.Init()) return false;
56 | ```
57 |
58 | ???+ summary "Main Setup"
59 | Now we will create our `IMUData` and `IMUSensor` object and use it to receive data from the IMU sensor.
60 |
61 | ```c++
62 | // The following code is part of main()
63 |
64 | // Create IMUData object
65 | matrix_hal::IMUData imu_data;
66 | // Create IMUSensor object
67 | matrix_hal::IMUSensor imu_sensor;
68 | // Set imu_sensor to use MatrixIOBus bus
69 | imu_sensor.Setup(&bus);
70 |
71 | // Endless loop
72 | while (true) {
73 | // Overwrites imu_data with new data from IMU sensor
74 | imu_sensor.Read(&imu_data);
75 | // Accelerometer Output
76 | float accel_X = imu_data.accel_x;
77 | float accel_Y = imu_data.accel_y;
78 | float accel_Z = imu_data.accel_z;
79 | // Gyroscope Output
80 | float gyro_X = imu_data.gyro_x;
81 | float gyro_Y = imu_data.gyro_y;
82 | float gyro_Z = imu_data.gyro_z;
83 | // Yaw, Pitch, Roll Output
84 | float yaw = imu_data.yaw;
85 | float pitch = imu_data.pitch;
86 | float roll = imu_data.roll;
87 | // Magnetometer Output
88 | float mag_X = imu_data.mag_x;
89 | float mag_Y = imu_data.mag_y;
90 | float mag_Z = imu_data.mag_z; // Z-axis points upward
91 | // Clear console
92 | std::system("clear");
93 | // Output sensor data to console
94 | std::cout << " [ IMU Sensor Output ]" << std::endl;
95 | std::cout << " [ Acceleration In X : " << accel_X
96 | << " ] [ Acceleration In Y : " << accel_Y
97 | << " ] [ Acceleration In Z : " << accel_Z << " ]" << std::endl;
98 | std::cout << " [ Gyroscope In X : " << gyro_X
99 | << " ] [ Gyroscope In Y : " << gyro_X
100 | << " ] [ Gyroscope In Z : " << gyro_Z << " ]" << std::endl;
101 | std::cout << " [ Yaw : " << yaw << " ] [ Pitch : " << pitch
102 | << " ] [ Roll : " << roll << " ]" << std::endl;
103 | std::cout << " [ Magnetometer in X : " << mag_X
104 | << " ] [ Magnetometer in Y : " << mag_Y
105 | << " ] [ Magnetometer in Z : " << mag_Z << " ]" << std::endl;
106 |
107 | // Sleep for 20000 microseconds
108 | usleep(20000);
109 | }
110 |
111 | return 0;
112 | }
113 | ```
--------------------------------------------------------------------------------
/docs/matrix-hal/examples/index.md:
--------------------------------------------------------------------------------
1 | ## MATRIX HAL Examples
2 |
3 | ### Download Examples
4 |
5 | The following commands download and compile all the examples.
6 |
7 | ```bash
8 | sudo apt-get install cmake g++ git
9 | ```
10 |
11 | Download, build, and run the examples.
12 | ```bash
13 | cd ~/
14 | git clone https://github.com/matrix-io/matrix-hal-examples.git
15 | cd matrix-hal-examples
16 | mkdir build
17 | cd build
18 | cmake ..
19 | make -j4
20 | ```
21 |
22 |
44 | Near field communication.
45 |
46 | > The NFC Examples are not part of the main HAL Repository, they can be found [here](https://github.com/matrix-io/matrix-hal-nfc/tree/master/examples).
47 |
48 |
--------------------------------------------------------------------------------
/docs/matrix-hal/examples/pressure.md:
--------------------------------------------------------------------------------
1 |
Pressure
2 |
HAL Example
3 |
4 | ### Device Compatibility
5 |
6 |
7 | ## Overview
8 |
9 | The pressure sensor reports values for:
10 |
11 | * Pressure
12 | * Altitude
13 | * Temperature
14 |
15 | ## Code Example
16 |
17 | Below is an example of how to interface with the pressure sensor in MATRIX HAL.
18 |
19 | Pressure sensor function references can be found [here](/matrix-hal/reference/pressure).
20 |
21 | The following section shows how to receive data from the pressure sensor. You can download this example here.
22 |
23 | The command below will compile the example. Be sure to pass in your C++ file and desired output file.
24 |
25 | ```c++
26 | g++ -o YOUR_OUTPUT_FILE YOUR_CPP_FILE -std=c++11 -lmatrix_creator_hal
27 | ```
28 |
29 | ???+ summary "Include Statements"
30 | To begin working with the pressure sensor you need to include these header files.
31 |
32 | ```c++
33 | // System calls
34 | #include
35 | // Input/output streams and functions
36 | #include
37 |
38 | // Interfaces with pressure sensor
39 | #include "matrix_hal/pressure_sensor.h"
40 | // Holds data from pressure sensor
41 | #include "matrix_hal/pressure_data.h"
42 | // Communicates with MATRIX device
43 | #include "matrix_hal/matrixio_bus.h"
44 | ```
45 |
46 | ???+ summary "Initial Setup"
47 | You'll then need to setup `MatrixIOBus` in order to communicate with the hardware on your MATRIX device.
48 |
49 | ```c++
50 | int main() {
51 | // Create MatrixIOBus object for hardware communication
52 | matrix_hal::MatrixIOBus bus;
53 | // Initialize bus and exit program if error occurs
54 | if (!bus.Init()) return false;
55 | ```
56 |
57 | ???+ summary "Main Setup"
58 | Now we will create our `PressureData` and `PressureSensor` object and use it to receive data from the pressure sensor.
59 |
60 | ```c++
61 | // The following code is part of main()
62 |
63 | // Create PressureData object
64 | matrix_hal::PressureData pressure_data;
65 | // Create PressureSensor object
66 | matrix_hal::PressureSensor pressure_sensor;
67 | // Set pressure_sensor to use MatrixIOBus bus
68 | pressure_sensor.Setup(&bus);
69 |
70 | // Endless loop
71 | while (true) {
72 | // Overwrites pressure_data with new data from pressure sensor
73 | pressure_sensor.Read(&pressure_data);
74 | // Altitude output is represented in meters
75 | float altitude = pressure_data.altitude;
76 | // Pressure output is represented in Pa
77 | float pressure = pressure_data.pressure;
78 | // Temperature output is represented in Celsius
79 | float temperature = pressure_data.temperature;
80 | // Clear console
81 | std::system("clear");
82 | // Output sensor data to console
83 | std::cout << " [ Pressure Sensor Output ]" << std::endl;
84 | std::cout << " [ Altitude (m) : " << altitude
85 | << " ] [ Pressure (Pa) : " << pressure
86 | << " ] [ Temperature (Celsius) : " << temperature << " ]" << std::endl;
87 |
88 | // Sleep for 20000 microseconds
89 | usleep(20000);
90 | }
91 |
92 | return 0;
93 | }
94 | ```
--------------------------------------------------------------------------------
/docs/matrix-hal/examples/uv.md:
--------------------------------------------------------------------------------
1 |
UV
2 |
HAL Example
3 |
4 | ### Device Compatibility
5 |
6 |
7 | ## Overview
8 |
9 | The UV sensor reports values for:
10 |
11 | * UV Index scale used in the United States, conforms with international guidelines for UVI reporting established by the World Health Organization. From UV Index Scale
12 |
13 | ## Code Example
14 |
15 | Below is an example of how to interface with the UV sensor in MATRIX HAL.
16 |
17 | UV sensor function references can be found [here](/matrix-hal/reference/uv).
18 |
19 | The following section shows how to receive data from the UV sensor. You can download this example here.
20 |
21 | The command below will compile the example. Be sure to pass in your C++ file and desired output file.
22 |
23 | ```c++
24 | g++ -o YOUR_OUTPUT_FILE YOUR_CPP_FILE -std=c++11 -lmatrix_creator_hal
25 | ```
26 |
27 | ???+ summary "Include Statements"
28 | To begin working with the UV sensor you need to include these header files.
29 |
30 | ```c++
31 | // System calls
32 | #include
33 | // Input/output streams and functions
34 | #include
35 |
36 | // Interfaces with UV sensor
37 | #include "matrix_hal/uv_sensor.h"
38 | // Holds data from UV sensor
39 | #include "matrix_hal/uv_data.h"
40 | // Communicates with MATRIX device
41 | #include "matrix_hal/matrixio_bus.h"
42 | ```
43 |
44 | ???+ summary "Initial Setup"
45 | You'll then need to setup `MatrixIOBus` in order to communicate with the hardware on your MATRIX device.
46 |
47 | ```c++
48 | int main() {
49 | // Create MatrixIOBus object for hardware communication
50 | matrix_hal::MatrixIOBus bus;
51 | // Initialize bus and exit program if error occurs
52 | if (!bus.Init()) return false;
53 | ```
54 |
55 | ???+ summary "Main Setup"
56 | Now we will create our `UVData` and `UVSensor` object and use it to receive data from the UV sensor.
57 |
58 | ```c++
59 | // The following code is part of main()
60 |
61 | // Create UVData object
62 | matrix_hal::UVData uv_data;
63 | // Create UVSensor object
64 | matrix_hal::UVSensor uv_sensor;
65 | // Set uv_sensor to use MatrixIOBus bus
66 | uv_sensor.Setup(&bus);
67 |
68 | // Endless loop
69 | while (true) {
70 | // Overwrites UVData object with new data
71 | uv_sensor.Read(&uv_data);
72 | // UV output is represented in UV Index
73 | float UV = uv_data.uv;
74 | // Clear console
75 | std::system("clear");
76 | // Output sensor data to console
77 | std::cout << " [ UV Sensor Output ]" << std::endl;
78 | std::cout << " [ UV : " << UV << " ]" << std::endl;
79 |
80 | // Sleep for 20000 microseconds
81 | usleep(20000);
82 | }
83 |
84 | return 0;
85 | }
86 | ```
--------------------------------------------------------------------------------
/docs/matrix-hal/getting-started/index.md:
--------------------------------------------------------------------------------
1 | ## Getting Started
2 |
3 |
4 |
5 | > We recommend beginners install MATRIX HAL from package.
6 |
7 |
21 | Learn how to install MATRIX HAL NFC from source and compile NFC enabled programs.
22 |
23 |
--------------------------------------------------------------------------------
/docs/matrix-hal/getting-started/installation-nfc.md:
--------------------------------------------------------------------------------
1 | ## Installing MATRIX HAL NFC
2 |
3 | ### Device Compatibility
4 |
5 |
6 | > Make sure you have installed [MATRIX HAL](/matrix-hal/getting-started/) before continuing.
7 |
8 | ### Downloading the NXP Library
9 |
10 | > Due to NXP's terms & conditions, we cannot directly distribute the library to our users.
11 |
12 | You can download the **NFC Reader Library for PN512** by creating an account on the NXP website and downloading the zip file **here**.
13 |
14 | Click the download button.
15 |
16 | 
17 |
18 | Click the `4.04.05 NFC Reader Library for PN512`.
19 |
20 | 
21 |
22 | Then click `SW297940.zip` to download `NFC Reader Library v4.040.05 R2 for PNEV512B including all software examples`.
23 |
24 | 
25 |
26 | ### Compiling and Installing MATRIX HAL NFC
27 |
28 | Before starting, ensure you have access to the terminal of your Raspberry Pi via an SSH-session or connect a screen, mouse, and keyboard. Once you've opened the terminal, insert and run the following commands.
29 |
30 | Install the tools needed to build MATRIX HAL NFC
31 |
32 | ```bash
33 | sudo apt-get install cmake g++ git
34 | ```
35 |
36 | Clone the MATRIX HAL NFC repository.
37 |
38 | ```bash
39 | git clone https://github.com/matrix-io/matrix-hal-nfc.git
40 | cd matrix-hal-nfc
41 | ```
42 |
43 | Now move the `SW297940.zip` file you downloaded into the `matrix-hal-nfc` folder. If you don't know how to transfer files into your Raspberry Pi, follow this [simple guide on using an FTP client](https://www.techmuzz.com/how-to/raspberrypi/transfer-files-raspberry-pi-computer/).
44 |
45 | Once complete, you can install the NXP library into `/usr/local/include/matrix_nfc/nxp_nfc` with the following command. Please ensure that you have have placed `SW297940.zip` inside `matrix-hal-nfc`.
46 |
47 | ```bash
48 | ./install_nxp.sh
49 | ```
50 |
51 | Now build and install MATRIX HAL NFC with the following command.
52 |
53 | ```bash
54 | ./build.sh
55 | ```
56 |
57 | ## NFC Examples & Compile Instructions
58 |
59 | After building is complete, a few compiled examples will be in the `build/examples` folder.
60 |
61 | You can compile your own programs with the following command.
62 | ```bash
63 | g++ -o YOUR_OUTPUT YOUR_INPUT -std=c++11 -DNXPBUILD__PH_RASPBERRY_PI -I/usr/local/include/matrix_nfc/nxp_nfc/NxpNfcRdLib/types -I/usr/local/include/matrix_nfc/nxp_nfc/NxpNfcRdLib/intfs -lmatrix_hal_nfc -lmatrix_creator_hal
64 | ```
65 |
66 | ## Helpful Information
67 |
68 | MATRIX HAL NFC header files are installed in `/usr/local/include/matrix_nfc`.
69 |
70 | The compiled MATRIX HAL NFC library file is installed in `/usr/local/lib/libmatrix_hal_nfc.so`.
71 |
72 | ## Next Steps
73 |
74 | Now that MATRIX HAL NFC is properly installed, you can find examples [here](../examples/nfc) and references [here](../reference/nfc).
75 |
--------------------------------------------------------------------------------
/docs/matrix-hal/getting-started/installation-package.md:
--------------------------------------------------------------------------------
1 | ## Installing MATRIX HAL From Package
2 |
3 | > Make sure you have setup your
4 | > [MATRIX Creator](/matrix-creator/device-setup) or
5 | > [MATRIX Voice](/matrix-voice/device-setup) before continuing.
6 |
7 | Before starting, ensure you have access to the terminal of your Raspberry Pi via an SSH-session or connect a screen, mouse, and keyboard. Once you've opened the terminal, insert and run the following commands.
8 |
9 | Add the MATRIX repository and key.
10 |
11 | ```bash
12 | curl https://apt.matrix.one/doc/apt-key.gpg | sudo apt-key add -
13 | echo "deb https://apt.matrix.one/raspbian $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/matrixlabs.list
14 | ```
15 |
16 | Update your repository and packages.
17 |
18 | ```bash
19 | sudo apt-get update
20 | sudo apt-get upgrade
21 | ```
22 |
23 | Install the the MATRIX HAL packages.
24 |
25 | ```bash
26 | sudo apt-get install matrixio-creator-init libmatrixio-creator-hal libmatrixio-creator-hal-dev
27 | ```
28 |
29 | Reboot your device.
30 |
31 | ```bash
32 | sudo reboot
33 | ```
34 |
35 | ## Helpful Information
36 |
37 | MATRIX HAL header files are installed in `/usr/include/matrix_hal`.
38 |
39 | The compiled MATRIX HAL library file is installed in `/usr/lib/libmatrix_creator_hal.so`.
40 |
41 | ## Next Steps
42 |
43 | Now that MATRIX HAL is properly installed, learn how to create and compile your own MATRIX programs [here](programs).
--------------------------------------------------------------------------------
/docs/matrix-hal/getting-started/installation-source.md:
--------------------------------------------------------------------------------
1 | ## Installing MATRIX HAL From Source
2 |
3 | > Make sure you have setup your
4 | > [MATRIX Creator](/matrix-creator/device-setup) or
5 | > [MATRIX Voice](/matrix-voice/device-setup) before continuing.
6 |
7 | Before starting, ensure you have access to the terminal of your Raspberry Pi via an SSH-session or connect a screen, mouse, and keyboard. Once you've opened the terminal, insert and run the following commands.
8 |
9 | Add the MATRIX repository and key.
10 |
11 | ```bash
12 | curl https://apt.matrix.one/doc/apt-key.gpg | sudo apt-key add -
13 | echo "deb https://apt.matrix.one/raspbian $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/matrixlabs.list
14 | ```
15 |
16 | Update your repository and packages.
17 |
18 | ```bash
19 | sudo apt-get update
20 | sudo apt-get upgrade
21 | ```
22 |
23 | Install the MATRIX init package and tools needed to build MATRIX HAL.
24 |
25 | ```bash
26 | sudo apt-get install cmake g++ git libfftw3-dev wiringpi libgflags-dev matrixio-creator-init
27 | ```
28 |
29 | Clone, build, and install MATRIX HAL.
30 |
31 | ```bash
32 | cd ~/
33 | git clone https://github.com/matrix-io/matrix-creator-hal.git
34 | cd matrix-creator-hal
35 | mkdir build
36 | cd build
37 | cmake ..
38 | make -j4 && sudo make install
39 | ```
40 |
41 | Reboot your device.
42 |
43 | ```bash
44 | sudo reboot
45 | ```
46 |
47 | ## Helpful Information
48 |
49 | MATRIX HAL header files are installed in `/usr/local/include/matrix_hal`.
50 |
51 | The compiled MATRIX HAL library file is installed in `/usr/local/lib/libmatrix_creator_hal.so`.
52 |
53 | ## Next Steps
54 |
55 | Now that MATRIX HAL is properly installed, learn how to create and compile your own MATRIX programs [here](programs).
56 |
--------------------------------------------------------------------------------
/docs/matrix-hal/getting-started/programs.md:
--------------------------------------------------------------------------------
1 |
Introduction
2 |
3 | Programs created with MATRIX HAL allow you to directly access sensors and components on the MATRIX device through C++. This guide will show you how to create and run an LED demo in MATRIX HAL. The final result being a rainbow LED sequence.
4 |
5 | ## Creating A Program
6 |
7 |
Making Your Project Directory
8 | Use the following commands to create a folder to hold your MATRIX HAL projects, in the home directory `~/` of your MATRIX device.
9 | ```bash
10 | cd ~/
11 | mkdir matrix-hal-project
12 | cd matrix-hal-project
13 | ```
14 |
15 | Create a file called `app.cpp` in your project folder, and paste the code below.
16 |
17 | The following code turns the Everloop rainbow for 10 seconds.
18 |
19 | ```c++
20 | /*
21 | * Everloop rainbow example
22 | */
23 |
24 | /////////////////////////
25 | // INCLUDE STATEMENTS //
26 | ///////////////////////
27 |
28 | // System calls
29 | #include
30 | // Input/output streams and functions
31 | #include
32 | // Included for sin() function.
33 | #include
34 |
35 | // Interfaces with Everloop
36 | #include "matrix_hal/everloop.h"
37 | // Holds data for Everloop
38 | #include "matrix_hal/everloop_image.h"
39 | // Communicates with MATRIX device
40 | #include "matrix_hal/matrixio_bus.h"
41 |
42 | int main() {
43 | ////////////////////
44 | // INITIAL SETUP //
45 | //////////////////
46 |
47 | // Create MatrixIOBus object for hardware communication
48 | matrix_hal::MatrixIOBus bus;
49 | // Initialize bus and exit program if error occurs
50 | if (!bus.Init()) return false;
51 |
52 | /////////////////
53 | // MAIN SETUP //
54 | ///////////////
55 |
56 | // Holds the number of LEDs on MATRIX device
57 | int ledCount = bus.MatrixLeds();
58 | // Create EverloopImage object, with size of ledCount
59 | matrix_hal::EverloopImage everloop_image(ledCount);
60 | // Create Everloop object
61 | matrix_hal::Everloop everloop;
62 | // Set everloop to use MatrixIOBus bus
63 | everloop.Setup(&bus);
64 |
65 | // Variables used for sine wave rainbow logic
66 | float counter = 0;
67 | const float freq = 0.375;
68 |
69 | // 10 sec loop for rainbow effect 250*40000 microsec = 10 sec
70 | for (int i = 0; i <= 250; i++) {
71 | // For each led in everloop_image.leds, set led value
72 | for (matrix_hal::LedValue &led : everloop_image.leds) {
73 | // Sine waves 120 degrees out of phase for rainbow
74 | led.red =
75 | (std::sin(freq * counter + (M_PI / 180 * 240)) * 155 + 100) / 10;
76 | led.green =
77 | (std::sin(freq * counter + (M_PI / 180 * 120)) * 155 + 100) / 10;
78 | led.blue = (std::sin(freq * counter + 0) * 155 + 100) / 10;
79 | // If MATRIX Creator, increment by 0.51
80 | if (ledCount == 35) {
81 | counter = counter + 0.51;
82 | }
83 | // If MATRIX Voice, increment by 1.01
84 | if (ledCount == 18) {
85 | counter = counter + 1.01;
86 | }
87 | }
88 |
89 | // Updates the LEDs
90 | everloop.Write(&everloop_image);
91 |
92 | // If i is 0 (first run)
93 | if (i == 0) {
94 | // Output everloop status to console
95 | std::cout << "Everloop set to rainbow for 10 seconds." << std::endl;
96 | }
97 | // If i is cleanly divisible by 25
98 | if ((i % 25) == 0) {
99 | std::cout << "Time remaining (s) : " << 10 - (i / 25) << std::endl;
100 | }
101 |
102 | // Sleep for 40000 microseconds
103 | usleep(40000);
104 | }
105 |
106 | // Updates the Everloop on the MATRIX device
107 | everloop.Write(&everloop_image);
108 |
109 | // For each led in everloop_image.leds, set led value to 0
110 | for (matrix_hal::LedValue &led : everloop_image.leds) {
111 | // Turn off Everloop
112 | led.red = 0;
113 | led.green = 0;
114 | led.blue = 0;
115 | led.white = 0;
116 | }
117 |
118 | // Updates the Everloop on the MATRIX device
119 | everloop.Write(&everloop_image);
120 |
121 | return 0;
122 | }
123 | ```
124 |
125 | ## Compiling your Program
126 |
127 | The command below will use g++ to link the `libmatrix_creator_hal.so` library file when compiling your program.
128 |
129 | ```bash
130 | g++ -o app app.cpp -std=c++11 -lmatrix_creator_hal
131 | ```
132 |
133 | ## Running your Program
134 |
135 | Run the following command to start the demo program.
136 |
137 | ```bash
138 | cd ~/matrix-hal-project
139 | ./app
140 | ```
141 |
142 |
Result
143 | 
144 |
145 | ## Next Steps
146 |
147 | Now that everything is properly installed, view our function [references](../reference) to see what you can do with MATRIX HAL, or view the code [examples](../examples).
--------------------------------------------------------------------------------
/docs/matrix-hal/img/creator-pinout-v2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-hal/img/creator-pinout-v2.png
--------------------------------------------------------------------------------
/docs/matrix-hal/img/everloop_green.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-hal/img/everloop_green.jpg
--------------------------------------------------------------------------------
/docs/matrix-hal/img/everloop_moving_dots.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-hal/img/everloop_moving_dots.gif
--------------------------------------------------------------------------------
/docs/matrix-hal/img/everloop_rainbow.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-hal/img/everloop_rainbow.gif
--------------------------------------------------------------------------------
/docs/matrix-hal/img/everloop_yellow_purple.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-hal/img/everloop_yellow_purple.jpg
--------------------------------------------------------------------------------
/docs/matrix-hal/img/matrix-creator-alexa.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-hal/img/matrix-creator-alexa.png
--------------------------------------------------------------------------------
/docs/matrix-hal/img/matrix-creator-back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-hal/img/matrix-creator-back.png
--------------------------------------------------------------------------------
/docs/matrix-hal/img/matrix-creator-extgpio-pinout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-hal/img/matrix-creator-extgpio-pinout.png
--------------------------------------------------------------------------------
/docs/matrix-hal/img/matrix-creator-front.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-hal/img/matrix-creator-front.png
--------------------------------------------------------------------------------
/docs/matrix-hal/img/matrix-creator-rpgpio-pinout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-hal/img/matrix-creator-rpgpio-pinout.png
--------------------------------------------------------------------------------
/docs/matrix-hal/img/matrix-voice-back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-hal/img/matrix-voice-back.png
--------------------------------------------------------------------------------
/docs/matrix-hal/img/matrix-voice-diagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-hal/img/matrix-voice-diagram.png
--------------------------------------------------------------------------------
/docs/matrix-hal/img/matrix-voice-extpio-pinout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-hal/img/matrix-voice-extpio-pinout.png
--------------------------------------------------------------------------------
/docs/matrix-hal/img/matrix-voice-rpgpio-pinout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-hal/img/matrix-voice-rpgpio-pinout.png
--------------------------------------------------------------------------------
/docs/matrix-hal/img/matrix-voice-top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-hal/img/matrix-voice-top.png
--------------------------------------------------------------------------------
/docs/matrix-hal/img/matrixlabs_creator_block.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-hal/img/matrixlabs_creator_block.jpg
--------------------------------------------------------------------------------
/docs/matrix-hal/img/mic_creator_position.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-hal/img/mic_creator_position.png
--------------------------------------------------------------------------------
/docs/matrix-hal/img/mic_voice_position.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-hal/img/mic_voice_position.png
--------------------------------------------------------------------------------
/docs/matrix-hal/img/nxp_download_link.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-hal/img/nxp_download_link.png
--------------------------------------------------------------------------------
/docs/matrix-hal/img/pn512_library.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-hal/img/pn512_library.png
--------------------------------------------------------------------------------
/docs/matrix-hal/img/pn512_zip.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-hal/img/pn512_zip.png
--------------------------------------------------------------------------------
/docs/matrix-hal/img/voice_arch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-hal/img/voice_arch.png
--------------------------------------------------------------------------------
/docs/matrix-hal/overview.md:
--------------------------------------------------------------------------------
1 |
MATRIX Hardware Abstraction Layer
2 |
3 | MATRIX Hardware Abstraction Layer (HAL) is an open source library for directly interfacing with the MATRIX device. MATRIX HAL consists of driver files written in C++ which enable the user to write low level programs in C++.
4 |
5 | ### [Getting Started](getting-started)
6 |
7 | Learn how to install MATRIX HAL and create programs on your MATRIX device.
8 |
9 | ### [Reference](reference)
10 |
11 | Look over the MATRIX HAL functions for interacting with your MATRIX device.
12 |
13 | ### [Examples](examples)
14 |
15 | View our MATRIX HAL code examples.
16 |
17 | ### [Troubleshooting](troubleshooting)
18 |
19 | Look at common debugging solutions for any issues you encounter.
20 |
--------------------------------------------------------------------------------
/docs/matrix-hal/reference/everloop.md:
--------------------------------------------------------------------------------
1 |
Everloop
2 |
3 | ### Device Compatibility
4 |
5 |
6 |
7 |
8 | ## Overview
9 |
10 | The Everloop interface supports:
11 |
12 | - Setting the RGBW colors for each individual LED.
13 |
14 | ## References
15 |
16 | Below is the overview of the Everloop implementation. Code examples can be found [here](/matrix-hal/examples/everloop).
17 |
18 | These header files are required to use the Everloop.
19 |
20 | ```c++
21 | // Interfaces with Everloop
22 | #include "matrix_hal/everloop.h"
23 | // Holds data for Everloop
24 | #include "matrix_hal/everloop_image.h"
25 | // Communicates with MATRIX device
26 | #include "matrix_hal/matrixio_bus.h"
27 | ```
28 |
29 | ???+ info "EverloopImage"
30 | `EverloopImage` is a required **object** that contains an array of `LedValue` objects.
31 | The `EverloopImage` constructor takes in an integer representing the amount of RGBW leds your MATRIX device has.
32 |
33 | The MatrixIOBus function `bus.MatrixLeds` outputs the number of leds on your creator.
34 |
35 | ```c++
36 | // Holds the number of LEDs on MATRIX device
37 | int ledCount = bus.MatrixLeds();
38 | // Create EverloopImage object, with size of ledCount
39 | matrix_hal::EverloopImage everloop_image(ledCount);
40 | ```
41 |
42 | `EverloopImage` holds an array full of `LedValue` objects. The `LedValue` object contains the properties `red`, `green`, `blue`, `white`. These color properties accept an RGBW integer between 0-255.
43 |
44 | The following code shows how to set each led in everloop_image to green.
45 |
46 | ```c++
47 | // For each led, set RGBW colors
48 | // This sets all leds to green
49 | for (matrix_hal::LedValue &led : everloop_image.leds) {
50 | led.red = 0;
51 | led.green = 100;
52 | led.blue = 0;
53 | led.white = 0;
54 | }
55 | ```
56 |
57 |
58 | ???+ info "Everloop"
59 | `Everloop` is a required **object** that contains functions to interface with the Everloop on the MATRIX device.
60 |
61 | ```c++
62 | // Create Everloop object
63 | matrix_hal::Everloop everloop;
64 | ```
65 |
66 | The functions below are part of `Everloop`.
67 |
68 | ??? summary ".Setup"
69 | `Setup` is a **function** that takes `MatrixIOBus` object as parameter and sets that object as the bus to use for communicating with MATRIX device.
70 |
71 | ```c++
72 | // Function declaration in header file
73 | void Setup(MatrixIOBus *bus);
74 | ```
75 |
76 | ```c++
77 | // Set everloop to use MatrixIOBus bus
78 | everloop.Setup(&bus);
79 | ```
80 |
81 | ??? summary ".Write"
82 | `Write` is a **function** that takes an `EverloopImage` object as a parameter and updates the Everloop on the MATRIX device.
83 |
84 | ```c++
85 | // Function declaration in header file
86 | bool Write(EverloopImage *everloop_image;
87 | ```
88 |
89 | ```c++
90 | // Updates the Everloop on the MATRIX device
91 | everloop.Write(&everloop_image);
92 | ```
--------------------------------------------------------------------------------
/docs/matrix-hal/reference/humidity.md:
--------------------------------------------------------------------------------
1 |
Humidity
2 |
3 | ### Device Compatibility
4 |
5 |
6 | ## Overview
7 |
8 | The humidity sensor reports values for:
9 |
10 | * Humidity
11 | * Temperature
12 |
13 | ## References
14 |
15 | Below is the overview of the humidity sensor implementation. Code example can be found [here](/matrix-hal/examples/humidity).
16 |
17 | These header files are required to use the humidity sensor.
18 |
19 | ```c++
20 | // Interfaces with humidity sensor
21 | #include "matrix_hal/humidity_sensor.h"
22 | // Holds data from humidity sensor
23 | #include "matrix_hal/humidity_data.h"
24 | // Communicates with MATRIX device
25 | #include "matrix_hal/matrixio_bus.h"
26 | ```
27 |
28 | ???+ info "HumidityData"
29 | `HumidityData` is a required **object** that contains the humidity sensor's supported data parameters.
30 |
31 | ```c++
32 | // Create HumidityData object
33 | matrix_hal::HumidityData humidity_data;
34 | ```
35 |
36 | The following code accesses the parameters of `HumidityData`.
37 |
38 | ```c++
39 | // Output is represented in %
40 | float humidity = humidity_data.humidity;
41 | // Output is represented in Celsius
42 | float temperature = humidity_data.temperature;
43 | ```
44 |
45 | ???+ info "HumiditySensor"
46 | `HumiditySensor` is a required **object** that contains functions to interface with the humidity sensor.
47 |
48 | ```c++
49 | // Create HumiditySensor object
50 | matrix_hal::HumiditySensor humidity_sensor;
51 | ```
52 | The functions below are part of `HumiditySensor`.
53 |
54 |
55 | ??? summary "Setup"
56 | `Setup` is a **function** that takes a `MatrixIOBus` object as a parameter and sets that object as the bus to use for communicating with MATRIX device.
57 |
58 | ```c++
59 | // Function declaration in header file
60 | void Setup(MatrixIOBus *bus);
61 | ```
62 |
63 | ```c++
64 | // Set humidity_sensor to use MatrixIOBus bus
65 | humidity_sensor.Setup(&bus);
66 | ```
67 |
68 | ??? summary ".Read"
69 | `Read` is a **function** that takes a `HumidityData` object as a parameter and writes the current humidity sensor data into the `HumidityData` object.
70 |
71 | ```c++
72 | // Function declaration in header file
73 | bool Read(HumidityData *data);
74 | ```
75 |
76 | ```c++
77 | // Overwrites humidity_data with new data from humidity sensor
78 | humidity_sensor.Read(&humidity_data);
79 | ```
80 |
--------------------------------------------------------------------------------
/docs/matrix-hal/reference/imu.md:
--------------------------------------------------------------------------------
1 |
Inertial Measurement Unit (IMU)
2 |
3 | ### Device Compatibility
4 |
5 |
6 |
7 | ## Overview
8 |
9 | The IMU sensor reports values for:
10 |
11 | - Yaw, Pitch, and Roll
12 | - Acceleration for **x**, **y**, **z** axes
13 | - Gyroscope for **x**, **y**, **z** axes
14 | - Magnetometer for **x**, **y**, **z** axes
15 |
16 | ## References
17 |
18 | Below is the overview of the IMU sensor implementation. Code example can be found [here](/matrix-hal/examples/imu).
19 |
20 | These header files are required to use the IMU sensor.
21 |
22 | ```c++
23 | // Interfaces with IMU sensor
24 | #include "matrix_hal/imu_sensor.h"
25 | // Holds data from IMU sensor
26 | #include "matrix_hal/imu_data.h"
27 | // Communicates with MATRIX device
28 | #include "matrix_hal/matrixio_bus.h"
29 | ```
30 |
31 | ???+ info "IMUData"
32 | `IMUData` is a required **object** that contains the IMU sensor's supported data parameters.
33 |
34 | ```c++
35 | // Create IMUData object
36 | matrix_hal::IMUData imu_data;
37 | ```
38 |
39 | The following code accesses the parameters of `IMUData`.
40 |
41 | ```c++
42 | // Accelerometer
43 | float accel_X = imu_data.accel_x;
44 | float accel_Y = imu_data.accel_y;
45 | float accel_Z = imu_data.accel_z;
46 | // Gyroscope
47 | float gyro_X = imu_data.gyro_x;
48 | float gyro_Y = imu_data.gyro_y;
49 | float gyro_Z = imu_data.gyro_z;
50 | // Yaw, Pitch, Roll Output
51 | float yaw = imu_data.yaw;
52 | float pitch = imu_data.pitch;
53 | float roll = imu_data.roll;
54 | // Magnetometer
55 | float mag_X = imu_data.mag_x;
56 | float mag_Y = imu_data.mag_y;
57 | float mag_Z = imu_data.mag_z; // Z-axis points upward
58 | ```
59 |
60 | ???+ info "IMUSensor"
61 | `IMUSensor` is a required **object** that contains functions to interface with the IMU sensor.
62 |
63 | ```c++
64 | // Create IMUSensor object
65 | matrix_hal::IMUSensor imu_sensor;
66 | ```
67 |
68 | The functions below are part of `IMUSensor`.
69 |
70 | ??? summary ".Setup"
71 | `Setup` is a **function** that takes a `MatrixIOBus` object as a parameter and sets that object as the bus to use for communicating with MATRIX device.
72 |
73 | ```c++
74 | // Function declaration in header file
75 | void Setup(MatrixIOBus *bus);
76 | ```
77 |
78 | ```c++
79 | // Set imu_sensor to use MatrixIOBus bus
80 | imu_sensor.Setup(&bus);
81 | ```
82 |
83 | ??? summary ".Read"
84 | `Read` is a **function** that takes an `IMUData` object as a parameter and writes the current IMU sensor data into the `IMUData` object.
85 |
86 | ```c++
87 | // Function declaration in header file
88 | bool Read(IMUData *data);
89 | ```
90 |
91 | ```c++
92 | // Overwrites imu_data with new data from IMU sensor
93 | imu_sensor.Read(&imu_data);
94 | ```
--------------------------------------------------------------------------------
/docs/matrix-hal/reference/index.md:
--------------------------------------------------------------------------------
1 | ## MATRIX HAL References
2 |
3 |
25 | Near field communication.
26 |
--------------------------------------------------------------------------------
/docs/matrix-hal/reference/pressure.md:
--------------------------------------------------------------------------------
1 |
Pressure
2 |
3 | ### Device Compatibility
4 |
5 |
6 | ## Overview
7 |
8 | The pressure sensor reports values for:
9 |
10 | * Pressure
11 | * Altitude
12 | * Temperature
13 |
14 | >Based on component location, the temperature values from the [humidity sensor](./humidity) are recommended over the pressure sensor.
15 |
16 | ## References
17 |
18 | Below is the overview of the pressure sensor implementation. Code example can be found [here](/matrix-hal/examples/pressure).
19 |
20 | These header files are required to use the pressure sensor.
21 |
22 | ```c++
23 | // Interfaces with pressure sensor
24 | #include "matrix_hal/pressure_sensor.h"
25 | // Holds data from pressure sensor
26 | #include "matrix_hal/pressure_data.h"
27 | // Communicates with MATRIX device
28 | #include "matrix_hal/matrixio_bus.h"
29 | ```
30 |
31 | ???+ info "PressureData"
32 | `PressureData` is a required **object** that contains the pressure sensor's supported data parameters.
33 |
34 | ```c++
35 | // Create PressureData object
36 | matrix_hal::PressureData pressure_data;
37 | ```
38 |
39 | The following code accesses the parameters of `PressureData`.
40 |
41 | ```c++
42 | // Output is represented in meters
43 | float altitude = pressure_data.altitude;
44 | // Output is represented in Pa
45 | float pressure = pressure_data.pressure;
46 | // Output is represented in Celsius
47 | float temperature = pressure_data.temperature;
48 | ```
49 |
50 | ???+ info "PressureSensor"
51 | `PressureSensor` is a required **object** that contains functions to interface with the pressure sensor.
52 |
53 | ```c++
54 | // Create PressureSensor object
55 | matrix_hal::PressureSensor pressure_sensor;
56 | ```
57 | The functions below are part of `PressureSensor`.
58 |
59 | ??? summary ".Setup"
60 | `Setup` is a **function** that takes a `MatrixIOBus` object as a parameter and sets that object as the bus to use for communicating with MATRIX device.
61 |
62 | ```c++
63 | // Function declaration in header file
64 | void Setup(MatrixIOBus *bus);
65 | ```
66 |
67 | ```c++
68 | // Set pressure_sensor to use MatrixIOBus bus
69 | pressure_sensor.Setup(&bus);
70 | ```
71 |
72 | ??? summary ".Read"
73 | `Read` is a **function** that takes a `PressureData` object as a parameter and writes the current pressure sensor data into the `PressureData` object.
74 |
75 | ```c++
76 | // Function declaration in header file
77 | bool Read(PressureData *data);
78 | ```
79 |
80 | ```c++
81 | // Overwrites pressure_data with new data from pressure sensor
82 | pressure_sensor.Read(&pressure_data);
83 | ```
--------------------------------------------------------------------------------
/docs/matrix-hal/reference/uv.md:
--------------------------------------------------------------------------------
1 |
UV
2 |
3 | ### Device Compatibility
4 |
5 |
6 | ## Overview
7 |
8 | The UV sensor reports values for:
9 |
10 | * UV Index scale used in the United States, conforms with international guidelines for UVI reporting established by the World Health Organization. From UV Index Scale
11 |
12 | ## References
13 |
14 | Below is the overview of the UV sensor implementation. Code example can be found [here](/matrix-hal/examples/uv).
15 |
16 | These header files are required to use the UV sensor.
17 |
18 | ```c++
19 | // Interfaces with UV sensor
20 | #include "matrix_hal/uv_sensor.h"
21 | // Holds data from UV sensor
22 | #include "matrix_hal/uv_data.h"
23 | // Communicates with MATRIX device
24 | #include "matrix_hal/matrixio_bus.h"
25 | ```
26 |
27 | ???+ info "UVData"
28 | `UVData` is a required **object** that contains the UV sensor's supported data parameters.
29 |
30 | ```c++
31 | // Create UVData object
32 | matrix_hal::UVData uv_data;
33 | ```
34 |
35 | The following code accesses the parameters of `UVData`.
36 |
37 | ```c++
38 | // Output is represented in UV Index
39 | float UV = uv_data.uv;
40 | ```
41 |
42 | ???+ info "UVSensor"
43 | `UVSensor` is a required **object** that contains functions to interface with the UV sensor.
44 |
45 | ```c++
46 | // Create UVSensor object
47 | matrix_hal::UVSensor uv_sensor;
48 | ```
49 | The functions below are part of `UVSensor`.
50 |
51 | ??? summary ".Setup"
52 | `Setup` is a **function** that takes a `MatrixIOBus` object as a parameter and sets that object as the bus to use for communicating with MATRIX device.
53 |
54 | ```c++
55 | // Function declaration in header file
56 | void Setup(MatrixIOBus *bus);
57 | ```
58 |
59 | ```c++
60 | // Set uv_sensor to use MatrixIOBus bus
61 | uv_sensor.Setup(&bus);
62 | ```
63 |
64 | ??? summary ".Read"
65 | `Read` is a **function** that takes a `UVData` object as a parameter and writes the current humidity sensor data into the `UVData` object.
66 |
67 | ```c++
68 | // Function declaration in header file
69 | bool Read(UVData *data);
70 | ```
71 |
72 | ```c++
73 | // Overwrites uv_data with new data from UV sensor
74 | uv_sensor.Read(&uv_data);
75 | ```
--------------------------------------------------------------------------------
/docs/matrix-hal/troubleshooting.md:
--------------------------------------------------------------------------------
1 | ## Community
2 |
3 | Please visit our community support forums at
4 | community.matrix.one
5 |
6 | ## Check Installed MATRIX Packages
7 |
8 | Run the following command on your Raspberry Pi's terminal to see the currently installed MATRIX packages.
9 | ```bash
10 | dpkg -l | grep matrix
11 | ```
12 |
13 | ## Reinstall MATRIX HAL
14 |
15 | If you experience strange behavior, reinstall MATRIX HAL.
16 |
17 | Uninstall the `libmatrixio-creator-hal` and `libmatrixio-creator-hal-dev` package.
18 |
19 | ```bash
20 | sudo apt-get --purge remove libmatrixio-creator-hal libmatrixio-creator-hal-dev
21 | ```
22 |
23 | Uninstall HAL built from source.
24 |
25 | ```bash
26 | sudo rm -rf /usr/local/include/matrix_hal
27 | sudo rm -rf /usr/local/lib/libmatrix_creator_hal.so
28 | ```
29 |
30 | Reboot your device.
31 |
32 | ```bash
33 | sudo reboot
34 | ```
35 |
36 | Install MATRIX HAL from [package](/matrix-hal/getting-started/installation-package) or from [source](/matrix-hal/getting-started/installation-source).
--------------------------------------------------------------------------------
/docs/matrix-lite/getting-started/go.md:
--------------------------------------------------------------------------------
1 |
83 | Once you have `main.go` ready, use the following command to run our rainbow Hello World.
84 | ```
85 | go run main.go
86 | ```
87 |
88 |
89 |
Result
90 | 
91 |
92 |
93 | ## Next Steps
94 | With your device now setup, you can visit our [Reference](../go-reference) page to get started with MATRIX Lite.
95 |
--------------------------------------------------------------------------------
/docs/matrix-lite/getting-started/index.md:
--------------------------------------------------------------------------------
1 | ## Programming Languages
2 |
3 |
10 | Learn how to install and setup Go with MATRIX Lite.
--------------------------------------------------------------------------------
/docs/matrix-lite/getting-started/javascript.md:
--------------------------------------------------------------------------------
1 |
76 | Once you have `index.js` ready, use the following command to run our rainbow Hello World.
77 | ```bash
78 | node index.js
79 | ```
80 |
81 |
82 |
Result
83 | 
84 |
85 |
86 |
87 | ## Next Steps
88 | With your device now setup, you can visit our [Reference](../js-reference) page to get started with MATRIX Lite.
89 |
--------------------------------------------------------------------------------
/docs/matrix-lite/getting-started/python.md:
--------------------------------------------------------------------------------
1 |
Prerequisite MATRIX HAL
2 |
3 |
4 |
5 | > Make sure you have installed [MATRIX HAL](/matrix-hal/getting-started/), before continuing.
6 |
7 | ## Python Setup
8 |
9 | Install the PIP3 package manager.
10 | ```bash
11 | sudo apt-get install python3-pip
12 | ```
13 |
14 | Upgrade PIP3.
15 | ```langauge-bash
16 | python3 -m pip install --upgrade pip
17 | ```
18 |
19 | Create a project folder.
20 | ```bash
21 | mkdir lite_py
22 | cd lite_py
23 | touch app.py
24 | ```
25 |
26 | Download the matrix-lite-py package. Note that the module to import is called `matrix_lite`.
27 | ```bash
28 | sudo python3 -m pip install matrix-lite
29 | ```
30 |
31 | ## Creating An Application
32 |
33 | Copy our Hello World example below into `app.py` to test your installation.
34 |
35 | ```python
36 | from matrix_lite import led
37 | from time import sleep
38 | from math import pi, sin
39 |
40 | everloop = ['black'] * led.length
41 |
42 | ledAdjust = 0.0
43 | if len(everloop) == 35:
44 | ledAdjust = 0.51 # MATRIX Creator
45 | else:
46 | ledAdjust = 1.01 # MATRIX Voice
47 |
48 | frequency = 0.375
49 | counter = 0.0
50 | tick = len(everloop) - 1
51 |
52 | while True:
53 | # Create rainbow
54 | for i in range(len(everloop)):
55 | r = round(max(0, (sin(frequency*counter+(pi/180*240))*155+100)/10))
56 | g = round(max(0, (sin(frequency*counter+(pi/180*120))*155+100)/10))
57 | b = round(max(0, (sin(frequency*counter)*155+100)/10))
58 |
59 | counter += ledAdjust
60 |
61 | everloop[i] = {'r':r, 'g':g, 'b':b}
62 |
63 | # Slowly show rainbow
64 | if tick != 0:
65 | for i in reversed(range(tick)):
66 | everloop[i] = {}
67 | tick -= 1
68 |
69 | led.set(everloop)
70 |
71 | sleep(.035)
72 | ```
73 |
74 |
Running app.py
75 | Once you have `app.py` ready, use the following command to run our rainbow Hello World.
76 | ```bash
77 | python3 app.py
78 | ```
79 |
80 |
81 |
Result
82 | 
83 |
84 |
85 | ## Next Steps
86 | With your device now setup, you can visit our [Reference](../py-reference) page to get started with MATRIX Lite.
87 |
--------------------------------------------------------------------------------
/docs/matrix-lite/go-reference/alsa-mics.md:
--------------------------------------------------------------------------------
1 |
ALSA Microphones
2 |
3 | ## TODO
4 | Add a third party example on how to extract audio data from ALSA.
--------------------------------------------------------------------------------
/docs/matrix-lite/go-reference/everloop.md:
--------------------------------------------------------------------------------
1 |
Everloop
2 |
3 | ### Device Compatibility
4 |
5 |
6 |
7 | ## Overview
8 | The following sections below will go over how to control the LED array on your MATRIX Device.
9 |
10 | ## Import Statement
11 | ```go
12 | import ("github.com/matrix-io/matrix-lite-go")
13 | ```
14 |
15 | !!! tip "MATRIX Initialization"
16 | `.Init` will contain an `Led` struct to call the functions below
17 | ```go
18 | m := matrix.Init()
19 | ```
20 |
21 | ### led
22 |
23 | ???+ summary ".Length"
24 | Returns the number of LEDs on a MATRIX device.
25 | ```go
26 | m.Led.Length
27 | ```
28 | ???+ summary ".RGBW{}"
29 |
30 | ```go
31 | // RGBW is used to represent the color of an LED
32 | purple := m.RGBW{R: 255, G: 0, B:255, W:0}
33 | ```
34 |
35 | ???+ summary ".Set()"
36 | Allows you to set the colors of each LED. A `string`, `RGBW struct`, `slice` or `array` can be given to this function.
37 |
38 | ```go
39 | // Valid ways to set each LED
40 | m.Led.Set("blue")
41 | m.Led.Set(matrix.RGBW{0, 0, 255, 0})
42 | ```
43 |
44 | Passing in an array allows you to set each individual LED color. However, passing an array that's larger than `led.length` will result in an error.
45 | ```go
46 | // Slice
47 | m.Led.Set([]string{"red", "gold", "black", "purple"})
48 |
49 | // Slice with different data types
50 | m.Led.Set([]interface{}{"red", "", matrix.RGBW{}, "black", matrix.RGBW{G: 255}})
51 |
52 | // Array
53 | m.Led.Set([5]string{"red", "gold", "black", "purple"})
54 | ```
55 |
56 | ???+ example "Everloop Examples"
57 |
58 | ```go tab="LEDs blue"
59 | package main
60 |
61 | import "github.com/matrix-io/matrix-lite-go"
62 |
63 | func main() {
64 | m := matrix.Init()
65 | // A single string or RGBW sets all LEDs
66 | // Below are different ways of expressing a color (number values are from 0-255)
67 | m.Led.Set("blue")
68 | m.Led.Set(matrix.RGBW{0, 0, 255, 0})
69 | }
70 | ```
71 |
72 | ```go tab="LEDs off"
73 | package main
74 |
75 | import "github.com/matrix-io/matrix-lite-go"
76 |
77 | func main() {
78 | m := matrix.Init()
79 | m.Led.Set("black")
80 | m.Led.Set("")
81 | m.Led.Set("invalid color names will default to black")
82 | m.Led.Set(matrix.RGBW{})
83 | }
84 | ```
85 |
86 | ```go tab="Moving blue LED"
87 | package main
88 |
89 | import (
90 | "time"
91 |
92 | "github.com/matrix-io/matrix-lite-go"
93 | )
94 |
95 | func main() {
96 | m := matrix.Init()
97 |
98 | // It's recommended to use Slices so that m.Led.Length can be used
99 | everloop := make([]matrix.RGBW, m.Led.Length)
100 | everloop[0] = matrix.RGBW{B: 100}
101 |
102 | for {
103 | lastLed := everloop[0]
104 | everloop = everloop[1:]
105 | everloop = append(everloop, lastLed)
106 |
107 | m.Led.Set(everloop)
108 | time.Sleep(50 * time.Millisecond)
109 | }
110 | }
111 | ```
112 |
113 | ```go tab="Rainbow"
114 | package main
115 |
116 | import (
117 | "math"
118 | "time"
119 |
120 | "github.com/matrix-io/matrix-lite-go"
121 | )
122 |
123 | func main() {
124 | m := matrix.Init()
125 | everloop := make([]matrix.RGBW, m.Led.Length)
126 |
127 | ledAdjust := 0.0
128 | if len(everloop) == 35 {
129 | ledAdjust = 0.51 // MATRIX Creator
130 | } else {
131 | ledAdjust = 1.01 // MATRIX Voice
132 | }
133 |
134 | frequency := 0.375
135 | counter := 0.0
136 | tick := len(everloop) - 1
137 |
138 | for {
139 | // Create rainbow
140 | for i, led := range everloop {
141 | led.R = uint8(math.Max(0, (math.Sin(frequency*counter+(math.Pi/180*240))*155+100)/10))
142 | led.G = uint8(math.Max(0, (math.Sin(frequency*counter+(math.Pi/180*120))*155+100)/10))
143 | led.B = uint8(math.Max(0, (math.Sin(frequency*counter)*155+100)/10))
144 |
145 | counter += ledAdjust
146 |
147 | everloop[i] = led
148 | }
149 |
150 | // Slowly show rainbow
151 | if tick != 0 {
152 | for i := tick; i > 0; i-- {
153 | everloop[i] = matrix.RGBW{}
154 | }
155 | tick--
156 | }
157 |
158 | m.Led.Set(everloop)
159 | time.Sleep(35 * time.Millisecond)
160 | }
161 | }
162 | ```
--------------------------------------------------------------------------------
/docs/matrix-lite/go-reference/gpio.md:
--------------------------------------------------------------------------------
1 |
GPIO
2 |
3 | ### Device Compatibility
4 |
5 |
6 |
7 | ## Overview
8 | The following sections below will go over how to utilize the GPIO on your MATRIX Device. These functions affect `pins: 0-15`.
9 |
10 | ## Import Statement
11 | ```go
12 | import ("github.com/matrix-io/matrix-lite-go")
13 | ```
14 |
15 | !!! tip "MATRIX Initialization"
16 | `.Init` will contain a `Gpio` struct to call the functions below
17 | ```go
18 | m := matrix.Init()
19 | ```
20 | ### gpio
21 |
22 | ??? summary ".SetFunction()"
23 |
24 | ```go
25 | // Set a pin as use a digital signal
26 | m.Gpio.SetFunction(0, "DIGITAL")
27 |
28 | // Set a pin as use a PWM signal
29 | m.Gpio.SetFunction(0, "PWM")
30 | ```
31 |
32 | ??? summary ".SetMode()"
33 |
34 | ```go
35 | // Valid ways of setting a pin to receive input
36 | m.Gpio.SetMode(0, "input")
37 |
38 | // Valid ways of setting a pin to allow output
39 | m.Gpio.SetMode(0, "output")
40 | ```
41 |
42 | ??? summary ".GetDigital()"
43 |
44 | ```go
45 | // Returns a 1 or 0 representing the ON/OFF state of a pin
46 | m.Gpio.GetDigital(0)
47 | ```
48 |
49 | ??? summary ".SetDigital()"
50 |
51 | ```go
52 | // Controls the digital output of a pin
53 |
54 | // Set a pin to OFF
55 | m.Gpio.SetDigital(0, "OFF")
56 |
57 | // Set a pin to ON
58 | m.Gpio.SetDigital(1, "ON")
59 | ```
60 |
61 | ??? summary ".SetPWM()"
62 |
63 | ```go
64 | // Controls the PWM output of a pin
65 | m.Gpio.SetPWM(0, 25, 50);// pin, percentage, frequency
66 | ```
67 |
68 | ??? summary ".SetServoAngle()"
69 |
70 | ```go
71 | // This function requires the pin to be set to "PWM" mode.
72 | m.Gpio.SetServoAngle(0, 90, 0.8)// pin, angle, minimum pulse width for a PWM wave (in milliseconds)
73 | ```
74 |
75 | ???+ example "GPIO examples"
76 |
77 | ```go tab="Read Pin"
78 | package main
79 |
80 | import (
81 | "fmt"
82 |
83 | "github.com/matrix-io/matrix-lite-go"
84 | )
85 |
86 | func main() {
87 | m := matrix.Init()
88 |
89 | // Configure pin 0
90 | m.Gpio.SetFunction(0, "DIGITAL")
91 | m.Gpio.SetMode(0, "input")
92 |
93 | // Read pin 0
94 | fmt.Println(m.Gpio.GetDigital(0))
95 | }
96 | ```
97 |
98 | ```go tab="Digital Output"
99 | package main
100 |
101 | import "github.com/matrix-io/matrix-lite-go"
102 |
103 | func main() {
104 | m := matrix.Init()
105 |
106 | // Set pin 1 to be ON
107 | m.Gpio.SetFunction(1, "DIGITAL")
108 | m.Gpio.SetMode(1, "output")
109 | m.Gpio.SetDigital(1, "ON")
110 |
111 | // Set pin 10 to be OFF
112 | m.Gpio.SetFunction(10, "DIGITAL")
113 | m.Gpio.SetMode(10, "output")
114 | m.Gpio.SetDigital(10, "OFF")
115 | }
116 | ```
117 |
118 | ```go tab="PWM Output"
119 | package main
120 |
121 | import "github.com/matrix-io/matrix-lite-go"
122 |
123 | func main() {
124 | m := matrix.Init()
125 |
126 | // Set pin 2 to be output a PWM signal
127 | m.Gpio.SetFunction(2, "PWM");
128 | m.Gpio.SetMode(2, "output");
129 | m.Gpio.SetPWM(2, 25, 50);
130 | }
131 | ```
132 |
133 | ```go tab="Set Servo"
134 | package main
135 |
136 | import "github.com/matrix-io/matrix-lite-go"
137 |
138 | func main() {
139 | m := matrix.Init()
140 |
141 | // Tell pin 3 to set servo to 90 degrees
142 | m.Gpio.SetFunction(3, "PWM");
143 | m.Gpio.SetMode(3, "output");
144 | m.Gpio.SetServoAngle(3, 90, 0.8);// pin, angle, min_pulse_ms
145 | }
146 | ```
--------------------------------------------------------------------------------
/docs/matrix-lite/go-reference/index.md:
--------------------------------------------------------------------------------
1 | ## Go Reference
2 |
3 |
2 |
3 | ### Device Compatibility
4 |
5 |
6 | ## Overview
7 | The following sections below will go over how to read & what to expect from each sensor on the MATRIX Creator.
8 |
9 | ## Import Statement
10 | ```go
11 | import ("github.com/matrix-io/matrix-lite-go")
12 | ```
13 |
14 | !!! tip "MATRIX Initialization"
15 | `.Init` will contain a `Sensors` struct to call the functions below
16 | ```go
17 | m := matrix.Init()
18 | ```
19 |
20 | ## Reading Sensor Data
21 | Sensor data can be read by calling `.Read()` on a sensor struct. This updates the existing sensor's values. Below are examples on how to call each sensor and what information to expect.
22 |
23 | ```go tab="IMU"
24 | m.Imu.Read()
25 |
26 | // Imu properties
27 | m.Imu.AccelX float32
28 | m.Imu.AccelY float32
29 | m.Imu.AccelZ float32
30 | m.Imu.GyroX float32
31 | m.Imu.GyroY float32
32 | m.Imu.GyroZ float32
33 | m.Imu.Yaw float32
34 | m.Imu.Pitch float32
35 | m.Imu.Roll float32
36 | m.Imu.MagX float32
37 | m.Imu.MagY float32
38 | m.Imu.MagZ float32
39 | ```
40 |
41 | ```go tab="UV"
42 | m.Uv.Read()
43 |
44 | // Uv properties
45 | m.Uv.Uv float32
46 |
47 | ```
48 |
49 | ```go tab="Humidity"
50 | m.Humidity.Read()
51 |
52 | // Humidity properties
53 | m.Humidity.Humidity float32
54 | m.Humidity.Temperature float32
55 | ```
56 |
57 | ```go tab="Pressure"
58 | m.Pressure.Read()
59 |
60 | // Pressure properties
61 | m.Pressure.Altitude float32
62 | m.Pressure.Pressure float32
63 | m.Pressure.Temperature float32
64 | ```
65 |
--------------------------------------------------------------------------------
/docs/matrix-lite/img/everloop_rainbow.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-lite/img/everloop_rainbow.gif
--------------------------------------------------------------------------------
/docs/matrix-lite/js-reference/alsa.md:
--------------------------------------------------------------------------------
1 |
ALSA
2 |
3 | ### Device Compatibility
4 |
5 |
6 |
7 | ## Overview
8 | > Requires you to have the MATRIX Kernel Modules installed.
9 |
10 | The following sections below will go over how to retrieve microphone input through ALSA.
11 |
12 | ## Import Statement
13 | ```js
14 | const matrix = require("@matrix-io/matrix-lite");
15 | ```
16 |
17 |
18 | ### .mic
19 | This function will allow you to configure your MATRIX microphone settings. Default values will be used if no configuration was given.
20 |
21 | * **config: `object`**
22 | * **rate**: Any number from 0 to 15.
23 | * **debug**: true or false.
24 | * **exitOnSilence**: number of seconds.
25 | * **channels**: Any number from 1 to 8.
26 |
27 | ```js
28 | var mic = matrix.alsa.mic();
29 | // or
30 | var mic = matrix.alsa.mic({
31 | rate: '16000',
32 | debug: true,
33 | exitOnSilence: 6,
34 | channels: '1'
35 | });
36 | ```
37 |
38 | Once the microphone is setup, visit [npm mic page](https://www.npmjs.com/package/mic) to see what functions & event listeners are available. This package is included in MATRIX Lite.
--------------------------------------------------------------------------------
/docs/matrix-lite/js-reference/everloop.md:
--------------------------------------------------------------------------------
1 |
Everloop
2 |
3 | ### Device Compatibility
4 |
5 |
6 |
7 | ## Overview
8 | The following sections below will go over how to control the LED array on your MATRIX Device.
9 |
10 | ## Import Statement
11 | ```js
12 | const matrix = require("@matrix-io/matrix-lite");
13 | ```
14 |
15 | ### led
16 |
17 | ???+ summary ".length"
18 | Returns the number of LEDs on a MATRIX device.
19 | ```js
20 | matrix.led.length;
21 | ```
22 |
23 | ???+ summary ".set()"
24 | Allows you to set the colors of each LED. A `string`, `object`, `array`, or an `undefined` value can be given to this function.
25 |
26 | ```js
27 | // Valid ways to set each LED
28 | matrix.led.set("blue"); // color name
29 | matrix.led.set("rgb(0,0,255)"); // RGB values
30 | matrix.led.set("#0000ff"); // hex values
31 | matrix.led.set({r:0,g:0,b:255,w:0}); // objects
32 | ```
33 |
34 | Passing in an array allows you to set each individual LED color. However, passing an array that's larger than `led.length` will result in an error.
35 | ```js
36 | matrix.led.set(['red', 'gold', 'purple', {}, , '#6F41C1', 'rgb(0,0,255)', {g:255}]);
37 | ```
38 |
39 | ???+ example "Everloop Examples"
40 |
41 | ```js tab="LEDs blue"
42 | const matrix = require("@matrix-io/matrix-lite");
43 | // A single string or object sets all LEDs
44 | // Below are different ways of expressing the color blue (number values are from 0-255)
45 | matrix.led.set('blue');
46 | matrix.led.set('rgb(0,0,255)');
47 | matrix.led.set('#0000ff');
48 | matrix.led.set({r:0, g:0, b:255, w:0}); // objects can set white
49 | ```
50 |
51 | ```js tab="LEDs off"
52 | const matrix = require("@matrix-io/matrix-lite");
53 | // Each line below is a valid way of turning the LEDs off
54 | matrix.led.set('black');
55 | matrix.led.set([]);
56 | matrix.led.set();
57 | matrix.led.set({});
58 | ```
59 |
60 | ```js tab="Moving blue LED"
61 | const matrix = require("@matrix-io/matrix-lite");
62 |
63 | let everloop = new Array(matrix.led.length).fill({});// Array of black LEDs
64 | everloop[0] = {b:100};
65 |
66 | setInterval(()=>{
67 | let lastColor = everloop.shift();
68 | everloop.push(lastColor);
69 | matrix.led.set(everloop);
70 | },50);
71 | ```
72 |
73 | ```js tab="Rainbow"
74 | const matrix = require("@matrix-io/matrix-lite");
75 |
76 | let everloop = new Array(matrix.led.length);
77 |
78 | let ledAdjust = 0.0;
79 | if (everloop.length == 35) {
80 | ledAdjust = 0.51; // MATRIX Creator
81 | } else {
82 | ledAdjust = 1.01; // MATRIX Voice
83 | }
84 |
85 | let frequency = 0.375;
86 | let counter = 0.0;
87 | let tick = everloop.length - 1;
88 |
89 | setInterval(()=>{
90 | // Create rainbow
91 | for(i = 0; i < everloop.length; i++) {
92 | let led = {};
93 | led.r = Math.round(Math.max(0, (Math.sin(frequency*counter+(Math.PI/180*240))*155+100)/10));
94 | led.g = Math.round(Math.max(0, (Math.sin(frequency*counter+(Math.PI/180*120))*155+100)/10));
95 | led.b = Math.round(Math.max(0, (Math.sin(frequency*counter)*155+100)/10));
96 |
97 | counter += ledAdjust;
98 |
99 | everloop[i] = led;
100 | };
101 |
102 | // Slowly show rainbow
103 | if (tick != 0) {
104 | for (i = tick; i > 0; i--) {
105 | everloop[i] = {};
106 | }
107 | tick--;
108 | }
109 |
110 | matrix.led.set(everloop);
111 |
112 | },35);
113 | ```
--------------------------------------------------------------------------------
/docs/matrix-lite/js-reference/gpio.md:
--------------------------------------------------------------------------------
1 |
GPIO
2 |
3 | ### Device Compatibility
4 |
5 |
6 |
7 | ## Overview
8 | The following sections below will go over how to utilize the GPIO on your MATRIX Device. These functions affect `pins: 0-15`.
9 |
10 | ## Import Statement
11 | ```js
12 | const matrix = require("@matrix-io/matrix-lite");
13 | ```
14 |
15 | ### gpio
16 |
17 | ??? summary ".setFunction()"
18 |
19 | ```js
20 | // Valid ways of setting a pin as a digital pin
21 | matrix.gpio.setFunction(0, "DIGITAL");
22 | matrix.gpio.setFunction(0, 0);
23 |
24 | // Valid ways of setting a pin as a PWM pin
25 | matrix.gpio.setFunction(0, "PWM");
26 | matrix.gpio.setFunction(0, 1);
27 | ```
28 |
29 | ??? summary ".setMode()"
30 |
31 | ```js
32 | // Valid ways of setting a pin to receive input
33 | matrix.gpio.setMode(0, "input");
34 | matrix.gpio.setMode(0, 0);
35 |
36 | // Valid ways of setting a pin to allow output
37 | matrix.gpio.setMode(0, "output");
38 | matrix.gpio.setMode(0, 1);
39 | ```
40 |
41 | ??? summary ".getDigital()"
42 |
43 | ```js
44 | // Returns a 1 or 0 representing the ON/OFF state of a pin
45 | matrix.gpio.getDigital(0);
46 | ```
47 |
48 | ??? summary ".setDigital()"
49 |
50 | ```js
51 | // Controls the digital output of a pin
52 |
53 | // Valid ways of setting a pin to OFF
54 | matrix.gpio.setDigital(0,"OFF");
55 | matrix.gpio.setDigital(0,0);
56 |
57 | // Valid ways of setting a pin to ON
58 | matrix.gpio.setDigital(0,"ON");
59 | matrix.gpio.setDigital(0,1);
60 | ```
61 |
62 | ??? summary ".setPWM()"
63 |
64 | ```js
65 | // Controls the PWM output of a pin
66 | matrix.gpio.setPWM({
67 | pin: 0,
68 | percentage: 25,
69 | frequency: 50
70 | });
71 | ```
72 |
73 | ??? summary ".setServoAngle()"
74 |
75 | ```js
76 | // This function requires the pin to be set to "PWM" mode.
77 | matrix.gpio.setServoAngle({
78 | pin: 0,
79 | angle: 90,
80 | // minimum pulse width for a PWM wave (in milliseconds)
81 | min_pulse_ms: 0.8
82 | });
83 | ```
84 |
85 | ???+ example "GPIO examples"
86 |
87 | ```js tab="Read Pin"
88 | const matrix = require('@matrix-io/matrix-lite');
89 |
90 | // Configure pin 0
91 | matrix.gpio.setFunction(0, 'DIGITAL');
92 | matrix.gpio.setMode(0, 'input');
93 |
94 | // Read pin 0
95 | console.log(matrix.gpio.getDigital(0));
96 | ```
97 |
98 | ```js tab="Digital Output"
99 | const matrix = require('@matrix-io/matrix-lite');
100 |
101 | // Set pin 1 to be ON
102 | matrix.gpio.setFunction(1, 'DIGITAL');
103 | matrix.gpio.setMode(1, 'output');
104 | matrix.gpio.setDigital(1, 'ON');
105 |
106 | // Set pin 10 to be OFF
107 | matrix.gpio.setFunction(10, 'DIGITAL');
108 | matrix.gpio.setMode(10, 'output');
109 | matrix.gpio.setDigital(10, 'OFF');
110 | ```
111 |
112 | ```js tab="PWM Output"
113 | const matrix = require('@matrix-io/matrix-lite');
114 |
115 | // Set pin 2 to be output a PWM signal
116 | matrix.gpio.setFunction(2, 'PWM');
117 | matrix.gpio.setMode(2, 'output');
118 | matrix.gpio.setPWM({
119 | pin: 2,
120 | percentage: 25,
121 | frequency: 50 // min 36
122 | });
123 | ```
124 |
125 | ```js tab="Set Servo"
126 | const matrix = require('@matrix-io/matrix-lite');
127 |
128 | // Tell pin 3 to set servo to 90 degrees
129 | matrix.gpio.setFunction(3, 'PWM');
130 | matrix.gpio.setMode(3, 'output');
131 | matrix.gpio.setServoAngle({
132 | pin: 3,
133 | angle: 90,
134 | // minimum pulse width for a PWM wave (in milliseconds)
135 | min_pulse_ms: 0.8
136 | });
137 | ```
--------------------------------------------------------------------------------
/docs/matrix-lite/js-reference/index.md:
--------------------------------------------------------------------------------
1 | ## JavaScript Reference
2 |
2 |
3 | ### Device Compatibility
4 |
5 |
6 |
7 | ## Overview
8 | The following sections below will go over how to obtain information on your MATRIX device.
9 |
10 | ## Import Statement
11 | ```js
12 | const matrix = require("@matrix-io/matrix-lite");
13 | ```
14 |
15 | ### Info
16 |
17 | ???+ summary ".deviceType"
18 | A `string` of the MATRIX device currently attached.
19 | ```js
20 | console.log("The " + matrix.info.deviceType + " is attached to the pi");
21 | ```
22 |
23 | ???+ summary ".isDirectBus"
24 | A `boolean` that's true, if the kernel modules are not installed.
25 | ```js
26 | console.log("Are the Kernel Modules installed? " + matrix.info.isDirectBus);
27 | ```
--------------------------------------------------------------------------------
/docs/matrix-lite/js-reference/sensors.md:
--------------------------------------------------------------------------------
1 |
Sensors
2 |
3 | ### Device Compatibility
4 |
5 |
6 | ## Overview
7 | The following sections below will go over how to read & what to expect from each sensor on the MATRIX Creator.
8 |
9 | ## Import Statement
10 | ```js
11 | const matrix = require("@matrix-io/matrix-lite");
12 | ```
13 |
14 |
15 | ## Reading Sensor Data
16 | Sensor data can be read by calling `.read()` on a sensor object. This returns an object with the current sensor's values. Below are examples on how to call each sensor and what information to expect.
17 |
18 | ```js tab="IMU"
19 | matrix.imu.read();
20 |
21 | // Example imu.read() output //
22 | {
23 | accel_x: 0.0020000000949949026,
24 | accel_y: 0.004999999888241291,
25 | accel_z: 0.9819999933242798,
26 | gyro_x: 0.7770000100135803,
27 | gyro_y: -0.2460000067949295,
28 | gyro_z: 0.7250000238418579,
29 | yaw: -177.40724182128906,
30 | pitch: -0.11669033765792847,
31 | roll: 0.2917275130748749,
32 | mag_x: 0.5299999713897705,
33 | mag_y: -0.024000000208616257,
34 | mag_z: -0.05999999865889549
35 | }
36 | ```
37 |
38 | ```js tab="UV"
39 | matrix.uv.read();
40 |
41 | // Example uv.read() output //
42 | {
43 | uv: 0.013000000268220901
44 | }
45 | ```
46 |
47 | ```js tab="Humidity"
48 | matrix.humidity.read();
49 |
50 | // Example humidity.read() output //
51 | {
52 | humidity: 29.04400062561035,
53 | temperature: 33.279998779296875
54 | }
55 | ```
56 |
57 | ```js tab="Pressure"
58 | matrix.pressure.read();
59 |
60 | // Example pressure.read() output //
61 | {
62 | altitude: -47.4370002746582,
63 | pressure: 101896,
64 | temperature: 32.9370002746582
65 | }
66 | ```
67 |
--------------------------------------------------------------------------------
/docs/matrix-lite/overview.md:
--------------------------------------------------------------------------------
1 |
MATRIX Lite
2 |
3 | MATRIX Lite is a series of libraries for exposing [MATRIX HAL](../matrix-hal/overview) to other languages. We currently support JavaScript, Python, Go, and Ruby.
4 |
5 |
6 | ### [Getting Started](getting-started)
7 |
8 | Learn how to install MATRIX Lite with either JavaScript, Python or Golang.
9 |
10 | ### Reference
11 | Look over the MATRIX Lite functions to learn how to program with your MATRIX device.
12 |
13 | - [JavaScript Reference](js-reference)
14 | - [Python Reference](py-reference)
15 | - [Go Reference](go-reference)
16 | - Ruby Reference **[Under Development]**
17 |
18 | ### Contributing
19 | Help improve our libraries by submitting issues & pull requests to our GitHub repositories.
20 |
21 | - matrix-lite-js: Node.js addon for calling MATRIX HAL.
22 |
23 | - matrix-lite-nfc-js: Node.js addon for calling MATRIX HAL NFC.
24 |
25 | - matrix-lite-go: Go bindings for calling MATRIX HAL.
26 |
27 | - matrix-lite-py: A pybind11 extension for calling MATRIX HAL.
28 |
29 | - matrix-lite-nfc-py: A pybind11 extension for calling MATRIX HAL NFC.
30 |
31 | - matrix-hal-swig: A SWIG interface to expose MATRIX HAL for multiple languages.
32 |
33 | - matrix-lite-rb: SWIG implementation compiled for Ruby.
34 |
--------------------------------------------------------------------------------
/docs/matrix-lite/py-reference/alsa-mics.md:
--------------------------------------------------------------------------------
1 |
ALSA Microphones
2 |
3 | ### Device Compatibility
4 |
5 |
6 |
7 | ## Overview
8 | The following sections will go over how to read microphone data from your MATRIX device. Note the code below isn't actually part of MATRIX Lite, but a downloadable library that allows us to easily access ALSA microphones.
9 |
10 | ### Dependencies
11 | Install the MATRIX Kernel Modules.
12 |
13 | - Follow **Option1** or **Option2**: https://github.com/matrix-io/matrixio-kernel-modules.
14 |
15 | Install portaudio.
16 | ```bash
17 | sudo apt install portaudio19-dev
18 | ```
19 |
20 | Install pyaudio.
21 | ```bash
22 | sudo python3 -m pip install pyaudio
23 | ```
24 |
25 | Configure your Pi's asound.conf file.
26 |
27 | !!! bug "Due to the linux kernel being recently updated, the playback rate for the Raspberry Pi must be set to `16000`. Add the following **highlighted** line to `/etc/asound.conf`"
28 | ```bash hl_lines="5"
29 | pcm.speaker {
30 | type plug
31 | slave {
32 | pcm "hw:0,0"
33 | rate 16000
34 | }
35 | }
36 | ```
37 |
38 | ### Recording Example
39 | Below is a simple example that shows you how to create an audio recording with pyaudio.
40 | Visit the pyaudio documentation for a complete overview.
41 |
42 | !!! example "recordFile.py"
43 | Be sure to run the example with `python3`
44 |
45 | ```python
46 | import pyaudio
47 | import wave
48 |
49 | # recording configs
50 | CHUNK = 2048
51 | FORMAT = pyaudio.paInt16
52 | CHANNELS = 8
53 | RATE = 96000
54 | RECORD_SECONDS = 5
55 | WAVE_OUTPUT_FILENAME = "output.wav"
56 |
57 | # create & configure microphone
58 | mic = pyaudio.PyAudio()
59 | stream = mic.open(format=FORMAT,
60 | channels=CHANNELS,
61 | rate=RATE,
62 | input=True,
63 | frames_per_buffer=CHUNK)
64 |
65 | print("* recording")
66 |
67 | # read & store microphone data per frame read
68 | frames = []
69 | for i in range(0, int(RATE / CHUNK * RECORD_SECONDS)):
70 | data = stream.read(CHUNK)
71 | frames.append(data)
72 |
73 | print("* done recording")
74 |
75 | # kill the mic and recording
76 | stream.stop_stream()
77 | stream.close()
78 | mic.terminate()
79 |
80 | # combine & store all microphone data to output.wav file
81 | outputFile = wave.open(WAVE_OUTPUT_FILENAME, 'wb')
82 | outputFile.setnchannels(CHANNELS)
83 | outputFile.setsampwidth(mic.get_sample_size(FORMAT))
84 | outputFile.setframerate(RATE)
85 | outputFile.writeframes(b''.join(frames))
86 | outputFile.close()
87 | ```
88 |
89 | Once recorded, you can play the audio through the Pi's audio jack with:
90 | ```bash
91 | # raise the output volume to max
92 | amixer set PCM 100%
93 |
94 | # play the file
95 | aplay output.wav
96 | ```
--------------------------------------------------------------------------------
/docs/matrix-lite/py-reference/everloop.md:
--------------------------------------------------------------------------------
1 |
Everloop
2 |
3 | ### Device Compatibility
4 |
5 |
6 |
7 | ## Overview
8 | The following sections below will go over how to control the LED array on your MATRIX Device.
9 |
10 | ## Import Statement
11 | ```py
12 | from matrix_lite import led
13 | ```
14 |
15 | ### led
16 |
17 | ???+ summary ".length"
18 | Returns the number of LEDs on a MATRIX device.
19 | ```py
20 | led.length
21 | ```
22 |
23 | ???+ summary ".set()"
24 | Allows you to set the colors of each LED. A `string`, `object`, `tuple` or `array` can be given to this function.
25 |
26 | ```py
27 | led.set('blue') # color name
28 | led.set('#0000ff') # hex values
29 | led.set({'r':0, 'g':0, 'b':255, 'w':0 }) # object
30 | led.set((0,0,255,0)) # tuple
31 | ```
32 |
33 | Passing in an array allows you to set each individual LED color. However, passing an array that's larger than `led.length` will result in an error.
34 | ```py
35 | led.set(['red', 'gold', (255,0,255,0), {}, 'black', '#6F41C1', 'blue', {'g':255}])
36 | ```
37 |
38 | ???+ example "Everloop Examples"
39 |
40 | ```py tab="LEDs blue"
41 | from matrix_lite import led
42 | # A single string or object sets all LEDs
43 | # Below are different ways of expressing the color blue (number values are from 0-255)
44 | led.set('blue')
45 | led.set('#0000ff')
46 | led.set({'r':0, 'g':0, 'b':255, 'w':0 }) # objects can set white
47 | led.set((0,0,255,0)) # tuples can set white
48 | ```
49 |
50 | ```py tab="LEDs off"
51 | from matrix_lite import led
52 | # Each line below is a valid way of turning the LEDs off
53 | led.set('black')
54 | led.set([])
55 | led.set()
56 | led.set({})
57 | ```
58 |
59 | ```py tab="Moving blue LED"
60 | from matrix_lite import led
61 | import time
62 |
63 | everloop = ['black'] * led.length
64 | everloop[0] = {'b':100}
65 |
66 | while True:
67 | everloop.append(everloop.pop(0))
68 | led.set(everloop)
69 | time.sleep(0.050)
70 | ```
71 |
72 | ```py tab="Rainbow"
73 | from matrix_lite import led
74 | from time import sleep
75 | from math import pi, sin
76 |
77 | everloop = ['black'] * led.length
78 |
79 | ledAdjust = 0.0
80 | if len(everloop) == 35:
81 | ledAdjust = 0.51 # MATRIX Creator
82 | else:
83 | ledAdjust = 1.01 # MATRIX Voice
84 |
85 | frequency = 0.375
86 | counter = 0.0
87 | tick = len(everloop) - 1
88 |
89 | while True:
90 | # Create rainbow
91 | for i in range(len(everloop)):
92 | r = round(max(0, (sin(frequency*counter+(pi/180*240))*155+100)/10))
93 | g = round(max(0, (sin(frequency*counter+(pi/180*120))*155+100)/10))
94 | b = round(max(0, (sin(frequency*counter)*155+100)/10))
95 |
96 | counter += ledAdjust
97 |
98 | everloop[i] = {'r':r, 'g':g, 'b':b}
99 |
100 | # Slowly show rainbow
101 | if tick != 0:
102 | for i in reversed(range(tick)):
103 | everloop[i] = {}
104 | tick -= 1
105 |
106 | led.set(everloop)
107 |
108 | sleep(.035)
109 | ```
--------------------------------------------------------------------------------
/docs/matrix-lite/py-reference/gpio.md:
--------------------------------------------------------------------------------
1 |
GPIO
2 |
3 | ### Device Compatibility
4 |
5 |
6 |
7 | ## Overview
8 | The following sections below will go over how to utilize the GPIO on your MATRIX Device. These functions affect `pins: 0-15`.
9 |
10 | ## Import Statement
11 | ```py
12 | from matrix_lite import gpio
13 | ```
14 |
15 | ### gpio
16 |
17 | ??? summary ".setFunction()"
18 |
19 | ```py
20 | # Valid ways of setting a pin as a digital pin
21 | gpio.setFunction(0, 'DIGITAL')
22 | gpio.setFunction(0, 0)
23 |
24 | # Valid ways of setting a pin as a PWM pin
25 | gpio.setFunction(0, 'PWM')
26 | gpio.setFunction(0, 1)
27 | ```
28 |
29 | ??? summary ".setMode()"
30 |
31 | ```py
32 | # Valid ways of setting a pin to receive input
33 | gpio.setMode(0, "input")
34 | gpio.setMode(0, 0)
35 |
36 | # Valid ways of setting a pin to allow output
37 | gpio.setMode(0, "output")
38 | gpio.setMode(0, 1)
39 | ```
40 |
41 | ??? summary ".getDigital()"
42 |
43 | ```py
44 | # Returns a 1 or 0 representing the ON/OFF state of a pin
45 | gpio.getDigital(0)
46 | ```
47 |
48 | ??? summary ".setDigital()"
49 |
50 | ```py
51 | # Controls the digital output of a pin
52 |
53 | # Valid ways of setting a pin to OFF
54 | gpio.setDigital(0,"OFF")
55 | gpio.setDigital(0,0)
56 |
57 | # Valid ways of setting a pin to ON
58 | gpio.setDigital(0,"ON")
59 | gpio.setDigital(0,1)
60 | ```
61 |
62 | ??? summary ".setPWM()"
63 |
64 | ```py
65 | # Controls the PWM output of a pin
66 | gpio.setPWM({
67 | "pin": 0,
68 | "percentage": 25,
69 | "frequency": 50,
70 | })
71 | ```
72 |
73 | ??? summary ".setServoAngle()"
74 |
75 | ```py
76 | # This function requires the pin to be set to "PWM" mode.
77 | gpio.setServoAngle({
78 | "pin": 0,
79 | "angle": 90,
80 | # min_pulse_ms (minimum pulse width for a PWM wave in milliseconds)
81 | "min_pulse_ms": 0.8,
82 | })
83 | ```
84 |
85 | ???+ example "GPIO examples"
86 |
87 | ```py tab="Read Pin"
88 | from matrix_lite import gpio
89 |
90 | # Configure pin 0
91 | gpio.setFunction(0, 'DIGITAL')
92 | gpio.setMode(0, 'input')
93 |
94 | # Read pin 0
95 | print(gpio.getDigital(0))
96 | ```
97 |
98 | ```py tab="Digital Output"
99 | from matrix_lite import gpio
100 |
101 | # Set pin 1 to be ON
102 | gpio.setFunction(1, 'DIGITAL')
103 | gpio.setMode(1, 'output')
104 | gpio.setDigital(1, 'ON')
105 |
106 | # Set pin 10 to be OFF
107 | gpio.setFunction(10, 'DIGITAL')
108 | gpio.setMode(10, 'output')
109 | gpio.setDigital(10, 'OFF')
110 | ```
111 |
112 | ```py tab="PWM Output"
113 | from matrix_lite import gpio
114 |
115 | # Set pin 2 to be output a PWM signal
116 | gpio.setFunction(2, 'PWM')
117 | gpio.setMode(2, 'output')
118 | gpio.setPWM({
119 | "pin": 2,
120 | "percentage": 25,
121 | "frequency": 50, # min 36
122 | })
123 | ```
124 |
125 | ```py tab="Set Servo"
126 | from matrix_lite import gpio
127 |
128 | # Tell pin 3 to set servo to 90 degrees
129 | gpio.setFunction(3, 'PWM')
130 | gpio.setMode(3, 'output')
131 | gpio.setServoAngle({
132 | "pin": 3,
133 | "angle": 90,
134 | # min_pulse_ms (minimum pulse width for a PWM wave in milliseconds)
135 | "min_pulse_ms": 0.8,
136 | })
137 | ```
--------------------------------------------------------------------------------
/docs/matrix-lite/py-reference/index.md:
--------------------------------------------------------------------------------
1 | ## Python Reference
2 |
3 |
2 |
3 | ### Device Compatibility
4 |
5 |
6 | ## Overview
7 | The following sections below will go over how to read & what to expect from each sensor on the MATRIX Creator.
8 |
9 | ## Import Statement
10 | ```python
11 | from matrix_lite import sensors
12 | ```
13 |
14 |
15 | ## Reading Sensor Data
16 | Sensor data can be read by calling `.read()` on a sensor object. This returns an object with the current sensor's values. Below are examples on how to call each sensor and what information to expect.
17 |
18 | ```python tab="IMU"
19 | sensors.imu.read()
20 |
21 | ## Example imu.read() output ##
22 | {
23 | accel_x: 0.0020000000949949026,
24 | accel_y: 0.004999999888241291,
25 | accel_z: 0.9819999933242798,
26 | gyro_x: 0.7770000100135803,
27 | gyro_y: -0.2460000067949295,
28 | gyro_z: 0.7250000238418579,
29 | yaw: -177.40724182128906,
30 | pitch: -0.11669033765792847,
31 | roll: 0.2917275130748749,
32 | mag_x: 0.5299999713897705,
33 | mag_y: -0.024000000208616257,
34 | mag_z: -0.05999999865889549
35 | }
36 | ```
37 |
38 | ```python tab="UV"
39 | sensors.uv.read()
40 |
41 | ## Example uv.read() output ##
42 | {
43 | uv: 0.013000000268220901
44 | }
45 | ```
46 |
47 | ```python tab="Humidity"
48 | sensors.humidity.read()
49 |
50 | ## Example humidity.read() output ##
51 | {
52 | humidity: 29.04400062561035,
53 | temperature: 33.279998779296875
54 | }
55 | ```
56 |
57 | ```python tab="Pressure"
58 | sensors.pressure.read()
59 |
60 | ## Example pressure.read() output ##
61 | {
62 | altitude: -47.4370002746582,
63 | pressure: 101896,
64 | temperature: 32.9370002746582
65 | }
66 | ```
67 |
--------------------------------------------------------------------------------
/docs/matrix-voice/device-setup.md:
--------------------------------------------------------------------------------
1 | ## Hardware Prerequisites
2 | * MATRIX Voice
3 | * Compatible Raspberry Pi:
4 | * 4 Model B
5 | * 3 Model B+
6 | * 3 Model B
7 | * 3 Model A+
8 | * 2 Model B
9 | * 1 Model B+
10 | * Zero
11 | * Zero W
12 | * 5V 2.5A Micro USB Power Supply
13 | * MicroSD Card with the latest version of Raspbian installed
14 | * We recommend using Etcher.io for easy flashing
15 |
16 | ## Device Installation
17 | 
18 |
Steps
19 |
20 | 1. Insert flashed microSD card into Raspberry Pi
21 | 2. Attach MATRIX Voice onto Raspberry Pi GPIO pins
22 | 3. Power Raspberry Pi with micro USB power supply
23 |
24 | > The yellow startup LED sequence (with 1 LED off) will be removed when a programming environment is installed.
25 |
26 | ## Choosing A Programming Environment
27 | After your MATRIX Voice is setup, visit [Ecosystem Overview](/#programming-layers) for information about the three programming environments available to you in the MATRIX platform.
28 |
29 | > All 3 programming environments are compatible with the MATRIX Voice & MATRIX Voice ESP32 version on a Raspberry Pi.
30 |
31 | ## ESP32 Setup
32 | Users with a MATRIX Voice ESP32 version can also follow this [guide](/matrix-voice/esp32) on how to program their ESP32 module.
--------------------------------------------------------------------------------
/docs/matrix-voice/img/3d-model-bottom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-voice/img/3d-model-bottom.png
--------------------------------------------------------------------------------
/docs/matrix-voice/img/3d-model-top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-voice/img/3d-model-top.png
--------------------------------------------------------------------------------
/docs/matrix-voice/img/esp32-1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-voice/img/esp32-1.jpg
--------------------------------------------------------------------------------
/docs/matrix-voice/img/esp32-2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-voice/img/esp32-2.gif
--------------------------------------------------------------------------------
/docs/matrix-voice/img/m-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-voice/img/m-1.png
--------------------------------------------------------------------------------
/docs/matrix-voice/img/m-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-voice/img/m-2.png
--------------------------------------------------------------------------------
/docs/matrix-voice/img/m-3.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-voice/img/m-3.gif
--------------------------------------------------------------------------------
/docs/matrix-voice/img/m-4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-voice/img/m-4.png
--------------------------------------------------------------------------------
/docs/matrix-voice/img/m-5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-voice/img/m-5.png
--------------------------------------------------------------------------------
/docs/matrix-voice/img/m-6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-voice/img/m-6.png
--------------------------------------------------------------------------------
/docs/matrix-voice/img/m-7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-voice/img/m-7.png
--------------------------------------------------------------------------------
/docs/matrix-voice/img/matrix-voice-back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-voice/img/matrix-voice-back.png
--------------------------------------------------------------------------------
/docs/matrix-voice/img/matrix-voice-esp32-back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-voice/img/matrix-voice-esp32-back.png
--------------------------------------------------------------------------------
/docs/matrix-voice/img/matrix-voice-system-architecture.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-voice/img/matrix-voice-system-architecture.png
--------------------------------------------------------------------------------
/docs/matrix-voice/img/mic_voice_position.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-voice/img/mic_voice_position.png
--------------------------------------------------------------------------------
/docs/matrix-voice/img/pio_example.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-voice/img/pio_example.gif
--------------------------------------------------------------------------------
/docs/matrix-voice/img/pio_home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-voice/img/pio_home.png
--------------------------------------------------------------------------------
/docs/matrix-voice/img/pio_ini.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-voice/img/pio_ini.png
--------------------------------------------------------------------------------
/docs/matrix-voice/img/pio_intro.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-voice/img/pio_intro.jpg
--------------------------------------------------------------------------------
/docs/matrix-voice/img/pio_open.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-voice/img/pio_open.png
--------------------------------------------------------------------------------
/docs/matrix-voice/img/pio_run.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-voice/img/pio_run.png
--------------------------------------------------------------------------------
/docs/matrix-voice/overview.md:
--------------------------------------------------------------------------------
1 | ## MATRIX Voice
2 |
3 | 
4 |
5 | The MATRIX Voice is a development board for building sound driven behaviors and interfaces. MATRIX Voice was built with a mission to give every maker, tinkerer, and developer around the world a complete, affordable, and user-friendly tool for simple to complex Internet of Things (IoT) voice app creation.
6 |
7 | ## Overview
8 |
9 |
19 | Look at common debugging solutions and test the hardware on your MATRIX Voice
20 |
21 | ## Board Versions
22 |
23 | Both versions of these boards run the same on a Raspberry Pi, however, the MATRIX Voice ESP32 version has the option to run standalone by programming the ESP32 module.
24 |
25 |  
--------------------------------------------------------------------------------
/docs/matrix-voice/resources/microphone.md:
--------------------------------------------------------------------------------
1 | ## Microphone Array on MATRIX Voice
2 | 
3 |
4 | ## Usage
5 |
Driver installation
6 | Follow the instructions below for allowing your MATRIX Voice to register as a microphone for your Raspberry Pi.
7 | ```bash
8 | curl https://apt.matrix.one/doc/apt-key.gpg | sudo apt-key add -
9 | echo "deb https://apt.matrix.one/raspbian $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/matrixlabs.list
10 | sudo apt-get update
11 | sudo apt-get upgrade
12 | ```
13 | A reboot will be required after the MATRIX packages above are installed.
14 | ```bash
15 | sudo reboot
16 | ```
17 | The next commands will install the MATRIX kernel modules, overriding the stock Raspbian kernel.
18 | ```bash
19 | sudo apt install matrixio-kernel-modules
20 | ```
21 | A second reboot will be required.
22 | ```bash
23 | sudo reboot
24 | ```
25 |
Check If Everything Works
26 | Your Raspberry Pi should now treat your MATRIX Voice as a regular microphone. You can test this by using the following commands to record and play a 5 second long audio file on your Raspberry Pi.
27 | > Be sure to have something connected to the Raspberry Pi's audio output.
28 | ```bash
29 | arecord recording.wav -f S16_LE -r 16000 -d 5
30 | aplay recording.wav
31 | ```
32 |
33 |
ALSA Configuration
34 | The microphones can be grabbed using ALSA. Multiple libraries that support ALSA use these configurations to read microphone data with ALSA.
35 |
36 | Device name - `hw:2,0`
37 |
38 | Rates(Hz) - `8000` `12000` `16000` `22050` `24000` `32000` `44100` `48000`
39 |
40 | Channels for each microphone - `1` `2` `3` `4` `5` `6` `7` `8`
41 |
42 | ## Audio specs
43 |
44 | **Sample Rate:** 8 to 96 kHz
45 |
46 | **Bit Depth:** Signed 16 bit
47 |
48 |
17 | {% for nav_child in nav_item.children %} {% if not nav_child.children %}
18 |
19 | {% if nav_child.title != 'Index' and nav_child.title != 'MATRIX OS' and nav_child.title != 'MATRIX HAL' and nav_child.title != 'MATRIX CORE' %}
20 |
31 | {% for nav_subchild in nav_child.children %} {% if nav_subchild.title != 'Index' and nav_subchild.title != 'Reference' and nav_subchild.title != 'Overview' and nav_subchild.title != 'Components' and nav_subchild.title != 'Examples' %}
32 | {% if nav_child.active or expand %}
33 |