in

MATRIX Core Setup – MATRIX Python Programming

What is MATRIX Core?

MATRIX Core is the layer that sandwiches in between the MATRIX OS and the MATRIX HAL. We can make use of MATRIX CORE to query sensors and control any MATRIX Device from any language that supports protocol buffers and 0MQ.

Things Needed

  • Raspberry Pi
  • Matrix Device
  • Micro SD Card
  • Active Internet Connection
  • A Power Adapter ( Min 2.3 Amp)
  • Camera (Optional)

Step 1 : Setting Up Raspberry Pi

Download and burn latest Raspbian image to a micro SD card and insert it into the raspberry Pi.

Now power it up with a power adapter that can provide at least 2.5 Ampere. Now fire up your terminal and create a password for the user ‘pi’ by executing the command

sudo passwd pi

Connect your Raspberry Pi to a WiFi router or Wired network and make sure it is connected by checking whether it is getting an IP address from the switch.

Now perform and update and upgrade by running

sudo apt update -ysudo apt upgrade -y

Step 2 : Connect MATRIX Device to Raspberry Pi

Now simply align the header pins and slowly connect the MATRIX device to your Raspberry Pi

Step 3 : Adding the key and repository

curl https://apt.matrix.one/doc/apt-key.gpg | sudo apt-key add -

echo "deb https://apt.matrix.one/raspbian $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/matrixlabs.list

Step 4 : Perform Update and Upgrade

sudo apt-get update

sudo apt-get upgrade

Step 5 : Installing the MATRIX Software

sudo apt-get install matrixio-malos

sudo reboot

Step 6 : Upgrade MATRIX Core Packages

sudo apt-get update
sudo apt-get upgrade
sudo reboot

Step 7 : Malos Service

Malos runs in the background as a service.

To get the Process ID of Malos,

sudo pgrep malos

This will give you the pid.

To kill the process,

sudo kill <pid>

or

sudo pkill -9 malos

To start Malos again,

malos &

Step 8 – Setting Up Python – Clone python examples to your Raspberry Pi

You can either use Java or Python to program in this layer. Here I will be using python. Now start by cloning python examples to your raspberry pi.

git clone https://github.com/matrix-io/matrix-creator-malos;
git submodule update --init;
cd matrix-creator-malos/src/python_test;

Step 9 – Install Python Packages and Dependencies

sudo apt-get install build-essential python-dev
pip install -r requirements.txt

Step 10 – Install MATRIX Core

echo "deb http://packages.matrix.one/matrix-creator/ ./" | sudo tee --append /etc/apt/sources.list
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install matrix-creator-init matrix-creator-malos cmake g++ git libzmq3-dev --no-install-recommends
reboot

Testing

Now go inside the directory and start running python scripts

python test_driver_info.py

python test_everloop.py

python test_gpio_read_write.py

Rate the Project

Did you find this page useful? Help us to improve by rating this page.

Rating
MATRIX Core Setup - MATRIX Python Programming Overall rating: 4.6 out of 5 based on 76 reviews.

 

 

What do you think?

0 points
Upvote Downvote

Total votes: 0

Upvotes: 0

Upvotes percentage: 0.000000%

Downvotes: 0

Downvotes percentage: 0.000000%

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Loading…

Comments

comments

MATRIX HAL Setup Raspberry Pi and Demo Scripts

MATRIX Voice Detection PocketSphinx on Raspberry Pi