Do you want to use a Galileo GEN2 board to implement a webcam display systems? If you want, this instructables can realize your wish!
What you will need:
- a Galileo GEN2 board
- a microSD card (2G at least)
- a USB-RS232 serial converter
- an Ethernet cable
- a Nokia 5110 LCD
- a Logitech C170 webcam (or other webcam that can co-work with the Galileo GEN2)
- a breadboard
- some jumper wires
Step 1: Install Linux and OpenCV
For implementing the webcam display system, you need a Linux system with OpenCV library. The following steps guide you to install the Linux OS in your micro-SD card.
- Please download Intel® Galileo Board microSD Card Linux* Operating System Image.
- Decompress the Linux OS image iot-devkit-1.5-i586-galileo.bz2 file to be iot-devkit-1.5-i586-galileo.
- In your PC, use Win32DiskImager.exe to burn the image iot-devkit-1.5-i586-galileo to your micro-SD card. This homepage instructs you how to use Win32DiskImager.exe to burn an image file.
Now, you can insert the burned micro-SD card to your Galileo GEN2 board. Power on the board and connect the USB-RS232 serial converter. In the converter, you only connect RXI, TXO, and GND pins. You can refer the attached figure. You must install the driver of the serial converter in your PC.
After the Galileo runs the Linux, either Tera Term or PuTTY can be used to open a console (shell) of the Galileo Linux in your PC. You can use the console to install the OpenCV library cad control your Galileo board by a Linux shell. The homepage teaches you how to use PuTTY to connect your Galileo board. The user name of the default account is root. You don’t give any password.
Before you install OpenCV library, you can re-size your micro-SD card partition. If you don't do it, the free space of the Linux system is too small to do a complex work. The homepage guides you how to re-size the micro-SD card partition.
Before you install OpenCV library, you must setup your Ethernet network. The following steps guide you to setup your Ethernet network.
- Enterifconfig to see the Ethernet name (e.g. enp0s20f6).
- Create a file /etc/network/interfaces. The file content is as follows (you should change the IP values and the Ethernet name).
auto enp0s20f6 iface enp0s20f6 inet static address 192.168.0.105 netmask 255.255.255.0 gateway 192.168.0.1 dns-nameservers 18.104.22.168
- Set your DNS server in the file /etc/resolv.conf. The file content is as follows. You should change the IP of the name server.
nameserver 22.214.171.124 nameserver ::1
Now, connect the Ethernet cable to your Galileo board. Start the network by entering
Type ifconfig to check whether your network set is correct. If it is OK, you can install OpenCV library by internet access. This homepage instructs you in installing python-opencv package that includes the OpenCV library. There is a bug in the python-opencv package. For fixing the bug, you should edit the file /usr/lib/pkgconfig/opencv.pc. Delete the statement, -lopencv_ts, of the file.
Step 2: C Program
The C program can be found in the attached file. In the Linux shell, you can enter the following statement to compile the program to create an execution file (new_arduino_webcam_rt_nf).
g++ new_arduino_webcam_rt_nf.c `pkg-config opencv --cflags --libs` -o new_arduino_webcam_rt_nf
Connect your webcam to the Galileo board, and then run the execution file by entering
You can change the number that must be between 3 to 143. The number controls the block size of the OpenCV cvAdaptiveThreshold function. The number affects the display style.
Step 3: Arduino Sketch
Connect your Nokia 5110 LCD to your Galileo board by the guide shown in the figure.
The PCD8544 Arduino library for Nokia 5510 LCD can be downloaded in the following URL.
The password for decompressing this .rar file is 406. You must save the decompressed library folder under the libraries path ofyourGalileo Arduino IDE.
The attached file is the Arduino sketch rar file. Please decompress the rar file. Refer to the homepage, and burn the Arduino sketch in your Galileo board. Now, the picture captured by the webcam can display in your Nokia 5110 LCD. The LCD can show about 2 frames per second. I attach 2 LCD figures in this step.