Todos os post de pablo

Auto-run LXTerminal from LXDE desktop at startup

The script may be running to completion and the terminal closes before you see it. Test to see if it works using a script that waits for input, so the terminal will stay open until you close it.

Create a test script. I just named it “”, make it executable.

sudo chmod +x filename.ext



 read -n1 -rsp $'Press any key to close the terminal...\n'

echo Script is running


Then edit the autostart file


nano ~/.config/lxsession/LXDE-pi/autostart

Add this line at the bottom


lxterminal -e /path/to/

Then log out and back in, or reboot. When the desktop starts you should see the terminal open in the middle of the screen, waiting for you to press a key. That will confirm everything’s working, then edit the autostart file and replace “/path/to/” with the script you want to use.

inspirational quotes:

Linux commands


The ls command lists the content of the current directory (or one that is specified). It can be used with the -l flag to display additional information (permissions, owner, group, size, date and timestamp of last edit) about each file and directory in a list format. The -a flag allows you to view files beginning with . (i.e. dotfiles).


Using cd changes the current directory to the one specified. You can use relative (i.e. cd directoryA) or absolute (i.e. cd /home/pi/directoryA) paths.


The pwd command displays the name of the present working directory: on a Raspberry Pi, entering pwd will output something like /home/pi.


You can use mkdir to create a new directory, e.g. mkdir newDir would create the directory newDir in the present working directory.


To remove empty directories, use rmdir. So, for example, rmdir oldDir will remove the directory oldDir only if it is empty.


The command rmremoves the specified file (or recursively from a directory when used with -r). Be careful with this command: files deleted in this way are mostly gone for good!


Using cp makes a copy of a file and places it at the specified location (this is similar to copying and pasting). For example, cp ~/fileA /home/otherUser/would copy the file fileA from your home directory to that of the user otherUser (assuming you have permission to copy it there). This command can either take FILE FILE (cp fileA fileB), FILE DIR(cp fileA /directoryB/) or -r DIR DIR (which recursively copies the contents of directories) as arguments.


The mv command moves a file and places it at the specified location (so where cp performs a ‘copy-paste’, mv performs a ‘cut-paste’). The usage is similar to cp. So mv ~/fileA /home/otherUser/ would move the file fileA from your home directory to that of the user otherUser. This command can either take FILE FILE (mv fileA fileB), FILE DIR (mv fileA /directoryB/) or DIR DIR (mv /directoryB /directoryC) as arguments. This command is also useful as a method to rename files and directories after they’ve been created.


The command touch sets the last modified time-stamp of the specified file(s) or creates it if it does not already exist.


You can use cat to list the contents of file(s), e.g. cat thisFile will display the contents of thisFile. Can be used to list the contents of multiple files, i.e. cat *.txt will list the contents of all .txt files in the current directory.


The head command displays the beginning of a file. Can be used with -n to specify the number of lines to show (by default ten), or with -c to specify the number of bytes.


The opposite of headtail displays the end of a file. The starting point in the file can be specified either through -b for 512 byte blocks, -c for bytes, or -n for number of lines.


You would normally use chmod to change the permissions for a file. The chmodcommand can use symbols u (user that owns the file), g (the files group) , and o (other users) and the permissions r (read), w (write), and x (execute). Using chmod u+x *filename* will add execute permission for the owner of the file.


The chown command changes the user and/or group that owns a file. It normally needs to be run as root using sudo e.g. sudo chown pi:root *filename* will change the owner to pi and the group to root.


ssh denotes the secure shell. Connect to another computer using an encrypted network connection. For more details see SSH (secure shell)


The scp command copies a file from one computer to another using ssh. For more details see SCP (secure copy)


The sudo command enables you to run a command as a superuser, or another user. Use sudo -s for a superuser shell. For more details see Root user / sudo


The dd command copies a file converting the file as specified. It is often used to copy an entire disk to a single file or back again. So, for example, dd if=/dev/sdd of=backup.img will create a backup image from an SD card or USB disk drive at /dev/sdd. Make sure to use the correct drive when copying an image to the SD card as it can overwrite the entire disk.


Use df to display the disk space available and used on the mounted filesystems. Use df -h to see the output in a human-readable format using M for MBs rather than showing number of bytes.


The unzip command extracts the files from a compressed zip file.


Use tar to store or extract files from a tape archive file. It can also reduce the space required by compressing the file similar to a zip file.

To create a compressed file, use tar -cvzf *filename.tar.gz* *directory/* To extract the contents of a file, use tar -xvzf *filename.tar.gz*


A pipe allows the output from one command to be used as the input for another command. The pipe symbol is a vertical line |. For example, to only show the first ten entries of the ls command it can be piped through the head command ls | head


Use the tree command to show a directory and all subdirectories and files indented as a tree structure.


Run a command in the background with &, freeing up the shell for future commands.


Download a file from the web directly to the computer with wget. So wget download this file to your computer as


Use curl to download or upload a file to/from a server. By default, it will output the file contents of the file to the screen.


Show the manual page for a file with man. To find out more, run man man to view the manual page of the man command.



Use grep to search inside files for certain search patterns. For example, grep "search" *.txt will look in all the files in the current directory ending with .txt for the string search.

The grep command supports regular expressions which allows special letter combinations to be included in the search.


awk is a programming language useful for searching and manipulating text files.


The find command searches a directory and subdirectories for files matching certain patterns.


Use whereis to find the location of a command. It looks through standard program locations until it finds the requested command.



The ping utility is usually used to check if communication can be made with another host. It can be used with default settings by just specifying a hostname (e.g. ping or an IP address (e.g. ping It can specify the number of packets to send with the -c flag.


nmap is a network exploration and scanning tool. It can return port and OS information about a host or a range of hosts. Running just nmap will display the options available as well as example usage.


The hostname command displays the current hostname of the system. A privileged (super) user can set the hostname to a new one by supplying it as an argument (e.g. hostname new-host).


Use ifconfig to display the network configuration details for the interfaces on the current system when run without any arguments (i.e. ifconfig). By supplying the command with the name of an interface (e.g. eth0 or lo) you can then alter the configuration: check the manual page for more details.

PowerPoint report with data from MYSQL

Some times we need make a report with information that can’t be changed, and other situations better if the report informations can be changed and improved!
In this post I’m gonna show you, an library on javascript that give us, the flessible tools to do it.

So, to make it more easy, please watch the video series below, and don’t forget, please, help me to make it better give me you opinion and coments

Thank you so motch for your vist!!

Introduction: (A little introduction at how this javascript library work)
Imagem de Amostra do You Tube

Step 1: (Creating the pptx presentation without mysql connection)
Imagem de Amostra do You Tube

Step 2: (Creating the system to generate the data and reports)
Imagem de Amostra do You Tube

Step 3: (Populating database and creating the upload button)
Imagem de Amostra do You Tube


Sometimes it is not convenient to work directly on the Raspberry Pi. Maybe you would like to work on it from another device by remote control.

VNC is a graphical desktop sharing system that allows you to remotely control the desktop interface of one computer (running VNC Server) from another computer or mobile device (running VNC Viewer). VNC Viewer transmits the keyboard and either mouse or touch events to VNC Server, and receives updates to the screen in return.

You will see the desktop of the Raspberry Pi inside a window on your computer or mobile device. You’ll be able to control it as though you were working on the Raspberry Pi itself.

Pi Desktop as seen from a mobile device

VNC Connect from RealVNC is included with Raspbian. It consists of both VNC Server, which allows you to control your Raspberry Pi remotely, and VNC Viewer, which allows you to control desktop computers remotely from your Raspberry Pi should you want to.

You must enable VNC Server before you can use it: instructions for this are given below. By default, VNC Server gives you remote access to the graphical desktop that is running on your Raspberry Pi, as though you were sitting in front of it.

However, you can also use VNC Server to gain graphical remote access to your Raspberry Pi if it is headless or not running a graphical desktop. For more information on this, see Creating a virtual desktop, further below.


On your Raspberry Pi, run the following commands to make sure you have the latest version of VNC Connect:

sudo apt-get update
sudo apt-get install realvnc-vnc-server realvnc-vnc-viewer

Now enable VNC Server. You can do this graphically or at the command line.


  • On your Raspberry Pi, boot into the graphical desktop.
  • Select Menu > Preferences > Raspberry Pi Configuration > Interfaces.
  • Ensure VNC is Enabled.


You can enable VNC Server at the command line using raspi-config:

sudo raspi-config

Now, enable VNC Server by doing the following:

  • Navigate to Interfacing Options.
  • Scroll down and select VNC > Yes.


There are two ways to connect to your Raspberry Pi. You can use either or both, depending on what works best for you.


Direct connections are quick and simple providing you’re joined to the same private local network as your Raspberry Pi. For example, this might be a wired or wireless network at home, at school, or in the office).

  • On your Raspberry Pi (using a terminal window or via SSH) use these instructions or run ifconfig to discover your private IP address.
  • On the device you’ll use to take control, download VNC Viewer. For best results, use the compatible app from RealVNC.
  • Enter your Raspberry Pi’s private IP address into VNC Viewer:

    VNC Viewer dialog showing IP address


You are entitled to use RealVNC’s cloud service for free, provided that remote access is for educational or non-commercial purposes only.

Cloud connections are convenient and encrypted end-to-end. They are highly recommended for connecting to your Raspberry Pi over the internet. There’s no firewall or router reconfiguration, and you don’t need to know the IP address of your Raspberry Pi, or provide a static one.

  • Sign up for a RealVNC account here: it’s free and it only takes a few seconds.
  • On your Raspberry Pi, sign in to VNC Server using your new RealVNC account credentials:

    VNC Server dialog showing sign in

  • On the device you’ll use to take control, download VNC Viewer. You must use the compatible app from RealVNC.
  • Sign in to VNC Viewer using the same RealVNC account credentials, and then either tap or click to connect to your Raspberry Pi:

    VNC Viewer dialog showing sign in


To complete either a direct or cloud connection, you must authenticate to VNC Server.

If you’re connecting from the compatible VNC Viewer app from RealVNC, enter the user name and password you normally use to log in to your user account on the Raspberry Pi. By default, these credentials are pi and raspberry.

If you’re connecting from a non-RealVNC Viewer app, you’ll first need to downgrade VNC Server’s authentication scheme, specify a password unique to VNC Server, and then enter that instead.

  • If you are in front of your Raspberry Pi and can see its screen, open the VNC Server dialog on your Raspberry Pi, select Menu > Options > Security, and choose VNC password from the Authentication dropdown.
  • Or if you’re configuring your Raspberry Pi remotely from the command line, then to make the changes for Service Mode (the default configuration for the Raspberry Pi):
    • Open the /root/.vnc/config.d/vncserver-x11 config file.
    • Replace Authentication=SystemAuth with Authentication=VncAuth and save the file.
    • In the command line, run sudo vncpasswd -service. This will prompt you to set a password, and will insert it for you in the right config file for VNC Server running in Service Mode.
    • Restart VNC Server.


You can remotely access apps which use a directly rendered overlay, such as Minecraft, the text console, the Raspberry Pi Camera Module, and more.

Minecraft running on Raspberry Pi via VNC

To turn this feature on:

  • On your Raspberry Pi, open the VNC Server dialog.
  • Navigate to Menu > Options > Troubleshooting and select Enable experimental direct capture mode.
  • On the device you’ll use to take control, run VNC Viewer and connect.

    Note: existing connections must be restarted in order for these changes to take effect.

Please note that direct screen capture is an experimental feature. If you’re connecting from a desktop computer and mouse movements seem erratic, try pressing F8 to open the VNC Viewer shortcut menu and selecting Relative Pointer Motion.

If performance seems impaired, try these troubleshooting steps, or let RealVNC know.


If your Raspberry Pi is headless (i.e. not plugged into a monitor) or controlling a robot, it is unlikely to be running a graphical desktop.

VNC Server can create a virtual desktop for you, giving you graphical remote access on demand. This virtual desktop exists only in your Raspberry Pi’s memory:

Connecting to an in-memory virtual desktop

To create and connect to a virtual desktop:

  • On your Raspberry Pi (using Terminal or via SSH), run vncserver. Make note of the IP address/display number that VNC Server will print to your Terminal (e.g.
  • On the device you’ll use to take control, enter this information into VNC Viewer.

To destroy a virtual desktop, run the following command:

vncserver -kill :<display-number>

This will also stop any existing connections to this virtual desktop.

CMD Chommand


Resultado de imagem para lista de comando cmd windows 10

Painel de controle

pushd \\Server\Volume –>Acesso a pasta no servidor

ACCESS.CPL: abre as opções de acesso (só no XP);
APPWIZ.CPL: abre a ferramenta Adicionar/Excluir um programa;
AZMAN.MSC: abre o gerenciador de autorizações (só no Vista);
CERTMGR.MSC: abre os certificados para o usuário atual;
CLICONFG: abre a configuração dos clientes SQL;
COLLAB.CPL: abre a visualização instantânea (só no Vista);
COMEXP.MSC ou DCOMCNFG: abre a ferramenta de serviços e componentes (só no Vista);
COMPMGMT.MSC: abre a ferramenta de gestão do computador;
COMPUTERDEFAULTS: abre a ferramenta dos programas padrão (só no Vista);
CONTROL /NAME MICROSOFT.BACKUPANDRESTORECENTER: abre o centro de backup e de restauração (só no Vista);
CONTROL ADMINTOOLS: abre as ferramentas de administração;
CONTROL COLOR: abre as propriedades de exibição;
CONTROL FOLDERS: abre as opções de pastas;
CONTROL FONTS: abre o gerenciador de caracteres;
CONTROL INTERNATIONAL ou INTL.CPL: abre as opções regionais e linguísticas;
CONTROL KEYBOARD: abre as propriedades do teclado;
CONTROL MOUSE ou MAIN.CPL: abre as propriedades do mouse;
CONTROL PRINTERS: impressoras e faxes disponíveis;
CONTROL USERPASSWORDS: abre as contas dos usuários;
CONTROL USERPASSWORDS2 ou NETPLWIZ: controla os usuários e seus acessos;
CONTROL: abre o Painel de controle;
CREDWIZ: abre a ferramenta de backup e de restauração de senhas dos usuários (só no Vista);
DESK.CPL: abre as configurações de exibição;
DEVMGMT.MSC: abre o gerenciador de dispositivos;
DRWTSN32: abre o Dr. Watson (só no XP);
DXDIAG: abre a ferramenta de diagnóstico DirectX;
EVENTVWR ou EVENTVWR.MSC: abre o observador de eventos;
FSMGMT.MSC: abre as pastas compartilhadas;
GPEDIT.MSC: abre o editor de estratégias de grupo (para edições profissionais do Windows);
HDWWIZ.CPL: abre o assistente para adicionar hardware;
INFOCARDCPL.CPL: abre o assistente de compatibilidade de programas;
IRPROPS.CPL: abre o gerenciador de infravermelho;
ISCSICPL: abre a ferramenta de configuração do iniciador ISCI Microsoft (só no Vista);
JOY.CPL: abre a ferramenta do controlador de jogos;
LPKSETUP: abre o assistente de instalação e desinstalação dos idiomas de exibição (só no Vista);
LUSRMGR.MSC: abre o editor de usuários locais e grupos;
MDSCHED: abre a ferramenta de diagnósticos da memória do Windows (só no Vista);
MMC: abre um novo console vazio;
MMSYS.CPL: abre as configurações de som;
MOBSYNC: abre o centro de sincronização;
MSCONFIG: abre a ferramenta de configuração do sistema;
NAPCLCFG.MSC: abre a ferramenta de configuração do cliente NAP (só no Vista);
NTMSMGR.MSC: abre o gerenciador de suporte de armazenamento removível;
NTMSOPRQ.MSC: abre as solicitações do operador de armazenamento removível;
ODBCAD32: abre o administrador de fonte de dados ODBC;
OPTIONALFEATURES: abre a ferramenta Adicionar/Excluir componentes do Windows (só no Vista);
PERFMON ou PERFMON.MSC: abre o monitor de confiabilidade e de desempenho Windows;
POWERCFG.CPL: abre o gerenciador de modos de alimentação (só no Vista);
REGEDITou REGEDT32: abre o editor de registro (só no Vista);
REKEYWIZ: abre o gerenciador de certificados de criptografia de arquivos (só no Vista);
RSOP.MSC: abre o conjunto resultante de diretivas;
SECPOL.MSC: abre as configurações de segurança local;
SERVICES.MSC: abre o gerenciador de serviços;
SLUI: abre o assistente de ativação do Windows (só no Vista);
SYSDM.CPL: abre as propriedades do sistema;
SYSEDIT: abre o editor de configuração do sistema (atenção, manipular com cautela);
SYSKEY: abre o utilitário de proteção do banco de dados das contas do Windows (atenção, manipular com extrema cautela);
SYSPREP: abre a pasta com a ferramenta de preparação do sistema (só no Vista);
TABLETPC.CPL: abre as configurações para Tablet PC (só no Vista);
TASKSCHD.MSC ou CONTROL SCHEDTASKS: abre o planejador de tarefas (só no Vista);
TELEPHON.CPL: abre a ferramenta de conexão telefônica;
TIMEDATE.CPL: abre as configurações de hora e data;
TPM.MSC: abre a ferramenta de gestão de módulo de plataforma protegida no computador local (só no Vista);
UTILMAN: abre as opções de ergonomia (só no Vista);
VERIFIER: abre o gerenciador de verificação de drivers;
WMIMGMT.MSC: abre o Windows Management Infrastructure;
WSCUI.CPL: abre o centro de segurança do Windows;
WUAUCPL.CPL: abre o serviço de atualização do Windows (só no XP).

Comandos para abrir programas e ferramentas do Windows

%WINDIR%\SYSTEM32\RESTORE\RSTRUI.EXE: abre a ferramenta de restauração do sistema (só no XP);
CALC: abre a calculadora;
CHARMAP: abre a tabela de caracteres;
CLIPBRD: abre a área de transferência (só no XP);
CMD: abra o interpretador de comandos (prompt);
DIALER: abre o numerador telefônico do Windows;
DVDPLAY: abre seu leitor DVD;
EUDCEDIT: abre o editor de caracteres privados;
EXPLORER: abre o Windows Explorer;
FSQUIRT: abre o assistente de transferência de arquivos Bluetooth;
IEXPLORE: abre Internet Explorer;
IEXPRESS: abre o assistente de criação dos arquivos auto-extraíveis;
JOURNAL: abre um novo registrador (só no Vista);
MAGNIFY: abre a lupa;
MBLCTR: abre o centro de mobilidade do Windows (só no Vista);
MIGWIZ: abre a ferramenta de transferência de arquivos e configurações do Windows (só no Vista);
MIGWIZ.EXE: abre a ferramenta de transferência de arquivos e de configurações do Windows (só no XP);
MOVIEMK: abre o Windows Movie Maker;
MRT: abre a ferramenta de remoção de malwares;
MSDT: abre a ferramenta de diagnósticos e suporte da Microsoft;
MSINFO32: abre as informações do sistema;
MSPAINT: abre o Paint;
MSRA: abre a assistência remota do Windows;
MSTSC: abre a ferramenta de conexão da assistência remota;
NOTEPAD: abre o bloco de notas;
OSK: abre o teclado visual;
PRINTBRMUI: abre o assistente de migração da impressora (só no Vista);
RSTRUI: abre a ferramenta de restauração do sistema (só no Vista);
SIDEBAR: abre a barra do Windows (só no Vista);
SIGVERIF: abre a ferramenta de verificação da assinatura do arquivo;
SNDVOL: abre as propriedades do volume;
SNIPPINGTOOL: abre a ferramenta captura de tela (só no Vista);
SOUNDRECORDER: abre o gravador;
STIKYNOT: abre o lembrete (só no Vista);
TABTIP: abre o painel de entrada dados de Tablet PC (só no Vista);
TASKMGR: abre o gerenciador de tarefas do Windows;
WAB: abre os contatos (só no Vista);
WERCON: abre a ferramenta de relatórios e de soluções de problemas (só no Vista);
WINCAL: abre o calendário do Windows (só no Vista);
WINCHAT: abre o software Microsoft de bate-papo na net (só no XP);
WINDOWSANYTIMEUPGRADE: permite a atualização do Windows Vista;
WINVER: abre a janela para que você conheça a versão do seu Windows;
WINWORD: abre o Word (se estiver instalado);
WMPLAYER: abre o Windows Media Player;
WRITE ou Wordpad: abre o Wordpad.

Comandos para administrar os discos

CHKDSK: efetua análises da partição especificadas nas configurações do comando (para mais informações, digite CHKDSK /? no interpretador de comandos);
CLEANMGR: abre a ferramenta de limpeza do disco;
DEFRAG: desfragmenta o disco rígido;
DFRG.MSC: abre a ferramenta de desfragmentação do disco;
DISKMGMT.MSC: abre o gerenciador de discos;
DISKPART: abre a ferramenta de particionamento (manipulação pesada).

Comandos de gestão das redes e Internet

CONTROL NETCONNECTIONS ou NCPA.CPL: abre as conexões da rede;
FIREWALL.CPL: abre o firewall do Windows;
INETCPL.CPL: abre as propriedades da Internet;
IPCONFIG: exibe as configurações dos endereços IP no computador;
NETSETUP.CPL: abre o assistente de configuração de rede (só no XP);
WF.MSC: abre as funções avançadas do firewall do Windows (só no Vista).

Outros comandos do Windows

%HOMEDRIVE%: abre o explorador na partição onde o sistema operacional está instalado;
%HOMEPATH%: abre a pasta do usuário conectado C:\Documents and settings\[nome do usuário];
%PROGRAMFILES%: abre a pasta de instalação de outros programas;
%TEMP% ou %TMP%: abre a pasta temporária;
%USERPROFILE%: abre a pasta do perfil do usuário conectado;
%WINDIR% ou %SYSTEMROOT% : abre a pasta de instalação do Windows;
%WINDIR%\system32\rundll32.exe shell32.dll,Control_RunDLL hotplug.dll: exibe a janela “Retirar o dispositivo com segurança”;
AC3FILTER.CPL: abre as propriedades do filtro AC3 (se instalado);
FIREFOX: executa o Mozilla Firefox (se instalado);
JAVAWS: visualiza o cache do software JAVA (se instalado);
LOGOFF: fecha a sessão;
NETPROJ: autoriza ou não a conexão a um projetor de rede (só no Vista);
SFC /SCANNOW: varre, imediatamente, todos os arquivos do sistema e localiza os que estão danificados;
SFC/VERIFYONLY: varre apenas os arquivos do sistema;
SFC/SCANFILE=”nome e caminho do arquivo”: varre o arquivo especificado e repara, caso esteja danificado;
SFC/VERIFYFILE=”nome e caminho do arquivo”: varre apenas o arquivo especificado;
SFC/SCANONCE: varre os arquivos do sistema no arranque seguinte;
SFC/REVERT: restabelece a configuração inicial (para mais informações, digite SFC /? no interpretador de comandos);
SHUTDOWN: desliga o Windows;
SHUTDOWN-A: interrompe a desconexão do Windows;
VSP1CLN: remove o cache de instalação do serviço pack 1 do Vista.

Lux monitoring – LDR Arduino and Nodejs

Hello guys! How are you? I hope everything’s ok!

So, in this post I’ll try explain, how you can do the lux monitoring system, using:

– Arduino Uno,

Photo-resistor LDR,

Two led (green and red) to visual status indicator

Nodejs and chart.js module,  to show the lux range in real time.

Step 0 > Install Nodejs and NPM

To make this task you need install before the nodejs and npm

Step 1 > Electrical connections

See the electrical connections bellow:


Step 2 > Installation of dependencies:

Create the folder the folder Node_LDR;

Into this folder create the packagejson.js:

Into the packagejson.js file, write the code below:

    "name": "LDR_Aduino_Nodejs",
    "version": "0.0.1",
    "dependencies": {
      "chart.js": "^2.2.1",
      "express": "^4.14.0",
      "serialport": "^4.0.1",
      "": "^1.4.8"

Save and close!

After, open your prompt command and run npm install:


When the installation is finished look into the folder   Node_LDR:

– Node_LDR

— node_modules

— package.json

If your folder it’s the same that format, everything’s ok!!

Step 3 > Installation of Arduino IDE:

Click here and install the IDE


Step 4 > C++ code:

Open your arduino IDE and write the follow code:

int portaledred = 10;
int portaledgreen = 11;
int pinoport = 5;
int valorport = 0;
float luminosidade = 0;

void setup() {
 pinMode(portaledred, OUTPUT);
 pinMode(portaledgreen, OUTPUT);

void loop() {
 valorport = analogRead(pinoport);

 luminosidade = map(valorport, 0, 1023, 0, 255);
 Serial.print("Valor do LDR : ");
 Serial.print(" = Luminosidade : ");

 if (valorport &amp;gt; 900)
 digitalWrite(portaledred, HIGH);
 digitalWrite(portaledgreen, LOW);
 digitalWrite(portaledred, LOW);
 digitalWrite(portaledgreen, HIGH);

Make Upload the code on Arduino board:


After the upload is done make a test

Step 5 > Communication between Arduino, Nodejs and Web page:

Open the text editor of your preference and create the app.js with code below:

var app = require('express')();
var express = require('express');

app.use(express.static(__dirname + '/public'));

var http = require('http').Server(app);
var io = require('')(http);

app.get("/", function(req, res){
 res.sendFile("/cygwin64/home/pablo.binotto/node/arduino/index.html");//here is necessary the all url of folder into the c:/

var mySocket;

var serialport = require('serialport');
var SerialPort = serialport.SerialPort;

var mySerial = new SerialPort("COM5", {
 baudrate: 9600,
 parser: serialport.parsers.readline("\n")

mySerial.on('open', function(){
 console.log("Porta aberta.");

mySerial.on("data", function(data){
 io.emit("dadoArduino", {
 valor: data

io.on("connection", function(socket){
 console.log("Usuario conectado")

http.listen(3000, function(){
 console.log("Server running on 3000 port");

Save this file on Node_LDR folder and on the same folder, create the file index.html follow the code below:

<!DOCTYPE html>
<html lang="">
 <meta charset="utf-8">
 <meta http-equiv="X-UA-Compatiblr" content="IE=edge">
 <meta name= "viewport" content="width=device-width, initial-scale=1">
 <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-wp-preserve="" data-mce-resize="false" data-mce-placeholder="1" class="mce-object" width="20" height="20" alt="&lt;script&gt;" title="&lt;script&gt;" />
 <canvas id="myChart" width="400" height="400"></canvas>
 <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-wp-preserve="%3Cscript%20type%3D%22text%2Fjavascript%22%3E%0A%20var%20ctx%20%3D%20document.getElementById(%22myChart%22)%3B%0A%20%0A%20var%20myLineChart%20%3D%20new%20Chart(ctx%2C%20%7B%0A%20type%3A%20'line'%2C%0A%20data%3A%20data%2C%0A%20options%3A%20options%0A%20%7D)%3B%0A%20%0A%20%3C%2Fscript%3E" data-mce-resize="false" data-mce-placeholder="1" class="mce-object" width="20" height="20" alt="&lt;script&gt;" title="&lt;script&gt;" />
 <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-wp-preserve="%3Cscript%20type%3D%22text%2Fjavascript%22%3E%0A%20var%20socket%20%3D%20io()%3B%0A%20socket.on(%22dadoArduino%22%2C%20function(dado)%7B%0A%20console.log(dado)%3B%0A%20%7D)%3B%0A%20%3C%2Fscript%3E" data-mce-resize="false" data-mce-placeholder="1" class="mce-object" width="20" height="20" alt="&lt;script&gt;" title="&lt;script&gt;" />

On your prompt command write: node app.js and click enter…

Open a new web page and go to localhost:3000…

In this video below, you can see the communication happening

Step 6 > Show the result on line graph into the web page:

See you again!

Raspberry Pi and NFC ACR122u – English version

Hello everybody!

In this post I’ll show you, how to do a presence control using the ACR122u reader and the Raspberry Pi B+ 2, programing with javascript, Nodejs and MYSQL.


Imagem de Amostra do You Tube








After Terminal opening, the first step is check if all thing are updated on our Raspberry

~$ sudo apt-get update

~$ sudo apt-get upgrade

Installing Node.js via package manager:

curl -sL | sudo -E bash -
sudo apt-get install -y nodejs
sudo apt-get install -y build-essential

For more information on how to install Node.js visit the official site

to check that everything was installed correctly enter the code below:

~$ node -v

v0 . 12 . 9 

~$ npm -v

2 . 14 . 9

You’ll have something like this.

First you need install libudev-dev:

sudo apt-get install libudev-dev

Then you need to install libusb, this should do the trick:

sudo apt-get install libusb-dev

apt-get install libpcsclite1 libpcsclite-dev
npm install pcsclite
apt-get install pcscd

Now we need to install NFC Tools:


tar xjf libnfc-1.7.1.tar.bz2

cd libnfc-1.7.1

./configure –prefix=/usr –sysconfdir=/etc


./configure –with-drivers=all –prefix=/usr –sysconfdir=/etc


sudo make install

sudo apt-get install libtool

sudo apt-get install libsystemd-dev

sudo apt-get install libpcsclite1

sudo apt-get install flex

git clone git://

Now will install the dependencias of ACR122u reader:

— Install the ACS Driver —
make a dowload on oficial web site of ACR122u here.

unzip the file

~$ cd acsccid-x.y.z // to access the folder

~$  ./configure

~$ make

~$ make install

The installation can spend some minutes

Now you need to configure the file libccid_info.plist on cd /etc directory

~$ cd

~$ cd /etc

~$ sudo nano libccid_info.plist

Change the following line in the file:




Ctrl + x and press y to save!

~$ cd // to return on root folder (/home/pi..)

To verify that everything worked out so far, write:

~$ sudo nfc-list // comment: see result below

nfc-list uses libnfc 1.7.1
NFC device: ACS / ACR122U PICC Interface opened

~$ sudo nfc-scan-device -v // comment: see result below

nfc-scan-device uses libnfc 1.7.1
1 NFC device(s) found:
– ACS / ACR122U PICC Interface:
chip: PN532 v1.6
initator mode modulations: ISO/IEC 14443A (106 kbps), FeliCa (424 kbps, 212 kbps), ISO/IEC 14443-4B (106 kbps), Innovision Jewel (106 kbps), D.E.P. (424 kbps, 212 kbps, 106 kbps)
target mode modulations: ISO/IEC 14443A (106 kbps), FeliCa (424 kbps, 212 kbps), D.E.P. (424 kbps, 212 kbps, 106 kbps)

I believe that everything must have worked here! In case of problems leave a comment we will solve the problem.

Acabamos a primeira fase do nosso projeto onde temos:

  • The Raspberry with the OS installed and running;
  • The ACR122u reader configured and running.

Now create a folder by typing:

~$ cd // to ensure that the root folder

~$ mkdir rfid // to create the folder

~$ cd rfid // to enter the folder

Let’s start by installing the dependencies to our project …

~$ npm install express

~$ npm install pcsclite

~$ npm install

~$ npm install mysql

  • Ready believe we installed all dependencies, but if they encounter problems tell me to review the post.

Continuing with our project created in mysql database databesname the tables using the settings below:

`evento` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`qty` int(1) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

 `nome` varchar(100) DEFAULT NULL,
 `foto` varchar(100) DEFAULT NULL,
 `rfid` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
 `dept` varchar(20) NOT NULL,
 `turno` varchar(10) NOT NULL,
 `divi` varchar(1) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
 `Qty` int(1) NOT NULL DEFAULT '1',
 `fone` varchar(30) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
 `email` varchar(50) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `coutbyid` AS select `ck`.`evento` AS `evento`,count(`ck`.`qty`) AS `count(``qty``)` from `ck` group by `ck`.`evento`;
 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `grupo` AS select `event`.`rfid` AS `rfid`,`event`.`foto` AS `foto`,`event`.`nome` AS `nome`,`event`.`turno` AS `turno`,`event`.`divi` AS `divi`,`event`.`dept` AS `dept`,`coutbyid`.`count(``qty``)` AS `count(``qty``)` from (`event` join `coutbyid` on((`event`.`rfid` = `coutbyid`.`evento`))) order by `event`.`nome`; 

Clone the files on GitHub:

sudo apt-get clone


sudo npm install

Let’s test it all worked out:

1º open the terminal in raspberry;

2º  Start new.js middleware that will be responsible for reading and writing of RFID tags in the code mysql:

~$ cd rfid

~$ node new

3º In another terminal to start the HTTP server of the node:

~$ cd rfid

~$ node sv-http

4º Open your browser and access the html we created last, the page that will display that is present or absent. In vavegador Type in: http://localhost:8000


If all right gave up page will be displayed!!


Place raspberry in Kiosk mode and automatically start the sv-http server and has open the page to display our presence control:

First we have to install the chromium

~$ sudo apt-get install chromium x11-xserver-utils unclutter

Now let’s edit the file auto start

~$ sudo nano /etc/xdg/lxsession/LXDE-pi/autostart

The file should look like the following lines:

@xscreensaver -no-splash

@xset s off
@xset -dpms
@xset s noblank

@lxterminal –command “node /home/pi/rfid/sv-http.js”

@sed -i ‘s/”exited_cleanly”: false/”exited_cleanly”: true/’ ~/.config/chromium/Default/Preferences
@chromium –noerrdialogs –kiosk

Ctrl + C  – y  – enter

Now let’s make the raspberry connect without using keyboard and mouse

~$ sudo nano /etc/rc.local

su -l pi -c startx // deu certo

Add line before exit 0

Ctrl + C  – y  – enter

Let’s stop here.

  • The post goes on to the next update we will make a page for more dynamic record, without having to enter the rfid each new account. The way that this is not good.

I hope you enjoyed and that everything has worked out so far. Any problems leave a comment that soon I will answer!

Should they improve what was done let me know !!

Big hug to all 🙂