วันพฤหัสบดีที่ 21 มิถุนายน พ.ศ. 2561

Raspberry Pi Face Detection with OpenCV


Raspberry Pi Face Detection with OpenCV

Face Detection is famous technology now.I'd like to use it also for the cheap one you can use raspberry pi board and web camera with openCV in python code.

Hardware

  • Raspberry Pi 3B Board with SD card and accessories.
  • USB webcam

Software and Library

  • Raspbien Stretch OS
  • OpenCV 2.4.9.1
  • Python 2.7.13
check python version








check openCV version


Demo











Source Code on Github
https://github.com/shantnu/Webcam-Face-Detect



Reference

https://www.hackster.io/mjrobot/real-time-face-recognition-an-end-to-end-project-a10826

https://www.hackster.io/Rjuarez7/raspberry-pi-3-face-detection-in-python-2-and-opencv-2-2b06bf

https://github.com/shantnu/Webcam-Face-Detect


My Website

email : info@softpowergroup.net  ,amphancm@gmail.com  Tel .+6681-6452400

Android and Arduino IoT

วันพุธที่ 14 กุมภาพันธ์ พ.ศ. 2561

Raspberry pi Node.JS Webserver + WebSocket Control LED


Raspberry pi NodeJS Webserver + WebSocket Control LED

This article show how to use raspberry pi to be NodeJS webserver and control LED via websocket.

What is WebSocket?

WebSocket enables bidirectional communication in real time over the web.
WebSocket can be run together with a normal HTTP server. You can click a button in a web browser, and enable a GPIO on your Raspberry Pi which turns on a light in your house. All in real time, and with communication going both ways!

System Diagram



Wiring Diagram

Hardware
Raspberry Pi Board
LED
Push Button Switch
Resistor 100 - 470 Ohm ( for LED )
Resistor 1K - 50K Ohm ( for Pull-up switch )



This is my raspberry pi development board.






Software and Library

Check Node Version

$ node -v 

If you don't have node. Install Node first

Then install npm
sudo apt-get install npm


check npm version

$ npm -v  

Install the onoff Module

To interface with the GPIO on the Raspberry Pi using Node.js, we will use a Module called "onoff".
Install the onoff module using npm:

$ npm install onoff


Install socket.io for Node.js

To download and install newest version of socket.io, use the following command:

$ npm install socket.io --save



Source Code


webserver.js

Public/index.html


Demo

Run Node.js Webserver 

$ node webserver.js


Open on Web Browser on your Raspberry pi IP address and port 8080


Control on Checkbox on Web Browser or Push Button Switch on Raspberry pi Board.
End the program with Ctrl+c.



Reference

https://www.w3schools.com/nodejs/nodejs_raspberrypi.asp


My Website

email : info@softpowergroup.net  ,amphancm@gmail.com  Tel .+6681-6452400

Android and Arduino IoT

วันอาทิตย์ที่ 4 กุมภาพันธ์ พ.ศ. 2561

Raspberry pi connect RFID Reader ( SL500 USB )


Raspberry pi connect RFID Reader ( SL500 USB )

We 'd like to use RFID card with Raspberry pi board for eMoney or RFID cash card  Application in canteen of school.

RFID Reader


We want to use USB RFID Reader. we choose RFID reader model SL500 USB.
For Thailand Shop http://arduinoandroid.lnwshop.com/product/4/rfid-nfc-reader-writer 

RFID Card


Famous RFID tag is NXP Mifare MF-1.


Overview


NXP® has developed the MIFARE® MF1ICS50 to be used in a contactless smart card according to ISO/IEC 14443 Type A.
The MIFARE MF1ICS50 IC is used in applications like public transport ticketing where major cities have adopted MIFARE as their e-ticketing solution of choice.
1.1 Key applications
  • Public transportation
  • Access control
  • Event ticketing
  • Gaming & identity
1.2 Anticollision
An intelligent anticollision function allows to operate more than one card in the field simultaneously. The anticollision algorithm selects each card individually and ensures that the execution of a transaction with a selected card is performed correctly without data corruption resulting from other cards in the field.
1.3 Simple integration and user convenience
The MF1ICS50 is designed for simple integration and user convenience. Which could allow complete ticketing transactions to be handled in less than 100 ms. Thus, the MF1ICS50 card user is not forced to stop at the reader leading to a high throughput at gates and reduced boarding times onto busses. The MIFARE card may also remain in the wallet during the transaction, even if there are coins in it.
1.4 Security
  • Mutual three pass authentication (ISO/IEC DIS 9798-2)
  • Individual set of two keys per sector (per application) to support multi-application with key hierarchy
  • Unique serial number for each device

  • 1 Kbyte, organized in 16 sectors with 4 blocks of 16 bytes each (one block consists of 16 byte)
  • User definable access conditions for each memory block
  • Data retention of 10 years.

Library and Demo

Read Block 0 ( Manufacturer Block )


         b0 88 3f 7b 7c                  88 04                          44 85 00 b4 2e f0 bb 6a a8

Source code on Github

https://github.com/amphancm/RaspberryPi_rfid_sl500

CODE
SL500 Python Library - rfid_sl500.py
Example Code
Read Block0 16 Bytes data - read_block0.py
Read loop - loop.py

Reference

SL500 C language

python

วันพุธที่ 31 มกราคม พ.ศ. 2561

Raspberry Pi connect Smartcard Reader

Raspberry Pi connect Smart Card Reader

We'd like to read Thai ID Smartcard with Raspberry Pi Board. ( with python code )


Smart Card Reader  

USB Smartcard Reader  Alcor Micro model AU9560

Test detect smartcard reader in pyscard example code 




Smart Card
Test ATR ( Answer To Reset ) in Pyscard Example Code




Install Library on Raspberry pi


sudo apt-get install pcscd git python-setuptools swig gcc libpcsclite-dev python-dev

cd pyscard
sudo python setup.py build_ext install
sudo reboot


Thai ID Smart Card Demo


Reference

pyscard

User guide

Test

code thai id card





My Website
email : info@softpowergroup.net  ,amphancm@gmail.com  Tel .+6681-6452400

Android and Arduino IoT



LINE : adunnun
FaceBook : https://www.facebook.com/adun.nantakaew
email: amphancm@gmail.com

วันพุธที่ 24 มกราคม พ.ศ. 2561

Raspberry Pi GUI

Raspberry Pi GUI


How to make GUIs (Graphical User Interface) on Raspberry Pi in Python.

In Python, the steps to get started with GUI programming are not terribly complex, but they do require the user to begin making some choices. By its nature as a general purpose programming language with interpreters available across every common operating system, Python has to be fairly agnostic as to the choices it presents for creating graphical user interfaces.
Fortunately, there are many options available for programmers looking to create an easy way for users to interact with their programs. Bindings exist for several UI frameworks on a variety of platforms.

TkinterGTKQT (PySide and PyQT), wxPythonKivythrust, …?


Tkinter

Tkinter is the standard GUI library for Python. Python when combined with Tkinter provides a fast and easy way to create GUI applications. Tkinter provides a powerful object-oriented interface to the Tk GUI toolkit.
If there were a single package which might be called the "standard" GUI toolkit for Python, it would be Tkinter. Tkinter is a wrapper around Tcl/Tk, a popular graphical interface and language pairing first popularized in the early 90s. The advantage of choosing Tkinter is the vast number of resources, including books and code samples, as well as a large community of users who may be able to help you out if you have questions. Simple examples are easy to get started with and fairly human-readable.
Tkinter is available under the Python license, on top of the BSD license of Tcl/Tk.

WxPython

WxPython brings the wxWidgets cross-platform GUI library from its native C++ to Python. WxPython is a slightly more modern approach to, which looks a little more native than Tkinter across different operating systems as it does not attempt to create its own set of widgets (although these can be themed to look much like native components). It's fairly easy to get started with as well, and has a growing developer community. You may need to bundle wxPython with your applications, as it is not automatically installed with Python.
Working with Python 3? Check out wxPython's Project Phoenix, a rewrite of the project which will work with the newest version of Python.
WxPython uses the wxWindows Library License of its parent project, which is OSI approved.

PyQt

PyQt implements the popular Qt library, and so if you are familiar with Qt development in another language, perhaps from developing native applications for KDE or another Qt-using desktop environment, you may already be familiar with Qt. This opens up the possibility of developing applications in Python which have a familiar look and feel across many platforms, while taking advantage of the tools and knowledge of the large Qt community.
PyQt is dual licensed under both a commercial and GPL license, not unlike Qt project itself, and the primary company supporting PyQt offers a license FAQ to help understand what this means for your application. For another option to use the Qt libraries with Python, consider checking out PySide, which is available under the LPGL.

ElectronJS
Electron is a framework for creating native applications with web technologies like JavaScript, HTML, and CSS. It takes care of the hard parts so you can focus on the core of your application.



My Website
email : info@softpowergroup.net  ,amphancm@gmail.com  Tel .+6681-6452400

Android and Arduino IoT



LINE : adunnun
FaceBook : https://www.facebook.com/adun.nantakaew
email: amphancm@gmail.com

วันอังคารที่ 2 มกราคม พ.ศ. 2561

Raspberry Pi connect Fingerprint Reader




Raspberry Pi connect Fingerprint Reader

Optical fingerprint readers offer large capture areas, excellent image quality and rapid capture speed all in a compact, durable case. Our optical readers with a silicone membrane provide superior image capture performance for a wide range of skin conditions. This translates to easy, efficient and high-quality image capture – which impact technology acceptance and performance – making our U.are.U readers the preferred biometric solution for a range of commercial applications.


Digital Persona U.are.U 4500 Fingerprint Reader

The U.are.U 4500 Fingerprint Reader is a USB peripheral perfect for individual desk top users, as well as multiple users in shared environments. Its compact design conserves desk space in enterprises, and its professional, modern appearance
looks elegant in point-of-sale environments. The U.are.U 4500 Reader utilizes optical fingerprint scanning technology to achieve excellent image quality, a large capture area and superior reliability. A silicone coating allows it to read a wide range of fingerprints accurately and rapidly regardless of placement angle. The high-quality metal casing resists unintentional movement.


To use, simply place a finger on the reader window and the reader quickly and automatically captures and encrypts the fingerprint image before sending it to the DigitalPersona® FingerJetTM biometric engine for verification. For superior user feedback, a red “flash” indicates that a fingerprint image has been captured.
The U.are.U 4500 Fingerprint Reader is designed for use with a full range of CrossmatchTM software including our authentication solutions, as well as most of our U.are.U Software Development Kits. Whether you are an enterprise customer or a system integrator, Crossmatch’s biometric identity verification solutions provide a natural extension to your security system and applications. 


KEY SPECIFICATIONS
• Pixel resolution: 512 dpi (average x, y over the scan area)
• Scan capture area: 14.6 mm (nom. width at center) 18.1 mm (nom. length)
• 8-bit grayscale (256 levels of gray)
• Reader size (approximate): 65 mm x 36 mm x 15.56 mm
• Compatible with USB 1.0, 1.1 and 2.0 (Full Speed) specifications 



fprint_demo

http://www.reactivated.net/fprint/wiki/Fprint_demo

The fprint project aims to plug a gap in the Linux desktop: support for consumer fingerprint reader devices.
Previously, Linux support for such devices has been scattered amongst different projects (many incomplete) and inconsistent in that application developers would have to implement support for each type of fingerprint reader separately. For more information on where we came from, see ?/Project history.
We're trying to change that by providing a central system to support all the fingerprint readers we can get our hands on. The software is open source and in the long term we're shooting for adoption by distributions, integration into common desktop environments, etc.
Software to demonstrate libfprint's capabilities. Currently in early stages. Written in C. Requires libfprint and GTK+. Licensed under the GPL version 2



Install on Raspberry pi
$ sudo apt-get install libfprint-dev libgtk2.0-dev                                             $ git clone --recursive https://github.com/dsd/fprint_demo
$ cd fprint_demo
$ ./autogen
$ ./configure
$ make
$ make install
Run fprint_demo
$ fprint_demo

Reference
https://github.com/dsd/fprint_demo





My Website
email : info@softpowergroup.net  ,amphancm@gmail.com  Tel .+6681-6452400

Android and Arduino IoT



LINE : adunfong
FaceBook : https://www.facebook.com/adun.nantakaew
email: amphancm@gmail.com

วันจันทร์ที่ 18 ธันวาคม พ.ศ. 2560

Google Assistant with Raspberry Pi





Google Assistant with Raspberry Pi

What is Google Assistant?

Google Assistant is Google’s voice assistant, which grew out of Google Now, and is available on a range of recent Android devices and now the iPhone

You can use Google Assistant to trigger apps and devices, ask all kinds of questions, make plans, and carry out a variety of useful tasks. If you’re new to the voice assistant, it may be difficult to figure out just how it works. Lucky for you, we can help! If you’re currently wondering, “what is Google Assistant anyway?” or “how can I use all this stuff with OK Google?” then read on to get started.

So,we 'll use Google Assistant on Raspberry Pi.

Hardware

1. Raspberry Pi Board model 3B and accessories
2. Speaker and Amplifier with Speaker
3. USB Microphone



Set Google Assistant API

Open Browser in Pi and go to: https://console.cloud.google.com/cloud-resource-manager

Create Project



New Project
Add your Project name. then Create.



Dashboard
Your Project detail.



Enable API
Go to API  ( APIs & services ) then Dashboard




Then ENABLE APIs and Services




Search "google assistant"




Click ENABLE



Create credentials



Go to OAuth consent screen




Then Download your credential id. ( JSON File )
We will use this file on Raspberry pi.
Then copy this file to raspberry pi.




How to Setup on Raspberry Pi

Install python virtual environment


$  sudo apt-get install python3-dev python3-venv


Download Dependencies

$  sudo apt-get install portaudio19-dev libffi-dev libssl-dev


Setup Python3

$  python3 -m venv env
$  env/bin/pip install setuptools --upgrade


set the virtual environment

$  source env/bin/activate 


Install Google Assistant SDK

$  python -m pip install google-assistant-sdk[samples]


Updated SDK for newest version

$  pip install --upgrade google-auth-oauthlib[tool]


Setup Google Assistant SDK with Credentials

$  google-oauthlib-tool --client-secrets /home/pi/Downloads/client_secret_XXXXX.json --scope https://www.googleapis.com/auth/assistant-sdk-prototype --save --headless

Need your credential file form Credential Setup page.
Then you have link to Google Permission Page



Run Google Assistant

$  googlesamples-assistant-pushtotalk



Enjoy your Google Assistant on Raspberry Pi.

see on Youtube

Reference

https://www.novaspirit.com/17SSm

https://www.raspberrypi.org/forums/viewtopic.php?t=188958

https://www.hackster.io/Salmanfarisvp/googlepi-google-assistant-on-raspberry-pi-9f3677



My Website
email : info@softpowergroup.net  ,amphancm@gmail.com  Tel .+6681-6452400

Android and Arduino IoT



LINE : adunfong
FaceBook : https://www.facebook.com/adun.nantakaew
email: amphancm@gmail.com