element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Remote Monitoring & Control
  • Challenges & Projects
  • Project14
  • Remote Monitoring & Control
  • More
  • Cancel
Remote Monitoring & Control
Blog CatDogFoxBot # 7 : GridEye and Artificial Neural Network Combined
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Remote Monitoring & Control to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: dubbie
  • Date Created: 13 Aug 2019 2:42 PM Date Created
  • Views 1165 views
  • Likes 4 likes
  • Comments 1 comment
  • ann
  • grideye
  • arduino
Related
Recommended

CatDogFoxBot # 7 : GridEye and Artificial Neural Network Combined

dubbie
dubbie
13 Aug 2019

There's not much time left before the end of the Remote Monitoring and Control Project14 competition so I'm rushing to get finished, or at least, nearer to finishing. I have combined the two Arduino programmes I have been working with; one from the GridEye sensor and one for an Artificial Neural Network (ANN) into a single working programme. It is a bit of a bodge in places as I didn't want to spend too much time on good solutions if it wasn't going to work. The main problem I have had is to convert the 8x8 GridEye sensor data into the 7x7 array that is the biggest array I can use with the ANN (for some reason as of yet unknown). The data comes from the GridEye as a single 1x64 element array rather than a 8x8 data structure. The ANN also uses a single dimension array of 1x49. I decided to use the top 7x7 array part of the original 8x8 array - no particular reason for this, I could have used any part. I couldn't think of a neat way of doing this so just copied the first 7 elements from each of the first seven rows, as listed below.

 

// Get the 7x7 data from the 8x8 array

    for(int i=0; i<=6; i++){pixels49[i] = pixels[i];}
    for(int i=7; i<=13; i++){pixels49[i] = pixels[i+1];}
    for(int i=14; i<=20; i++){pixels49[i] = pixels[i+2];}
    for(int i=21; i<=27; i++){pixels49[i] = pixels[i+3];}
    for(int i=28; i<=34; i++){pixels49[i] = pixels[i+4];}
    for(int i=35; i<=41; i++){pixels49[i] = pixels[i+5];}
    for(int i=42; i<=48; i++){pixels49[i] = pixels[i+6];}

 

(If anyone can think of a clever way of doing this, do please let me know.)

 

I have also normalised the data rather than having temperatures as the ANN works better. There are a number of different normalisations that I could use but in the end decided on a simple linear one. I am not expecting the temperature to drop below 5 C at night so I am subtracting that from the temperature. I have decided on 30 C as my maximum temperature as this is about the maximum temperature a cat has. Even if the temperature of the cat was higher, all it would do would be to create a normalised value slightly greater than 1.0, and the ANN would still be O with that - one of the beauties of ANN is the ability to cope with different data ranges. So I am dividing the values by 25 (which is 30 - 5 = 25), using the code fragment below.

 

    for(int i=1; i<=49; i++)

      {

          pixels49[i-1] = (pixels49[i-1] - 5.0) / 25.0;

          Serial.print(pixels49[i-1]);

          Serial.print(" ");

        if( i%7 == 0 ) Serial.println();

      } /* for */

    Serial.println();

 

This produces normalise data arrays such as that shown below.

 

image

 

The data under the test 'Inputs' is the 7x7 normalised array being provided to the ANN This data was taken during the day when the room temperature is about 22 C so the data is all between about 0.6 and 0.7. This is not quite what I was expecting, mainly because I didn't think about it enough. Testing during the daytime inside isn't all that applicable to when it is used outside. This is illustrated at the bottom of the image above where the test 'Output = 0.77 which is effectively a probability of there being a cat at 77%, which is obviously not correct. This is because the training data has been created assuming a background temperature of 7 C. I will need to try it out tonight outside once the temperature has dropped.

 

However, just to show that something happens, the image below shows the data output when I put my hand in front of the sensor, which has a tmeprature of about 27 - 29 C so creates array values nearer to 0.8 or 0.9 or even higher.

image

 

The output is now shown as 0.90 which is indicating there is a 90% probability that a cat has been detected. Well, at least it has detected a hotter body which would be enough for this sensor system.

 

I'll see about trying this out tonight and see what data can be obtained.

 

Dubbie

  • Sign in to reply

Top Comments

  • genebren
    genebren over 6 years ago +1
    Dubbie, Moving in the right direction. It seems that you could sample the background (no pixels registering a higher that normal value) and calibrate the device so that it would give a more accurate score…
  • genebren
    genebren over 6 years ago

    Dubbie,

     

    Moving in the right direction.  It seems that you could sample the background (no pixels registering a higher that normal value) and calibrate the device so that it would give a more accurate score when an object is present.  Also, seeing movement (the blob changes position) could be used to also improve the detection score.

     

    Good luck wrapping this up!

     

    Gene

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube