Book Image

Intel Edison Projects

By : Avirup Basu
Book Image

Intel Edison Projects

By: Avirup Basu

Overview of this book

Change the way you look at embedded electronics with Intel Edison. It is a small computing platform packed with a set of robust features to deliver hands-on performance, durability, and software support. This book is a perfect place to kickstart development and rapid prototyping using Intel Edison. It will start by introducing readers to the Intel Edison board and explaining how to get started with it. You will learn how to build a mini weather station, which will help you to acquire temperature and smoke level and push it to the IoT platform. Then you will see how to build a home automation device and control your appliances using an Android app. Furthermore, we will build a security system using a webcam to detect faces and perform voice recognition. Toward the end, the book will demonstrate how you can build two robots, which will be based on different line sensing sensors and can be controlled by a PC. The book will guide the readers through each and every step of execution of a project, using Intel Edison.
Table of Contents (7 chapters)

Intel Edison code

For the Intel Edison, let's find out what is actually possible. We don't have a display, so we can rely only on console messages and LED, perhaps, for visual signals. Next, we may need to optimize the code to run on the Intel Edison. But first let's edit the code discussed previously to include an LED and some kind of messages to the picture:

import cv2 
import numpy as np
import sys
import os

faceCascade = cv2.CascadeClassifier('C:/opencv/build/haarcascade_frontalface_default.xml')
video_capture = cv2.VideoCapture(0)
led = mraa.Gpio(13)
led.dir(mraa.DIR_OUT)
while (1):
led.write(0)
# Capture frame-by-frame
ret, frame = video_capture.read()

gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
faces = faceCascade.detectMultiScale(gray, 2, 4)
iflen(faces) > 0:
print("Detected")
led.write(1)
else:
print("You are clear...