├── .gitignore ├── .travis.yml ├── Dockerfile ├── README.md ├── deploy-key.enc ├── docs ├── help.md ├── img │ ├── E14.svg │ ├── Github.svg │ ├── community.png │ ├── creator-icon.svg │ ├── docs.png │ ├── hackster.png │ ├── m-11.jpg │ ├── m-4.jpg │ ├── matrix-creator-system-architecture-expanded.png │ ├── matrix-creator.png │ ├── matrix-voice.png │ ├── voice-icon.svg │ └── youtube.png ├── index.md ├── matrix-core │ ├── getting-started │ │ ├── core-installation.md │ │ ├── golang-installation.md │ │ ├── index.md │ │ ├── javascript-installation.md │ │ ├── python-installation.md │ │ └── understanding-core.md │ ├── img │ │ ├── core-flow.jpg │ │ ├── creator-icon.svg │ │ ├── golang-mascot.png │ │ ├── install-setup-test.gif │ │ ├── nodejs-logo.png │ │ ├── python-logo.png │ │ ├── voice-esp32-icon.svg │ │ └── voice-icon.svg │ ├── javascript-examples │ │ ├── everloop.md │ │ ├── gpio.md │ │ ├── humidity.md │ │ ├── imu.md │ │ ├── index.md │ │ ├── pressure.md │ │ ├── servo.md │ │ ├── uv.md │ │ └── wakeword.md │ ├── overview.md │ ├── protocols │ │ ├── everloop.md │ │ ├── gpio.md │ │ ├── humidity.md │ │ ├── imu.md │ │ ├── index.md │ │ ├── pressure.md │ │ ├── servo.md │ │ ├── uv.md │ │ └── wakeword.md │ ├── python-examples │ │ ├── everloop.md │ │ ├── gpio.md │ │ ├── humidity.md │ │ ├── imu.md │ │ ├── index.md │ │ ├── pressure.md │ │ ├── servo.md │ │ ├── uv.md │ │ └── wakeword.md │ └── troubleshooting.md ├── matrix-creator │ ├── device-setup.md │ ├── img │ │ ├── 3d-model-bottom.png │ │ ├── 3d-model-top.png │ │ ├── MATRIX Creator PF Back.png.png │ │ ├── creator-icon.svg │ │ ├── creator-printed-case.jpg │ │ ├── ir-locations.png │ │ ├── m-1.png │ │ ├── m-2.png │ │ ├── m-3.gif │ │ ├── m-6.png │ │ ├── m-7.png │ │ ├── m-8.png │ │ ├── matrix-creator-system-architecture.png │ │ ├── matrix-voice-diagram.png │ │ ├── mcu_d48_led.jpg │ │ ├── mcu_led_modify.png │ │ ├── mic_creator_position.png │ │ ├── voice-icon.svg │ │ └── voice_arch.png │ ├── overview.md │ ├── resources │ │ ├── fpga.md │ │ ├── ir.md │ │ ├── mcu.md │ │ ├── microphone.md │ │ ├── overview.md │ │ ├── pinout.md │ │ ├── reference-models.md │ │ ├── system-architecture.md │ │ ├── technical-datasheets.md │ │ └── verilogCheatSheet.md │ └── troubleshooting.md ├── matrix-hal │ ├── examples │ │ ├── everloop.md │ │ ├── gpio.md │ │ ├── humidity.md │ │ ├── imu.md │ │ ├── index.md │ │ ├── microphone.md │ │ ├── nfc.md │ │ ├── pressure.md │ │ └── uv.md │ ├── getting-started │ │ ├── index.md │ │ ├── installation-nfc.md │ │ ├── installation-package.md │ │ ├── installation-source.md │ │ └── programs.md │ ├── img │ │ ├── creator-icon.svg │ │ ├── creator-pinout-v2.png │ │ ├── everloop_green.jpg │ │ ├── everloop_moving_dots.gif │ │ ├── everloop_rainbow.gif │ │ ├── everloop_yellow_purple.jpg │ │ ├── matrix-creator-alexa.png │ │ ├── matrix-creator-back.png │ │ ├── matrix-creator-extgpio-pinout.png │ │ ├── matrix-creator-front.png │ │ ├── matrix-creator-rpgpio-pinout.png │ │ ├── matrix-voice-back.png │ │ ├── matrix-voice-diagram.png │ │ ├── matrix-voice-extpio-pinout.png │ │ ├── matrix-voice-rpgpio-pinout.png │ │ ├── matrix-voice-top.png │ │ ├── matrixlabs_creator_block.jpg │ │ ├── mic_creator_position.png │ │ ├── mic_voice_position.png │ │ ├── nxp_download_link.png │ │ ├── pn512_library.png │ │ ├── pn512_zip.png │ │ ├── voice-icon.svg │ │ └── voice_arch.png │ ├── overview.md │ ├── reference │ │ ├── everloop.md │ │ ├── gpio.md │ │ ├── humidity.md │ │ ├── imu.md │ │ ├── index.md │ │ ├── microphone.md │ │ ├── nfc.md │ │ ├── pressure.md │ │ └── uv.md │ └── troubleshooting.md ├── matrix-lite │ ├── getting-started │ │ ├── go.md │ │ ├── index.md │ │ ├── javascript.md │ │ └── python.md │ ├── go-reference │ │ ├── alsa-mics.md │ │ ├── everloop.md │ │ ├── gpio.md │ │ ├── index.md │ │ └── sensors.md │ ├── img │ │ └── everloop_rainbow.gif │ ├── js-reference │ │ ├── alsa.md │ │ ├── everloop.md │ │ ├── gpio.md │ │ ├── index.md │ │ ├── info.md │ │ ├── nfc.md │ │ └── sensors.md │ ├── overview.md │ └── py-reference │ │ ├── alsa-mics.md │ │ ├── everloop.md │ │ ├── gpio.md │ │ ├── index.md │ │ ├── nfc.md │ │ └── sensors.md └── matrix-voice │ ├── device-setup.md │ ├── esp32.md │ ├── img │ ├── 3d-model-bottom.png │ ├── 3d-model-top.png │ ├── esp32-1.jpg │ ├── esp32-2.gif │ ├── m-1.png │ ├── m-2.png │ ├── m-3.gif │ ├── m-4.png │ ├── m-5.png │ ├── m-6.png │ ├── m-7.png │ ├── matrix-voice-back.png │ ├── matrix-voice-esp32-back.png │ ├── matrix-voice-system-architecture.png │ ├── mic_voice_position.png │ ├── pio_example.gif │ ├── pio_home.png │ ├── pio_ini.png │ ├── pio_intro.jpg │ ├── pio_open.png │ ├── pio_run.png │ └── voice-icon.svg │ ├── overview.md │ ├── resources │ ├── fpga.md │ ├── microphone.md │ ├── overview.md │ ├── pinout.md │ ├── reference-models.md │ ├── system-architecture.md │ └── technical-datasheets.md │ └── troubleshooting.md ├── matrix ├── __init__.py ├── base.html ├── css │ ├── clipboard.css │ ├── codehilite.css │ ├── details.css │ ├── superFences.css │ └── theme.css ├── footer.html ├── img │ ├── brazil.png │ ├── clippy.svg │ ├── english.png │ ├── everloop.png │ ├── favicon.ico │ ├── matrix.png │ ├── overview-diagram.png │ ├── search.svg │ └── spain.png ├── js │ ├── clipboard.min.js │ ├── footer.js │ ├── jquery.ajaxchimp.langs.min.js │ ├── jquery.ajaxchimp.min.js │ └── theme.js ├── main.html ├── nav.html ├── search.html ├── sidebar.html └── toc.html ├── mkdocs.yml ├── myFile.pd ├── new_rpi.md ├── package-lock.json ├── package.json └── requirements.txt /.gitignore: -------------------------------------------------------------------------------- 1 | site 2 | .DS_Store 3 | env/ 4 | .vscode 5 | *.icloud -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | python: 3 | - '2.7' 4 | 5 | branches: 6 | only: 7 | - master 8 | 9 | install: 10 | - pip install -r requirements.txt 11 | 12 | script: 13 | - openssl aes-256-cbc -K $encrypted_cf83979854f7_key -iv $encrypted_cf83979854f7_iv -in deploy-key.enc -out /tmp/deploy-key -d 14 | - eval "$(ssh-agent -s)" 15 | - chmod 600 /tmp/deploy-key 16 | - ssh-add /tmp/deploy-key 17 | - git remote add gh-token "git@github.com:matrix-io/matrix-documentation.git"; 18 | - git fetch gh-token && git fetch gh-token gh-pages:gh-pages; 19 | - if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then echo "Pushing to github"; PYTHONPATH=src/ mkdocs gh-deploy -v --clean --remote-name gh-token; git push gh-token gh-pages; fi; 20 | 21 | notifications: 22 | email: false 23 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:2.7 2 | 3 | WORKDIR /volume 4 | 5 | RUN mkdir -p /volume 6 | COPY requirements.txt /volume 7 | RUN pip install --upgrade -r requirements.txt 8 | 9 | EXPOSE 8000 10 | 11 | CMD ["mkdocs", "serve"] 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Overview 2 | 3 | MATRIX Documentation uses [MkDocs](http://www.mkdocs.org/) to format and compile Markdown into an HTML site. Choose one of the following setups to start writing documentation. 4 | 5 | # Development Setup (Python 2.7) 6 | 7 | > Install [pip](https://pip.pypa.io/) and [virtualenv](https://virtualenv.pypa.io/) on your computer. 8 | 9 | Create and start a Python virtual environment. 10 | 11 | ``` 12 | virtualenv env 13 | source env/bin/activate 14 | ``` 15 | 16 | Install the required dependencies. 17 | 18 | ``` 19 | pip install --upgrade -r requirements.txt 20 | ``` 21 | 22 | Serve the documentation locally at http://localhost:8000. 23 | 24 | ``` 25 | mkdocs serve 26 | ``` 27 | 28 | # Docker Development Setup 29 | 30 | > [Install Docker](https://docs.docker.com/v17.12/install/) on your computer. 31 | 32 | Download and move into the MATRIX docs. 33 | 34 | ``` 35 | git clone https://github.com/matrix-io/matrix-documentation 36 | cd matrix-documentation 37 | ``` 38 | 39 | Create the Docker image. 40 | 41 | ``` 42 | docker build -t matrix_docs -f Dockerfile . 43 | ``` 44 | 45 | Start a Docker container and serve the recently downloaded docs. 46 | 47 | 48 | 49 | ``` 50 | docker run -p 8000:8000 -v `pwd`/.:/volume matrix_docs 51 | ``` 52 | 53 | You can now go to http://localhost:8000 to view the docs. 54 | 55 | # Deployment To GitHub Pages 56 | 57 | The **master** branch will automatically be built and pushed to GitHub Pages. 58 | -------------------------------------------------------------------------------- /deploy-key.enc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/deploy-key.enc -------------------------------------------------------------------------------- /docs/help.md: -------------------------------------------------------------------------------- 1 | ## Support & Resources 2 | Feel free to visit our communities and projects for any suggestions and/or questions you may have! 3 | 4 |

Post questions or comments on community.matrix.one.

5 | 6 |

7 | Submit documentation issues or improvements to the MATRIX Documentation Repository.

8 | 9 |

Check out our Hackster projects and guides on our Hackster Page.

10 | 11 |

Follow our live streams and tutorial videos on YouTube.

12 | 13 | 14 |

View blog posts & project guides on our element14 page.

15 | 16 |

17 | Alert issues on our GitHub under the corresponding repository.

-------------------------------------------------------------------------------- /docs/img/E14.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/img/Github.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 11 | 12 | 14 | 15 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /docs/img/community.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/img/community.png -------------------------------------------------------------------------------- /docs/img/docs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/img/docs.png -------------------------------------------------------------------------------- /docs/img/hackster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/img/hackster.png -------------------------------------------------------------------------------- /docs/img/m-11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/img/m-11.jpg -------------------------------------------------------------------------------- /docs/img/m-4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/img/m-4.jpg -------------------------------------------------------------------------------- /docs/img/matrix-creator-system-architecture-expanded.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/img/matrix-creator-system-architecture-expanded.png -------------------------------------------------------------------------------- /docs/img/matrix-creator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/img/matrix-creator.png -------------------------------------------------------------------------------- /docs/img/matrix-voice.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/img/matrix-voice.png -------------------------------------------------------------------------------- /docs/img/youtube.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/img/youtube.png -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | # MATRIX Ecosystem Overview 2 |
Objective: Hardware shouldn't be hard
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 |

Post questions or comments on community.matrix.one.

10 | 11 |

12 | Submit documentation issues or improvements to the MATRIX Documentation Repository.

13 | 14 |

Check out our Hackster projects and guides on our Hackster Page.

15 | 16 |

Follow our live streams and tutorial videos on YouTube.

17 | 18 |

View blog posts & project guides on our element14 page.

19 | 20 |

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 |

Installation

4 | Learn how to install MATRIX CORE on your MATRIX Device. 5 | 6 |

Understanding CORE

7 | Understand how MATRIX CORE uses ZeroMQ to communicate with Protocol Buffers. 8 |

9 | ## Programming Languages 10 | 11 |

Javascript Setup

12 | Use Javascript to program with MATRIX CORE. 13 | 14 |

Python Setup

15 | Use Python to program with MATRIX CORE. 16 | 17 |

Golang Setup

18 | Use Golang to program with MATRIX CORE. -------------------------------------------------------------------------------- /docs/matrix-core/img/core-flow.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-core/img/core-flow.jpg -------------------------------------------------------------------------------- /docs/matrix-core/img/golang-mascot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-core/img/golang-mascot.png -------------------------------------------------------------------------------- /docs/matrix-core/img/install-setup-test.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-core/img/install-setup-test.gif -------------------------------------------------------------------------------- /docs/matrix-core/img/nodejs-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-core/img/nodejs-logo.png -------------------------------------------------------------------------------- /docs/matrix-core/img/python-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/docs/matrix-core/img/python-logo.png -------------------------------------------------------------------------------- /docs/matrix-core/javascript-examples/index.md: -------------------------------------------------------------------------------- 1 | ## Javascript Examples 2 |

Everloop

3 | LED interface. 4 | 5 |

Humidity

6 | Humidity and temperature measurement. 7 | 8 |

IMU

9 | Inertial Measurement Unit. 10 | 11 |

Pressure

12 | Pressure, altitude and temperature measurement. 13 | 14 |

UV

15 | Ultraviolet light sensor. 16 | 17 |

Servo

18 | Adjust servo positions. 19 | 20 |

GPIO

21 | General Purpose Input/Output. 22 | 23 | -------------------------------------------------------------------------------- /docs/matrix-core/javascript-examples/pressure.md: -------------------------------------------------------------------------------- 1 |

Pressure

2 |

Javascript Example

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 | *

Javascript

17 | *

Python

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 |

General Purpose Input Output (GPIO)

2 | 3 | ### Device Compatibility 4 | 5 | 6 | 7 | ## Overview 8 | 9 | The GPIO driver supports:Available ZeroMQ Ports 21 | * `Base port`: 20049 22 | * `Keep-alive port`: 20050 23 | * `Error port`: 20051 24 | * `Data Update port`: 20052 25 | 26 | ## Protocol 27 | 28 | 29 | ???+ info "Base Port" 30 | This port accepts 3 configuration for communicating with the GPIO driver. 31 | 32 | * `delay_between_updates` - controls the output speed of messages from the **Data Update port**. 33 | 34 | * `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. 35 | 36 | * `gpio` - the gpio configuration that's created from a `GpioParams` message. 37 | 38 | ```protobuf 39 | message DriverConfig { 40 | // Delay between updates in seconds 41 | float delay_between_updates = 1; 42 | // Timeout after last ping 43 | float timeout_after_last_ping = 2; 44 | // Gpio service configuration 45 | matrix_io.malos.v1.io.GpioParams gpio = 8; 46 | } 47 | ``` 48 | View the defined message here. 49 | 50 | `GpioParams` 51 | 52 | * `pin` - Selects the pin you want to use on your MATRIX device. 53 | 54 | * `EnumMode` - Determines input or output mode for GPIO pins. 55 | 56 | * `value` - Set as 1 or 0 to signify on/off. 57 | 58 | > Each `pin` will save its last set `value` until the next device boot. 59 | 60 | ```protobuf 61 | // GPIO handler params 62 | message GpioParams { 63 | // GPIO to config 64 | uint32 pin = 1; 65 | 66 | // GPIO mode input/output 67 | enum EnumMode { 68 | INPUT = 0; 69 | OUTPUT = 1; 70 | } 71 | EnumMode mode = 2; 72 | 73 | // GPIO value 74 | uint32 value = 3; 75 | } 76 | ``` 77 | View the defined message here. 78 | 79 | 80 | ???+ info "Keep-alive Port" 81 | 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. 82 | 83 | 84 | ???+ info "Error Port" 85 | Applications can subscribe to this port to receive driver related errors. 86 | 87 | 88 | ???+ info "Data Update Port" 89 | Applications can subscribe to this port for GPIO data. The output will be a serialized message of type `GpioParams` with the following information. 90 | ```protobuf 91 | // GPIO handler params 92 | message GpioParams { 93 | // Integer to represent all pin values (Convert to 16bit for readability) 94 | uint32 values = 4; 95 | } 96 | ``` 97 | View the defined message here. -------------------------------------------------------------------------------- /docs/matrix-core/protocols/humidity.md: -------------------------------------------------------------------------------- 1 |

Humidity

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 |

Inertial Measurement Unit (IMU)

2 | 3 | ### Device Compatibility 4 | 5 | 6 | ## Overview 7 | 8 | The IMU driver reports values for: 9 | 10 | * Yaw, Pitch, and Roll 11 | * Acceleration for **x**, **y**, **z** axes 12 | * Gyroscope for **x**, **y**, **z** axes 13 | * Magnetometer for **x**, **y**, **z** axes 14 | 15 |

Available ZeroMQ Ports

16 | * `Base port`: 20013 17 | * `Keep-alive port`: 20014 18 | * `Error port`: 20015 19 | * `Data Update port`: 20016 20 | 21 | ## Protocol 22 | 23 | ???+ info "Base Port" 24 | This port accepts 2 configurations for communicating with the IMU driver. 25 | 26 | * `delay_between_updates` - controls the output speed of messages from the **Data Update port**. 27 | 28 | * `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. 29 | 30 | ```protobuf 31 | message DriverConfig { 32 | // Delay between updates in seconds 33 | float delay_between_updates = 1; 34 | // Timeout after last ping 35 | float timeout_after_last_ping = 2; 36 | ``` 37 | View the defined message here. 38 | 39 | 40 | ???+ info "Keep-alive Port" 41 | 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. 42 | 43 | 44 | ???+ info "Error Port" 45 | Applications can subscribe to this port to receive driver related errors. 46 | 47 | 48 | ???+ info "Data Update Port" 49 | Applications can subscribe to this port for IMU data. The output will be a serialized message of type `Imu` with the following information. 50 | ```protobuf 51 | message Imu { 52 | //Vertical axis (yaw) 53 | float yaw = 1; 54 | 55 | //Lateral axis (pitch) 56 | float pitch = 2; 57 | 58 | //Longitudinal axis (roll) 59 | float roll = 3; 60 | 61 | // Acceleration 62 | float accel_x = 4; 63 | float accel_y = 5; 64 | float accel_z = 6; 65 | 66 | // Gyroscope 67 | float gyro_x = 7; 68 | float gyro_y = 8; 69 | float gyro_z = 9; 70 | 71 | // Magnetometer 72 | float mag_x = 10; 73 | float mag_y = 11; 74 | float mag_z = 12; 75 | } 76 | ``` 77 | View the defined message here. -------------------------------------------------------------------------------- /docs/matrix-core/protocols/index.md: -------------------------------------------------------------------------------- 1 | ## Driver Protocols 2 |

Everloop

3 | LED interface. 4 | 5 |

Humidity

6 | Humidity and temperature measurement. 7 | 8 |

IMU

9 | Inertial Measurement Unit. 10 | 11 |

Pressure

12 | Pressure, altitude and temperature measurement. 13 | 14 |

UV

15 | Ultraviolet light sensor. 16 | 17 |

Servo

18 | Adjust servo positions. 19 | 20 |

GPIO

21 | General Purpose Input/Output. 22 | 23 | -------------------------------------------------------------------------------- /docs/matrix-core/protocols/pressure.md: -------------------------------------------------------------------------------- 1 |

Pressure

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 |

Everloop

3 | LED interface. 4 | 5 |

Humidity

6 | Humidity and temperature measurement. 7 | 8 |

IMU

9 | Inertial Measurement Unit. 10 | 11 |

Pressure

12 | Pressure, altitude and temperature measurement. 13 | 14 |

UV

15 | Ultraviolet light sensor. 16 | 17 |

Servo

18 | Adjust servo positions. 19 | 20 |

GPIO

21 | General Purpose Input/Output. 22 | 23 | -------------------------------------------------------------------------------- /docs/matrix-core/python-examples/servo.md: -------------------------------------------------------------------------------- 1 |

Servo

2 |

Python 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 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 | ![](./img/m-3.gif) 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 | ![](img/m-2.png) 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 |

Device Setup

9 | How to get started with your MATRIX Creator 10 | 11 |

Resources

12 | View and download helpful information about the MATRIX Creator 13 | 14 |

Troubleshooting

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 | ![IR Locations](../img/ir-locations.png) 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 | ![Mic Position](../img/mic_creator_position.png) 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 |

Position [x,y] of each mic in the array (mm)

49 | 50 | | Mic | X | Y | 51 | | ---- | ----------- | ----------- | 52 | | M1 | 20.0908795 | -48.5036755 | 53 | | M2 | -20.0908795 | -48.5036755 | 54 | | M3 | -48.5036755 | -20.0908795 | 55 | | M4 | -48.5036755 | 20.0908795 | 56 | | M5 | -20.0908795 | 48.5036755 | 57 | | M6 | 20.0908795 | 48.5036755 | 58 | | M7 | 48.5036755 | 20.0908795 | 59 | | M8 | 48.5036755 | -20.0908795 | 60 | 61 |

Connection to the FPGA

62 | 63 | You can check the physical connection between the FPGA and other components in 64 | creator.ucf 65 | 66 | | Mic | FPGA pin | PDM_Data | 67 | | ---- | ----------- | ----------- | 68 | | M1 | P45 | pdm_data<0> | 69 | | M2 | P46 | pdm_data<1> | 70 | | M3 | P47 | pdm_data<2> | 71 | | M4 | P58 | pdm_data<3> | 72 | | M5 | P59 | pdm_data<4> | 73 | | M6 | P64 | pdm_data<5> | 74 | | M7 | P65 | pdm_data<6> | 75 | | M8 | P44 | pdm_data<7> | 76 | | CLK | P47 | pdm_clk | 77 | -------------------------------------------------------------------------------- /docs/matrix-creator/resources/overview.md: -------------------------------------------------------------------------------- 1 | ## Resources 2 | 3 |

Pinout

4 | Lists and labels of the MATRIX Creator's Pinouts 5 | 6 |

Microphones

7 | Microphone drivers, sample rate, and board position 8 | 9 |

IR

10 | General information on the infrared receiver and transmitters. 11 | 12 |

Reference Models

13 | Download or view the Matrix Creator's 3D models and case 14 | 15 |

System Architecture

16 | View a technical diagram of the MATRIX Creator architecture. 17 | 18 |

Technical Datasheets

19 | PDFs of MATRIX Creator Components 20 | 21 |

MCU

22 | Microcontroller source and flashing guide 23 | 24 |

FPGA

25 | FPGA source and flashing guide -------------------------------------------------------------------------------- /docs/matrix-creator/resources/pinout.md: -------------------------------------------------------------------------------- 1 | ## Expansion GPIO 2 | ![](../img/m-6.png) 3 | 4 | - Rev 1 Boards do not include pin 25 & 26. Rev 2 boards can be identified if there is a QR code sticker on the MATRIX Creator's face. 5 | ## Raspberry Pi GPIO 6 | ![](../img/m-7.png) 7 | 8 | ## GPIO Locations 9 | ![](../img/m-8.png) 10 | 11 | -------------------------------------------------------------------------------- /docs/matrix-creator/resources/reference-models.md: -------------------------------------------------------------------------------- 1 | ## Board Model 2 |

Top View

3 | ![Creator Top Image](../img/3d-model-top.png) 4 | 5 |

Bottom View

6 | ![Creator Back Image](../img/3d-model-bottom.png) 7 | 8 |

Model Download

9 | Access to 3D models here. Also, you can take a look online 10 | here. 11 | 12 | ## Case Model 13 |

Printed Case

14 | ![Creator Case Image](../img/creator-printed-case.jpg) 15 | 16 |

Model Download

17 | Access to 3D case models here. 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/matrix-creator/resources/system-architecture.md: -------------------------------------------------------------------------------- 1 | ## System Architecture 2 | ### Overview 3 | ![](../img/matrix-creator-system-architecture.png) 4 | 5 | ### Expanded Overview 6 | ![](../../img/matrix-creator-system-architecture-expanded.png) 7 | -------------------------------------------------------------------------------- /docs/matrix-creator/resources/technical-datasheets.md: -------------------------------------------------------------------------------- 1 | ## Datasheets: 2 | 3 | * [Atmel 32 bits Cortex M3 SAM3S2](http://www.atmel.com/Images/Atmel-6500-32-bit-Cortex-M3-Microcontroller-SAM3S4-SAM3S2-SAM3S1_Datasheet.pdf) 4 | 5 | * [Xilinx Spartan 6S XC6SLX4 FPGA](http://www.xilinx.com/support/documentation/data_sheets/ds160.pdf) 6 | 7 | * [8 MEMS audio sensor digital microphones](https://www1.iodparts.com/datasheets/stmicroelectronics-microphones-dm00111225.pdf) 8 | 9 | * [ST LSM9DS1 3D accelerometer, 3D gyroscope, 3D magnetometer](http://www.st.com/content/ccc/resource/technical/document/datasheet/1e/3f/2a/d6/25/eb/48/46/DM00103319.pdf/files/DM00103319.pdf/jcr:content/translations/en.DM00103319.pdf) 10 | 11 | * [ST HTS221 digital sensor for relative humidity and temperature](http://www.st.com/content/ccc/resource/technical/document/datasheet/4d/9a/9c/ad/25/07/42/34/DM00116291.pdf/files/DM00116291.pdf/jcr:content/translations/en.DM00116291.pdf) 12 | 13 | * [NXP PN512 NFC reader](https://www.nxp.com/documents/data_sheet/PN512.pdf) 14 | 15 | * [NXP MPL3115A2 Altimeter](http://cache.freescale.com/files/sensors/doc/data_sheet/MPL3115A2.pdf) 16 | 17 | * [Vishay VEML6070 UV Light Sensor](http://www.vishay.com/docs/84277/veml6070.pdf) 18 | 19 | * [Vishay INFRARED Receptor](http://www.vishay.com/docs/82450/tsop573.pdf) 20 | 21 | * [RGBW everloop LED](http://blinkinlabs.com/wp-content/uploads/2016/01/SK6812RGBW-datasheet.pdf) 22 | 23 | -------------------------------------------------------------------------------- /docs/matrix-hal/examples/humidity.md: -------------------------------------------------------------------------------- 1 |

Humidity

2 |

HAL Example

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 |

Everloop

23 | LED interface. 24 | 25 |

Humidity

26 | Humidity and temperature measurement. 27 | 28 |

IMU

29 | Inertial Measurement Unit. 30 | 31 |

Pressure

32 | Pressure, altitude and temperature measurement. 33 | 34 |

UV

35 | Ultraviolet light sensor. 36 | 37 |

GPIO

38 | General Purpose Input/Output. 39 | 40 |

Microphone

41 | Microphone Array. 42 | 43 |

NFC

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 |

Installation From Package 8 |

9 | Learn how to install MATRIX HAL from package. 10 | 11 |

Installation From Source 12 |

13 | Learn how to install MATRIX HAL from source. 14 | 15 |

Compiling Your Program 16 |

17 | Create and compile a sample program for your MATRIX device. 18 | 19 |

Installing HAL NFC 20 |

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 | ![](../img/nxp_download_link.png) 17 | 18 | Click the `4.04.05 NFC Reader Library for PN512`. 19 | 20 | ![](../img/pn512_library.png) 21 | 22 | Then click `SW297940.zip` to download `NFC Reader Library v4.040.05 R2 for PNEV512B including all software examples`. 23 | 24 | ![](../img/pn512_zip.png) 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 | ![](/matrix-hal/img/everloop_rainbow.gif) 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 |

Everloop

4 | LED interface. 5 | 6 |

Humidity

7 | Humidity and temperature measurement. 8 | 9 |

IMU

10 | Inertial Measurement Unit. 11 | 12 |

Pressure

13 | Pressure, altitude and temperature measurement. 14 | 15 |

UV

16 | Ultraviolet light sensor. 17 | 18 |

GPIO

19 | General Purpose Input/Output. 20 | 21 |

Microphone

22 | Microphone Array. 23 | 24 |

NFC

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 |

Prerequisite MATRIX HAL

2 | 3 | > Make sure you have installed [MATRIX HAL](/matrix-hal/getting-started/), before continuing. 4 | 5 | ## Go Setup 6 | 7 | Install Go. 8 | ```bash 9 | sudo apt-get install golang 10 | ``` 11 | 12 | Create a project folder. 13 | ```langauge-bash 14 | mkdir lite_go 15 | cd lite_go 16 | go mod init myapp 17 | touch main.go 18 | ``` 19 | 20 | Download the matrix-lite-go package. 21 | ```bash 22 | go get -u github.com/matrix-io/matrix-lite-go 23 | ``` 24 | 25 | ## Creating An Application 26 | 27 | Copy our Hello World example below into `main.go` to test your installation. 28 | 29 | ```go 30 | package main 31 | 32 | import ( 33 | "math" 34 | "time" 35 | 36 | "github.com/matrix-io/matrix-lite-go" 37 | ) 38 | 39 | func main() { 40 | m := matrix.Init() 41 | everloop := make([]matrix.RGBW, m.Led.Length) 42 | 43 | ledAdjust := 0.0 44 | if len(everloop) == 35 { 45 | ledAdjust = 0.51 // MATRIX Creator 46 | } else { 47 | ledAdjust = 1.01 // MATRIX Voice 48 | } 49 | 50 | frequency := 0.375 51 | counter := 0.0 52 | tick := len(everloop) - 1 53 | 54 | for { 55 | 56 | // Create rainbow 57 | for i, led := range everloop { 58 | led.R = uint8(math.Max(0, (math.Sin(frequency*counter+(math.Pi/180*240))*155+100)/10)) 59 | led.G = uint8(math.Max(0, (math.Sin(frequency*counter+(math.Pi/180*120))*155+100)/10)) 60 | led.B = uint8(math.Max(0, (math.Sin(frequency*counter)*155+100)/10)) 61 | 62 | counter += ledAdjust 63 | 64 | everloop[i] = led 65 | } 66 | 67 | // Slowly show rainbow 68 | if tick != 0 { 69 | for i := tick; i > 0; i-- { 70 | everloop[i] = matrix.RGBW{} 71 | } 72 | tick-- 73 | } 74 | 75 | m.Led.Set(everloop) 76 | time.Sleep(35 * time.Millisecond) 77 | 78 | } 79 | } 80 | ``` 81 | 82 |

Running main.go

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 | ![](/matrix-lite/img/everloop_rainbow.gif) 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 |

JavaScript Setup

4 | Learn how to install and setup Node.js with MATRIX Lite. 5 | 6 |

Python Setup

7 | Learn how to install and setup Python 3 with MATRIX Lite. 8 | 9 |

Go Setup

10 | Learn how to install and setup Go with MATRIX Lite. -------------------------------------------------------------------------------- /docs/matrix-lite/getting-started/javascript.md: -------------------------------------------------------------------------------- 1 |

Prerequisite MATRIX HAL

2 | 3 | 4 | 5 | > Make sure you have installed [MATRIX HAL](/matrix-hal/getting-started/), before continuing. 6 | 7 | ## JavaScript Setup 8 | 9 | Install Node.js 10 | ```bash 11 | curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash 12 | . ~/.bashrc 13 | nvm install 13 14 | ``` 15 | 16 | Create a project folder. 17 | ```bash 18 | mkdir lite_js 19 | cd lite_js 20 | npm init -y 21 | touch index.js 22 | ``` 23 | 24 | Download the matrix-lite-js package. 25 | ```bash 26 | npm install @matrix-io/matrix-lite --save 27 | ``` 28 | 29 | ## Creating An Application 30 | 31 | Copy our Hello World example below into `index.js` to test your installation. 32 | 33 | ```js 34 | const matrix = require("@matrix-io/matrix-lite"); 35 | 36 | let everloop = new Array(matrix.led.length); 37 | 38 | let ledAdjust = 0.0; 39 | if (everloop.length == 35) { 40 | ledAdjust = 0.51; // MATRIX Creator 41 | } else { 42 | ledAdjust = 1.01; // MATRIX Voice 43 | } 44 | 45 | let frequency = 0.375; 46 | let counter = 0.0; 47 | let tick = everloop.length - 1; 48 | 49 | setInterval(()=>{ 50 | // Create rainbow 51 | for(i = 0; i < everloop.length; i++) { 52 | let led = {}; 53 | led.r = Math.round(Math.max(0, (Math.sin(frequency*counter+(Math.PI/180*240))*155+100)/10)); 54 | led.g = Math.round(Math.max(0, (Math.sin(frequency*counter+(Math.PI/180*120))*155+100)/10)); 55 | led.b = Math.round(Math.max(0, (Math.sin(frequency*counter)*155+100)/10)); 56 | 57 | counter += ledAdjust; 58 | 59 | everloop[i] = led; 60 | }; 61 | 62 | // Slowly show rainbow 63 | if (tick != 0) { 64 | for (i = tick; i > 0; i--) { 65 | everloop[i] = {}; 66 | } 67 | tick--; 68 | } 69 | 70 | matrix.led.set(everloop); 71 | 72 | },35); 73 | ``` 74 | 75 |

Running index.js

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 | ![](/matrix-lite/img/everloop_rainbow.gif) 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 | ![](/matrix-lite/img/everloop_rainbow.gif) 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 |

GoDoc

4 | Auto-generated documentation. 5 | 6 |

Everloop

7 | Interface for the LED array. 8 | 9 |

Sensors

10 | Reading data from the IMU, humidity, UV, and pressure sensors. 11 | 12 |

GPIO

13 | General Purpose Input/Output. 14 | 15 | -------------------------------------------------------------------------------- /docs/matrix-lite/go-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 | ```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 |

Everloop

3 | Interface for the LED array. 4 | 5 |

Sensors

6 | Reading data from the IMU, humidity, UV, and pressure sensors. 7 | 8 |

GPIO

9 | General Purpose Input/Output. 10 | 11 |

ALSA

12 | Audio management through the use of ALSA. 13 | 14 |

Info

15 | Information about your MATRIX device. 16 | 17 |

NFC

18 | Read & Write to NFC tags. 19 | -------------------------------------------------------------------------------- /docs/matrix-lite/js-reference/info.md: -------------------------------------------------------------------------------- 1 |

Info

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 |

Everloop

4 | Interface for the LED array. 5 | 6 |

Sensors

7 | Reading data from the IMU, humidity, UV, and pressure sensors. 8 | 9 |

GPIO

10 | General Purpose Input/Output. 11 | 12 |

ALSA Microphones

13 | Reading microphone data through ALSA. 14 | 15 |

NFC

16 | Read & Write to NFC tags. 17 | -------------------------------------------------------------------------------- /docs/matrix-lite/py-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 | ```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 | ![](./img/m-3.gif) 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 | ![](img/m-2.png) 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 |

Device Setup

10 | How to get started with your MATRIX Voice & MATRIX Voice ESP32 version 11 | 12 |

ESP32

13 | Instructions to setup your ESP32 module 14 | 15 |

Resources

16 | View and download helpful information about the MATRIX Voice 17 | 18 |

Troubleshooting

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 | ![](img/matrix-voice-back.png) ![](img/matrix-voice-esp32-back.png) -------------------------------------------------------------------------------- /docs/matrix-voice/resources/microphone.md: -------------------------------------------------------------------------------- 1 | ## Microphone Array on MATRIX Voice 2 | ![Mic Position](../img/mic_voice_position.png) 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 |

Position [x,y] of each mic in the array (mm)

49 | 50 | | Mic | X | Y | 51 | | ---- | ----------- | ----------- | 52 | | M1 | 00.00 | 0.00 | 53 | | M2 | -38.13 | 3.58 | 54 | | M3 | -20.98 | 32.04 | 55 | | M4 | 11.97 | 36.38 | 56 | | M5 | 35.91 | 13.32 | 57 | | M6 | 32.81 | -19.77 | 58 | | M7 | 5.00 | -37.97 | 59 | | M8 | -26.57 | -27.58 | 60 | 61 |

Connection to the FPGA

62 | 63 | | Mic | FPGA pin | PDM_Data | 64 | | ---- | ----------- | ----------- | 65 | | M1 | E6 | pdm_data<0> | 66 | | M2 | B8 | pdm_data<1> | 67 | | M3 | A8 | pdm_data<2> | 68 | | M4 | C7 | pdm_data<3> | 69 | | M5 | A7 | pdm_data<4> | 70 | | M6 | A6 | pdm_data<5> | 71 | | M7 | B6 | pdm_data<6> | 72 | | M8 | A5 | pdm_data<7> | 73 | | CLK | B5 | pdm_clk | 74 | -------------------------------------------------------------------------------- /docs/matrix-voice/resources/overview.md: -------------------------------------------------------------------------------- 1 | ## Resources 2 | 3 |

Pinout

4 | Lists and labels of the MATRIX Voice's Pinouts 5 | 6 |

Microphones

7 | Microphone drivers, sample rate, and board position 8 | 9 |

Reference Models

10 | Download or view the Matrix Voice's 3D models 11 | 12 |

System Architecture

13 | View a technical diagram of the MATRIX Voice architecture 14 | 15 |

Technical Datasheets

16 | PDFs of MATRIX Creator Components 17 | 18 |

FPGA

19 | FPGA source and flashing guide -------------------------------------------------------------------------------- /docs/matrix-voice/resources/pinout.md: -------------------------------------------------------------------------------- 1 | ## Expansion GPIO 2 | ![](../img/m-4.png) 3 | 4 | ## Raspberry Pi GPIO 5 | ![](../img/m-5.png) 6 | 7 | ## GPIO Locations 8 | ![](../img/m-6.png) ![](../img/m-7.png) 9 | 10 | 11 | -------------------------------------------------------------------------------- /docs/matrix-voice/resources/reference-models.md: -------------------------------------------------------------------------------- 1 | ## Board Model 2 |

Top View

3 | ![Voice Top Image](../img/3d-model-top.png) 4 | 5 |

Bottom View

6 | ![Voice Back Image](../img/3d-model-bottom.png) 7 | 8 |

Model Download

9 | Access to 3D models here. Also, you can take a look online 10 | here. -------------------------------------------------------------------------------- /docs/matrix-voice/resources/system-architecture.md: -------------------------------------------------------------------------------- 1 | ## System Architecture 2 | ![](../img/matrix-voice-system-architecture.png) -------------------------------------------------------------------------------- /docs/matrix-voice/resources/technical-datasheets.md: -------------------------------------------------------------------------------- 1 | ## Datasheets: 2 | 3 | * [Xilinx Spartan 6 FPGA - XC6SLX9-2FTG256C](http://www.xilinx.com/support/documentation/data_sheets/ds160.pdf) 4 | 5 | * [8 MEMS audio sensor digital microphones - MP34DB02](https://www1.iodparts.com/datasheets/stmicroelectronics-microphones-dm00111225.pdf) 6 | 7 | * [Serial Flash 64MBIT - MX25L6406E](http://www.macronix.com/Lists/Datasheet/Attachments/6681/MX25L6406E,%203V,%2064Mb,%20v1.9.pdf) 8 | 9 | * [DDR2 SDRAM 512MBIT - MT47H32M16](http://www.micron.com/~/media/Documents/Products/Data%20Sheet/DRAM/DDR2/512MbDDR2.pdf) 10 | 11 | * [3W Stereo Class-D Audio Amplifier and Class-AB Headphone Driver - PAM8019](https://www.diodes.com/assets/Datasheets/PAM8019.pdf) 12 | 13 | * [RGBW LED - SK6812RGBW](http://blinkinlabs.com/wp-content/uploads/2016/01/SK6812RGBW-datasheet.pdf) 14 | 15 | * [ESP32-WROOM](http://espressif.com/sites/default/files/documentation/esp-wroom-32_datasheet_en.pdf) 16 | 17 | -------------------------------------------------------------------------------- /matrix/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/matrix/__init__.py -------------------------------------------------------------------------------- /matrix/css/clipboard.css: -------------------------------------------------------------------------------- 1 | /* Copy buttons */ 2 | a.copybtn { 3 | webkit-transition: opacity .3s ease-in-out; 4 | -o-transition: opacity .3s ease-in-out; 5 | transition: opacity .3s ease-in-out; 6 | opacity: .5; 7 | padding: 5px 8px; 8 | position: absolute; 9 | right: 4px; 10 | top: 4px; 11 | background-color: #cccccd; 12 | box-shadow: 0px 4px 0px 0px grey; 13 | } 14 | 15 | div.codehilite .copybtn:hover { 16 | opacity: 1; 17 | } 18 | 19 | div.codehilite { 20 | position: relative; 21 | } 22 | 23 | /* copied notification */ 24 | .tooltip { 25 | position: relative; 26 | display: inline-block; 27 | } 28 | 29 | .copy-success{ 30 | margin-top: 4px; 31 | box-shadow: none !important; 32 | background-color: white; 33 | } -------------------------------------------------------------------------------- /matrix/css/superFences.css: -------------------------------------------------------------------------------- 1 | .superfences-tabs { 2 | display: flex; 3 | position: relative; 4 | flex-wrap: wrap; 5 | box-sizing: border-box; 6 | box-shadow: 0 2px 2px 0 rgba(0,0,0,.14), 0 1px 5px 0 rgba(0,0,0,.12), 0 3px 1px -2px rgba(0,0,0,.2); 7 | max-width: 100%; 8 | border-radius: .2rem; 9 | margin-bottom: 20px; 10 | } 11 | 12 | .superfences-tabs label:hover { 13 | color: #7f7f7f; 14 | /* border-bottom: 2px solid #7f7f7f; */ 15 | } 16 | 17 | .superfences-content .codehilite pre { 18 | margin-bottom: 0; 19 | } 20 | 21 | .superfences-tabs .highlight { 22 | background: #ddd; 23 | } 24 | 25 | .superfences-content{ 26 | background-color: #141414; 27 | } 28 | 29 | .superfences-tabs .superfences-content { 30 | display: none; 31 | order: 99; 32 | width: 100%; 33 | border-top: 1px solid #CCC; 34 | } 35 | 36 | .superfences-tabs label { 37 | margin: 0; 38 | width: auto; 39 | cursor: pointer; 40 | font-size: 1.28rem; 41 | padding: 1.2rem 1.6rem; 42 | } 43 | 44 | .superfences-tabs input { 45 | position: absolute; 46 | opacity: 0; 47 | } 48 | 49 | .superfences-tabs input:nth-child(n+1) { 50 | color: #333333; 51 | } 52 | 53 | .superfences-tabs input:nth-child(n+1):checked + label { 54 | color: #2F80ED; 55 | } 56 | 57 | .superfences-tabs input:nth-child(n+1):checked + label + .superfences-content { 58 | display: block; 59 | } 60 | 61 | .superfences-tabs .highlight { 62 | background: #ddd; 63 | } 64 | 65 | .superfences-tabs .superfences-content { 66 | display: none; 67 | order: 99; 68 | width: 100%; 69 | } 70 | 71 | .superfences-tabs label { 72 | width: auto; 73 | margin: 0; 74 | padding: 0.9em; 75 | font-size: 1rem; 76 | cursor: pointer; 77 | } 78 | 79 | .superfences-tabs input { 80 | position: absolute; 81 | opacity: 0; 82 | } 83 | 84 | .superfences-tabs input:nth-child(n+1) { 85 | color: #333333; 86 | } 87 | 88 | .superfences-tabs input:nth-child(n+1):checked + label { 89 | color: #2F80ED; 90 | border-bottom: 2px solid #2F80ED; 91 | } 92 | 93 | .superfences-tabs input:nth-child(n+1):checked + label + .superfences-content { 94 | display: block; 95 | } 96 | 97 | .superfences-tabs .codehilite { 98 | margin-bottom: 0; 99 | } 100 | 101 | -------------------------------------------------------------------------------- /matrix/footer.html: -------------------------------------------------------------------------------- 1 | 91 | -------------------------------------------------------------------------------- /matrix/img/brazil.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/matrix/img/brazil.png -------------------------------------------------------------------------------- /matrix/img/clippy.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /matrix/img/english.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/matrix/img/english.png -------------------------------------------------------------------------------- /matrix/img/everloop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/matrix/img/everloop.png -------------------------------------------------------------------------------- /matrix/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/matrix/img/favicon.ico -------------------------------------------------------------------------------- /matrix/img/matrix.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/matrix/img/matrix.png -------------------------------------------------------------------------------- /matrix/img/overview-diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/matrix/img/overview-diagram.png -------------------------------------------------------------------------------- /matrix/img/search.svg: -------------------------------------------------------------------------------- 1 | 2 | Vector.svg 3 | Created using Figma 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /matrix/img/spain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/matrix/img/spain.png -------------------------------------------------------------------------------- /matrix/js/footer.js: -------------------------------------------------------------------------------- 1 | (function($) { 2 | $.ajaxChimp.translations.us = { 3 | 'submit': 'Submitting...', 4 | 0: 'Thank you. We have sent you a confirmation e-mail.', 5 | 1: 'Please enter a value.', 6 | 2: 'An email address must contain a single @.', 7 | 3: 'The domain portion of the email address is invalid (the portion after the @: ).', 8 | 4: 'The username portion of the email address is invalid (the portion before the @: ).', 9 | 5: 'This email address looks fake or invalid. Please enter a real email address.' 10 | }; 11 | 12 | $('#newsletter-form').ajaxChimp({ 13 | url: 'https://admobilize.us6.list-manage.com/subscribe/post?u=456538565a6b42a1ca52edfd2&id=a9216adb2d', 14 | language: 'us', 15 | callback: function(respnse) { 16 | $('#newsletter-form').find('.warning').each(function() { 17 | $(this).removeClass('warning'); 18 | }); 19 | 20 | if(respnse.msg[0] == '0') { 21 | $('#newsletter-form').find('#newsletter-email').addClass('warning'); 22 | } 23 | } 24 | }); 25 | })(jQuery); 26 | -------------------------------------------------------------------------------- /matrix/js/jquery.ajaxchimp.langs.min.js: -------------------------------------------------------------------------------- 1 | (function($){"use strict";$.ajaxChimp.translations={it:{submit:"Registrazione in corso...",0:"Ti abbiamo inviato una mail di conferma",1:"Per favore inserisci una mail",2:"Un indirizzo valido contiene una sola @",3:"Il dominio della tua mail non è valido (la porzione dopo la @: )",4:"Il nome della mail non è valido (la porzione prima della @: )",5:"L'indirizzo email sembra finto o non valido: per favore inseriscine uno reale"},de:{submit:"Senden...",0:"Wir haben Ihnen eine Bestätigungs-E-Mail geschickt",1:"Bitte geben Sie Ihre E-Mail-Adresse ein",2:"Eine E-Mail-Adresse muss ein @ enthalten",3:"Der Domain-Teil der E-Mail-Adresse ist ungültig (der Teil nach dem @)",4:"Der Benutzername der E-Mail-Adresse ist ungültig (der Teil vor dem @)",5:"Diese E-Mail-Adresse scheint gefälscht oder ungültig zu sein. Bitte geben Sie eine echte E-Mail-Adresse an!"},pl:{submit:"Wysyłanie...",0:"Email z potwierdzeniem został wysłany",1:"Proszę podać adres email",2:"Adres email musi zawierać jeden znak @",3:"Część adresu z domeną jest niepoprawna (część po znaku @: )",4:"Część adresu z użytkownikiem jest niepoprawna (część przed znakiem @: )",5:"Ten adres wygląda na nieprawdziwy lub niepoprawny. Proszę podać prawdziwy adres email."},es:{submit:"Grabación en curso...",0:"Te hemos enviado un email de confirmación",1:"Por favor, introduzca un valor",2:"Una dirección de correo electrónico debe contener una sola @",3:"La parte de dominio de la dirección de correo electrónico no es válida (la parte después de la @:)",4:"La parte de usuario de la dirección de correo electrónico no es válida (la parte antes de la @:)",5:"Esta dirección de correo electrónico se ve falso o no válido. Por favor, introduce una dirección de correo electrónico real"},fr:{submit:"Enregistrement en cours...",0:"Nous vous avons envoyé un e-mail de confirmation",1:"S'il vous plaît entrer une valeur",2:"Une adresse e-mail doit contenir un seul @",3:"La partie domaine de l'adresse e-mail n'est pas valide (la partie après le @:)",4:"La partie nom d'utilisateur de l'adresse email n'est pas valide (la partie avant le signe @:)",5:"Cette adresse e-mail semble faux ou non valides. S'il vous plaît entrer une adresse email valide"}}})(jQuery); -------------------------------------------------------------------------------- /matrix/js/jquery.ajaxchimp.min.js: -------------------------------------------------------------------------------- 1 | (function($){"use strict";$.ajaxChimp={responses:{"We have sent you a confirmation email":0,"Please enter a value":1,"An email address must contain a single @":2,"The domain portion of the email address is invalid (the portion after the @: )":3,"The username portion of the email address is invalid (the portion before the @: )":4,"This email address looks fake or invalid. Please enter a real email address":5},translations:{en:null},init:function(selector,options){$(selector).ajaxChimp(options)}};$.fn.ajaxChimp=function(options){$(this).each(function(i,elem){var form=$(elem);var email=form.find("input[type=email]");var label=form.find("label[for="+email.attr("id")+"]");var settings=$.extend({url:form.attr("action"),language:"en"},options);var url=settings.url.replace("/post?","/post-json?").concat("&c=?");form.attr("novalidate","true");email.attr("name","EMAIL");form.submit(function(){var msg;function successCallback(resp){if(resp.result==="success"){msg="We have sent you a confirmation email";label.removeClass("error").addClass("valid");email.removeClass("error").addClass("valid")}else{email.removeClass("valid").addClass("error");label.removeClass("valid").addClass("error");var index=-1;try{var parts=resp.msg.split(" - ",2);if(parts[1]===undefined){msg=resp.msg}else{var i=parseInt(parts[0],10);if(i.toString()===parts[0]){index=parts[0];msg=parts[1]}else{index=-1;msg=resp.msg}}}catch(e){index=-1;msg=resp.msg}}if(settings.language!=="en"&&$.ajaxChimp.responses[msg]!==undefined&&$.ajaxChimp.translations&&$.ajaxChimp.translations[settings.language]&&$.ajaxChimp.translations[settings.language][$.ajaxChimp.responses[msg]]){msg=$.ajaxChimp.translations[settings.language][$.ajaxChimp.responses[msg]]}label.html(msg);label.show(2e3);if(settings.callback){settings.callback(resp)}}var data={};var dataArray=form.serializeArray();$.each(dataArray,function(index,item){data[item.name]=item.value});$.ajax({url:url,data:data,success:successCallback,dataType:"jsonp",error:function(resp,text){console.log("mailchimp ajax submit error: "+text)}});var submitMsg="Submitting...";if(settings.language!=="en"&&$.ajaxChimp.translations&&$.ajaxChimp.translations[settings.language]&&$.ajaxChimp.translations[settings.language]["submit"]){submitMsg=$.ajaxChimp.translations[settings.language]["submit"]}label.html(submitMsg).show(2e3);return false})});return this}})(jQuery); -------------------------------------------------------------------------------- /matrix/js/theme.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | //Clipboard.js integration\\ 3 | if (ClipboardJS.isSupported()){ 4 | var allCodeBlocksElements = $( "div.codehilite pre" ); 5 | 6 | // For each element, do the following steps 7 | allCodeBlocksElements.each(function(ii) { 8 | // define a unique id for this element and add it 9 | var currentId = "codeblock" + (ii + 1); 10 | $(this).attr('id', currentId); 11 | 12 | // create the button just after the text in the code block 13 | var clipButton = 'Copy to clipboard'; 14 | $(this).after(clipButton); 15 | }); 16 | 17 | var clipboard = new ClipboardJS(".btn"); 18 | 19 | clipboard.on("success", (event)=> { 20 | // find button html element 21 | var buttonIndex = event.trigger.dataset.clipboardTarget.replace(/[^0-9]/g,'')-1; 22 | var copyButton = $(".copybtn:eq("+buttonIndex+")"); 23 | 24 | // button click animation 25 | copyButton.addClass("copy-success"); 26 | setTimeout(function(){copyButton.removeClass("copy-success");},100); 27 | 28 | // show copy notification 29 | if(copyButton.attr("allow-copy-notify") === "true"){ 30 | copyButton.tooltip({trigger: "click"}); 31 | copyButton.attr("allow-copy-notify", false); 32 | copyButton.tooltip("hide").attr("data-original-title", "copied!").tooltip("show"); 33 | 34 | // remove copy notification 35 | setTimeout(function() { 36 | copyButton.tooltip("hide"); 37 | copyButton.css("background-color","#cccccd"); 38 | copyButton.attr("allow-copy-notify", true); 39 | }, 1000); 40 | } 41 | 42 | // prevent copy notification spam 43 | copyButton.tooltip().off(); 44 | 45 | // prevent code block from being highlighted 46 | event.clearSelection(); 47 | }); 48 | } 49 | 50 | //Drop Down Submenu Menu\\ 51 | $('.dropdown-submenu a.submenu').on("mouseover", function (e) { 52 | $('.dropdown-submenu > ul').hide(); 53 | $(this).next('ul').toggle(); 54 | e.stopPropagation(); 55 | e.preventDefault(); 56 | }); 57 | 58 | //User Scroll Tracking\\ 59 | let latchY = 0 60 | let caught = false; 61 | let t; 62 | 63 | $('html').on('mousewheel', function (e) { 64 | let pos = document.getElementsByClassName('toc')[0].getClientRects()[0]; 65 | 66 | if (!caught && window.scrollY > latchY && pos.top < 100) { 67 | // find roughly where the top of this thing is 68 | latchY = window.scrollY; 69 | $('.toc').addClass('float'); 70 | caught = true 71 | } else if (caught && window.scrollY < latchY) { 72 | latchY = 0; 73 | caught = false; 74 | $('.toc').removeClass('float'); 75 | } 76 | }); 77 | }); -------------------------------------------------------------------------------- /matrix/main.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {# 4 | The entry point for the ReadTheDocs Theme. 5 | 6 | Any theme customisations should override this file to redefine blocks defined in 7 | the various templates. The custom theme should only need to define a main.html 8 | which `{% extends "base.html" %}` and defines various blocks which will replace 9 | the blocks defined in base.html and its included child templates. 10 | #} -------------------------------------------------------------------------------- /matrix/nav.html: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /matrix/search.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block extrahead %} 4 | 5 | 6 | {% endblock %} 7 | 8 | {% block content %} 9 | 19 | {% endblock %} 20 | -------------------------------------------------------------------------------- /matrix/sidebar.html: -------------------------------------------------------------------------------- 1 | {% if expand or nav_item.children %} 2 | 3 | 4 | 5 | 6 | 7 | {% if not nav_item.children[0].url %} {% set nav_url = nav_item.children[0].children[0].url %} {% else %} {% set nav_url = nav_item.children[0].url %} {% endif %} 8 | 9 | 10 |
  • 11 | 12 | {{ nav_item.title }} 13 | 14 |
  • 15 | 16 | 39 | 40 | {% else %} 41 | 42 | 43 | {% if not nav_item.url %} {% if not nav_item.children[0].url %} {% set nav_url = nav_item.children[0].children[0].url %} {% else %} {% set nav_url = nav_item.children[0].url %} {% endif %} {% else %} {% set nav_url = nav_item.url %} {% endif %} 44 | 45 | 46 |
  • 47 | 48 | {{ nav_item.title }} 49 | 50 |
  • 51 | 52 | 53 | {% endif %} -------------------------------------------------------------------------------- /matrix/toc.html: -------------------------------------------------------------------------------- 1 | 17 | -------------------------------------------------------------------------------- /myFile.pd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-io/matrix-documentation/c12e5cdd0dc8f1ac2b214a4cc38fa971314be5d8/myFile.pd -------------------------------------------------------------------------------- /new_rpi.md: -------------------------------------------------------------------------------- 1 | Image New Card 2 | Copy known_hosts 3 | 4 | 5 | ``` 6 | echo "deb http://packages.matrix.one/matrix-creator/ ./" | sudo tee --append /etc/apt/sources.list; 7 | sudo apt-get update; 8 | sudo apt-get upgrade; 9 | sudo apt-get install -y libzmq3-dev xc3sprog malos-eye matrix-creator-malos matrix-creator-openocd oh-my-zsh wiringpi matrix-creator-init cmake g++ git --force-yes; 10 | sudo apt-get install -y npm; 11 | npm install -g n 12 | npm install -g node-gyp 13 | n 6.5 14 | 15 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "matrix-documentation", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1 5 | } 6 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "matrix-documentation", 3 | "version": "1.0.0", 4 | "description": "MATRIX Documentation uses [MkDocs](http://www.mkdocs.org/) to format and compile Markdown into a HTML site.", 5 | "directories": { 6 | "doc": "docs" 7 | }, 8 | "scripts": { 9 | "deploy": "mkdocs gh-deploy --clean", 10 | "watch": "nodemon -e md,yml,html,css,js,json -i site --exec mkdocs build", 11 | "surge": "surge site matrix-docs.surge.sh" 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "git+https://github.com/matrix-io/matrix-documentation.git" 16 | }, 17 | "author": "", 18 | "license": "ISC", 19 | "bugs": { 20 | "url": "https://github.com/matrix-io/matrix-documentation/issues" 21 | }, 22 | "homepage": "https://github.com/matrix-io/matrix-documentation#readme" 23 | } 24 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | Markdown==3.1.1 2 | mkdocs==0.16.3 3 | mkdocs-material==0.2.4 4 | Pygments==2.4.2 5 | pymdown-extensions==6.0 6 | 7 | ## pip list output (in case something breaks) ## 8 | # backports-abc 0.5 9 | # Click 7.0 10 | # futures 3.2.0 11 | # htmlmin 0.1.12 12 | # Jinja2 2.10.1 13 | # livereload 2.6.1 14 | # Markdown 3.1.1 15 | # markdown-fenced-code-tabs 1.0.5 16 | # MarkupSafe 1.1.1 17 | # mkdocs 0.16.3 18 | # mkdocs-material 0.2.4 19 | # pip 19.1.1 20 | # Pygments 2.4.2 21 | # pymdown-extensions 6.0 22 | # PyYAML 5.1.1 23 | # setuptools 41.0.1 24 | # singledispatch 3.4.0.3 25 | # six 1.12.0 26 | # tornado 5.1.1 27 | # wheel 0.33.4 --------------------------------------------------------------------------------