Advertisement

Quick Links

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the MIAC AIICode Series and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for Matrix MIAC AIICode Series

  • Page 2 Controlling The MIAC - Using Python Controlling The MIAC - Using Labview Transistor Outputs - Using PWM API Documentation - Input and Output API Documentation - Display and Relay API Documentation - Peripheral Copyright © 2017 Matrix Technology Solutions Limited www.matrixtsl.com...
  • Page 3: Getting Started

    The Pre-Programmed Firmware The original API firmware can be found on the AllCode section of the Matrix Website and can be re-programmed using the mLoader programming tool. Copyright © 2017 Matrix Technology Solutions Limited...
  • Page 4 DIN Rail Mounting Screw Hole Mounting Transistor Outputs x 4 Relay Outputs x 4 (High Speed) (Normally Open) (2 x DC motor Full H-Bridge) (Mains Rated) Bluetooth / WIFI communications module (Internally Fitted) Copyright © 2017 Matrix Technology Solutions Limited www.matrixtsl.com...
  • Page 5 MIAC. As an example, you might choose to use a Bluetooth enabled mobile phone to control the MIAC. Alternatively, a Wifi enabled PC/Mac/Raspberry Pi® or a Matrix E-block upstream board would do the same to create a simple controller. Copyright © 2017 Matrix Technology Solutions Limited...
  • Page 6 If you wanted to control all transistor outputs at once you could use this command. WriteTrans <value> The parameters <value> can take a value from 0 to 15 to define the binary state of the transistor outputs. Copyright © 2017 Matrix Technology Solutions Limited www.matrixtsl.com...
  • Page 7 Once you have expressed your ideas, using pseudo-code, you can move on and write the actual program using your chosen programming language, which should hopefully be a fairly simple coding task. Copyright © 2017 Matrix Technology Solutions Limited www.matrixtsl.com...
  • Page 8: Bluetooth Setup

    1234, although this can be changed to another code if you want to ensure no-one else can pair with your MIAC. Once the code has been entered, Windows will confirm that it has paired with the MIAC. Copyright © 2017 Matrix Technology Solutions Limited www.matrixtsl.com...
  • Page 9 Now you have paired the MIAC and determined the COM port number, you can use any of the many programming languages available on Windows to control the MIAC AllCode. Copyright © 2017 Matrix Technology Solutions Limited www.matrixtsl.com...
  • Page 10 The name of the MIAC AllCode can be found by using the MIAC keypad and navigating to the Configure menu followed by the Bluetooth Settings menu when powering up the MIAC. Copyright © 2017 Matrix Technology Solutions Limited www.matrixtsl.com...
  • Page 11 MIAC AllCode apps you download or create. Please note: This may be subtly different on your Android device. For specifics on your Phone or Tablet please look up how to pair Bluetooth devices for your specific device. Copyright © 2017 Matrix Technology Solutions Limited www.matrixtsl.com...
  • Page 12 MAC address, a unique identifier to the MIAC – in my case, “00:BA:55:23:1C:20”. Step 3 – Pair the MIAC with the RPi To pair, you can use the “bluez-simple-agent” command using the “hci0” and MAC address found in the previous steps. Copyright © 2017 Matrix Technology Solutions Limited www.matrixtsl.com...
  • Page 13 “username”!): sudo usermod -a -G dialout username You will then need to logout and log back in and the “ WriteRelay ” command should now work Copyright © 2017 Matrix Technology Solutions Limited www.matrixtsl.com...
  • Page 14 MIAC will display its local IP address you should use to connect to the MIAC. To communicate with the MIAC you will need to connect your controller (PC/Linux/Phone/Tablet/ etc) to the WIFI network and then use the IP address provided by the MIAC. Copyright © 2017 Matrix Technology Solutions Limited www.matrixtsl.com...
  • Page 15 As you probably know, Flowcode provides component macros for all complex devices like CAN bus, ZigBee, and the MIAC AllCode There are programs on the Matrix website to inspire and help you. https://www.matrixtsl.com/allcode/resources/ This section assumes you are familiar with the basics of using Flowcode. There are two ways of using Flowcode to control the MIAC AllCode.
  • Page 16 Note: Downloading code to the MIAC will remove the API functionality from the MIAC AllCode. Instructions on restoring the API firmware to get the MIAC back to the original factory functionality are provided on page 3. Copyright © 2017 Matrix Technology Solutions Limited www.matrixtsl.com...
  • Page 17 ‘AI Companion’ from the ‘Connect’ menu in App Inventor. 5. Download the MIAC AllCode template onto your computer by scanning the QR code or clicking the hyperlink. Remember where you saved them on your desktop/laptop. Copyright © 2017 Matrix Technology Solutions Limited www.matrixtsl.com...
  • Page 18 - a list of icons will appear. Drag the “when R1On.Click” icon onto your program. Do the same again but this time click on the ‘R1Off’ object. Repeat for the other switches. Copyright © 2017 Matrix Technology Solutions Limited www.matrixtsl.com...
  • Page 19 The mauve coloured icons relate to a set of procedures or subroutines that have been designed to perform certain tasks for you. You should not alter these unless you are an experienced App Inventor user. Copyright © 2017 Matrix Technology Solutions Limited www.matrixtsl.com...
  • Page 20 MatrixTSL to communicate with the MIAC. As will other languages, you need to use the COM port number or IP address that the MIAC is connected to. There are examples on the AllCode pages of the Matrix TSL website here: https://www.matrixtsl.com/allcode/resources/...
  • Page 21 As with the other languages, the calls to the AllCode API are very similar, meaning it is very easy to use the MIAC with different languages - assuming you know the basics of that language anyway! Copyright © 2017 Matrix Technology Solutions Limited www.matrixtsl.com...
  • Page 22: Using Python

    # Import the MIAC AllCode library ma = MA.Create() # Create an instance of the API ma.ComOpen(3) # Open the COM port ma.WriteRelay(1,1) # Switch On Relay 1 ma.ComClose() # Close the COM port Copyright © 2017 Matrix Technology Solutions Limited www.matrixtsl.com...
  • Page 23 We have shown only a few brief examples of how to control the MIAC AllCode using Python. If you look at the API reference at the end of this document you will find many other commands that can be used. Copyright © 2017 Matrix Technology Solutions Limited www.matrixtsl.com...
  • Page 24: Using Labview

    Using the MIAC AllCode with Labview is fairly easy and consists of using a library provided by MatrixTSL. First, download the library (which consists of a DLL and a LabView library file) from the Matrix TSL website: https://www.matrixtsl.com/allcode/resources/ To begin, create a new blank VI and then open the “MIAC_AllCode.lvlib”...
  • Page 25: Transistor Outputs

    Enable1 and C/D outputs also share their own unique PWM timer, prescaler and period. PWM duties are 16-bit by default with the range of 0 to 65535. The overall duty can be altered by changing the PWM period. Copyright © 2017 Matrix Technology Solutions Limited www.matrixtsl.com...
  • Page 26: Api Documentation

    Reads the binary values of all the input terminals Value = 0 to 255 Value ReadAnalogInput Channel Returns the analog value of one of the input terminals Channel = 1 to 8 Value = 0 to 1023 Copyright © 2017 Matrix Technology Solutions Limited www.matrixtsl.com...
  • Page 27 Brightness = 0 to 100 - 0=Off / 100=Brightest LCDVerbose Value Allows the LCD to be used to display the API calls as they are received Value = 0 to 1 - 0=Verbose Off / 1=Verbose On Copyright © 2017 Matrix Technology Solutions Limited www.matrixtsl.com...
  • Page 28 Value = 0 to 255 CommsBaud Baud Sets the speed of the alt communications bus Baud = 0 to 7 - 0=1200 / 1=2400 / 2=4800 / 3=9600 4=19200 / 5=38400 / 6=57600 / 7=115200 Copyright © 2017 Matrix Technology Solutions Limited www.matrixtsl.com...
  • Page 29 Matrix Technology Solutions Ltd. 33 Gibbet Street Halifax HX1 5BA t: +44 ( 0 ) 1422 252380 e: sales@matrixtsl.com www.matrixtsl.com CP8656...

Table of Contents