In this way, it is like a security option and we will learn a few tricks on our way.
First of all. Do you remember our other projects with the Pi?
So, first step, let’s change Raspberry Pi password to have in in the local Wifi network.
1. Change Password. Open a LXTerminal and run
The configuration window will open. From there just select to change the Password.
2. Change Raspberry Pi network name. By default, when in a Wifi network, the Raspberry Pi will try to get the local hostname “raspberrypi” (that is the name you will write when doing remote desktop to look for the Raspberry Pi). This configuration will create conflicts if there is various Raspberry Pi in the same network. So let’s change the name of the Raspberry Pi in the local network (original tutorial here).
Type the next command to open the host file:
sudo nano /etc/hosts
It will show this window, the last one is the actual name of the raspberry pi in the network
Edit that and put the name you want. In my case I’m going to call it Eneas. Just Ctrl+C and Yes and Enter.
Now edit the hostname file:
sudo nano /etc/hostname
Change here the name also
Save and run the file:
Now just reboot the terminal and you will be able to locate it in the network with the new name. Or in my case to do remote access from windows I don’t need any more the IP, I just type the name (remember the tutorial where I explained how to do remote desktop?).
3 More memory. Do you have a 512mB Raspberry Pi model B? Is it using the 512mB? It seems that by default most of the Pi with 512mB need a firmware update before being able to use the whole memory! How to check it?
This window will appear. Here we can see the amount of memory used by the system. It is not the whole 512mB since part of the memory is reserved for the GPU. Raspberry Pi shares memory between CPU and GPU. So in my case it is not necessary, but still if you need it:
First install Git Core
sudo apt-get install git-core
Now download the required files
sudo wget http://goo.gl/1BOfJ -O /usr/bin/rpi-update && sudo chmod +x /usr/bin/rpi-update
The next command will update the SSL
sudo apt-get install ca-certificates
sudo apt-get install rpi-update mkdir -p /lib/modules/3.10.25+/build
and finally update
4 Turbo boost. There is a few things that can be done in order to overclock the Pi, like adjusting the CPU voltage, but most of them will break the warranty. Here is one that will not.
sudo apt-get update && sudo apt-get install raspberrypi* raspi-config
Now launch the config and turn the TURBO mode on
Reboot and changes will be made.
5 Dropbox. Next step is to connect your Raspberry Pi with Dropbox. We do it through the Dropbox API. First ensure you have Git Core
sudo apt-get install git-core
Next copy the files you need in order to invoke the API
Now you will be able to see the next directory
And inside the folder…
You should now see three files, one of which is called dropbox_uploader.sh. This is the script we’re going to use. Run it.
You should see something like this:
Now you need to go to Dropbox webpage for developers https://www.dropbox.com/developers/apps, login to DropBox and create an “app” by clicking the “create app” button.
Then choose “Dropbox API app”, “Files and Datastores”, and answer the final question “Can your app be limited to its own, private folder?” – either answer is OK, depending on your needs.
Fill the information from Dropbox into the script and everything should be ready.
Now you can try uploading a file from the main folder (in my case named image.jpg).
./dropbox_uploader.sh upload /home/pi/name_of_upload_file name_of_upload_file
from subprocess import call photofile = "/home/pi/Dropbox-Uploader/dropbox_uploader.sh upload /home/pi/image.jpg image.jpg" call ([photofile], shell=True)
6 Python and saving the start image to Dropbox. This is a nice idea I have that can be implemented as a safety feature. Basically now that we have access to Dropbox API and with the PiCamera installed… (how to setup the PiCamera) it will be a great idea making a script that runs at the start-up takes a picture and uploads it to Dropbox. You can think it as a safety feature. If your Raspberry Pi gets stolen, every time somebody starts it a picture will be taken and send to Dropbox.
First create a Python script that looks like this:
from subprocess import call try:#We put everything inside a try to avoid running if the camera doesn't work import picamera import datetime timestamp=datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S") camera = picamera.PiCamera() try: camera.resolution=(1024,768) camera.rotation=180 camera.start_preview() camera.capture(timestamp+".jpg") except: pass finally: camera.close() photofile = "/home/pi/Dropbox-Uploader/dropbox_uploader.sh upload /home/pi/"+timestamp+".jpg "+timestamp+".jpg " call([photofile], shell=True) except: pass
This script will try to run the camera, take a picture and upload it to Dropbox. The format of the time is a little bit tricky and will not work for naming files in Dropbox. It should be fine as it is.
Now as we explained in
Put the script into the start up sequence to run after starting the Pi.
and every time you start the Pi it will take a picture and send it to Dropbox!
In this way if your Pi is stolen and they are not aware of this, you will be able to see images and maybe locate it.
Did you like it?