Skip to end of metadata
Go to start of metadata

By Ben Roloff

Table of Contents

 

Introduction

Maxim Integrated has designed an evaluation board for the Panasonic GridEye, the MAXREFDES131#-ND.  It doesn’t add anything new to the GridEye other than that it uses their 1-wire interface and some nice microcontroller shields, MAXREFDES130#-ND and MAXREFDES132#-ND.  The shields work on maxim microcontrollers and the Arduino platform.  They have examples out there for quick start up.  For this example I am using the MAXREFDES132# and an Arduino UNO.  The project uses simple gesture, swiping left, right, up, or down, to control a motor.

Getting Started

On the shield, MAXREFDES132#, you will have to make sure that you the jumper is off JP2.  Make sure the jumper on JP1 is on pins 2 and 3.  You will need to download the Arduino libraries for the OWGridEye and the OneWire.  You can add them to Arduino following the instructions here.  I have found inserting the libraries manually works the best. For the 1-wire connection you can use A2662R-07-ND.

The Program

The program I modified for this one is one of the example programs.  After it reads the sensors it finds the average for the x and y axis.  It then check to see what state it is in, by looking where it is above certain threshold on the x and y axis.  It has a left, right, up, down, and full state.  It then looks at the previous state and the current state.  From the states you can determine which way the hand is moving.  You can move the motor accordingly how you would like.

int xflag[8] = {0};
int yflag[8] = {0};
int countx1 = 0;
int county1 = 0;
int flagArray[10] = {0};
bool swipeLeft = false;
bool swipeRight = false;
bool swipeUp = false;
bool swipeDown = false;
int servoValue = 90;
int forward = 180;
int reverse = 0;
int speedChange = 0;

...

void gridEyeFx(OWGridEye & owGridEye)
{
    if(owGridEye.connectGridEye() == OWGridEye::Success)
    {
        
        int16_t pixelTemperature[64];
        uint8_t idx, idy;
        int i = 0;
        float rowx[8] = {0};
        float rowy[8] = {0};
        OWGridEye::CmdResult result = owGridEye.gridEyeGetFrameTemperature(pixelTemperature);
        if(result == OWGridEye::Success)
        {
            for(idx = 0; idx < 8; idx++)
            {
                for(idy = 0; idy < 8; idy++)
                {
                    rowy[i] += fAMG_PUB_CMN_ConvStoF(pixelTemperature[idx*8 + idy]);
                    rowx[i] += fAMG_PUB_CMN_ConvStoF(pixelTemperature[idx + idy*8]);
                }
                rowy[i] /= 8;
                rowx[i] /= 8;
                if (rowx[i] > 32)xflag[i] = 1;
                if (rowy[i] > 32)yflag[i] = 1;
                i++;
            } 

      for ( i = 0; i < 8; i++)
      {
        if(xflag[i] == 1)
        {
          countx1++;
        }
        if(yflag[i] == 1)
        {
          county1++;
        }
      }

      if(xflag[0] == 1 && countx1 < 7 && countx1 > 1) flagArray[0] = 1;
      if(xflag[7] == 1 && countx1 < 7 && countx1 > 1) flagArray[1] = 1;
      if(yflag[0] == 1 && county1 < 7 && county1 > 1) flagArray[2] = 1;
      if(yflag[7] == 1 && county1 < 7 && county1 > 1) flagArray[3] = 1;
      if(countx1 == 8 && county1 == 8)flagArray[4] = 1;

      if((flagArray[9] && flagArray[1])||(flagArray[5]&&(flagArray[4]||flagArray[1])))swipeLeft = true;
      if((flagArray[9] && flagArray[0])||(flagArray[6]&&(flagArray[4]||flagArray[0])))swipeRight = true;
      if((flagArray[9] && flagArray[3])||(flagArray[7]&&(flagArray[4]||flagArray[3])))swipeUp = true;
      if((flagArray[9] && flagArray[2])||(flagArray[8]&&(flagArray[4]||flagArray[2])))swipeDown = true;
        
      for (int j = 0; j < 8; j++)
      { 
        xflag[j] = 0;
        yflag[j] = 0;
      }

 
      if(swipeRight)
      {
        Serial.print("Swipe Right");
        Serial.println();
      }
      if(swipeLeft)
      {
        Serial.print("Swipe Left");
        Serial.println();
      }
      if(swipeUp)
      {
        Serial.print("Swipe Up");
        Serial.println();
      }
      if(swipeDown)
      {
        Serial.print("Swipe Down");
        Serial.println();
      } 
      
      countx1 = 0;
      county1 = 0;
      flagArray[5] = flagArray[0];
      flagArray[6] = flagArray[1];
      flagArray[7] = flagArray[2];
      flagArray[8] = flagArray[3];
      flagArray[9] = flagArray[4];
      flagArray[0] = 0;
      flagArray[1] = 0;
      flagArray[2] = 0;
      flagArray[3] = 0;
      flagArray[4] = 0;
      
        }
        else
        {
            Serial.println("GridEye Access Failed");
        }
    }
    else
    {
        Serial.println("GridEye Connect Failed");
    }
}

 

Conclusion

This adds more power to IR application.  You can do some gesture sensing, heat mapping, and even count the number of people.  There are more gesture sensing that is possible, as long as you are further from the sensor, you can pick out more shapes.  With the MAXREFDES130# board you have the ability to control home lighting or other appliances through the relays on the board.  Maxim's eval board makes it easy to get started with the Panasonic GridEye.

Video

You can watch a video of it running here.

  • No labels