Arduino may seem very rudimentary, but it is more than enough to create even fairly advanced projects. With the help of some existing modules on the market, such as camera modules, and with the help of some libraries or APIs, you can provide your project with intelligence or artificial vision. That will give new applications and new horizons beyond rudimentary projects.
Machine vision is a type of computer vision. It is not simply capturing the image through a digital camera, it goes further. Can be used for acquire environmental data, process the image, analyze it, understand real-world images, etc. For example, it could be used to obtain numerical information through the camera, recognize human beings, etc. Imagine everything you could do with this ...
Table of Contents
What is computer vision used for?
By example, many current vision systems are based on this type of vision, such as some vehicles that allow automatic parking, mapping of the environment, traffic control systems on roads, or recognize pedestrians to stop the vehicle and not run over them, recognize faces and obtain data from the people registered in a database such as in some security systems, analyze videos, etc.
The potential of this machine vision is so extreme that governments and large corporations They use it for a multitude of purposes, whether they are legal or not. Some practical fields of application that you surely know are:
- Facebook: use this type of artificial vision for photos uploaded to your social network, in this way you can recognize faces using complex algorithms. That way you can feed your AI to make it more powerful and improve it for other future applications.
- Flickr- You can use this machine vision to reconstruct 3D scenes using image repositories on this platform.
- Industry: With artificial vision systems you can detect defects in an assembly line, quickly discard objects with defects, etc. For example, when the fruits collected in the agricultural sector travel through a conveyor belt, by means of an artificial vision sensor, broken, damaged, rotten fruits, or objects other than fruits, could be detected to remove them by means of a jet of air or other mechanisms.
- Video surveillance: it can be used in many protected centers to capture certain vehicles or people, find out who they are and send said information to a system or record it for later analysis. Many companies even use it to find out how people dress (fashion sector), certain entities to find out who may have been in demonstrations, detect the presence of suspicious personnel in public or busy centers, etc.
Keep in mind that there are currently a multitude of surveillance cameras of all kinds scattered around the street, whether they are to monitor businesses, banks, the DGT, etc., so a lot of information is collected from all of us...
In addition to the Arduino board with the microcontroller that you can program and that makes use of libraries, you will need to also other basic elements for your project. Among them, of course, a module with a camera capable of image processing. An example of this is the Pixy CMUCam 5 or Similar. This module has a powerful processor that can be programmed to send information captured by the sensor through the serial port UART, SPI, I2C, digital out, or analog signals.
With the Pixy CMUCam 5 you can process up to 50 frames per second (50 FPS). With these capabilities, it could be programmed to send only the images that are wanted or searched for, instead of constantly recording all the video it captures. For easier handling, it has a free and open source application call PixyMon for your control.
If you decide to purchase this Pixy CMUcam5 camera, it will come with a 6-pin to 10-pin IDC cable, and the mounting hardware. In addition, technical characteristics of the module are:
- NXP LPC4330 204 Mhz DualCore processor.
- 254 Kb RAM memory,
- 140mA consumption.
- Image sensor Omnivision OV9715 of 1/4 ″ and resolution of 1280 × 800.
- Viewing angle of 75º horizontal and 47º vertical.
- Simple image recognition to locate objects.
- You can use it with Arduino boards (with specific libraries), Raspberry Pi, BeagleBone Black, and other similar boards.
- Communication ports: SPI, I2C, UART, USB, or analog / digital output.
- PixyMon software compatible with Windows, macOS and GNU / Linux.
- Small size.
- Documentation available on the project Wiki.
- Github repositories with the library for Arduino.
In addition to that, you must bear in mind that you have at your disposal another type of APIs, libraries and more material that can help you create projects of all kinds with the help of these cameras and artificial vision. For example, it should be noted:
- OpenCV: is a free machine vision library initially developed by Intel. It has now been released under the BSD license and can be used by anyone to detect motion, recognize objects, robotic vision, facial recognition, etc. It is cross-platform, so it can be used on GNU / Linux, macOS, Windows and Android.
- Other projects, such as vehicle detection.
From Hwlibre, I encourage you to start experiment and learn about this discipline...
Simple example of integrating Pixy 2 CMUcam5 with Arduino
In order to use this Pixy 2 CMUcam5 module with your Arduino board, which you must use several extra elements. For example, you can use a servo motor S06NF, or similar, to act when the camera detects an object for which you have programmed it. Of course, you will need to download the PixyMon software I said above and the GitHub library for Arduino.
More information about Arduino programming, you can download our PDF with the free course.
Once you have installed PixyMon In your operating system, the following is to follow these steps:
- Connect the Pixy with the USB cable and check if the RGB LED of the module is on, which will indicate that it is working properly.
- Open the PixyMon app and if everything is correct you will see what the camera is capturing at this moment.
- Go to the submenu Action or Action, and then click Set signature or Set signature. Now the video should freeze and you can select what color or object you want the camera to detect as long as it is in front of the sensor. For example, you can use a ball. That way, whenever the ball passes in front of the sensor it will be detected.
- As you can see, there is up to 7 Set Signature, so you could configure up to 7 different objects that the camera can detect.
- If you only choose one, you can move on to the next step. Or if you want to remove an object from the list, you can go to the Action or Action menu, and then Delete all The signatures or choose Delete Specific signature. You can even go to Configuration or Configuration and then go to the specific signature that you want to modify to change it….
Now you can go on to configure your board Arduino, if you want. To do this, you already know that you must use the Pixy library for Arduino. This library will also include simple examples that you can start experimenting with without writing code from scratch. Simply by opening them and running these sketches or making modifications to them to see how they behave. To have this library, you can follow these steps.
- Download the library for Arduino.
- Opens Arduino IDE.
- Go to Sketch, Include library and then Add .zip library and select the one you downloaded.
- Now it will be integrated, you can start testing some example with the camera properly connected to your Arduino board. To do this, go to the Examples or Examples menu, then to Pixy and select one of them. I recommend you start with hello_world.
- With your Arduino board connected by USB to PC, upload the sketch to your board, then select Tools and then Serial Monitor.
- Now, the window will begin to show you information.
Of course, don't forget to connect all the electronic components you need to your Arduino board, including the camera itself. You already know that it connects to the Arduino ISCP pins destined to these modules, as can be seen in the image ...