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
Robots with Wheels
  • Challenges & Projects
  • Project14
  • Robots with Wheels
  • More
  • Cancel
Robots with Wheels
Blog RoboBobLet #7 : Adding a Pixy Camera
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Robots with Wheels to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: dubbie
  • Date Created: 2 May 2018 12:06 PM Date Created
  • Views 1230 views
  • Likes 5 likes
  • Comments 1 comment
  • roboboblet
  • robotwheelsch
Related
Recommended

RoboBobLet #7 : Adding a Pixy Camera

dubbie
dubbie
2 May 2018
image

Robots with Wheels

Enter Your Electronics & Design Project for Your Chance to Win a $100 Shopping Cart!

Back to The Project14 homepage image

Project14 Home
Monthly Themes
Monthly Theme Poll

 

Another step towards the completion of RoboBobLet is to add a camera system. It would be possible to add a simpler digital camera to RoboBobLet and then use the Arduino to do some simple image processing but that would take more time than is available. An alternative is to use the Pixy Camera system (Pixy (CMUcam5) – Charmed Labs ) which uses an on board DSP to do all the heavy image processing. The default Pixy can be easily set to recognise blocks of colours and to provide this information directly to an Arduino (Hooking up Pixy to a Microcontroller (like an Arduino) - CMUcam5 Pixy - CMUcam: Open Source Programmable Embedded Color …). The Pixy camera is provided with a ribbon cable to connect it directly to the ICSP connection on the Nano (and other Arduinos I think) and uses the SPI interface. After down loading the Pixy library ZIP file and adding to the Arduino IDE a number of example files become available and I used the Hello_World one. This provides numerical values about the number of identified colour blocks, the (X, Y) values of the centres and their widths and heights. An example of the data obtained is shown below.

 

image

 

Once every second all the recognised block data is transferred to the Nano with the Hello_World programme just displaying this on the IDE Serial Monitor display. The figure above shows three blocks being identified all of sig (signature) 2. The signatures have to be previously trained and I had trained the Pixy to recognise small blue wooden blocks of size 30 x 60 cm. The figure below shows the three blocks being recognised.

 

image

 

Although it does not look like it, these three blocks were all aligned at the same distance from the camera of 14 cm. The two outer blocks look slightly further away but this is a feature of the camera lenses and the lighting used. The whole system is shown in the video below. I have added a white front piece to the front of the Pixy camera, produced using my 3D printer and TinkerCAD, which I will use later to fix the laser rangefinder to that is already on RoboBobLet. Hopefully the two sensors will work together.

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

The Pixy Camera is provided with a USB interface as well as the SPI (and other serial) interfaces, which works with the PixyMon programme provided. This enables the image being collected by the Pixy Camera to be viewed. Regretfully the USB interface to PixyMon and the SPI interface to the Nano cannot be used at the same time so it is not possible to be completely certain about the objects being recognised. I used blue bricks as this is not a common colour in most environments, but you will notice that a pink ruler is placed adjacent to the blocks as the camera was picking up the blue strip on my laptop and causing problems. Differing lighting conditions also cause great problems, as is the way with most camera systems.

 

When thinking about how to use the data from the Pixy Camera it seemed it might be possible to try and determine the range to the blue objects by using the difference in image width (or height). This will only work if the detected blue object is actually one of the bricks. By considering the aspect ratio (height to width) of the detected object which should be consistent at all distances then it might be possible to confirm that object as being a brick. Once this was done then the width (or height) of the blue brick in the image could be used to determine distance. The screen dump below shows an (Excel Online) spreadsheet of the aspect ratio of the blue brick as different distances.

 

image

 

The distances ranges from 14 cm to 53 cm at intervals of 3 cm. The graph shows a fairly consistent aspect ratio between 2.0 and 2.2. The actual aspect ratio is 2.0. It was necessary to insert the (0,0) point in order to obtain a nice graph. The Online version of Excel does not seem to provide many options for formatting graphs so this was the best I could achieve. It would seem that there is be reasonable confidence in assuming that any blue object detected by the Pixy camera with an aspect ratio in the region 2.0-2.2 is one of the blue bricks. Then by using the width (or height or possibly both) it should be possible to use the information from the Pixy camera to provide some information about the distance. This is illustrated in the following screen dump with both the width and height plotted against distance.

 

image

 

There is clearly a good correlation between distance and object width and height. All that is needed now is to amend the programme in the Nano to determine this. A lookup table might be the easiest approach. As the laser rangefinder will be fixed directly onto the Pixy camera it should also be possible to use it's distance information to confirm that from the camera.

 

The next step in RobBobLet's evolution now is to integrate the Pixy camera into the chassis and get all the sensors to work together. There is still time to do this before the end of this challenge (hopefully).

  • Sign in to reply
  • genebren
    genebren over 7 years ago

    Nice update to your project.  Keep up the good work.

    Gene

    • Cancel
    • Vote Up 0 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