Welcome, my name is Giovanni, a 35 years old italian engineer
that would like share his experience in IoT, electronic, raspberry, arduino,
electrotechnic, and others things. In this blog i will try to realize a different
approch to these stuff. It’s not a hobby or a toys…. I will try to explain my practical,
pragmatical and REAL approch for building REAL, SAFE, and RELIABLE utilities.
all posts- #16 Best Toners ever 2020-08-08
- #15 Eletronics Stuff 2020-08-05
- #14 Create SSH Reverse Tunnel in rapid way, reliable and programmaticaly 2019-08-08
- #13 Automate, silence smartphone at work 2019-07-07
- #12 Control your lights without sonoff or other things 2019-06-06
- #11 Google Home and IFTTT, turn on the stove 2019-05-05
- #10 Google Home Hack, send voice programmaticaly with Python 2019-04-04
- #9 Google Home Hack, hidden REST API 2019-03-03
- #8 1.05 A quick WebApp for your thermostat 2019-02-02
- #7 Root for my Huawei P8 Lite 2017 PRA-LX1 2019-01-01
- #6 1.04 Relais board and Thermostat script 2018-12-12
- #5 1.03 Reading the DS18B20, prepare some libraries 2018-11-11
- #4 1.02 Use temperature sensor DS18B20 2018-10-10
- #2 1.01 Initially setup your RaspberryPI 2018-09-25
- #3 1.00 The Silvano idea – the beginning 2018-09-23
- #1 Welcome 2018-09-21
1.01 Initially setup your RaspberryPI
So, buy a RaspberryPI download RASPBIAN STRETCH LITE here (it’s minimal image, only cli, no visual), and write on a SD. I use Win32DiskImager, you can download here. When you have wrote the SD, insert it into a windows computer, and create a file into /boot/ path. Named this file “ssh” without extension. This thing allow you to use ssh from the begin. Insert the SD into raspberry and attach power supply. Now we see my default configuration…. packages installed, configuration files ecc. Update your raspberry with the utility raspi-config. Update your timezone, change the host name and change your password.
Put pi in the sudoers
PI user in our cases must be like root. For this purpose the user pi will be in sudoers file, without password.
sudo nano /etc/sudoers
#adding this line at the end
pi ALL=(ALL) NOPASSWD: ALL
Install Apache2 and Php7. 0-cli
For making stable interface (maybe in http) and in the future a web-app for controlling stove and other feature we install apache2 and php7. 0….
Also php7. 0-cli for making script.
sudo apt install apache2 php -y
sudo chmod -R 777 /var/www/html
the last command is for making the wwwroot accessible also for pi user.
Now, we have to change configuration of apache and php for display eventualy errors. Open the php.ini and modify a line.
sudo nano /etc/php/7.0/apache2/php.ini
# search the line with display_errors=
# and set display_errors=On
sudo cp /etc/php/7.0/apache2/php.ini /etc/php/7.0/cli/php.ini
sudo service apache2 restart
Install WiringPI for access GPIO
Install the beautiful WiringPI library (here is the original guide)
sudo apt-get update
sudo apt-get purge wiringpi
hash -r
sudo apt-get install git-core
cd
git clone git://http://git.drogon.net/wiringPi
cd ~/wiringPi
git pull origin
cd ~/wiringPi
./build
Install sshpass for future use
In future posts We will use ssh and the utility sshpass for an automatic reverse tunneling and controls gpio remotly… You trust me.
sudo apt-get install sshpass
Set static IP to your Raspberry
Modify this file
sudo nano /etc/dhcpcd.conf
Now reboot, please.
Ok, Raspberry is ready
Now we have a raspberry ready for control relais and temperature sensor (one little setup for the DS18B20 in the next post). We have also apache2 and php for making some API and some cli-script. And olso GCC…. for making C++ and C software that is just installed by default.