IRPyro API  (sKEMLIB1)
Collection of routines and data structures covering the functionality of the IRPyro sensor
Getting Started

This section describes how to use the IRPyro API. It part one describe the use "as is" and part two describe the customization process of the GPIO, I2C and User modules for use with other micro controllers.

For information on the sensor itself see: "IRPyro Sensor Reference Manual.pdf"

Part 1: To use the firmware "as is" in the current configuration


Attention
The current set of files included with this release are customized for the STM32F303 family of MCUs

Software

Hardware

  • IRPyro breakout board . IRPYxxxxx -B1()or IRPyro sensors IRPYxxxxx.
  • Backplane Board Kit dIRBB01 based on Nucleo-32 STM32F303.
  • An MCU with support for I2C (http://www.i2c-bus.org/).

Note for IRPyro demo board users (See "IRPyro Sensor Reference Manual.pdf":3 Ordering Information)

@verbatim

The PCB is connected to the MCU as follows:

For an IRPyro demo board the SDA and SCL pins are located on PORTB: 7,6

For an IRPyro demo board the CS pins are located on PORTB: 1,5,4,3

For an IRPyro demo board the INT pins are located on PORTA: 4,5,6,7

IRPyro demo boards PIN assignments

  • SDA PORTB GPIO_Pin_7
  • SCL PORTB GPIO_Pin_6
  • U1 CS: PORTB GPIO_Pin_1 INT: PORTA GPIO_Pin_4
  • U2 CS: PORTB GPIO_Pin_5 INT: PORTA GPIO_Pin_5
  • U3 CS: PORTB GPIO_Pin_4 INT: PORTA GPIO_Pin_6
  • U4 CS: PORTB GPIO_Pin_3 INT: PORTA GPIO_Pin_7

Part 2: To use with own MCU

Software

Hardware

GPIO configuration

See Micro_controller_template.c

The MCU to be used should be capable of providing:

  • Two dedicated pins for I2C bus communication.
  • UART capability to send collected data to a serial terminal.

Optionally

  • One pin configured as an OUTPUT pin, to control the CS line and turn ON/OFF the IRPyro.
  • One pin configured as an INPUT pin to read the state of the INT pin, which to indicates when data is ready.
        IRPyro break out board PIN assignments (IRPYxxxxx-B1)

         VDD  -   pin 1      pin 2   - NC   
         SCL  -   pin 3      pin 4   - SDA  
         CS   -   pin 5      pin 6   - INT  
         SYNC -   pin 7      pin 8   - CLK  
         NC   -   pin 9      pin 10  - GND  

I2C configuration

See Micro_controller_template.c

  • Modify i2c_Init() to allow the chosen MCU to function as I2C master
  • Modify i2c_Read() to be able to perform a READ operation on a slave device on the I2C bus
  • Modify i2c_Write() to be able to perform a WRITE operation on a slave device on the I2C bus

Modify provided micro controller specific functions

See Micro_controller_template.c


Part 3: Run the examples in main.c

The example configure the sensor and collect data. A serial terminal like RealTerm or similar is useful to see the collected data.

USART configuration

A basic USART implementation allows the examples to send data to RealTerm using UART_stream_char_send() for plain text and UART_stream_binary_send()

The settings for serial communication are as follow:

            Baud Rate:           921600
            Parity:                None
            Data Bits:                8
            Stop Bits:                1
            Hardware Flow Control: None
            Software Flow Control: None

Plain text sampling data

Data collected can be seen as plain text of as a binary packet

Plain text:

FRAME #, 4750, CH, 0, 14252, 0, 0 SAT> 0

The packet starts with a consecutive frame number followed by the unsigned integer indicating the signal strength of the first active channel on the sensor. All the sensors are configured by the firmware with only channel 2 active, although there is space in the line for channels 1,3 and 4.

Binary format data package

Binary packet:

AA 02 0E 00 23 31 00 38 64 AA 02 0E 00 22 73 00 38 3C 00 26 7B 00 22 88 09 D4 00 55

   Byte Number   Byte Type        Byte Value      Description
       0         Packet Header      0xAA          Marker for start of packet.
       1         Data Type          0x02          Indicates that packet is of data type
       2         Number of Bytes    0x0E          Number of data bytes in packet. For this command, there are 14 bytes.
      3-5        First channel                    23 bit unsigned integer indicating signal strength
                 enabled
      6-8        Second channel                   23 bit unsigned integer indicating signal strength
                 enabled
      9-11       Third channel                    23 bit unsigned integer indicating signal strength
                 enabled
      12-14      Fourth channel                   23 bit unsigned integer indicating signal strength
                 enabled
      15-16      Frame counter                    16 bit unsigned integer
       17        Encoded saturation               8 bit unsigned integer (See note)
                 byte
      20    Packet Footer            0x55         Marker for the end of the packet.

Encoded saturation byte (1 saturated / 0 not saturated) Bit 0 indicates first channel active saturation status Bit 1 indicates second channel active saturation status Bit 2 indicates third channel active saturation status Bit 3 indicates fourth channel active saturation status

Examples

The following examples are included:

  • Collect data from a single sensor : read_sample_single_device()
  • Data collection from a multiple IRPyro sensors : read_sample_multiple_devices()
  • Change the parameters of a single running sensor: IOCTL_example()
  • Sleep/Wake up detection : wake_up_event_detection()