Dear friends welcome to another video! This is Nick from educ8s.tv and today we are going to take a first look at the Pixy2 Machine Vision camera module. It is an impressive little camera that we can use with any microcontroller and build impressive projects! The best part, is that you don’t have to be a Machine Vision expert to program this board.
You can teach this board new objects with a press of a button. A last, Machine Vision made easy! There are a lot of things to cover so let’s get started! A few weeks ago, I reviewed the OpenMV camera module, a really capable machine vision camera module.
A viewer of the channel commented that I should also give Pixy a try, so here it is, the Pixy2 camera module, the newest version of the board. The first version of the Pixy cam was released in 2014 after a successful Kickstarter campaign.
The designers of the board, describe it as a vision sensor. We can’t program this board. This board is preprogrammed, it runs its own firmware and it uses advanced machine vision algorithms to report back only what is interesting.
For example, I have trained the board to recognize this 3D printed Pikachu toy. Since this is a Vision Sensor we only care to know if there is a Pikachu in front of the camera, and where is it. The Pixy camera can do just that.
It reports that an object is detected and some additional information about it, like the size and position in the frame using either the SPI, UART or I2C interface. I think, this is a great idea and a great implementation.
We don’t have to be a Machine Vision expert to build some Machine Vision applications! We can teach this camera in a few seconds, and the camera will do the hard work for us automatically! Amazing stuff! Let’s take a look at the specs of the Pixy2 camera module.
The board features the following: • An image sensor with a resolution 1296×976 • 32Bit NXP LPC4330, • 204 MHz, dual core • 264KB RAM memory • 2MB RAM memory • UART, SPI, I2C, USB, Digital Analog output • Embedded Light Source • Driver for 2 Servos • Low Power consumption If we compare this board with the OpenMV M7 camera module we can see, that the Pixy2 uses a higher resolution camera module and a faster processor.
On the other hand the OpenMV M7 offers more RAM and Flash memory, more IO pins and of course it is user programmable. I will prepare detailed comparison video between the OpenMV cam and the Pixy2 cam if you are interested.
Please let me know in the comments section below. The Pixy2 board costs around 65$, and you can find a link to it in the description of the video below. The specs of the Pixy2 Cam are great but what can we do with it? The Pixy can be used for the following things according to its designers: • Color Tracking • Object Tracking • Color Code Detection • Simple Barcode Detection • Line Detection • Intersection Detection And much more.
But enough with the specs. Let’s take a look at a real life example. Let’s start using the board with a simple example. Let’s teach the board to recognize this green Pikachu. There are two ways to teach Pixy a new object.
We can use the computer, or we can use this button on the Pixy board itself. Let’s first teach Pixy using the computer. In order to do so, we have to download the PixyMon software which if provided by the creators of the board.
If we connect the board to the computer and fire up the PixyMon software we see live video from the PixyCam. Pixy uses a hue-based color filtering algorithm to detect objects. Since Pixy uses color, the object needs to have a distinct hue.
The Pixy Cam can detect up to 7 different objects. Each object has its unique signature which is used by Pixy to detect an object. So, let’s use Signature 1 for the Green Pikachu. We place the object close to the camera and from the Menu we select Action -> Set Signature 1.
Then using the mouse we can select the object we want to detect. That’s it! Pixy can now detect the green Pikachu toy. How cool is that! Now, let’s go the menu again and select File -> Configure and then the Signature Tab.
Here we can set a label for each signature. I am going to use the label Green Pikachu for the first Signature. If we now press apply we can see that now, on the screen we can see that now, Pixy can recognize the object as a Green Pikachu.
If we place another Green Pikachu next to the first one, you can see that Pixy can detect him as well. Let’s teach Pixy to also detect this Red Pikachu and this yellow lighter. We follow exactly the same procedure.
We again set labels for the new object signatures and we can see that Pixy has no problem recognizing 4 objects at the same time at 60 frames per seconds! Amazing stuff! Let’s now connect Pixy to an Arduino Uno board in order to provide vision to it.
First of all we have to download install the Pixy library for Arduino. Then we can use the provided cable like this. It makes things so easy. I have also connected 4 LEDs to the Arduino, two Greens, one Red and one yellow.
I have loaded a very simple sketch to it, and now the slow and low cost Arduino Uno can detect objects. Let’s try the objects we trained Pixy to recognize. First, let’s put a Green Pikachu in front of it.
A green LED lights up, meaning that the Arduino successfully detected a Green Pikachu in front of the vision sensor. If we place a Red Pikachu in front of the camera the Red LED lights up and so on. Let’s see, what kind of data the pixy reports back, and how the Arduino handles them in this example.
If we open the serial monitor we can see that the Pixy cam reports back some data. It reports a block number. A block is a recognized object. It also reports the signature number of this block and the X and Y coordinates of the block within the visible frame.
It can also report the width and height of the block and the index, a unique number assigned to each block so we can track multiple objects of the same signature. Lastly it reports the age of the object, a number from 0 to 255 in order to know how long this object is visible.
With all this information we build interesting behaviors. In this simple example, I only count how many objects of each type are in front of the camera and I light up the appropriate LED. Check this out, with just 100 lines of Arduino code we are able to detect objects! Our first Machine Vision Arduino sketch is ready and we didn’t have to write any Machine Vision algorithm at all.
You can find the code of this example in the description of the video below. Let’s now see another example. As I said earlier, at the back of the Pixy board we can connect two servo motors. I connected just one SG90 servo and I loaded the PanTilt demo that comes with the Arduino Library.
I have cleared all the signatures from the Pixy memory so now the Pixy cam can not detect any objects at all. Let’s teach Pixy to detect this Red Pikachu at once without using the computer. We press and hold the button of the Pixy board until the RGB led flashes.
Now it is ready to be taught. We place the object in front of it. The RGB led reflects the color of the object the camera sees. We need to recognize a red object so, when the LED turns red it means that Pixy can see our red object.
When that happens we press the button once more and now Pixy can recognize this object! It is as easy as this. If we now connect the Servo and power up the Arduino we can see that the camera can follow the Red Pikachu! Cool! We can easily teach Pixy to follow the Green Pikachu.
Check this out, pressing the button once, placing the Green Pikachu in front of the camera, pressing the button once more and the camera can now follow the Green Pikachu. Amazing stuff! Pixy can do many more things, like line following, detecting color codes and simple barcodes.
Since I cannot cover all this stuff in details in this video I will have to prepare a follow up video about the Pixy cam. I have already got some parts to build a line following robot with it. It will be our first robot that will be able to see.
Until then, I would love to know your opinion about the Pixy cam. In my opinion, Pixy is a great camera, and it clearly demonstrates where Machine Vision is going to be in a few years. In a few of years we will be able to buy low cost Vision Sensors, and they are going to be very common and easy to use, just like this temperature sensor.
Machine Vision is going to present everywhere and it is going to change everything both in good and bad ways. If this is your first time here, I would love to have you subscribed. In this channel, I post videos about DIY projects twice a month.
I love making things, and I believe that anyone can make things, anyone can become a maker. That’s why I created this channel, to share my knowledge with the community and learn from the community. I hope you will join us.
I will see you in the next video!