Categories
How to Raspberry Pi

Setting up static IP on your Pi

In order to set a static IP address on your Pi we will have to go into the configuration of your network adapter. So start the command line (or a terminal window) and start typing the following commands.

sudo nano /etc/network/interfaces

Once the configuration file is open delete all the content by holding down CTRL + K

Now copy and paste the following text into the configuration file.

allow-hotplug eth0
iface eth0 inet dhcp

allow-hotplug wlan0
auto wlan0
iface wlan0 inet static

address 192.168.2.21
netmask 255.255.255.0
gateway 192.168.2.254

dns-nameservers 8.8.8.8 8.8.4.4
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

In this configuration the ethernet port will stay on DHCP (dynamic IP address). The WiFi adapter (wlan0) will get a static IP address. In my example this will be 192.168.2.21 with a class C subnet (255.255.255.0) and my gateway is 192.168.2.254. Feel free to use your personal IP ranges instead.

The DNS addresses are from Google. Also feel free to replace them with other DNS name server addresses.

Save and Exit Nano by typing CTRL + X then press Y followed by ENTER.

sudo reboot now

After the reboot your WiFi IP should read 192.168.2.21 (or the ip you choose).

To check this use the command

ip addr

 

Categories
How to Raspberry Pi

Configuring WiFi on your PI (CLI)

While you can configure WiFi via the Raspi-config method, it can be usefull to do it ‘by hand’. This is how you do that.

From the command prompt give the following commands.

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

At the bottom of the tekst add these lines and replace the network name with the name of your WiFi network (SSID) and password with the password of your WiFi network. Leave the quotation marks before and after both the name and the password.

network={
ssid=”network name”
psk=”password”
}

Save and close the file with CTRL + X, Y and ENTER and reboot your Pi for the configuration to take effect.

sudo reboot now

Categories
Crypto currency How to Raspberry Pi

Mining crypto with a Raspberry Pi

Did you ever wanted to try your hand at mining crypto currency? I did. And I even got it to work on a Raspberry Pi. Okay I did not get rich overnight, but it worked and for a nerd like me that is really fun. If you want to try this yourself, follow the instructions below and watch my Youtube video for details on mining pool setup and even how to send your coins to an Exchange to buy Bitcoin. Ha! who said you can’t mine Bitcoin with a Raspberry BUYAH!

Okay the starting point of these instructions is a freshly installed Raspberry with either Raspbian Stretch (Lite version will do fine) or Pi64. Both work, but I found that Pi64 got a little higher Hashing rate. You can follow my instructions on how to install an image and configure a Pi via this link if you need to and I forked the Pi64 image location to my Github page here.

So you booted up your Pi and are looking at the command prompt. Let’s first update everything and get that out of the way.

sudo apt-get update -y && sudo apt-get upgrade -y

Now install all the dependencies to get your mining rig running.

sudo apt-get install autoconf libcurl4-openssl-dev libjansson-dev openssl libssl-dev gcc gawk wget unzip make

Download the mining software and unzip it

wget https://github.com/conan-equal-newone/yenten/releases/download/1.1.0/yenten_minerd_source.zip

unzip yenten_minerd_source.zip

Do some configuring

cd yenten_miner

sudo chmod 700 *

sudo touch ChangeLog

sudo ./autogen.sh

sudo ./configure

sudo make -j4

If all went well we are now able to mine the Altcoin named Yenten. It is a Japanese coin and will become the world only currency in about 10 years or so I’m told. But for now it is almost worth 2 cents at the moment of writing this post.

Be sure to watch my video in order to understand how to get a wallet where all your mining spoils will be send to from the mining pool. Oh and you will also see how to create and configure your miningpool account. So be sure to check it. The video isn’t my greatest work (yet) but it is my first step on my very own Youtube channel.

[embedyt] https://www.youtube.com/watch?v=pkXI19YPm7Q[/embedyt]

Once you have done the wallet and the miningpool thingy, you are clear to mine some coins. Just give the following command (and replace my account, workername and password with yours).

sudo ./minerd -a yescryptr16 -t 4 -o stratum+tcp://yenten.luckypool.org:3344 -u jiltednl.pi001 -p password

Oh and if you become a miljonair with this great tutorial, email me for my bankaccount number. Thank you.

This is my own mining rig by the way. Impressive right?

 

Categories
How to Raspberry Pi

Setting the time on your PI

Because Time is money I will keep this short and sweet.

From the command prompt (or a terminal window) give the following two commands

sudo apt-get install ntpdate

sudo ntpdate -u 0.nl.pool.ntp.org

Reboot your Pi and that is it.

sudo reboot now

Categories
Domotica How to Raspberry Pi

Monitoring your power consumption

Here in the Netherlands most houses are equiped with a so called ‘Smart-meter’. This device makes it possible to register the in- and outtake of the power used. While this is mostly confinient for the powercompanies for sending you the powerbill, it can also be read with the right equipment and monitor your energy consumption for yourself.

I myself do this with a ‘Smart-meter cable’ that connects to my Raspberry Pi running Domoticz.

All you need is a ‘Smart-meter’ cable and a Pi running the latest version of Raspbian and install Domoticz. Any Pi will do for this particular use, but if you want Domoticz to do more than just registering your Power consumption a Pi 3B is adviced. The footprint of Domoticz isn’t that big, so a 8 GB SD card should be enough (I used a 16 GB card).

You can follow my guides to install Raspbian if this is your first time.

From the command prompt (or from a terminal) you give the following commands.

sudo curl -L install.domoticz.com | bash

After the installation is finished be sure to reboot your pi.

sudo reboot now

Now your Domoticz server is running on your network you can connect to it by using a webbrowser to the ip address of your Pi. If you do not know the IP address use the following command to get it.

ip addr

Your <IP address> should look something like 192.168.2.123 in my case for instance it’s 192.168.2.23

In a webbrowser type the follwing and be sure to replace my IP address with your address.

http://192.168.2.23:8080

Your browser will show the Domoticz admin page where you can add all sorts of domotica devices like Nest, Netatmo, Hue, etc. But also your smart-meter cable.

To do this go to the top right menu item named Setup and choose Hardware

Than add a new device called P1 smart meter USB and configure like it is shown in the image below.

Now go back to the Setup menu and select the Devices option.

Now look for the green dot with the white arrow in it an click on it. A pop-up will appear where you can give the device a name. Leave it default or type something you would like to name the device in Domoticz and click Add (the example is when I was adding my Rain meter from Netatmo, just so you know).

When you have added the device, Domoticz will start registering the power intake and report it back to you in various graphs. Starting with the 24 Hour graph a Weekly graph, Monthly and even a Year view. So this time next Year all graphs will be filled 😉

If you are using solar panels in combination with a smart meter Domoticz will also show how much energy you have produced in regards to your power consumption.

As a nerd these figures and graphs are not only usefull, but fun to watch if you ask me.

 

Categories
Domotica How to Raspberry Pi

Domotica Hub: Domoticz

As a domotica enthousiast a domotica hub is a must. This is due to all the ‘standards’ that are used that do not communicatie with each other. There is Zigbee, Z-Wave, Bluetooth, WiFi, etc, etc. A pain in the butt if you ask me. Guess that’s just the way these things work (or don’t work actually).

But here come the domotica-hubs and all the various protocols just suddenly talk with each other. Because the domotica-hub is the universal translator so to speak (pun intended).

There are a few hubs you can choose from and some good ones are even free. Just install them on a computer and plug them into your home network. One of the first hubs I tried is Domoticz. Simply running on a Raspberry Pi. Totally free, super easy to install.

Just get a freshly installed Raspberry with a fully updated Raspbian connected to your home network and the Internet and run the following command.

sudo curl -L install.domoticz.com | bash

Now you have your own domotica hub.

Just start a webbrowser and connect to the Domoticz installation using the IP address of your Pi. My Pi for example uses 192.168.2.23

http://192.168.2.23:8080

And voila! All that is left to do is configure your various devices and you are done. Okay, there are better solutions that are also running on a Raspberry Pi, but as I said this was my first experiment regarding the domotica hub software extravaganza.

Adding devices is done by these three steps.

First go to the Setup menu (upper right of the screen) and choose Hardware

The first drop down menu you see is called Type. Here you must choose the device your want to add. For example Netatmo.

Click Add and go back to the Setup menu. Now choose Devices.

If the device you’ve added under Hardware has more than one function or several attached other devices they will probably all show up here. In my case I use multiple Netatmo devices such as indoor temp, outdoor temp, rain, wind, and so on. They all show up in the Devices menu.

By clicking on the green dot with the white arrow of each device I can actually add them to my Domoticz server. After which I can use them from the various other menu options (Temperature, Weather, etc.).

Just go through all of the other menu options to see if a device is added. Once you have found one you can click on the little star icon in the bottom left corner of each device to make them a favourite and they will be added to your Dashboard.

Do this for all your other domotica devices if you wish. Add your Hue lights, Logitech Harmony remote, Nest thermostats, what ever is presented in the Type dropdown menu.

This is just the basic setup. If you look in the Setup menu you will find more advanced options to automate and even script all of the devices triggers and values into a complete automation Walhalla. But that is for another post…

 

 

featured image source: techpulse.be

Categories
How to Raspberry Pi

Basic installation steps (part 2)

You probably just finished my tutorial on configuring your Pi with raspi-config and are have rebooted your Pi. If not, check that post in order to enable all the features you need to update and upgrade your Pi.

After that you can follow these final steps to make sure you are running the latest versions of the installed software and dependencies.

from the command prompt (and if you booted into the graphical user interface (GIU) start a terminal window) type the following command en press enter.

sudo apt-get update -y && sudo apt-get upgrade -y

This will update all the latest software locations and also install the newest versions of the already installed software (dependencies).

When the installation is done (this can take a while) make sure to reboot your Pi before moving on to the next step.

sudo reboot now

The next step is optional and is only needed if your Pi isn’t brand new to start with. It updates the Pi’s firmware (the software on the Pi itself, not on the SD card).

sudo rpi-update

When this is finished be sure to reboot again, so that the new firmware is active and your Pi feels brand new. Enjoy!

 

Categories
How to Raspberry Pi

Basic installation steps (part 1)

When you have written the Raspbian image to your SD card and booted your Pi for the first time be sure to follow these steps to configure your Pi for your home situation. From the command prompt (or a Terminal window) use the following command.

sudo raspi-config

You will see the configuration program of Raspbian. Here we will set al the primairy settings in order for you to use the Pi. I will not be getting into al the details of the entire configuration with all its options, just the basics to get you on your way.

First it is always a good idea to change the default password to a password you only know. Therefore select the first menu option and follow the instructions onscreen.

Once you have done that you will be brought back to the main menu. Now we will set the network options to let your Pi communicate with your home network and the rest of the world.

If you like you can change te hostname of your Pi (the name it is presented by on your network). If you have more than one Pi this is recommended to change. I myself are very creative with my Pi naming. I name them pi001, pi002, and so on. Fun right?

Select the Hostname option and give your Pi its new name.

After you have confirmed the name setting with an Ok you will be brought back to the main menu. Go back into the Network settings so we can configure your Wifi.

Now type in the name of your WiFi network (the so called SSID).

And then type in your password for your WiFi network. Please keep in mind that your keyboard settings may not be set correctly yet. In which case your special characters in your password (if you use them, please use them by the way!) will be incorrect and you won’t see because the password characters are hidden in this screen. So be sure your password is completely accurate in order to get this working. You could use the SSID screen to try typing your password in order to check the characters you type. (but be aware that the person behind you will also see the password… did I just make you look over your shoulder?).

Once this is done your WiFi connection should be up and running. From the main menu screen we will now change your Location settings.

And choose Timezone.

I am located in the Netherlands, so I will set my location to Europe, Amsterdam.

And we’re back in the main menu again. Now we will set the SSH option. This will allow you to connect to your Pi from another computer using software like Putty (on Windows) or the Terminal in OSX to Secure Shell (SSH) to the command prompt. Maybe this is unknown to you at this point in time, but believe me in no time you will be roaring in you SSH session to your Pi and make it do all kinds of neat stuff. But for now, let’s just turn it on.

Easy right? (n00bs going: “What did I just enable?”) It will all be clear in time my young Padawan.

And now the real scary stuff. No, JK. We will open the rest of your microSD card space that has been waiting for you unclaimed after you wrote the image file to the card. So let us reclaim what is ours!

Choose Expand Filesystem and see the magic unfold.

Once this is done (and I hope you did not blink or else you’ve missed it) you are brought back to the main menu again.

Move all the way to the bottom of the menu untill the Finish option is getting red.

The Pi will ask you if you want to reboot and the only correct answer now is YES!

After this reboot the Pi is ready for the next step, updates! Follow this link to the instructions for that. Great job so far by the way! Your n00b status is almost upgraded to Beginner.

Categories
How to Raspberry Pi

Writing an image file on SD cards

So you took the first step and bought yourself a Raspberry Pi. You took it out of the box, got rid of the anti-static wrapper and stared at it for a few minutes. Totally amazed by the small form factor and the laser engraved Raspberry logo. But now what? Well there are some basics you will need to get to know in order to start enjoying the actual benefits of a Pi, I mean other than starring at that sexy Raspberry logo that is.

The most important thing you need to learn in my opinion is how to write an image to an SD card in order make your Pi do really cool stuf. Let’s begin!

I assume that you have downloaded at least one image file to put on your SD card by the way, you will need one near the end of this post. I will add some links to some of my favourite image files at the bottom.

Get your SD card (8 GB or higher preferably, I use 16 GB minimum by the way) and make sure you can connect it to your ‘other’ computer. What? Nobody told you that you need another computer in order yo get the Raspberry Pi to work … oops. Well that is how it is I’m afraid.

So get yourself one of these SD to USB dongle adapters. I think that is the most universal way of presenting your SD card to your ‘other’ computer. I use a Mac or a Windows machine to prepare my cards to run in the Pi, but a Linux machine should do fine too. However, on this website I explain things the OSX/Windows way. Sorry, and yes Linux rulez and all that.

Now that you are able to see the SD card in OSX or Windows we will need two applications. SD Formatter and Etcher. Follow these links to get them and install them while you’re at it.

SD formatter OSX / Windows
Etcher OSX / Windows

Now more experienced Pi users (no offence) will tell you that SD formatter is not necesarry. But it is always a good idea to completely wipe the SD card before putting your next ultimate peace of software on it. And it only takes a few seconds extra, so why not.

Insert the SD card into your Mac or Windows machine. Startup SD formatter.

Be sure to select Quick Format, or else the few seconds I promised earlier will change into a few minutes. Be sure the SD card is selected and click Format.

That’s it.

Now startup Etcher.

Etcher will automatically detect the SD card (and even prevent you from overwriting your harddrive, it simply will not let you choose your harddisk to write the image to. Well if you do not change the settings that is).

Now pick the image you want to write to the SD card by clicking on the blue button on the left called Select Image. Once your image file is loaded, hit Flash.

Etcher will now write the image to the SD card, verify if the writing has been done 100% correct and than notify you that it is done!

No need to eject the USB/SD card from your PC, Etcher has done that for you. Don’t you just love software that knows what you want and does it before you have to? Me neither, but in this case I think it’s okay.

Now put that SD card into your Pi and give it some juice (by that I mean insert the micro USB poweradapter plug).

And you are good to go!

 

Some of my favourite image files: