Switch On/Off the HDMI port in Raspberry Pi 3

Sometime we need to switch Off or On the HDMI port on our Raspberry Pi 3.

Check the status of the HDMI port

To check the status of the HDMI port we can use the tvservice with parameter -s. Type:

sudo /opt/vc/bin/tvservice -s

If the HDMI port is OFF the output will be:

state 0x120002 [TV is off]

If the HDMI port is ON the output will be something similar to:

state 0x12000a [HDMI CEA (16) RGB lim 16:9], 1920x1080 @ 60.00Hz, progressive

Switch On or Off the HDMI port

To switch On the HDMI port we will invoke the tvservice with parameter -p:

sudo /opt/vc/bin/tvservice -p

The output will be:

Powering on HDMI with preferred settings

To switch Off the HDMI port we will invoke the tvservice with parameter -o:

sudo /opt/vc/bin/tvservice -o

The output will be:

Powering off HDMI

Switch Off HDMI on boot

To switch Off the HDMI port on every boot, you have to edit your /etc/rc.local. I will use nano to edit the file:

sudo nano /etc/rc.local

Now, add the following line above the exit 0.

# Disable HDMI
/opt/vc/bin/tvservice -o

Switching Off HDMI on boot can save about 30mA of current.


Install Node.JS on Raspberry Pi 3

To install Node.JS on our little raspbian server, we will use the NodeSource repository.

The first step is to add the NodeSource APT repository and the PGP keys to verify packages. In your terminal, type:

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -

Now we can install Node.JS. Type:

sudo apt-get install -y nodejs

To check if Node.JS is installed successfully on your raspberry, type:

node -v

The output will be the node version (v8.6.0 in my case):




Share a folder via Samba on Raspberry Pi 3

Share a folder from Raspbian 9 (stretch) is pretty simple.

Check samba status

You need to check if samba already installed and running.

Type in your terminal:

$ samba --version

The output must be the version number of the installed samba version:

$ Version 4.5.12-Debian

To check if it’s running, type (you mast be root or sudoers):

$ sudo smbstatus

If samba is running it will show different information on the service PID, user, machine, shred folders and so on. In this case skip the next paragraph.

Install samba server

If samba is not correctly installed type (you mast be root or sudoers):

$ sudo apt-get install samba samba-common-bin

Configure your samba server

It’s now time to configure your samba server.

Let’s go to edit the smb.conf located in /etc/samba (I’ll use nano editor). Type:

$ sudo nano /etc/samba/smb.conf

Change the following entries:

workgroup=WORKGROuP  # This must be set with your workgroup. Leave if you don't know.
wins support=yes # Wins is support to Windows machine. Leave if you don't need it.

and ADD to the end of the file the share setting for your folder:

comment = ANY_COMMENT
read only = no
only guest=no
guest ok=no
create mask=0777
directory mask=0777

Where SHARE_FOLDER_NAME is the name you want to give to this share, ANY_COMMENT is just a comment, PATH_OF_THE_SHARED_FOLDER is the path of the folder to share (for ex. if I want to share my home folder it is: /home/stefano ).
To save just press CTRL+X and confirm with Y.

Setup a password

It’s time to setup a password for your user. Type:

$ sudo smbpasswd -a username

where username is your local username. Provide a new password.

Restart the server

To restart the server and make all change available, type:

$ sudo /etc/init.d/samba restart

Connect to your share

Now you can try to connect to your samba server.

For example: in Mac OS X you can press from a Finder window Command+k (+k). In the server address type smb://IP_ADDRESS_OF_YOUR_SERVER/SHARE_FOLDER_NAME and provide your Username and your Password that you previously created.