tag:blogger.com,1999:blog-45191742351840128552024-02-19T17:21:29.608+01:00Tutorials & TechnicalitiesUnknownnoreply@blogger.comBlogger12125tag:blogger.com,1999:blog-4519174235184012855.post-63734454178458133692017-04-09T23:34:00.002+02:002018-08-18T02:35:55.618+02:00Full Bitcoin node on a Raspberry Pi 3 with or without a PiDrive (updated for UASF support)<!--
https://bitnodes.21.co/nodes/176.20.253.46-8333/
https://www.reddit.com/r/Bitcoin/comments/625n8g/what_settings_should_you_use_to_run_a_full_core/
https://np.reddit.com/r/Bitcoin/comments/5jwpnf/full_node_raspberry_pi_3_guide_2017/
https://www.reddit.com/r/Bitcoin/comments/5gmhvo/rpi3_full_node_sync_woes/
-->
<div class="separator" style="clear: right; float: right; text-align: center; margin-bottom: 1em; margin-left: 1em;"><img style="border-style: solid; border-color: gray; border-width: 1px;" src="http://i.imgur.com/UCeWRYF.png" /></div>
<p>For a long time the Raspberry Pi has seemed tempting for people who wanted to run a full node on the Bitcoin network because of its small size, low power use and cheap price-tag. With their relatively low performance specs, the first generations of the Pi were really not quite up to the task, though. Some people were able to compile and run Bitcoin Core (this very blog, for instance), but only barely, and others didn't succeed in making it work at all.</p>
<p>This has changed to the better with the newer generations of the Pi. The Raspberry Pi 2 and especially the Raspberry Pi 3 have more RAM and multi-core processors. While we're still far from modern desktop computers, of course, you're much better off with the current specs than before. That being said, syncing the blockchain can still be quite painful on a Pi 3.</p>
<p>With the blockchain growing larger and larger, you basically have two options. One option is to have enough storage space to contain the entire blockchain (and then some), be it by means of a really large Micro SD card, a <a href="http://wdlabs.wd.com/category/wd-pidrive/">Western Digital PiDrive</a> like explained here, or a large USB pen-drive. The other option is pruning the blockchain, which became available in the Bitcoin Core software recently. Pruning is basically storing only the most recent part of the blockchain, and cutting away everything else.</p>
<p>Also, for Ubuntu, pre-compiled binaries of Bitcoin Core and its dependencies have been made available for the Raspberry Pi, which has made the process <i>much</i> easier since you no longer have to compile yourself if you don't wish to go through the trouble.</p>
<p>This guide will show how to set up a complete headless full node system with a Pi 3, either as a pruned node, or using a Western Digital PiDrive (or another USB harddisk) to store the blockchain. A Raspberry Pi 3 with a connected PiDrive will consume around 3-4 watt of power. A pruned node on just the Pi 3 is just above 2 watt. Compare that to the 100-200 watt that is consumed by a typical desktop computer running Bitcoin software with the screen turned off.</p>
<a name='more'></a>
<p>It <i>will</i> be a bit technical, but my goal was to make it quite comprehensive and explaining, so even if you have little to no experience with using Linux/Unix systems, you should be able to follow along, as long as you're not afraid of trying out new things.</p>
<hr />
<h2>Sections of this guide</h2>
<p><ul>
<li><a href="#hwrequirements">The hardware requirements</a></li>
<li><a href="#initialsetup">Initial setup</a></li>
<li><a href="#updating">Updating and configuring the system</a></li>
<li><a href="#pidrive">Getting the PiDrive ready</a> <small style="color: #cdcdcd;">(this section can be ignored for most pruned nodes)</small></li>
<li><a href="#swapfile">Adding a swapfile</a></li>
<li><a href="#ssh">Allowing SSH access from another computer on the network</a></li>
<li><a href="#boot">Letting Bitcoin Core start automatically on boot</a></li>
<li><a href="#port">Open port in your router</a></li>
<li><a href="#start">Start your new full node</a></li>
<li><a href="#image">Download and use my (almost) ready-to-go image instead</a></li>
<li><a href="#thanks">Thanks!</a></li>
</ul></p>
<hr>
<h2 id="hwrequirements">The hardware requirements</h2>
<div class="separator" style="clear: right; float: right; text-align: center; margin-bottom: 1em; margin-left: 1em;"><img style="border-style: solid; border-color: gray; border-width: 1px;" src="http://i.imgur.com/o7Sj85j.png" /></div>
<p><b>Raspberry Pi 3</b>: This guide will be using the Raspberry Pi 3 model B, but the process should be the same on the Pi 2, if you have that laying around. If you're going to buy a new Pi for this project, I recommend <a href="https://www.pi-supply.com/product/raspberry-pi-3-model-b-newest-version/?v=dd65ef9a5579">going for the Pi 3</a>, since its price-tag is the same, and the specs are higher.</p>
<div class="separator" style="clear: right; float: right; text-align: center; margin-bottom: 1em; margin-left: 1em;"><img style="border-style: solid; border-color: gray; border-width: 1px;" src="http://i.imgur.com/wgdL3aO.png" /></div>
<p><b>Micro SD card, min 4-8 GB (min 16 GB without PiDrive), class 10 or better</b>: The Pi boots off an SD card. For that you'll need one that's fairly fast, so get a class 10 or better. 4 or 8 GB should be more than enough for setups with the PiDrive. <a href="https://www.adafruit.com/products/2692">This one is fine</a>, but be aware that PiDrives often come with a 4 GB MicroSD card included, so you may not have to buy one separately. If you're planning on a pruned node without a harddisk, choose a fairly larger SD card, depending on how much of the blockchain you want to prune (also take into account the space taken up by the system plus a swapfile). <a href="https://www.adafruit.com/products/2693">16 GB</a> is probably the minimum without a PiDrive. Warning: Don't buy cheap SD cards off Ebay and elsewhere from China, as these are often small cards technically disguised as larger cards.</p>
<p><b>SD card reader</b>: You'll need an SD card reader and a MicroSD card adapter or some other way to plug your Micro SD card into your ordinary computer during installation of the Pi's operating system.</p>
<div class="separator" style="clear: right; float: right; text-align: center; margin-bottom: 1em; margin-left: 1em;"><img style="border-style: solid; border-color: gray; border-width: 1px;" src="http://i.imgur.com/yqt9FbS.png" /></div>
<p><b>WD PiDrive</b> (optional if you're going to run a pruned node): Since SD cards of the required size to store the entire blockchain are quite expensive still, we will be using a harddisk to store the space hungry blockchain files. Western Digital's PiDrive is very fit for the purpose; it comes in sizes of <a href="https://www.pi-supply.com/product/wd-pidrive-foundation-edition-hdd/">250 GB, 314 GB</a> and <a href="https://www.pi-supply.com/product/wd-pidrive-berryboot-edition/">even 1 TB</a>. In the spirit of Pi, I used the 314 GB version (π ≈ 3.14, get it?), a storage capacity that at the time of writing can hold the blockchain three times, so there's plenty of space left for the rapid growth the blockchain. At the same time, it comes with a USB plug that fits right into one of the Pi's USB slots, instead of a SATA connector as usual, and a nice lead that allows you to power both the Pi and the PiDrive from the same power supply. Alternatively, you could use an external USB-harddisk of any make and model, or an internal harddisk with a powered USB adapter. Also, if you want to save on power, an SSD or a USB pendrive instead of a physical harddrive will be a good option. And of course, if you plan on running a pruned node or on getting a <i>huge</i> MicroSD card, you won't need an extra drive at all.</p>
<div class="separator" style="clear: right; float: right; text-align: center; margin-bottom: 1em; margin-left: 1em;"><img style="border-style: solid; border-color: gray; border-width: 1px;" src="http://i.imgur.com/rEwxmGR.png" /></div>
<p><b>Micro USB power adapter, min 2.5 A</b>: As the Pi models grow bigger in specs, so do their power requirements. Traditionally, Pi owners have used old phone chargers as a power supply. While you can still do that, you should be very cautious that the supply delivers enough power for the newer Pi models. A minimum of 2.5 A is the official recommendation. The easy route (and the safe bet) is to just get <a href="https://www.pi-supply.com/product/official-raspberry-pi-power-supply-newest-version/?v=dd65ef9a5579">the official Pi 3 power supply</a> which can power both the Pi 3 and the PiDrive at the same time.</p>
<p><b>Ethernet cable (optional)</b>: Even though the Pi 3 has built-in wifi support, I recommend using a cabled network for a Bitcoin node. For that you'll need a piece of Ethernet cable from your network router/switch to your Pi. The Raspberry Pi supports only 10/100 Mbit/s, so any category 5e or better is fine. If you must, you can of course use wifi instead, but in my experience, cabled network is just much more reliable.</p>
<div class="separator" style="clear: right; float: right; text-align: center; margin-bottom: 1em; margin-left: 1em;"><img style="border-style: solid; border-color: gray; border-width: 1px;" src="http://i.imgur.com/Z8gIdKS.png" /></div>
<p><b>Raspberry Pi case (optional)</b>: In order not to risk damaging the electronics parts of your Pi, I recommend to get a case for it. This might be anything from one of the <a href="https://www.pi-supply.com/product-category/raspberry-pi-cases/?v=dd65ef9a5579">many different cases that are available</a>, or you might make a case yourself that fits both the Pi and your PiDrive.</p>
<p><b>Heatsink and/or fan for the Pi (optional)</b>: Either an inactive aluminium heatsink, a cooling fan (comes with <a href="http://r.ebay.com/clKEDd">some cases</a>), or maybe both. The Raspberry Pi Foundation says cooling is not necessary on a Pi, and the Pi does throttle down performance when it gets too hot to prevent damage. However, especially when syncing with the blockchain, the Pi's CPU runs quite hot to a degree that I can't hold my finger on it for more than a couple of seconds. Also, I see the "thermometer" symbol on the screen (meaning performance is being throttled) quite often. After adding a heatsink and a fan I haven't noticed performance being throttled. It should be noted that after synchronisation is done, load on the CPU decreases drastically, and you will probably have no problems running without cooling day-to-day.</p>
<p><b>A spare HDMI screen, USB keyboard and mouse</b>: These will only be used during setup, so don't go out buying these.</p>
<p>Several of these hardware items are available from online store Pi Supply. I am not affiliated with them in any way, other than I'm a happy customer there; they send worldwide, they have great customer service, and they take Bitcoin.</p>
<hr>
<h2 id="initialsetup">Initial setup</h2>
<div class="separator" style="clear: both; float: right; border-style: solid; border-color: gray; border-width: 1px; padding: 10px; margin: 10px; width: 200px; font-size: 80%;">
<h3 style="color: red;">Download finished image file instead</h3>
<p>Following this guide will take some time, especially for downloading the blockchain. For the impatient, I have made an almost ready-to-go image file with the (at the time of writing) updated blockchain files for a pruned node. Download this at the bottom of this guide.</p>
<p style="text-align: center; font-size: 125%; color: red;">⇓ ⇓</p>
</div>
<p>For this project, I have chosen to let the Pi run Ubuntu Linux instead of the otherwise very nice Raspbian, since that makes the installation of Bitcoin Core a bit easier.</p>
<p>Installing Ubuntu on the SD card is not too hard. It's a matter of downloading an image file, and writing that image file onto the MicroSD card that the Pi will boot off. Download the latest LTS (long term support) <a href="https://ubuntu-mate.org/download/">image file</a>. The link here is actually Ubuntu Mate, which is normal Ubuntu with the Mate graphical desktop system, but since we won't be using the desktop system with the finished headless Bitcoin node, it doesn't really matter which flavour of Ubuntu it is. I also tried with the <a href="https://wiki.ubuntu.com/ARM/RaspberryPi">unofficial Ubuntu Server image</a> without a desktop system, but I had boot problems after updating it, so I went for Ubuntu Mate instead.</p>
<p>After downloading the image file, it needs to be written to the MicroSD card. How this is done differs depending on whether you're on Windows, Linux, Mac, etc., but the Raspberry Pi Foundation has a <a href="https://www.raspberrypi.org/documentation/installation/installing-images/README.md">very nice guide</a> to doing that.</p>
<!-- sudo ddrescue -D -d --force ubuntu-mate-16.04.2-desktop-armhf-raspberry-pi.img /dev/sdc --->
<p>After writing the image file to the MicroSD card, insert it into the Pi, and also connect the PiDrive (unless you're going for the pruned node), Ethernet cable, keyboard, mouse, and screen.</p>
<hr />
<h2 id="updating">Updating and configuring the system</h2>
<div class="separator" style="clear: both; float: right; border-style: solid; border-color: gray; border-width: 1px; padding: 10px; margin: 10px; width: 200px; font-size: 80%;">
<h3>Terms</h3>
<p>The function of a <b>Bitcoin node</b> is to validate the blocks of the blockchain when they are found by the miners and distributed throughout the network. The more distributed nodes, the better, since a miner not playing by the book will have their invalid blocks rejected.</p>
<p>The term <b>full node</b> refers to the fact that it "fully validates transactions and blocks".<sup><a href="https://bitcoin.org/en/full-node">[source]</a></sup></p>
<p>A <b>pruned node</b> keeps only the most recent part of the blockchain. The node operator can set an amount of megabytes to use for storing the blockchain, and the node will delete old parts of the chain that exceeds this amount of storage. A pruned node will still have to download the entire blockchain at first run, though, but it will never use more harddisk space than was allocated for it.</p>
<p>A pruned node will in most cases also be a full node, since the "full" part does not refer to how much of the blockchain is stored on the node.</p>
</div>
<p>Plug in the power cable, and the Pi will boot up and you will be presented with a few dialogue boxes where you should set up your time zone, user account and password for the system and a few other things. The remainder of this guide will assume user name <tt>pinode</tt>, but you can of course use which ever user name you wish. You are encouraged to use a strong password, especially if you plan to be able to log in from the Internet. Once completed, you will be able to login to the Mate desktop.</p>
<p>Start up a Terminal (sort of a command line window; opened through the Applications menu, System Tools, MATE Terminal), and give the following command to let the Pi boot up into text mode in the future, since there is no need for a headless Bitcoin node to spend precious RAM on loading a full graphical desktop:
<pre style="border-style: solid; border-width: 1px; border-color: #dddddd; padding: 3px; width: 65%">sudo systemctl set-default multi-user.target</pre>
<p>Now, reboot the Raspberry Pi and make sure that you are logged in to the text based command line interface (all black screen with white text).</p>
<p>The next six commands will: 1: Tell the system from where it should fetch the Bitcoin software. 2: Update the system's information about which packages are available to download and install. 3: Download and install the text based version of Bitcoin Core, plus another tool that will be used next. 4+5: Remove the entire graphical desktop environment so that it doesn't take up space on the SD card. Run the last of these two remove commands repeatedly (maybe 4-5 times) until it doesn't remove any more packages. 6: Download and install all available updates to the entire system. Type them in one command at a time, as each command will ask you a question or two (typically just press Enter or Y to proceed). The last command will probably take quite some time to finish.</p>
<pre style="border-style: solid; border-width: 1px; border-color: #dddddd; padding: 3px; width: 100%">sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt update
sudo apt install bitcoind deborphan
sudo apt remove --auto-remove --purge libx11-.*
sudo apt remove --purge $(deborphan) #Repeat until no more is removed
sudo apt upgrade</pre>
<p><i>Note</i>: If you want to run an UASF enabled node instead of the standard Bitcoin Core software, in the first line change "<tt>ppa:bitcoin/bitcoin</tt>" into "<tt>ppa:luke-jr/bitcoin-core-bip148-unofficial-builds</tt>".</p>
<p>After that we will write a very short and simple configuration text file for Bitcoin Core. We will use the text based editor "nano" since it's very simple to use. Feel free to use any other text editor if you have another favourite, just as long as it writes plain txt files. These two commands create a <tt>.bitcoin</tt> directory (which is where Bitcoin Core will later put all the blockchain files) in your home directory, and then start up nano and open a new file for editing:</p>
<pre style="border-style: solid; border-width: 1px; border-color: #dddddd; padding: 3px;">mkdir ~/.bitcoin
nano ~/.bitcoin/bitcoin.conf</pre>
<p>In the nano editor, write the four following lines. Omit the last line (<tt>prune</tt>) if you are connecting the PiDrive and want to keep the full blockchain. Otherwise change <tt>1000</tt> into however many megabytes of the blockchain that your want to store at all times (at least 550). Keep in mind, though, that this number only controls the space that the block files themselves (the <tt>~/.bitcoin/blocks</tt> directory) take up. Other than those, expect a couple of gigabytes or more for other data in <tt>~/.bitcoin</tt>. Also keep thought of the space that the Ubuntu system itself takes up. And finally you will most likely be creating a swapfile that will take up around 2-3 GB. See how much free space you have on the partition that will keep the blockchain with the command "<tt>df -h ~./bitcoin</tt>" and then subtract <i>at least</i> 5-8 GB from that. The following should work on a 16 GB SD card.</p>
<pre style="border-style: solid; border-width: 1px; border-color: #dddddd; padding: 3px;">dbcache=800
maxmempool=50
disablewallet=1
prune=5000</pre>
<p>Hit Ctrl-X to exit nano, and then press the Y key and Enter to save the file.</p>
<p>In the Mate flavour of Ubuntu Linux, 64 MB of the shared memory is reserved for the GPU (graphics chip) by default. We can safely lower that to the minimum of 16 MB, thereby gaining 48 MB of additional RAM. Open the file <tt>/boot/config.txt</tt>:</p>
<pre style="border-style: solid; border-width: 1px; border-color: #dddddd; padding: 3px;">sudo nano /boot/config.txt</pre>
<p>Then scroll down to the bottom of this (rather long) text file and add the following line:</p>
<pre style="border-style: solid; border-width: 1px; border-color: #dddddd; padding: 3px;">gpu_mem=16</pre>
<p>Again, Ctrl-X and then Y + Enter saves and exits.</p>
<hr />
<h2 id="pidrive">Getting the PiDrive ready</h2>
<div class="separator" style="border-style: solid; border-color: red; border-width: 1px; padding: 10px; margin: 10px; font-size: 110%; color: red;">
You can skip this entire section and go directly to "<i>Adding a swapfile</i>" if you go for a pruned node without additional storage!
</div>
<p>The PiDrive comes preformatted for running on a Linux system on a Pi. Mine contained just one large "ext4" partition which is exactly what is needed.</p>
<div class="separator" style="clear: right; float: right; text-align: left; margin-bottom: 1em; margin-left: 1em;"><img style="border-style: solid; border-color: gray; border-width: 1px;" src="http://i.imgur.com/C0zhig1.png" /><br /><small>Instead of a PiDrive you might also use any ordinary harddrive<br />with a <i>powered</i> SATA to USB adapter.</small></div>
<p>However, you might also want to use another kind of drive (external USB harddrive, an SSD, a USB pendrive, etc.), and those usually come formatted for Windows, or maybe not formatted at all. So assuming you already connected your drive to the Pi, what we need to do is remove any existing partition(s) and add one large "ext4" partition that fills out the entire drive.</p>
<p>In the end I will of course use my PiDrive, but for the sake of demonstration here, I connected a drive from an old Windows machine that was given to me, through a cheap <a href="http://r.ebay.com/MKsdp4">externally powered SATA to USB adapter</a> (important to get an externally powered one, as the Pi will not be able to deliver enough power for a harddrive). This drive contains several Windows partitions that I needed to remove.</p>
<p>First, to get an overview of the drives that are attached to the Pi, run the following command. Notice that the system also treats the SD card as a drive:</p>
<pre style="border-style: solid; border-width: 1px; border-color: #dddddd; padding: 3px;">sudo fdisk -l</pre>
<p>This gives me the following on my system with the old Windows drive connected:</p>
<div class="separator" style="float: center; text-align: center; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="http://i.imgur.com/W3XDM4M.png" /></div>
<p>The first disk, named <tt>/dev/mmcblk0</tt> is the SD card, so don't do anything to that, or you will lose the Ubuntu system that you just set up. On my system, the next disk is <tt>/dev/sda</tt>, and you can see that it has four partitions named <tt>/dev/sda1</tt>, <tt>2</tt>, <tt>5</tt> and <tt>6</tt> that need to be removed. Maybe you want to write down the names of the existing partitions on your harddisk, if any. Notice that <b>ALL DATA</b> that might already be on the harddisk <b>will be lost</b>, so don't use a drive containing anything you don't want to lose. Write the following command to enter the fdisk utility, changing <tt>/dev/sda</tt> into your harddisk's name if it is different:</p>
<pre style="border-style: solid; border-width: 1px; border-color: #dddddd; padding: 3px;">sudo fdisk /dev/sda</pre>
<p>Here, you will be met with a command prompt. To delete the existing partitions, type <tt>d</tt> and hit Enter, whereafter the prompt will ask you which partition number to delete, along with a list of the existing partitions numbers. Press a corresponding number and then Enter to delete the partition. Repeat until there are no partitions left.</p>
<p>Now, hit <tt>n</tt> to create a new partition. Then <tt>p</tt> to make it a primary partition, and <tt>1</tt> to give it partition number 1 (and hence the partition name <tt>/dev/sda1</tt>, if your disk name is <tt>/dev/sda</tt>). At the questions about first and last sector, just press Enter to make the partition fill out the entire harddisk.</p>
<div class="separator" style="float: center; text-align: center; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="http://i.imgur.com/aSJyJHG.png" /></div>
<p>Last, press <tt>w</tt> + Enter to save the changes to the disk and exit the fdisk tool.</p>
<p>To format your new partition, type in the following command (making sure to change the partition name approately, if your disk was not <tt>/dev/sda</tt>):</p>
<pre style="border-style: solid; border-width: 1px; border-color: #dddddd; padding: 3px;">sudo mkfs.ext4 /dev/sda1</pre>
<p>After a short while, you are ready to mount the partition. In the Linux world, drives don't mount to drive letters like in Windows. Instead you can mount a drive/partition to any place in the file tree. We will take advantage of this fact by mounting the harddisk partition to the <tt>~/.bitcoin</tt> directory, which is exactly the place where Bitcoin Core will save its settings and store the blockchain. This way, the entire system is stored on the SD card (including Bitcoin Core itself), except for Bitcoin Core's data files.</p>
<p>To do this, you must first move the existing directory out of the way and create a new empty directory that the drive partition will be mounted to:</p>
<pre style="border-style: solid; border-width: 1px; border-color: #dddddd; padding: 3px;">mv ~/.bitcoin ~/.bitcoin-old
mkdir ~/.bitcoin</pre>
<p>Now, to tell the system to mount the drive to the newly created directory on every boot, you need to edit a short text file. Again, the text editor nano will come in handy:</p>
<pre style="border-style: solid; border-width: 1px; border-color: #dddddd; padding: 3px;">sudo nano /etc/fstab</pre>
<p>In the bottom of the file, write the following line (remember to change "<tt>sda1</tt>" if your harddrive partition was named differently, and also change "<tt>pinode</tt>" into your username):</p>
<pre style="border-style: solid; border-width: 1px; border-color: #dddddd; padding: 3px;">/dev/sda1 /home/pinode/.bitcoin ext4 defaults 0 0</pre>
<p>Then, press Ctrl-<tt>x</tt> followed by <tt>y</tt> and Enter to save the file and exit nano.</p>
<p>Test it out by typing <tt>sudo reboot</tt> to reboot the system. When the Pi has rebooted, log in and type <tt>df -h</tt> to see all mounted partitions. Your newly created harddisk partition should be in the list along with information that it is mounted to your <tt>.bitcoin</tt> directory:</p>
<div class="separator" style="float: center; text-align: center; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="http://i.imgur.com/a4uR5pv.png" /></div>
<p>Finally, make sure that the <tt>pinode</tt> user account (which will be running Bitcoin Core) has full access to the harddrive, and then move the bitcoin.conf file to the harddrive:</p>
<pre style="border-style: solid; border-width: 1px; border-color: #dddddd; padding: 3px;">sudo chown pinode /home/pinode/.bitcoin
sudo chgrp pinode /home/pinode/.bitcoin
mv ~/.bitcoin-old/bitcoin.conf ~/.bitcoin/</pre>
<hr />
<h2 id="swapfile">Adding a swapfile</h2>
<p>Now for an optional, but highly recommended step, namely adding a swapfile. The Pi 3 has 1 GB of RAM, which is an improvement to earlier Pi's, but still quite low for running Bitcoin Core as a full node, especially during synchronisation with the blockchain. A swapfile (or a swap partition) is a part of the harddrive (or in this case, the SD card) that acts as an addition to the RAM. The Ubuntu Mate system does not use a swapfile or swap partition by default. The reason that the step is optional is that swapfiles (and swap partitions) can be quite hard on an SD card due to the many read/write operations being performed, and SD cards only last for a certain amount of read/write operations. It's not like it will wear out in a few days or weeks or anything like that; just be prepared to only use your SD card for this project. The reason that adding a swapfile is highly recommended anyway is that chances are you will not be able to synchronise with the blockchain without it, since 1 GB RAM may simply be too little. However, we will set up the system to only use the swapfile if strictly necessary.</p>
<p>If you will be connecting a PiDrive, it is highly recommended to put the swapfile there instead of on the SD card. Just use <tt>/home/pinode/.bitcoin/swapfile</tt> instead of <tt>/swapfile</tt> in the rest of the commands in this section.</p>
<p>To set up a swapfile, perform the following commands. 4 GB RAM for a Bitcoin node should be more than fine, so given the Pi's 1 GB RAM, you can set up the swapfile to 3 GB:</p>
<pre style="border-style: solid; border-width: 1px; border-color: #dddddd; padding: 3px;">sudo fallocate -l 3G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo nano /etc/fstab</pre>
<p>The last command will open the settings file for partitions to be mounted at boot. Scroll down to the end and add the following line, then Ctrl-X, then Enter to save and exit the editor:</p>
<pre style="border-style: solid; border-width: 1px; border-color: #dddddd; padding: 3px;">/swapfile none swap sw 0 0</pre>
<p>Also, to let the system only use the swapfile if really necessary, open the following file in nano by performing:</p>
<pre style="border-style: solid; border-width: 1px; border-color: #dddddd; padding: 3px;">sudo nano /etc/sysctl.conf</pre>
<p>In the end of the file, add the following line:</p>
<pre style="border-style: solid; border-width: 1px; border-color: #dddddd; padding: 3px;">vm.swappiness=1</pre>
<hr>
<h2 id="ssh">Allowing SSH access from another computer on the network</h2>
<p>We want to make the setup headless. This means that there are no monitors, keyboards, mice, etc. plugged into the Pi when it's running. So if we want to log in to the Pi anyway, we will make an SSH connection to it from an ordinary computer and get access to the Pi's command line this way. To allow for this, we need to get the local IP address of the Pi. Maybe you can see it in your router's user interface—otherwise start the Terminal on the Pi and run <tt>ifconfig</tt>. With a cabled connection, your IP address is in the <tt>eth0</tt> section, with a wi-fi connection, it is in the <tt>wlan0</tt> section.</p>
<div class="separator" style="float: center; text-align: center; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="http://i.imgur.com/eE6yR82.png" /></div>
<p>We'll also make sure that the SSH server on the Pi is installed and started at boot:</p>
<pre style="border-style: solid; border-width: 1px; border-color: #dddddd; padding: 3px;">sudo apt install openssh-server
sudo systemctl enable ssh</pre>
<p>Now you can power down the Pi (if you are in text mode by now, you can do so using the command "<tt>sudo halt</tt>"), and you may remove keyboard, mouse, and screen. The only cables you need from now is the power and Ethernet cables, and of course the PiDrive if you're using that. If you want to log in to the Pi through SSH from another computer on the network, you may do so with (change "192.168.1.199" into your Pi's IP address, and "pinode" into the username you created on the Pi):</p>
<pre style="border-style: solid; border-width: 1px; border-color: #dddddd; padding: 3px;">ssh pinode@192.168.1.199</pre>
<p>This is assuming your other computer also runs some sort of Linux/Unix (maybe including MacOS?). If you're on Windows, you can use the <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html">PuTTY SSH client</a>.</p>
<hr />
<h2 id="boot">Letting Bitcoin Core start automatically on boot</h2>
<p>Also, we want Bitcoin Core to start whenever the Raspberry Pi has been started up. And in addition to that, we will attempt to start it every five minutes in case it stopped for some reason. An easy way of doing that is through "crontab" which is a mechanism in any Unix/Linux system that can start programs and scripts at certain times and occasions. There may be other, more correct ways of doing this, but crontab seems to do the job. To edit the crontab settings, run:</p>
<pre style="border-style: solid; border-width: 1px; border-color: #dddddd; padding: 3px;">crontab -e</pre>
<p>If this was the first time you ran that command (it most likely was), you will be presented with a menu where you can choose a text editor to use. Again, if you have no other preferences, select "nano". Scroll all the way down in the file that nano opened for you, and add the following as the last two lines:</p>
<pre style="border-style: solid; border-width: 1px; border-color: #dddddd; padding: 3px;">@reboot bitcoind -daemon
*/5 * * * * bitcoind -daemon</pre>
<hr />
<h2 id="port">Open port in your router</h2>
<p>In addition to your node making connections to other nodes, you will want other nodes to also be able to connect to your node. This is done by forwarding incoming traffic on port 8333 to the Raspberry Pi. How to do this varies from network to network, but typically involves entering the web interface of your network router or modem, and setting up "Port Forwarding" there. Typically this is done by simply adding the local IP address of the Raspberry Pi (which you found above, e.g. 192.168.1.199) along with port number 8333 to a list of forwarded ports. Refer to the documentation from your router/modem's manufacturer on how to do this exactly. Some routers even do this automatically so you don't need to do anything.</p>
<p>You can verify that it works by using <a href="https://bitnodes.21.co/">Bitnodes</a>' "Join the network" feature. If it returns a line that includes the word "Satoshi", you have successfully forwarded traffic on port 8333 to your Pi. Notice that while your Pi is still synchronising the blockchain, it might be lagging so much that Bitnodes will report it as unreachable. Try again after synchronising is done.</p>
<div class="separator" style="float: center; text-align: center; margin-bottom: 1em; margin-left: 1em;"><img style="border-style: solid; border-color: gray; border-width: 1px;" src="http://i.imgur.com/bQ4BMYX.png" /></div>
<hr />
<h2 id="start">Start your new full node</h2>
<p>Now it's time to plug your node in, and let it synchronise with the network. This will probably take several days. You can keep track of the progress by logging in (remotely or with a keyboard) and running the command:</p>
<pre style="border-style: solid; border-width: 1px; border-color: #dddddd; padding: 3px;">bitcoin-cli getinfo</pre>
<p>Compare "<tt>blocks</tt>" line with the most recent block number at your favourite block explorer (such as <a href="https://blockchain.info/">Blockchain.info</a>).</p>
<p>Some have reported that their node stops synchronising at around block 300,000. If this is the case for you, you might want to replace your <tt>~/.bitcoin</tt> directory with my (at the time of writing) fully synchronised directory, or even my complete SD card image file that you can download below.</p>
<div class="separator" style="float: center; text-align: center; margin-bottom: 1em; margin-left: 1em;"><img style="border-style: solid; border-color: gray; border-width: 1px;" src="http://i.imgur.com/XyweSar.png" /></div>
<hr />
<h2 id="image">Download and use my (almost) ready-to-go image instead</h2>
<p>I've already done the work, so why should you? Well, because you might not trust me to not offer a malicious Bitcoin node that will break into your private network and steal all your Bitcoins and private data. And why should you; after all you don't know me.</p>
<p>Anyway, for the brave few, I've completed this guide for you, let the node synchronise with the Bitcoin network, and made an image file of my SD card available to download.</p>
<h3 style="font-size: 80%;">Download complete Pi 3 image</h3>
<p>The image file is for a <b>pruned node</b> without any external drive (such as the PiDrive) attached, ready to be used on a Raspberry Pi 3 with an SD card of at least 16 GB:<br />
<a href="http://pryds.eu/pinode/pinode-pruned-20170409.img.zip">Download my (almost) ready-to-go <i>pruned</i> Bitcoin node SD card image</a><br />
<tt style="font-size: 60%;">SHA256: b9ce45dd2af0c3ab8d07ec31ea058bbaf92f641c679cc2225726113fffd5fd66<br />
MD5: d3d33be1a85df13629c5d281bfc1c5b4</tt></p>
<p>After transferring the image to your SD card, you are urged to log in (username <tt>pinode</tt> and password <tt>pinode</tt>) and change the password (you will be asked to change it when logging in for the first time) and then run the system update commands below (this will also ensure that Bitcoin Core is updated, in case a new version has been released since this guide was written):</p>
<pre style="border-style: solid; border-width: 1px; border-color: #dddddd; padding: 3px;">sudo apt update
sudo apt upgrade</pre>
<p>You also still will need to open a port in your router as described above.</p>
<h3 style="font-size: 80%;">Download only the blockchain for your node</h3>
<p>You might also want to set up the system yourself and only download my (at the time of writing) fully synchronised <tt>~/.bitcoin</tt> directory to save on sync time (which can be <i>long</i>). Transfer the compressed file to your Pi through SCP (file transfer over SSH), copy the directory on to your SD card through your SD card reader on your normal computer, or download it directly from the Pi:<br />
<a href="http://pryds.eu/pinode/pinode-pruned-blockchain-20170409.zip">Download <i>pruned</i> <tt>~/.bitcoin</tt> directory</a><br />
<tt style="font-size: 60%;">SHA256: dd6ffcce71590f7a72356182ff80df00c11408a54b122305969fdb2df975fe63<br />
MD5: c36816adf5ca4fb9ea515b871e318bfa</tt></p>
<p>With the compressed file in your home directory (<tt>~</tt>) on your Pi, remove your old bitcoin directory (backup your <tt>bitcoin.conf</tt> file first if you made changes to it other than described in this guide) and extract the file to the right place (might take some time) with:</p>
<pre style="border-style: solid; border-width: 1px; border-color: #dddddd; padding: 3px;">cd ~
rm -rf .bitcoin
tar -zxvf bitcoindirectoryfilename.tar.gz</pre>
<!--
Remember:
sudo apt update && sudo apt upgrade
sudo apt autoremove --purge
dpkg --get-selections | grep linux-image
sudo apt-get remove --purge linux-image-X.X.XX-XX-generic
sudo apt clean
bitcoin-cli stop
(umount /home/pi/.bitcoin)
sudo swapoff /swapfile && sudo shred -n0 -z /swapfile && sudo mkswap /swapfile #fill swapfile with zeros
sudo rm /etc/ssh/ssh_host_* && sudo dpkg-reconfigure openssh-server
rm -rf ~/.ssh #necessary?
sudo rm /tmp/*
Remove/change RPC user/pass in bitcoin.conf
rm /home/pi/.bash_history
sudo sfill -llvz / # from package secure-delete
sudo sfill -llvz /boot
sudo chage -d 0 pinode # force password change; set specific pw: sudo passwd pinode
rm /home/pi/.bash_history
On main system:
shrink system partition in gparted + make sure it grows automatically on boot
-->
<hr />
<h2 id="thanks">Thanks!</h2>
<p>If we're to conclude anything from this, it must be that while installing and setting up a Raspberry Pi 3 system to act as a Bitcoin node is a fairly smooth procedure, the relatively low spec'ed hardware makes it quite painful to actually synchronise with the blockchain. Possible yes, but still painful. Especially the last couple of hundred blocks seem to take forever and then some. When the node is synced up, though, it seems to run without any problems.</p>
<p>I hope you liked this guide as much as I liked writing it. If anything is unclear, or you have any tips to share, please feel free to do so in the comments below. Also feel free (but not obliged) to <a href="bitcoin: 343bLegkXSEiTN63WbxF8TZHZeAeFAoto7">donate</a> an amount of your choice.</p>
<p style="border-style: solid; border-width: 1px; border-color: gray; padding: 5px; font-size: 80%;"><b>Disclaimer</b>: Use this guide at your own risk. The author of this guide is in no way responsible for any loss, even when following the guide to the last comma. You're responsible for your own data and money. Don't do anything with it that you don't feel 100% comfortable with, and only test things out using small amounts.</p>
Unknownnoreply@blogger.com31tag:blogger.com,1999:blog-4519174235184012855.post-42721764234220474972015-08-16T00:40:00.000+02:002015-08-16T19:26:57.639+02:00Measuring Humidity and Temperature Using a Raspberry Pi<style>
pre.code {
border-style: solid; border-width: 1px; border-color: gray; padding: 5px; background-color: whitesmoke;
}
</style>
<div class="separator" style="clear: right; float: right; text-align: center; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="http://i.imgur.com/DBxmraI.jpg" /></div>
<p>I have a collection of old books and a basement to store them in. But in fact, I don't do that yet, because I had a suspicion that storing them there would not be healthy to the books. Old books and too much humidity don't go well together, especially if you want to keep the books in a pristine condition.</p>
<p>I could, of course, just go to the nearest builders merchant and get a cheap hygrometer for something like €7-15. But I wanted to track the humidity level over a period of at least a week, to see if factors like day/night conditions and changing weather (not to mention the tumble dryer in the next room) have any measurable effect on the level of humidity in the basement room.</p>
<p>Therefore I decided to build a humidity and temperature meter with logging capability from a Raspberry Pi and a few bits of electronics.</p>
<a name='more'></a>
<p>The device logs temperature and relative humidity to a csv file which makes it easy to import the log file into a spreadsheet or similar, and in turn have nice graphs and charts with all the bells and whistles that I like to have.</p>
<h2>The Parts and Pieces I Used</h2>
<p>Most of the electronic parts I found on Ebay, but your local electronics store should also have most, if not all of them.</p>
<p><ul>
<li>A Raspberry Pi – I used a Pi 1 B+ but any model will do – with a fresh install of Raspbian on it.</li>
<li>The <a href="http://www.ebay.com/sch/i.html?_nkw=dht22">DHT22 temperature and relative humidity sensor</a>.</li>
<li>A single <a href="http://www.ebay.com/sch/i.html?_nkw=10k+ohm+resistor">10 ㏀ resistor ¼W</a>, unless it comes with the sensor. They usually come in bulks of a LOT, so you might want to get an <a href="http://www.ebay.com/sch/i.html?_nkw=resistor+assortment+kit">assortment kit</a> with resistors of many different Ω values now that you're at it.</li>
<li>A <a href="http://www.ebay.com/sch/i.html?_nkw=4+20+lcd+i2c">4×20 character LCD display</a> with an I2C board attached to it. The I2C board is an extra, small printboard which is soldered onto the display's own printboard, and which lets you have only four connecting pins instead of the LCD board's own 16 pins.</li>
<li>A <a href="http://www.ebay.com/sch/i.html?_nkw=bi-directional+logic+level+converter">Bi-Directional Logic Level Converter</a> to convert from 5V to 3.3V. Two channels are enough, although mine has four channels. They might also look <a href="http://www.ebay.com/sch/i.html?_nkw=I2C+5V-3V+converter">slightly different</a>, but they're essentially the same. Just make sure you get an assembled one, unless you feel like soldering the pins to the board yourself.</li>
<li>Some assorted <a href="http://www.ebay.com/sch/i.html?_nkw=jumper+wire+breadboard">jumper wires</a> – get both some male-males, some male-females, and possibly some female-females. And save yourself some trouble and get the ones with square plugs, not round ones.</li>
<li>A <a href="http://www.ebay.com/sch/i.html?_nkw=breadboard">breadboard</a> – a small one will do fine.</li>
</ul></p>
<h2>The Raspberry Pi's GPIO pins</h2>
<div class="separator" style="clear: right; float: right; text-align: center; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="http://i.imgur.com/1cZ097h.png" /><br /><small>Pi 1 B+ and later models have more<br />GPIO pins than the older models,<br />but the first 26 pins are the same.</small></div>
<p>I hooked everything up via a breadboard so that I didn't have to solder anything, but if you want to make this into a more permanent solution, you might want to solder everything up and put it in a nice box.</p>
<p>We will need to use the Pi's GPIO pins. Raspberry Pi 1, rev A and B have a 26 pin GPIO, while Pi 1, rev B+ and Pi 2 have a larger 40 pin GPIO, both located at the long edge of the board with pin 1 and 2 towards the corner. The first 26 pins are exactly the same on all Pi boards, and since we don't use any of the "extra" pins, the setup is the same no matter which Pi you have.</p>
<h2>Hooking up the DHT22 Sensor</h2>
<p>The DHT22 is a very inexpensive sensor that can be attached to an Arduino or a Raspberry Pi. With it you can read the current temperature and relative humidity percentage from your own Python scripts.</p>
<p>Hooking it up to the Pi is quite simple. The DHT22 sensor have four pins. Pins 1, 2 and 4 are connected to pins on the Raspberry Pi's GPIO, while pin 3 is not used. You will need to put a 10 ㏀ resistor between pin 1 and 2 on the DHT22. Here are the details:</p>
<table style="border-style: solid; border-width: 1px; border-color: gray; padding: 5px; text-align: center;">
<tr><th>DHT22</th> <th></th> <th>Raspberry Pi<br />GPIO</th></tr>
<tr><td>Pin 1 (3.3 V)</td> <td>↔</td> <td>Pin 1 (3.3 V)</td></tr>
<tr><td>Pin 2 (data)</td> <td>↔</td> <td>Pin 7 (GPIO4)</td></tr>
<tr><td>Pin 4 (GND)</td> <td>↔</td> <td>Pin 9 (GND)</td></tr>
<tr><td colspan="3">Put a 10 ㏀ resistor between the data line and the 3.3 V line</td></tr>
</table>
<p>Below is a diagram of how I hooked it up via a breadboard. You'll notice I connected the Pi's ground (GND) pin to the "minus" rail on the breadboard which will allow me to better connect the GND pins of more components later on without having more cables going to the Pi. Actually I didn't connect wires to the sensor and the resistor like the diagram suggests; I just plugged them directly into the breadboard.</p>
<div class="separator" style="float: center; text-align: center; margin-bottom: 1em;"><img src="http://i.imgur.com/GdWsvMl.png"></div>
<h2>Hooking up the LCD Display</h2>
<p>The LCD display is capable of showing four rows of 20 characters and when connected to your Pi, you will be able to send text to it from your Python scripts. This particular one has an i2c board attached which means we can connect it to the Pi in a relatively simple manner.</p>
<p>In order to connect it to the Pi, we will have to use a logic level converter, because the Pi has 3.3 V logic while the display uses 5 V. The converter must go in between the Pi's GPIO and the LCD. Here are the details:</p>
<table style="border-style: solid; border-width: 1px; border-color: gray; padding: 5px; text-align: center;">
<tr><th>LCD display</th> <th></th> <th>Converter</th> <th></th> <th>Raspberry Pi<br />GPIO</th></tr>
<tr><td>VCC</td> <td>↔</td> <td>HV</td> <td>↔</td> <td>5V</td></tr>
<tr><td>GND</td> <td>↔</td> <td>GND</td> <td>↔</td> <td>GND</td></tr>
<tr><td>SCL</td> <td>↔</td> <td>HV1</td> <td></td> <td></td></tr>
<tr><td>SDA</td> <td>↔</td> <td>HV2</td> <td></td> <td></td></tr>
<tr><td></td> <td></td> <td>LV</td> <td>↔</td> <td>3.3 V</td></tr>
<tr><td></td> <td></td> <td>LV1</td> <td>↔</td> <td>SCL</td></tr>
<tr><td></td> <td></td> <td>LV2</td> <td>↔</td> <td>SDA</td></tr>
</table>
<p>Since the converter fits right onto the breadboard, the far easiest thing to do is to just plug it right on there. On the breadboard diagram below you will notice that again I use the minus rail for ground, so in this entire setup, I have only one wire going to a GND pin on the Pi.</p>
<div class="separator" style="float: center; text-align: center; margin-bottom: 1em;"><img src="http://i.imgur.com/e3Z0o0y.png"></div>
<div class="separator" style="float: center; text-align: center; margin-bottom: 1em;"><img src="http://i.imgur.com/WYPztyu.png"> <img src="http://i.imgur.com/h4Li9nk.png"><br />
<small>Enlargements of the pins of the I2C board on the display (left) and the converter (right).</small></div>
<h2>Installing APIs and Software</h2>
<p>When you have everything connected, it's time to boot up your Raspberry Pi. With a running Raspbian, open a terminal window (or SHH into the Pi from another computer), as we will install the necessary software by text commands.</p>
<p>First up, we will install some dependencies:
<pre class="code">sudo apt-get update
sudo apt-get install build-essential python-dev python-smbus i2c-tools</pre></p>
<p>Then, we will download and install the Adafruit Python DHT library which will enable us to write Python code that reads temperatures and humidities from the DHT22 sensor:
<pre class="code">git clone https://github.com/adafruit/Adafruit_Python_DHT.git
cd Adafruit_Python_DHT
sudo python setup.py install</pre></p>
<p>As for preparing the display, the process is slightly longer. First, we will make sure that the required modules are read on system boot. We do that by loading the file /etc/modules in our favourite text editor. In this example it's the text based, but easy to use, editor nano, but if you have the Pi running with a graphical environment, you may want to change "nano" into "gedit" to get a graphical editor:
<pre class="code">sudo nano /etc/modules</pre></p>
<p>Add the following two lines, then save the file and exit the editor:
<pre class="code">i2c-bcm2708
i2c-dev</pre></p>
<p>Now, reboot the Pi and then start up the terminal again:
<pre class="code">sudo reboot</pre></p>
<p>Load the following blacklist file in an editor. There is a line "<tt>blacklist i2c-bcm2708</tt>" -- put a <tt>#</tt> in front of that line, save the file and exit:
<pre class="code">sudo nano /etc/modprobe.d/raspi-blacklist.conf</pre></p>
<p>Again, reboot the Pi and then start up the terminal:
<pre class="code">sudo reboot</pre></p>
<p>Now, we need a couple of driver files for the display. I put them in a file archive which you can download for convenience. Create a directory that will contain this, change to it, download the archive file and decompress it like this:
<pre class="code">mkdir ~/temperature
cd ~/temperature
wget http://pryds.eu/files/temperature.tar.gz
tar -zxvf temperature.tar.gz</pre></p>
<p>You'll see that I also put my Python script called "temperature.py" -- which polls the sensor and writes its output to screen and to the display -- into the archive file. We're almost ready to run this script, but first we need to make sure that we use the correct I2C address for the display. Now you must run ONE of these two commands, depending on whether your Raspberry Pi is Rev 1 or Rev 2:
<pre class="code">sudo i2cdetect -y 0 <small style="color: gray;">#if your Pi is Rev 1</small>
sudo i2cdetect -y 1 <small style="color: gray;">#if your Pi is Rev 2</small></pre></p>
<p>By doing this, you will get an output similar to this:
<pre class="code">$ sudo i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 3f
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --</pre></p>
<p>From this you can see that I have a device with address 1b which is in use ("UU" denotes this), while the display is at address 3f. Your device might use another address. If in doubt, this should be noted in your display's spec listings.</p>
<p>We will need to tell the lcddriver at which address it can write to the display, so open up lcddriver.py in your favourite editor:
<pre class="code">nano lcddriver.py</pre></p>
<p>Then scroll just a bit down to the line that says "<tt>ADDRESS = 0x3f</tt>", and if you found that your display's address was anything else than 3f, you need to change "<tt>3f</tt>" into that address at this line. Then, save and exit the editor.</p>
<p>Now you should be able to run the Python script and let it query the sensor and give you the current temperature and relative humidity:
<pre class="code">sudo ./temperature.py</pre></p>
<p>You can stop the script by pressing Ctrl+C in the terminal.</p>
<h2>Letting the script start automatically with the Pi</h2>
<p>In order to make this a headless setup, we need to make sure that the script is started every time the Pi starts up. Also, if the script is to run automatically without a screen (other than the display) attached to the Pi, we would need a small "launcher" shell script that runs the Python script properly, while it redirects screen output to a file (templogs.csv) for you to grab later and feed into e.g. a spreadsheet for nice graphs, etc. Therefore, create such a shell script in your editor:
<pre class="code">nano launcher.sh</pre></p>
<p>And then paste the following lines into that new file (assuming your username is "pi" and the directory you created above was "temperature" as suggested):
<pre class="code">#!/bin/sh
cd /home/pi/temperature
sudo ./temperature.py >> templogs.csv</pre></p>
<p>Now, mark the new script file as executable:
<pre class="code">chmod a+x launcher.sh</pre></p>
<p>Now we need to tell the operating system that this launcher file needs to be executed at every system startup. We will let cron handle this -- a system that runs on all Linux systems, letting users run programs and scripts at specific incidents or times. Add such a "crontab job" by executing the following command, which will in turn start up your default editor (probably nano):
<pre class="code">sudo crontab -e</pre></p>
<p>Scroll down to the end of the file and on a new line write the following:
<pre class="code">@reboot sh /home/pi/temperature/launcher.sh >/home/pi/logs/cronlog 2>&1</pre></p>
<p>Save and exit the editor, and you're ready to reboot the system and see your Pi automatically start logging temperature and relative humidity every time you boot it. For a quick reboot, do:
<pre class="code">sudo reboot</pre></p>
<h2>The Log File</h2>
<p>As mentioned, the launcher.sh script will redirect output to a csv file on the format "<tt>date/time<b>;</b>temperature<b>;</b>humidity</tt>", i.e. three fields separated by semicolons, each entry on a new line. Temperature is in degrees Celcius (°C).</p>
<p>As for my own basement, I discovered that relative humidity there might actually be slightly too high. Generally it sits in the high 50es percent, whereas apparently <a href="http://www.brighthubengineering.com/hvac/81719-best-indoor-humidity-range-for-people-books-and-electronics/">experts recommend 30-50%</a> for storing books. So this means that I will probably have to do something about it, if I follow through on my plans on actually storing books there.</p>
<h2>Future Add-ons</h2>
<div class="separator" style="clear: right; float: right; text-align: center; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="http://i.imgur.com/DWIkGle.jpg" /></div>
<p>Although I think this project was fun to build, there is a lot of potential for future add-ons. Here are just a few that I thought of.</p>
<p><ul>
<li>Put everything in a nice box and solder everything up.</li>
<li>Add a switch that would gracefully close down the system for headless systems without network connection.</li>
<li>Add a UV light sensor to the mix. Books can be really badly damaged by direct exposure to light, and especially by UV light. This is why sunlight, in particular, can easily fade book covers.</li>
</ul></p>
<p>If you liked the tutorial, please consider donating an amount of your choice, to the Bitcoin address or using the PayPal button to the right.</p>
<p style="border-style: solid; border-width: 1px; border-color: gray; padding: 5px; font-size: 80%;"><b>Disclaimer</b>: Use this guide at your own risk. The author of this guide is in no way responsible for any damage to you or your hardware that might occur from following this tutorial. Please note, that this is a description of what I did to make it work; not how it will work for you.</p>
Unknownnoreply@blogger.com3tag:blogger.com,1999:blog-4519174235184012855.post-47328142386466143682015-05-04T13:35:00.000+02:002015-08-14T13:38:24.151+02:003D Print Your Bitcoin Gear<div class="separator" style="clear: right; float: right; text-align: center; margin-bottom: 1em; margin-left: 1em;"><a href="https://www.shapeways.com/shops/knahrvorn?sort=popularity§ion=Bitcoin+and+Other+Crypto"><img border="0" src="http://i.imgur.com/OL4E3h1.png" /><br />Click here to order</a></div>
<p dir="ltr">Bitcoin is a pretty cool technology. 3D printing is a pretty cool technology. What does that tell you about combining the two? I'll leave that up to you to decide while I continue with my shameless plug of promoting a few Bitcoin related accessories and other gear that I 3D modelled and put up for anyone to order from Shapeways, the international 3D printing service company.</p>
<a name='more'></a>
<p>3D printing is, as hinted by the name, the process of producing a physical object from a 3D model in a computer. The typical way of doing so is on a 3D printer that slowly builds the object from the bottom up by adding layer by layer of ultra-thin molten plastic that is extruded much like an inkjet printer sprays ink on paper. Companies like Shapeways have taken this a step further by using much more advanced ways of printing which give much finer and smoother faces, but also by offering 3D prints in many different sorts of metal and, soon, in porcelain.</p>
<p>When ordering a product from Shapeways, you deal with Shapeways only, which I like as a customer there. So if you trust Shapeways to deliver, there is no need to worry about crooked individuals trying to scam people into buying their designs and then never deliver, or something like that. You pay directly to Shapeways, they print and send the item directly to you. And in the rare case of a sub-standard item arriving at your door, all complaints and refunds are handled by Shapeways, who will also take care of everything with regards to the designer. The only thing, Bitcoin-wise, that I don't like so much about Shapeways, is that they don't accept BTC yet. <a href="https://www.shapeways.com/forum/index.php?t=msg&th=14030">Here's</a> to hoping that will change in the future.</p>
<hr />
<h2>Customizable Bitcoin QR Code Keychain</h2>
<p>Measures app. 3 × 3.4 × 0.3 cm (1.18 × 1.33 × 0.12 in)<br /><a href="http://shpws.me/HzdP">Order this 3D print from Shapeways</a>.</p>
<div class="separator" style="clear: left; float: left; text-align: center; margin-bottom: 1em; margin-right: 1em;"><a href="http://shpws.me/HzdP"><img border="0" src="http://i.imgur.com/Szv1uWV.png?1" /></a><br /><small><i>Keyring with your own Bitcoin QR code.</i></small><br /><br />
<a href="http://shpws.me/HzdP"><img border="0" src="http://i.imgur.com/smcUIAV.png?1" /></a><br /><small><i>The back side has a Bitcoin logo on it.</i></small></div>
<p>This item came out of a need that I felt I had for myself. Or, feared I would one day have without being able to fulfil it.</p>
<p>The fact that the Bitcoin network is Internet based has the downside that it doesn't work without a piece of technology, such as your computer or mobile phone. So what if, one day, you were away from your computer, your mobile phone just ran out of juice from playing too much Bitcoin Millionaire, and you needed to take a Bitcoin payment from someone?</p>
<p>A physically printed QR code that you always carry on you would solve that, of course. But a QR on a piece of paper folded in your (analogue) wallet just doesn't cut it on the nerd coolness scale. A <b>QR code engraved in a 3D printed stainless steel keychain</b> does, however. You always carry your keys with you. Attach your emergency Bitcoin QR code to your keys, and you always have your QR code with you. Of course, as multiple use of one Bitcoin address is discouraged, this is not for everyday use, but for that few times where you can't take a payment in any other way. Sort of an insurance, if you will.</p>
<p>When ordering this QR code keyring from Shapeways, you will be asked to provide a Bitcoin address in the process. I will generate a QR code containing a "bitcoin:" payment request with your address in it and model it into the keychain model that you see in the photos and then let Shapeways print it and send it to you. This way you will get your very own customized and unique Bitcoin keychain.</p>
<hr />
<h2>Bitcoin Microstand</h2>
<div class="separator" style="clear: right; float: right; text-align: center; margin-bottom: 1em; margin-left: 1em;"><a href="http://shpws.me/GUJM"><img border="0" src="http://i.imgur.com/fK44Fg7.png?1" /></a><br /><small><i>The tiny Bitcoin Microstand in a hand.</i></small><br /><br />
<a href="http://shpws.me/GUJM"><img border="0" src="http://i.imgur.com/gbig0kP.png?1" /></a><br /><small><i>Both these are printed in Frosted Ultra Detail plastic.</i></small></div>
<p>Measures app. 2.3 × 0.7 × 0.6 cm (9.89 × 0.28 × 0.25 in)<br /><a href="http://shpws.me/GUJM">Order this 3D print from Shapeways</a>.</p>
<p>I like to think of this as a neat piece of office decoration. Whether it's at work or your home office, or just for that empty spot on the shelf. Anywhere would look nice with the Bitcoin logo displayed. If you own a shop that takes Bitcoin payments, you might even display it next to your cash register.</p>
<p>This extremely small stand doesn't take up much space; in fact the logo itself is only 2 cm wide, half a cm tall and half a cm deep (0.8 × 0.2 × 0.2 in) which makes the details on this incredibly small and delicate. It is definitely not something you want the children to play with (and why would they?) since it's quite fragile, the smallest parts being less than three quarters of a millimeter thin (0.025 in). But it's perfect for display. Letting people that visit your home or office know that you're up to beats on the most innovative payment technology around.</p>
<p>You have the choice between two materials that are both very well suited for the ultra-fine level of details that are on this model. The pictures show the model printed in a plastic material called "Frosted Ultra Detail" which is the lesser detailed of the two. The other material "Frosted Extreme Detail" is exactly the same, except edges and faces will be slightly smoother and print lines slightly less visible.</p>
<p>Both materials appear with a partly see-through, partly opaque, frosted, matte surface. If you wish, you can paint the model with acrylic paint in any colour you see fit, since this is the same material that model train hobbyists use for their incredibly small and detailed models.</p>
<hr />
<h2>The Bitcoin Blockchain</h2>
<p>Measures (stretched out) app. 12 × 1 × 1.2 cm (4.74 × 0.4 × 0.5 in)<br /><a href="http://shpws.me/H8o7">Order this 3D print from Shapeways</a>.</p>
<div class="separator" style="clear: left; float: left; text-align: center; margin-bottom: 1em; margin-right: 1em;"><a href="http://shpws.me/H8o7"><img border="0" src="http://i.imgur.com/lOicINA.png?1" /></a><br /><small><i>The Bitcoin Blockchain printed in<br />blue strong & flexible plastic.</i></small></div>
<p>This is a physical representation of the Bitcoin blockchain. Yes, blocks and chains. Sneaky, eh? With the naturally behaving chains, you can move the model around and display it with the blocks arranged in different positions. Your visitors will wonder and ask what it is, and you have yourself the perfect opportunity, served on a silver platter, to introduce them to Bitcoin and blockchain technology.</p>
<p>If printed in one of the "strong and flexible" plastic materials, this model can actually take some slight playing and fiddling to a certain degree (but again, don't let small children play with it). The pictures show it as printed in blue strong and flexible plastic. It's available in multiple colours, and also in the transparent and frosted detail plastic (which is less strong and flexible, though, and is more suited for display only). Each block is around 2.5 cm wide (~1 in) with a Bitcoin logo on the sides.</p>
<hr />
<h2>Bitcoin Keychain in metal or plastic</h2>
<div class="separator" style="clear: right; float: right; text-align: center; margin-bottom: 1em; margin-left: 1em;"><a href="http://shpws.me/GMQt"><img border="0" src="http://i.imgur.com/9o0iOGv.png" /></a><br /><small><i>Front and back side of the Bitcoin keychain,<br />here printed in Polished Metallic Plastic.</i></small></div>
<p>Measures app. 4 × 4 × 0.3 cm (1.57 × 1.57 × 0.12 in)<br /><a href="http://shpws.me/GMQt">Order this 3D print from Shapeways</a>.</p>
<p>Here is another Bitcoin themed keychain. As opposed to the one above, this one is of more generic character, and it's the perfect conversation starter for when someone sees you take out your keys: "Oh, so you're into Bitcoin—tell me about it!"</p>
<p>It has the round, tilted Bitcoin logo on one side, and on the other the word "bitcoin" is written in the same font as is often displayed with the logo. You can get it in either metal or plastic, and while the metal versions are of course much more durable, the plastic versions are less expensive. The material shown on the pictures is the so-called "Polished Metallic Plastic" which is grey plastic that was made to look like metal a bit, by adding a slight sparkle to it.</p>
<hr />
<h2>More Bitcoin 3D Printed Objects</h2>
<p>As for all of my items, if you miss a certain plastic colour, or a certain type of metal (either precious or non-precious), Shapeways have lots to choose from. Have a look at their <a href="https://www.shapeways.com/materials">materials descriptions</a>. Just get in touch with me (via the comments below or via Shapeways), and I will do what I can to add it as an option, provided the item in question supports it, and Shapeways has it available. So, in other words, if you want to show off Bitcoin in 18 karat pure gold, or even platinum, or perhaps you just happen to like pink or purple plastic, that will most likely be possible.</p>
<p>Take a look at my other Bitcoin themed 3D stuff at <a href="https://www.shapeways.com/shops/knahrvorn?sort=popularity§ion=Bitcoin+and+Other+Crypto">my Shapeways shop</a>. You'll find tie pins, cuff links, and a cover case for the Raspberry Pi, for instance. Also some <a href="http://storj.io/">Storj</a> stuff.</p>
<p>Some of the items that are not specifically mentioned on this page haven't been tried out in printing yet (you will see them marked as "first to try"), but Shapeways makes thorough tests and inspections both before and after print to make sure everything is ok. And if something imperfect happens to slip through to you after all, they have a really good reputation of making refunds. Actually, while you're there, also surf around for Bitcoin themed stuff by other designers on Shapeways. You'll find a lot of neat and impressive work there.</p>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-4519174235184012855.post-55098926628974382962014-10-13T14:18:00.000+02:002017-03-16T10:22:10.505+01:00Compile Bitcoin Core on Raspberry Pi (Raspbian)<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrd8tDY8ifQTWLRlWKfUXd2z_sPdPzfDvhMzIwXr2rD_BOdJwRuUpMQvbPvcyJXttdq-JQAlO4iI5CQlsnVenL09tcyUhw4gWWlGvvSBqgbvGnmxfw-gqazdF0SiwKJ2_44RDMXldR7R0/s1600/raspberry-pi-model-b-300x225-bitcoin.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrd8tDY8ifQTWLRlWKfUXd2z_sPdPzfDvhMzIwXr2rD_BOdJwRuUpMQvbPvcyJXttdq-JQAlO4iI5CQlsnVenL09tcyUhw4gWWlGvvSBqgbvGnmxfw-gqazdF0SiwKJ2_44RDMXldR7R0/s1600/raspberry-pi-model-b-300x225-bitcoin.jpg" /></a></div>
<p>If you want to run a full node on the Bitcoin network, you might want to do so on a computer that doesn't use so much power and is very inexpensive. The <a href="http://www.raspberrypi.org/">Raspberry Pi</a> might seem as an obvious choice for that. Here's a tutorial on how to install the newest version of <a href="https://bitcoin.org/en/download">Bitcoin Core</a> on the Raspbian OS, which is based on the Debian GNU/Linux distribution. If you have used Debian or Ubuntu Linux, you'll find many things familiar about Raspbian.</p>
<a name='more'></a>
<p>The Raspbian repositories currently contain a very old version of the original Bitcoin client, Bitcoin Core. And in fact, only the text based back-end, bitcoind, not the graphical front-end bitcoinqt. It is, however, possible to compile the newest version of Bitcoin Core yourself. This process takes a while, but most of the time the system spends on its own while you needn't intervene. To follow this tutorial, basic Linux/Unix command line experience is recommended, but probably not a requirement.</p>
<p>Here be dragons! Note that Bitcoin technology is generally experimental, and so is this tutorial, so don't use any significant amount of BTC with any system that you setup while following this tutorial. Also <i>note that the relatively weak system that forms a Raspberry Pi 1 or 2, may or may not be able to handle the task of acting as a Bitcoin node satisfactorily</i>.</p>
<h2>Prerequisites</h2>
<ul>
<li>A Raspberry Pi, model B, rev 2 or model B+. Unfortunately the compiling process needs the 512 MB RAM that these models have, but it may be possible to compile on a 512 MB model, and then move the SD card to a model with 256 MB RAM afterwards.</li>
<li>SD card of at least 32 GB (it must be large enough to hold the entire block chain).</li>
<li>A clean install of the Raspbian OS on the SD card. Raspbian is a version of Debian Linux for the Pi. For instructions on this, please refer to the <a href="http://www.raspberrypi.org/documentation/installation/installing-images/README.md">guide on raspberrypi.org</a>.</li>
<li>Network cable, and possibly a case for the Pi, and a keyboard and mouse, unless you plan to ssh into the Pi from another computer.</li>
</ul>
<h2>Initial steps</h2>
<p>In order to compile and run, Bitcoin Core depends on some other tools which must be installed prior to compiling. Most are available from the Raspbian repositories and are easily installable via apt-get.</p>
<ol>
<li>Install Raspbian on your SD card, if you haven't done so already.</li>
<li>Log into a command line on your Raspberry Pi, either via attached keyboard or make an ssh connection to it.</li>
<li>Run the Pi configuration tool:
<pre>sudo raspi-config</pre>
In the menu, choose to expand the file system. Then, in "Internationalisation options", choose "Change locale", then in the list make sure that at least "en_US.UTF-8 UTF-8" is checked ("en_GB.UTF-8 UTF-8" should be checked already). Choose "OK" to build the locales. Change your timezone. Exit the Pi configuration tool and select yes when it asks to reboot. Otherwise, reboot from the command line with <tt>sudo reboot</tt></li>
<li>Change the password for your user from the default into a strong password. The is especially important if you want to run a full node and thereby run a computer connected to the Internet 24/7. But it's advised to change it anyway:
<pre>passwd</pre></li>
<li>Update your Raspbian system by issuing the two commands:
<pre>sudo apt-get update
sudo apt-get upgrade</pre></li>
<li>Install some dependencies:
<pre>sudo apt-get install build-essential autoconf libssl-dev libboost-dev \
libboost-chrono-dev libboost-filesystem-dev libboost-program-options-dev \
libboost-system-dev libboost-test-dev libboost-thread-dev</pre></li>
<li>If you want the graphical frontend, also install the following dependencies. If you just want bitcoind, you can skip this step.
<pre>sudo apt-get install libqt4-dev libprotobuf-dev protobuf-compiler \
libqrencode-dev</pre></li>
<li>Create a directory which we will use for downloading and compiling various stuff, then enter it:
<pre>mkdir ~/bin
cd ~/bin</pre></li>
</ol>
<h2>Compiling and installing Berkeley DB 4.8</h2>
<p>Compiling Bitcoin Core requires the Berkeley DB version 4.8 which is not available in the Raspbian repositories, so we must compile and install it manually. Note that if you don't need a wallet (i.e. if you want to run a headless Bitcoin node and keep your wallet elsewhere) you can completely skip this section and jump directly to downloading and compiling Bitcoin Core.</p>
<ol>
<li>Download the Berkeley DB, uncompress it, and cd into the uncompressed directory:
<pre>wget http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz
tar -xzvf db-4.8.30.NC.tar.gz
cd db-4.8.30.NC/build_unix/</pre></li>
<li>Then, configure the system for compiling, do the actual compile job with make (will take a good while), and then install Berkeley DB:
<pre>../dist/configure --enable-cxx
make
sudo make install</pre></li>
</ol>
<h2>Downloading and Compiling Bitcoin Core</h2>
<p>We're now ready to download and compile Bitcoin Core itself.</p>
<ol>
<li>Go to the <a href="https://github.com/bitcoin/bitcoin/branches">branches list on the Bitcoin Core project site</a>, locate the latest version number, and substitute "0.9.3" in the command below with that. This tutorial is known to work with version 0.9.3, but a newer version is recommended if there is one.
<pre>cd ~/bin/
git clone -b 0.9.3 https://github.com/bitcoin/bitcoin.git
cd bitcoin/</pre></li>
<li>The following three commands will configure the system for compilation, then do the actual compile job. The last command <tt>make</tt> will probably take several hours to complete.
<pre>./autogen.sh
./configure CPPFLAGS="-I/usr/local/BerkeleyDB.4.8/include -O2" \
LDFLAGS="-L/usr/local/BerkeleyDB.4.8/lib"
make</pre>
Note: If you skipped the Berkeley DB 4.8 dependency above because you don't need a wallet, you must add "<tt>--disable-wallet</tt>" (without the quotation marks) to the end of the line that starts with <tt>./configure</tt> above.</li>
</ol>
<h2>Installing and Running Bitcoin Core</h2>
<ol>
<li>To install the compiled Bitcoin Core on the system, perform the following command:
<pre>sudo make install</pre>
After that, you will be able to run Bitcoin Core from anywhere on the system by simply typing: <tt>bitcoind</tt> (the text based backend) or <tt>bitcoin-qt</tt> (the graphical frontend).</li>
<li>If you want to automatically start bitcoind on startup, e.g. if you want to set up a headless Bitcoin node, add the following line to the file <tt>/etc/rc.local</tt>:
<pre>su pi -c '/usr/local/bin/bitcoind &'</pre>
Add the line anywhere <i>before</i> the already existing <tt>exit 0</tt> line. You can run a text based editor by typing "<tt>sudo nano /etc/rc.local</tt>", or a graphical text editor (if you're working in a graphical environment) by typing "<tt>sudo gedit /etc/rc.local</tt>", then pasting the script above and saving (in Nano, save and exit with Ctrl-X, then Y, then Enter).<br /><br />Now the bitcoind daemon will start when the system boots.</li>
</ol>
<h2>Open the port for Bitcoin traffic</h2>
<p>If you followed this tutorial to run a full Bitcoin node, don't forget to forward traffic on port 8333 to the Raspberry Pi. How to do this varies from network to network, but typically involves entering the web interface of your network router or modem, and setting up "Port Forwarding" there. Typically this is done by simply adding the local IP address of the Raspberry Pi along with port number 8333 to a list of forwarded ports. Refer to the documentation from your router/modem's manufacturer on how to do this exactly. Some routers even do this automatically so you don't need to do anything.</p>
<p>In order to find your Raspberry Pi's local IP address (assuming you're not connecting to it via SSH in which case you already have the IP address), log in to it and run the command:
<pre>ip addr show eth0</pre>
Look for the line that starts with the word inet. So if the line starts with "<tt>inet 192.168.1.106/24</tt>", your IP address is "192.168.1.106". You can verify that it works by checking the amount of connections after having run Bitcoin Core for a while. If it goes above 8 connections, you have successfully forwarded traffic on port 8333 to your Pi.</p>
<h2>Conclusion</h2>
<p>This concludes this tutorial on how to set up a recent version of Bitcoin Core on a Raspberry Pi. You should now be able to "<tt>sudo reboot</tt>" your Pi, whereafter it starts bitcoind and begins to download the blockchain. You can always check the status of bitcoind by logging in and typing "<tt>bitcoind getinfo</tt>".</p>
<p>In the future I might offer an almost ready-to-run .img file that you can just transfer to an SD card, make a few easy adjustments, and then you're ready to go, without the need for compiling any software. Although this will make it much easier to set up a Raspberry Pi Bitcoin node, it has the disadvantage that you will have to trust me not to have altered the software to do bad things. Suggestions and comments are welcome.</p>
<p>If you liked the tutorial, please consider donating an amount of your choice to the address or QR code to the right.</p>
<p style="border-style: solid; border-width: 1px; border-color: gray; padding: 5px; font-size: 80%;"><b>Disclaimer</b>: Use this guide at your own risk. The author of this guide is in no way responsible for any loss, even when following the guide to the last comma. You're responsible for your own money. Don't do anything with it that you don't feel 100% comfortable with, and only test things out using small amounts.</p>Unknownnoreply@blogger.com53tag:blogger.com,1999:blog-4519174235184012855.post-64118938133314875262014-09-12T18:22:00.001+02:002014-09-20T11:59:46.715+02:00How to keep your SJCX in cold storage using Armory<div class="separator" style="clear: right; float: right; text-align: center; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjL24oUUERI89676blZd1F8jCQhD5j0_TyIZNCieargzlBPa7zg1p7XtcK1Rrq_oD7DB8YoA2zhBO3HbNtNkeS3u5M2ABg-In2Cxq6P3hLxBo4f_KEp9zJ70pfVQlinFxbbPSsr9T5x1eY/s320/Untitled.png" /></div>
<p>Counterwallet has a nice feature which lets you keep your private key on an offline computer running Armory, while being able to initiate transactions from Counterwallet, transfer them to your offline system for signing, and back to Counterwallet for broadcast to the network. This, essentially, allows you to keep your SJCX in an Armory cold storage, while being able to see and control your funds from Counterwallet. Here's a tutorial on how to do this.</p>
<a name='more'></a>
<div class="separator" style="clear: both; float: right; border-style: solid; border-color: gray; border-width: 1px; padding: 10px; margin: 10px; width: 200px; font-size: 80%;">
<h2>About cold storage transactions</h2>
<p>A transaction with BTC (and therefore also with SJCX, since SJCX uses the Counterparty protocol, which in turn uses Bitcoin) can be roughly broken into three main steps: Creating the transaction, signing the transaction, and broadcasting the transaction to the Bitcoin network.</p>
<p>When you use a hot wallet, these three steps are usually performed automatically for you, all in one go. With cold storage, you keep your private key on a computer that has never been and never will be connected to the Internet. The reason for this is to hugely reduce the risk of someone cracking your computer and getting access to your private key, and thereby your wallet.</p>
<p>This separation means that the three steps will have to be performed as three actual steps. First, the transaction must be initiated/created on the online computer, then moved via a USB drive or similar to the offline computer for signing by your private key, then moved back to the online computer for broadcasting to the Bitcoin network.</p>
</div>
<h2>Prerequisites</h2>
<ul>
<li>A computer that has never been connected to the Internet since before the operating system was installed, and never will.</li>
<li><a href="https://bitcoinarmory.com/">Armory</a> installed on your offline computer. We will not cover this here, as it is out of scope for this tutorial. Also, the installation procedure will vary from system to system (personally I would recommend running a cold storage on <a href="http://www.ubuntu.com/">Ubuntu Linux</a>, or maybe even <a href="http://www.gnewsense.org/">gNewSense</a> for the super paranoid). The first part of <a href="http://blog.pryds.eu/2014/06/cold-storage-armory-ubuntu-14-04.html">this video tutorial shows hot to install Armory as a cold storage on Ubuntu</a>. Unlike when using Armory online, for this you don't need to have bitcoind installed, and you don't need to download the entire blockchain to your offline computer. We <i>will</i> cover setting up Armory, though, just not installing it.</li>
<li>Armory installed and running with an updated copy of the blockchain on a computer that <i>is</i> connected to the Internet (an online computer). We will need this for just one transaction during setup; after that you may remove this online Armory installation and the blockchain if you need the space.</li>
<li>A <a href="https://www.counterwallet.co/">Counterwallet</a> where you have the SJCX that you want to keep in cold storage.</li>
</ul>
<h2>Setting up</h2>
<ol>
<li>Run the offline version of Armory on your cold storage computer. On my system, the icon for this is called "Armory (Offline)".</li>
<li>If you haven't already, set up a new wallet with a strong password. During creation of the wallet, you will be asked to make a backup, and you should definitely do this! Good practice is to make at least two paper backups and keep them at separate, secure locations (like one in your safety box, and one in your bank, etc.)</li>
<li>Select your newly created wallet and click the "Receive Bitcoins" button. This will create a new address for you. This is the address that will be your cold storage.</li>
<li>From Counterwallet, transfer your SJCX funds to the address you just got from offline Armory. You should probably start out with a small amount, or some SJCT (Storj test coin which you can <a href="https://storjtalk.org/index.php/topic,1380.0.html">get for free from the Storj forums</a>), until you feel safe.</li>
<li>From any Bitcoin wallet, transfer a small amount of BTC. This will cover the fees for when you want to transfer SJCX away from the cold storage at a later time, plus you will need a small amount of BTC to later make one transaction <i>from</i> the cold storage address before you can properly add it to Counterwallet.</li>
<div class="separator" style="clear: right; float: right; text-align: center; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiH5xqAENu1aoz_74x2p3IRw9zVRnWl6IcmBvX40g9PcZEuAx6-JGjeq90hTZAl_7iOR4qQyhpjFbtzSljzmSWtuDw85ZSb35lHNL6m7PYBBFF7t6PHt9v7LX5OS1nnbQUvDVClt-hVpvU/s400/armory-screenshot.png" /></div>
<li>In offline Armory on your cold storage computer, select your wallet and click the "Wallet Properties" button. Then click the "Export Watching-Only Copy". Save your watching-only copy of the cold storage wallet on a USB drive, or write down the root data information that appears.</li>
<li>In online Armory, select the "Import or Restore Wallet" button. Load the file from the USB drive, or type in the root information and click "Restore Wallet". Go make a cup of coffee while Armory computes new addresses and rescans the blockchain.</li>
<li>Now you need to send a small amount of BTC from the cold storage address to somewhere else. This is because this will expose the public key of the address, and Counterwallet needs that to act as a "front-end" to your cold storage. Since the address is in cold storage, we will need to create the transaction "cold storage style", which is described here:</li>
<ol type="A">
<li>In your online Armory, select the watching-only copy of your offline-wallet, then click "Send Bitcoins".</li>
<li>Make sure you select "Use an existing address for change", and then "Send change to first input address". Then type in the address to where you want to send (probably to where it came from), and a small BTC amount. In Armory, you choose the fee amount yourself, but Armory will complain if it is too low for your transaction. Try with 0.00001 BTC first, and if it doesn't work, try with 0.0001 BTC. Then click "Continue".</li>
<li>From the appearing window, save the transaction data to a USB drive.</li>
<li>In offline Armory on your cold storage computer, click the "Offline Transactions" button, then "Sign Offline Transaction". Load the transaction file from your USB drive and click "Sign". Now a signed transaction file will be saved to your USB drive.</li>
<li>Put your USB drive back in your online computer, and click "Continue" in the window you left open (if you closed it, you can get back via the "Offline Transactions" button). Load the signed transaction file from your USB drive and click "Broadcast".</li>
</ol>
<li>Now you can add the cold storage address in Counterwallet: Click "Create New Address", and then "Create Armory Offline Address". Type the address you got from Armory in the "Address" field, and some descriptive text in the other field, such as "Cold storage". Click "Create New Address".</li>
</ol>
<h2>Sending funds TO the cold storage</h2>
<p>You should now be able to see the funds in your cold storage from Counterwallet. Adding more funds to it is easy: Just transfer SJCX or BTC (or any other Counterparty asset, for that matter) to the address that Armory gave you.</p>
<h2>Sending funds FROM the cold storage</h2>
<p>The whole point of a cold storage is to keep your funds secure. While sending funds <i>TO</i> the cold storage is easy as pie, this extra layer of security means that sending funds <i>FROM</i> the cold storage is slightly more cumbersome. Luckily, a cold storage is not meant for everyday use, but it is extremely secure for storing larger amounts that you don't need to access very often.</p>
<p>During the setup, you actually already created, signed, and broadcast a BTC transaction from your cold storage through Armory alone. The process is very much the same for SJCX, except now you will create and broadcast the transaction from Counterwallet. You will still be signing the transaction from offline Armory.</p>
<ol>
<li>In Counterwallet, you create an offline transaction in the same way you would initiate a normal transaction: Find your offline address in the list. Open the dropdown next to SJCX (or what ever asset you want to send) and click "Send". Paste the address you want to send to, and enter an amount. Click "Send".</li>
<div class="separator" style="clear: right; float: right; text-align: center; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJ9BtLagVmEIClrnGfI5J_EnYLoqmW_m9EcajACN7Kt_-Z_bu48UjbLpZ7T9EuyfZhdzThyKvumRX01B_taRi2i6P6zL5c-BcTtTuyKwUNWi8-urODB4nhj0VuksXMpt9dgmYIqJzUF_g/s400/counterwallet-screenshot.png" /></div>
<li>Now, instead of signing and broadcasting the transaction (Counterwallet can't sign because it doesn't have your private key), Counterwallet will present you with a text representation of the transaction. Copy the entire text (including all the equality signs) to a new txt file on your USB drive.</li>
<li>In your offline Armory, click the "Offline Transactions" button, then "Sign Offline Transaction". Open the txt file from the USB drive in a text editor, and copy the entire text to the clipboard. Insert it in the text field that appeared in Armory, and click "Sign".</li>
<li>Now the text in Armory's text field changed, and the transaction has been signed. Copy the changed text back to the text file on the USB drive (make sure to remove all of the old text first).</li>
<li>Back in Counterwallet, click the "Address Actions" dropdown next to your cold storage address, then click "Broadcast Transaction". Copy the transaction text from the file on your USB drive, and click "Broadcast". Et voilà!</li>
</ol>
<p style="border-style: solid; border-width: 1px; border-color: gray; padding: 5px; font-size: 80%;"><b>Disclaimer</b>: Use this guide at your own risk. The author of this guide is in no way responsible for any loss, even when following the guide to the last comma. You're responsible for your own money. Don't do anything with it that you don't feel 100% comfortable with, and only test things out using small amounts.</p>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-4519174235184012855.post-70852306616212355522014-07-29T11:33:00.000+02:002014-09-15T21:58:23.535+02:00Store your SJCX in Armory<div class="separator" style="clear: right; float: right; text-align: center; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKElQZHe7MEAj6iL5MVH83-herL9U2uuFVVzS1Atjh3lFBkyox9afvk-uXkCeYx6RHr4B922HX9jZJ92SDUl1KzeaYcEUpqu_mMIby3a3SZZriU6wIq3_EyjRxmunMS8w9_5uL4BYy-m4/s1600/storj.png" /></div>
<p>In the lack of proper SJCX desktop wallet software to manage your <a href="http://storj.io/">Storj</a> assets, here's how to send your SJCX from <a href="https://counterwallet.co/">Counterwallet</a> to an ordinary Bitcoin wallet and back again. This guide will assume a fully set up and running <a href="https://bitcoinarmory.com/">Armory</a>, but the process should be relatively similar in any other BTC wallet, as long as you are able to retrieve the private key. This might even be a cold storage wallet (in software or paper form), if you wish.</p>
<a name='more'></a>
<div class="separator" style="clear: both; float: right; border-style: solid; border-color: red; border-width: 1px; padding: 10px; margin: 10px; width: 200px; font-size: 80%;"><b>Update</b>: Since this article was written, a new way of storing your SJCX in Armory was made possible. Here's <a href="http://blog.pryds.eu/2014/09/how-to-keep-your-sjcx-in-cold-storage.html">a guide to keep your SJCX in Armory cold storage</a>, while being able to see your SJCX in and make transfers from Counterwallet. The tutorial on this page will still be valid if you want to use something like a paper wallet or if you want to store your SJCX in Armory on an online computer.</div>
<div class="separator" style="clear: both; float: right; border-style: solid; border-color: gray; border-width: 1px; padding: 10px; margin: 10px; width: 200px; font-size: 80%;">
<h2>GLOSSARY</h2>
<p><b>Armory</b>: Bitcoin wallet software focusing on security and usability.</p>
<p><b>Counterparty</b>: A framework for creation and maintenance of assets based on Bitcoin.</p>
<p><b>Counterwallet</b>: The official wallet for Counterparty assets.</p>
<p><b>SJCX</b>: Cryptocoin which is used for buying and selling storage on Storj.</p>
<p><b>Storj</b>: Decentralized network that allows for encrypted file storage in the cloud.</p>
</div>
<p>You might want to keep your SJCX in Armory (or another ordinary BTC wallet) if you don't fancy using a web wallet like Counterwallet for storing larger amounts that you're not going to use immediately. Only, beware that Armory, etc., cannot show the SJCX amount, but will instead only show a small BTC amount. The small BTC amount will not reflect the amount of SJCX nor any changes to the amount of SJCX.</p>
<h2>Transferring SJCX to Armory address</h2>
<ol>
<li><b>Create a new Armory wallet</b> for storing your SJCX by clicking the "New Wallet" button in the main window. Armory will guide you through setting up a new password and making a backup (two very important steps!). It is highly recommended to <i>not</i> use an existing wallet, as you will have to send the private key over the Internet when you want to transfer the SJCX back to Counterwallet.</li>
<li><b>Get a new address to send your SJCX to</b> by clicking "Receive Bitcoin" in the Armory main window, then selecting your new wallet in the window that pops up. A new address will be created for your new wallet. To ease things, you can copy that address to the clipboard.</li>
<li>Now, log in to <a href="https://counterwallet.co/">Counterwallet</a> and <b>send your desired SJCX amount</b> to the new address in Armory. Remember that sending SJCX to anywhere requires a small amount of BTC on that same Counterwallet address for fees. Also, you may want to send some BTC (0.000256 BTC recommended) to the Armory address (either from Counterwallet or from any other BTC address). This will cover fees for when you want to send your SJCX back to Counterwallet. However, you will have the option to do so later.</li>
</ol>
<p>Et voilà! You are now storing your SJCX in an address that is controlled by Armory. Notice, though, that Armory will only show you a BTC amount, not the SJCX amount. But no worries; your SJCX is just as safe and secure as the small BTC amount you see there. And remember, the small BTC amount does not tell anything about how much SJCX you have.</p>
<p>If you want to keep track on the amount of SJCX you have stored up in Armory, you can actually do so by importing the address as a "watch-only" address in Counterwallet. This way, you will be able to see your amount of SJCX from Counterwallet, but you will only be able to do anything with it from Armory. To do this, from Counterwallet select "Create New Address" -> "Create Watch Only Address".</p>
<h2>Sending back your SJCX to Counterwallet</h2>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijHfu667Uk3yzsM0jfiG4_s34oMJLbh0pjjLJXKOoXrVfRZ8f46w2z5Bc-6dl8qZRpnkHvcegZ0dXeb8RTfgUv_wMNZg9A4GTrRPaoG-L4s3EE6IJ6yIG98k8-VSAYYLstyan77U00nWA/s1600/armory-privatekey.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijHfu667Uk3yzsM0jfiG4_s34oMJLbh0pjjLJXKOoXrVfRZ8f46w2z5Bc-6dl8qZRpnkHvcegZ0dXeb8RTfgUv_wMNZg9A4GTrRPaoG-L4s3EE6IJ6yIG98k8-VSAYYLstyan77U00nWA/s320/armory-privatekey.png" /></a>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdEXCDo7PYyztkGZNMgiBaofx2DSDvxQOgRnSvaHhZX91_UVXViTlzbmFhF_-wpMdjoQZ-RSl3lYq3d6dEJ39GHJpNJrpVheTuI5nYEMCXhAOi4cHoGHJmGR2ZtvmSs7l5vSfBdfIGiOI/s1600/counterwallet-sweep.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdEXCDo7PYyztkGZNMgiBaofx2DSDvxQOgRnSvaHhZX91_UVXViTlzbmFhF_-wpMdjoQZ-RSl3lYq3d6dEJ39GHJpNJrpVheTuI5nYEMCXhAOi4cHoGHJmGR2ZtvmSs7l5vSfBdfIGiOI/s320/counterwallet-sweep.png" /></a></div>
<ol>
<li>To <b>get the private key for your address in Armory</b>, double-click your SJCX wallet in the Armory main window, click "Backup this wallet", select "Export Key Lists" and click the button of the same name. After having supplied your password, you'll be presented with your private key in different encodings. You can remove all checkboxes, except "Private Key (Plain Base58)". Check the "Omit spaces in key data" box. Now select the key string and copy it to the clipboard.</li>
<li>From Counterwallet, you can now <b>sweep your SJCX back from Armory</b>. This involves handing over your Armory wallet's private key to Counterwallet, which is why we created a new wallet for the purpose, so that we can delete it and never use it again afterwards. Go to Counterwallet and click the "Import Funds" button, then select "From Another Address". In the appearing window you can paste the private key, and Counterwallet will now tell you how much SJCX you have and let you choose how much to sweep. Sweeping involves Counterparty transferring the funds back to its own wallet on behalf of Armory, so to say, which is what the private key is needed for. Counterwallet will warn you if you have insufficient BTC for fees to do the sweep, including telling you exactly how much you need to transfer to the address.</li>
</ol>
<p>Until a dedicated SJCX wallet application is developed, this method can be used as a slightly inconvenient but much more secure way of storing your SJCX. Why does it work? It works because of the fact that all Counterparty assets (such as SJCX) are based on Bitcoin and uses the Bitcoin block chain. Thereby SJCX and other Counterparty assets allow you to handle them using ordinary Bitcoin apps, even though these apps don't directly support SJCX.</p>
<p>Hopefully, though, one day someone will develope a dedicated SJCX wallet, or even implement proper support into existing Bitcoin wallets so users can choose between Counterwallet and something else. More options are always better.</p>
<p style="border-style: solid; border-width: 1px; border-color: gray; padding: 5px; font-size: 80%;"><b>Disclaimer</b>: Use this guide at your own risk. The author of this guide is in no way responsible for any loss, even when following the guide to the last comma. You're responsible for your own money. Don't do anything with it that you don't feel 100% comfortable with, and only test things out using small amounts.</p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4519174235184012855.post-64049879979036719972014-06-01T18:14:00.000+02:002016-03-23T12:41:28.219+01:00Setting up cold storage in Armory on Ubuntu 14.04<div class="separator" style="clear: right; float: right; text-align: center; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyzIRxdUt9oiSzaaDxRxzPDSbV-uRX0PUvzGo6m1beXqQNT6Nv4U8ejUXDretgCIq48pnVHMBh1NH-nmGRpgS-zdAyfzvMO6ZVKdhY5Af1VEwkXIqpW4O1CP4mHvnjiGUCwrHooAvikkk/s1600/ubuntulogo.png" /></div>
Here's a video tutorial on how to set up a cold storage (a.k.a. offline wallet) in <a href="https://www.bitcoinarmory.com/">Armory</a> on <a href="http://www.ubuntu.com/">Ubuntu</a> 14.04. <a name='more'></a> You will see:
<ul>
<li>How to install Armory on an offline computer.</li>
<li>How to set up an offline wallet and import a watching only version to your online computer.</li>
<li>How to transfer bitcoin TO an offline wallet.</li>
<li>And how to transfer bitcoin FROM an offline wallet.</li>
</ul>
Prerequisites:
<ul>
<li>PC with an internet connection, running Ubuntu and Armory (see my other tutorial for how to set up Armory).</li>
<li>PC with Ubuntu installed without ever having been connected to the Internet (e.g. a small notebook or similar).</li>
<li>The same version of Ubuntu on both computers.</li>
<li>A USB stick (a small one will do fine).</li>
</ul>
<p>For step-by-step guidance, enable the subtitles!</p>
<iframe width="700" height="394" src="//www.youtube.com/embed/w9TGkUgekLY" frameborder="0" allowfullscreen></iframe>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-4519174235184012855.post-30881034761525569672013-09-20T17:11:00.000+02:002017-12-18T00:00:19.727+01:00Checklist for Panorama Photography<p>A lot of texts on the Internet about creating panoramas seem to focus on the stitching part of creating a panorama -- which is of course a good thing. Tips and tricks for stitching software help a lot to get a great result. However, the more care and attention is put into shooting the photographs, the less headache you'll have in the later steps.</p>
<a name='more'></a>
<p>The fact that I'm not a very experienced photographer always makes me wonder whether I remembered to set everything on the camera correctly before I start shooting. And often I forgot something and end up using way too much time on post-processing. Or even with an unusable result. So here I bring my own short checklist for shooting better panoramic photographs.</p>
<ol>
<li>No-Parallax Point</li>
<li>Minimise Camera Shake</li>
<li>Set Camera to RAW</li>
<li>Shoot F-Priority</li>
<li>No Flash</li>
<li>Pick Your White Balance Setting</li>
<li>Zoom All Out</li>
<li>Manual Focus</li>
<li>Shoot!</p>
</ol>
<p>This checklist assumes that you are using a DSLR camera. Many mobile phone cameras now offer full-automatic panorama features, but while they are getting increasingly better at the job, to my experience they are still inferior to using a "proper" camera and some stitching software. Any DSLR will probably do, but if you need help in choosing the right one for you, here is a <a href="https://www.jenreviews.com/dslr-camera/">very nice guide</a> on that topic.</p>
<div class="separator" style="clear: both; text-align: center;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzjWXOTbcpntTYPDONCb3jNfVxmJzX-mtL-LxyCgPvy_BT5ANliO1lSIQNyuqT7aQeA76lkQrMMlNuyjpnI0MVTApZbjqmw8RAID48vanL7wXy2yfG-waM6ggAbRV5hyphenhyphen7vcsrAjA10Z8Y/s400/1280px-Loggia_dei_Lanzi_360_view_big.jpg" /><br /><small>Panorama by <a href="http://commons.wikimedia.org/wiki/User:MatthiasKabel">Matthias Kabel</a>, from Wikimedia Commons</small></div>
<h2>1. No-Parallax Point</h2>
<p>The absolute top-of-the-list must-have entry. If you don't get this right, it's going to be a pain stitching your panorama later. Especially if you have a scene that includes both near and far objects. If you've read just a slight bit about panorama photography, this is probably what you've read about. In short, it's about rotating your camera around a certain point, called the <a href="http://wiki.panotools.org/No-parallax_point">no-parallax point</a>, which is placed typically within your lens, or else you're very likely to get parallax errors in your panorama, and they can be very hard to edit out afterwards. There are plenty of articles around the 'net explaining this in detail.</p>
<p>The thing you need in order to avoid parallax errors is a so-called pano-head, which goes between your tripod and your camera. There are those who prefer to do hand-held panorama shooting, but in my experience, such a pano-head will ease things dramatically. It can be an expensively bought one, or it can be a <a href="http://blog.pryds.eu/2012/07/build-your-own-panoramic-head-novice.html">simple, cheap, home-made panohead</a> -- doesn't matter too much.</p>
<h2>2. Minimise Camera Shake</h2>
<p>A tripod will minimise camera shake. It would be a shame if just one of the shots end up blurry and shaken, thereby ruining the whole panorama. And of course, you'd need a tripod for the panohead mentioned above.</p>
<p>Besides the tripod, you should do something to avoid camera shake caused by pressing down the camera's release button. The simplest solution is to use your camera's ability to shoot with a one- or two-second delay, although a bit cumbersome for panoramas that consist of more than a handful of shots. A more elegant solution is to use a remote control. These come in various shapes and sizes (and prices!), wired or wireless, branded or bamboo. I found a very inexpensive combined intervalometer/remote for my camera on <a href="http://www.ebay.com">ebay</a>, sent directly from China to Europe at app. €11 including shipping. I figured, at that price it wouldn't matter too much if it didn't last very long, or didn't even arrive. It did arrive, though, and still functions without any problems, and it's very simple to use.</p>
<h2>3. Set Camera to Raw</h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgV7sUqk-5PG1XZXjqKeRJhQ0zz2vQiWpoejEsODPz9v-UxOrLZzdoKpuPo6GIGB1n5GA0Cq2-Nl_nluaCDCnpCOKEj_I-Q4w9URYIqCpSOhQyl-JOHfFTdglpomthLKVMbg5ovf5XwQZk/s1600/raw-icon.png" imageanchor="1" style="clear:right; float:right; margin-left: 1em; margin-right: 1em;"><img border="0" psa="true" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgV7sUqk-5PG1XZXjqKeRJhQ0zz2vQiWpoejEsODPz9v-UxOrLZzdoKpuPo6GIGB1n5GA0Cq2-Nl_nluaCDCnpCOKEj_I-Q4w9URYIqCpSOhQyl-JOHfFTdglpomthLKVMbg5ovf5XwQZk/s1600/raw-icon.png" /></a></div>
<p>A good thing to do when you shoot photographs that are to be stitched later (and probably in general, too), is to shoot raw rather than JPEG. Your camera's raw format supports a wider range of steps from dark to light, called the <a href="http://wiki.panotools.org/Dynamic_range">dynamic range</a>, than JPEG does. This is especially beneficial if your stitching software uses exposure correction. With JPEGs you are more likely to get smeared-out light or dark areas. If your stitching software doesn't take RAW files directly, you can convert them into e.g. 16 bits TIFF files which also support a broader range than JPEGs.</p>
<p>If you haven't been shooting RAW before, it does introduce quite a few new things to learn. You'd probably want to <a href="http://en.wikipedia.org/wiki/Camera_raw">read something</a> and play around with this quite a bit before attempting at <a href="http://wiki.panotools.org/RAW_dynamic_range_extraction">panoramas from raw images</a>. Another method for maximising the dynamic range is <a href="http://wiki.panotools.org/Bracketing">bracketed shooting</a>.</p>
<h2>4. Shoot F-Priority</h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcl9kNZefzO0m3Ty7Sz96GOjE6p26YBYDx8thC2tzN1BxJ79ajniAOZuQt6BP9Z58T6-ldttIU-gMv2wiOktxHQXUfO3yJXcfk4lh0i_Ir1QYlqWtY0TKXk19CReTmU2tgCnnaixzzfQI/s1600/av.jpg" imageanchor="1" style="clear:right; float:right; margin-left: 1em; margin-right: 1em;"><img border="0" psa="true" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcl9kNZefzO0m3Ty7Sz96GOjE6p26YBYDx8thC2tzN1BxJ79ajniAOZuQt6BP9Z58T6-ldttIU-gMv2wiOktxHQXUfO3yJXcfk4lh0i_Ir1QYlqWtY0TKXk19CReTmU2tgCnnaixzzfQI/s1600/av.jpg" /></a></div>
<p>Unless you settle for shooting full-manual, it might be a good idea to set your camera to F-priority (the "Av" setting on some cameras). For most panorama scenes you want everything to be in focus, both near and far objects, so use a relatively high f-number -- probably 11 or more. This gives a large <a href="http://en.wikipedia.org/wiki/Depth_of_field">depth of field</a>.</p>
<h2>5. No Flash</h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWsZbTFVVrJCt9I99CT-cmaB2LM9goeQrOTnnHzeX3NKNgvQ9QzmjtkCAmpg05ZOAR-Z1rLpaxkmcYSWMsrVuCEiUWgeJq6xQZRG7AQnAFjt-tbAdr8banDmvoR26TEhqX7qNIr-J0rjY/s1600/noflash.png" imageanchor="1" style="clear:right; float:right; margin-left: 1em; margin-right: 1em;"><img border="0" psa="true" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWsZbTFVVrJCt9I99CT-cmaB2LM9goeQrOTnnHzeX3NKNgvQ9QzmjtkCAmpg05ZOAR-Z1rLpaxkmcYSWMsrVuCEiUWgeJq6xQZRG7AQnAFjt-tbAdr8banDmvoR26TEhqX7qNIr-J0rjY/s1600/noflash.png" /></a></div>
<p>If you shoot indoor, don't use the built-in flash (in general, don't use the built-in flash indoor, unless you really have to), as it tends to create uneven lighting of the photo. This will be quite evident when several images are stitched together. Make sure the room is sufficiently lit.</p>
<h2>6. Pick Your White Balance Setting</h2>
<p>Whether you're doing an out- or indoor panorama, you should pick a <a href="http://www.exposureguide.com/white-balance.htm">white balance</a> setting that fits the lighting in the scene; for instance tungsten or fluorescent light for indoor shooting. Often the auto-white-balance setting ("AWB") doesn't do a very good job, especially on indoor shots with no flash, and you'll get weirdly coloured photographs as a result. Do a few test shots to see if the selected white balance works for your location.</p>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgxZFv33q0VkA4LeE0f2rXldKi8G6vMYkhAn0cv29mFKRElc4ChkvBOkwu3POuHmHy24LLX4cJABFHOaC1YOuPn2S0W8pVjqor2WgNau8APhtZjdrdeXZ3Tq-0ipsegv9uAHEnTBcxZBQ/s1600/white-balance-settings.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" psa="true" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgxZFv33q0VkA4LeE0f2rXldKi8G6vMYkhAn0cv29mFKRElc4ChkvBOkwu3POuHmHy24LLX4cJABFHOaC1YOuPn2S0W8pVjqor2WgNau8APhtZjdrdeXZ3Tq-0ipsegv9uAHEnTBcxZBQ/s1600/white-balance-settings.png" /></a></div>
<h2>7. Zoom All Out</h2>
<p>Unless you're going for a giga-pano, you might as well zoom all the way out, if you're using a zoom lens. Also, remember that when you change the focal length (i.e. use the zoom), you also change the position of the no-parallax point, so you need to adjust your pano-head (if you're using one of those).</p>
<p>By always shooting all-zoomed-out you get at least two advantages: Adjusting your pano-head is easy (on mine I just have one setting, namely 18 mm on my standard 18-55 mm zoom lens), and you need to shoot and stitch fewer photographs. The only disadvantage is lower resolution, but at e.g. 18 mm, chance is you get plenty of resolution for a panorama. If not, try your way out to find your preferred focal length trade-off and then stick to that.</p>
<h2>8. Manual Focus</h2>
<p>The last thing to remember before shooting is to set your camera/lens to manual focus in order to get as uniform photographs as possible. If you're not too experienced in manual focus (like me), a good tip is to use this procedure before shooting: set to auto-focus, point the camera to something in your scene, half-click the release button until auto-focus has done its thing, then switch back to manual focus. Do a couple of test shots, and check that both near and far objects are in focus (if only some are, you might want to increase your F-number, see above).</p>
<h2>9. Shoot!</h2>
<p>Now, you should be ready to shoot your panoramic photographs for later stitching in e.g. <a href="http://hugin.sourceforge.net/">Hugin</a>. I won't cover that part much here, only mention the importance of getting good (something like 1/3) overlap between the photos, both horizontally and vertically. Also, I always shoot the nadir shot (downwards) as the last shot so that I'm sure not to have moved the tripod. In fact, I always shoot a couple of nadir shots having moved myself in-between so that I won't get my feet or shadow in the final panorama.</p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4519174235184012855.post-81467614610918731452013-02-26T21:58:00.001+01:002013-03-16T08:59:02.205+01:00Package Java Apps for Ubuntu and Debian<p>Recently, I've dived into the subject of packaging Java programs into .deb installation packages for easy installation on Debian, Ubuntu and other Debian based systems. Often, when you Google the subject, you're met with guides that assume that you have downloaded a source tarball, i.e. you are packaging someone else's program. But what if you want to package your own program that happens to be programmed in Java? Then you probably don't have source tarballs, make scripts and whatnot, but instead a bunch of .class files and ressource files (e.g. images, sound files, etc.) in a directory hierarchy -- or perhaps one or more .jar files.</p>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiTQn8Be1ElpFPMYkLhYQyximaJS3_quJb2D3-SIiD-o10kBk9whc96kdmr-sFFssutmLFergvQnTFjLl1C63M6gJg-qjN6JpuEfJ22SuxHbmbWIIXJDs-4tvisNrxM7NL3xFfIrHHxd8/s1600/dpkg.png" imageanchor="1" ><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiTQn8Be1ElpFPMYkLhYQyximaJS3_quJb2D3-SIiD-o10kBk9whc96kdmr-sFFssutmLFergvQnTFjLl1C63M6gJg-qjN6JpuEfJ22SuxHbmbWIIXJDs-4tvisNrxM7NL3xFfIrHHxd8/s320/dpkg.png" /></a>
<a name='more'></a>
<p>The solution is not overly complicated, although the .deb file building process does take a few steps before you have a working .deb package. I made the process easy for myself, writing a Bash script that handles it all, so it's a no-brainer to build a .deb at the next release of my program. It could probably just as well have been an Ant script, but as I happen to be less familiar with that, Bash was an obvious choice.</p>
<p>What I did is basically build up the contents of the deb file myself. I tried to have the result resemble a natively built program .deb as closely as possible. That is, there should be no hazzle for the user. So my main goals were:
<ul>
<li>The user should be able to install the .deb file directly with <tt>dpkg</tt> or the Software Center / other GUI install tools</li>
<li>No need to manually install Java, if the user hasn't already, the package system should handle that, of course</li>
<li>The program should execute through a simple terminal command (just type <tt>programname</tt>, no <tt>cd</tt>'ing to the program's directory, typing <tt>java programname</tt>, etc.) and/or through an icon that fully integrates into the GUI; be it the good, old categorized Gnome menu, the Ubuntu Dash, Gnome Shell, etc.</li>
<li>The package should adhere to common standards and recommendations as much as possible, as to let the user not experience any error and warning messages and/or other odd problems.</li>
</ul>
In other words: For the user, the program should behave like any other program and integrate with their system, without the need to pay special attention to the fact that the program is programmed in Java. Suggestions for improvements are of course very welcome.</p>
<hr>
<h2>The Bash Script</h2>
<p>Usually, for Java programs larger than a few lines, I use the Eclipse IDE. By default, Eclipse keeps source files in a directory called src, and compiled .class files in another directory (with an otherwise similar subdirectory structure) called bin. You can, of course, change this behaviour in Eclipse, but this guide assumes a directory structure like Eclipse's default one. Also, it assumes that you want to install a complete directory hierarchy containing .class files etc. on the user's system, but the process should be quite similar with jar files.</p>
<p>So, first step is to create a Bash script file to handle the packaging process. Basically, what the script does, is copy all files that should end up in the .deb file to a temporary directory, and then run a command that builds the actual .deb file. Create an empty text file called, e.g. <tt>packagedeb.sh</tt> in the root of your project, just inside the src directory. If you do this from within Eclipse, the script is automatically copied to the bin directory. Add the following lines to the file:</p>
<pre>
#!/bin/sh
PACKAGE_NAME="programname"
PACKAGE_VERSION="0.3"
SOURCE_DIR=$PWD
TEMP_DIR="/tmp"
</pre>
<p>The first line is a must for all Bash scripts. It just tells the system the fact that it's a Bash script. The next lines set up a few variables for easy package name and version number handling, and for changing between where the .class files reside (the "current directory", always stored in the $PWD variable) and the temporary directory that we use for building the .deb file. The package name is what the program will be known as in the package handling system, so make sure to pick one that's not likely to have already been used, so your user doesn't end up with two programs of the same package name on his system. Also, it should contain no spaces, and preferably only lower-case ASCII letters.</p>
<pre>
mkdir -p $TEMP_DIR/debian/DEBIAN
mkdir -p $TEMP_DIR/debian/lib
mkdir -p $TEMP_DIR/debian/bin
mkdir -p $TEMP_DIR/debian/usr/share/applications
mkdir -p $TEMP_DIR/debian/usr/share/doc/$PACKAGE_NAME
</pre>
<p>This next part of the script builds the directory hierarchy for the .deb file. Basically, we create a directory called <tt>debian</tt> (lower-case) in the temporary dir, and here we put files and directories that we would like to put on the user's system. So, if we want to install a file in <tt>/usr/share/applications</tt>, we create <tt>/tmp/debian/usr/share/applications</tt> and put a copy of the file there. In this part of the script, still only empty directories, though. We also create a directory called <tt>DEBIAN</tt> (upper-case) for meta data for the .deb package.</p>
<pre>
echo "Package: $PACKAGE_NAME" > $TEMP_DIR/debian/DEBIAN/control
echo "Version: $PACKAGE_VERSION" >> $TEMP_DIR/debian/DEBIAN/control
cat debian/control >> $TEMP_DIR/debian/DEBIAN/control
</pre>
<p>Next, we create a file <tt>control</tt>, containing deb package meta data, in the <tt>DEBIAN</tt> directory. The first two lines take the package name and version from the variables that we defined above, and the rest of the file is copied from a file in my Eclipse source hierarchy (I created a subdir "<tt>debian</tt>" in <tt>src</tt> containing such files). The rest of the <tt>control</tt> file is described further down this guide.</p>
<pre>
cp debian/programname.desktop $TEMP_DIR/debian/usr/share/applications/
cp debian/copyright $TEMP_DIR/debian/usr/share/doc/$PACKAGE_NAME/
</pre>
<p>Here, we copy a .desktop file, which is a GUI meta data file for the graphical environment, containing info on icon file location, etc. This file should reside in <tt>/usr/share/applications</tt> when the program is installed on a system. See further down for details.</p>
<p>Then, a file with copyright information expected by Debian systems. Since my program is open source, I used a text similar to <a href="http://people.debian.org/~jaldhar/make_package4.html">the "copyright" section of this page</a>. If this fits your program, put something like that in a file and tell the script to copy it like above. For a full explanation of the licence file, please refer to the <a href="http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/">Debian Policy</a>.</p>
<pre>
cp -r ../bin/ $TEMP_DIR/debian/lib/$PACKAGE_NAME
</pre>
<p>This line copies the complete "<tt>bin</tt>" directory and its contents (.class files, images, etc.) to the temporary directory, and renames it to whatever you set the $PACKAGE_NAME variable to. If you use .jar files, you would typically copy those here, instead.</p>
<pre>
gzip -9c $TEMP_DIR/debian/lib/$PACKAGE_NAME/NEWS > $TEMP_DIR/debian/usr/share/doc/$PACKAGE_NAME/changelog.gz
</pre>
<p>For my program, I have a text file called <tt>NEWS</tt> which is basically a changelog. I don't follow Debian's standard for changelogs, but I don't think that matters too much, as I'm not building a native Debian package. Debian expects the changelog file to be gzipped at max level, though, so we'll do that, and install it in the user's <tt>/usr/share/doc/programname</tt> directory.</p>
<pre>
mv $TEMP_DIR/debian/lib/$PACKAGE_NAME/resources/programname.svg $TEMP_DIR/debian/usr/share/doc/$PACKAGE_NAME/
chmod 644 $TEMP_DIR/debian/usr/share/doc/$PACKAGE_NAME/programname.svg
</pre>
<p>I have an .svg file containing a vector icon which is here put into what becomes <tt>/usr/share/doc/programname</tt> on the user's system. Note that instead of copying it from the my program's source tree, I move it from the temporary directory to which I copied the whole directory structure earlier, since there's no need to have the icon twice in the .deb file.</p>
<p>After that, I set permissions to 644 for the file, which is what the Debian system expects for icons.</p>
<pre>
rm -r $TEMP_DIR/debian/lib/$PACKAGE_NAME/debian
rm $TEMP_DIR/debian/lib/$PACKAGE_NAME/COPYING
rm $TEMP_DIR/debian/lib/$PACKAGE_NAME/packagedeb.sh
</pre>
<p>Now, remove some more unneeded files from the temporary directory: The whole directory containing meta data (we already copied from there what we need), a file containing the open source license (the <tt>copyright</tt> file covers this issue), and the very Bash script file that we're currently writing.</p>
<pre>
echo '#!/bin/sh' > $TEMP_DIR/debian/bin/programname
echo "export CLASSPATH=$CLASSPATH:/lib/$PACKAGE_NAME" >> $TEMP_DIR/debian/bin/programname
echo "java main/MyMainClass $1" >> $TEMP_DIR/debian/bin/programname
chmod 755 $TEMP_DIR/debian/bin/programname
</pre>
<p>What we need now is an executable file in <tt>/bin</tt> so that the program can be started by just typing its name. We'll write a simple bash script that adds the program's path to the CLASSPATH and then runs the Java virtual machine on the correct .class file. Last, we set executable permission 755 on the bash script file.</p>
<pre>
PACKAGE_SIZE=`du -bs $TEMP_DIR/debian | cut -f 1`
PACKAGE_SIZE=$((PACKAGE_SIZE/1024))
echo "Installed-Size: $PACKAGE_SIZE" >> $TEMP_DIR/debian/DEBIAN/control
</pre>
<p>Now that we're done copying files to the temporary directory, we need to add a line to the <tt>control</tt> file that will, in the end, give the user an idea of how much space the program will take up after installation. The <a href="http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Installed-Size">Debian Policy</a> tells us that this must be expressed as "the integer value of the estimated installed size in bytes, divided by 1024 and rounded up". So, we use <tt>du</tt> to get the total size of everything we put into the <tt>debian</tt> dir, and then devide by 1024. Admittedly, we don't specifically round up, but hey -- this is only an estimate, anyway.</p>
<pre>
chown -R root $TEMP_DIR/debian/
chgrp -R root $TEMP_DIR/debian/
</pre>
<p>The whole thing needs to be owned by root (both user and group wise) in order for it to be reachable by anyone on the user's system. Note that these two commands require the whole script to be run by root, or with the <tt>sudo</tt> command.</p>
<pre>
cd $TEMP_DIR/
dpkg --build debian
mv debian.deb $SOURCE_DIR/$PACKAGE_NAME-$PACKAGE_VERSION.deb
rm -r $TEMP_DIR/debian
</pre>
<p>Now we have a full directory structure full of files showing how and what we'd like to install on the target system. Therefore, we change directory to <tt>/tmp</tt> where we put it all, and run <tt>dpkg --build</tt> which will transform it all into a <tt>debian.deb</tt> file, which we will move back and rename to something more appropriate. Finally, we clean up after ourselves, by removing the entire directory structure that we created in the temporary directory.</p>
<p>Phew, that was the hard part. Now for the files that were mentioned along the way.</p>
<hr>
<h2>control File</h2>
<p>The file named <tt>control</tt> keeps meta data for the packaging system. Package name and version are generated in my Bash script above, but the rest of the file looks like this:</p>
<pre>
Section: sound
Priority: optional
Architecture: all
Maintainer: Thomas Pryds <my@email.address>
Description: Short description.
Longer description that may span multiple
lines. Indent with a space.
.
Even multiple paragraphs. Just remember that empty
lines should contain a period and nothing else
(except the space).
Depends: openjdk-8-jre | openjdk-7-jre | openjdk-6-jre | oracle-java8-installer | oracle-java7-installer | oracle-java6-installer
Homepage: http://a.web.page/presenting/theprogram/
</pre>
<p>Section is a categorization of the program. See <a href="http://packages.debian.org/unstable/">this full list</a> to find what fits your program best. Priority would be "optional" in most cases -- unless your building a vital system application, in which case you probably won't be following this guide. For Architecture, most Java programs are "all", unless some parts of it are architecture specific (if you don't know, then they're not). Maintainer is you as the .deb packager of the program (not as author).</p>
<p>The Description is actually two descriptions. First a short one-liner on the same line as the "Description:" label. Then on the next line a longer description that may span several lines and paragraphs. All lines in the long description must start with a space, and empty lines must consist of a space and a period.</p>
<p>Depends names the packages that this program needs in order to work. Perhaps your program makes use of other programs and requires them to be installed on the user's system. If so, list them here. The package system on the user's computer will make sure to have installed all packages listed as dependencies before your package in installed. Since this program requires Java in order to run, we list that here. In this case, both the OpenJDK and the official Oracle Java are accepted ("|" means "or").</p>
<p>The last line provides means to guide the user to your program's webpage.</p>
<hr>
<h2>.desktop File</h2>
<p>The <tt>myprogram.desktop</tt> file contains meta data used by the graphical user interface (GUI) of the user's system. You can view this as the data that provides a clickable link to the program, either in the "start" menu, the Ubuntu Unity Dash, the Gnome Shell, etc. So, if your program is a purely text based one, you probably don't need this file.</p>
<pre>
[Desktop Entry]
Encoding=UTF-8
Name=Program Name
Name[da]=Programnavn
Comment=This is my program
Comment[da]=Dette er mit program
Exec=/bin/programname
Icon=/usr/share/doc/programname/programname.svg
Terminal=false
Type=Application
Categories=GNOME;Application;Audio;AudioVideo
StartupNotify=true
</pre>
<p>This file should always start with <tt>[Desktop Entry]</tt>. Text editors on most recent (Linux) systems use UTF-8 encoding as default, but if you're unsure, check with your editor. The Name line provides the name of the program as it should appear in the graphical environment. This would typically be a more human readable version of the package name, and spaces are welcome. If your package name is "myprogram", this line would probably contain something like "My Program".</p>
<p>The Comment should be rather short; it is used as a tooltip when the mouse is hovering over your icon. Note that you can provide both the Name and Comment fields in alternative languages.</p>
<p>Next comes the full path to the small, executable Bash script that we generated from the main script above. And then the full path to the icon file that we also copied above. Icons may be in either the SVG format for vector icons, or PNG for bitmap icons. I prefer vectors because of their infinite scaling ability (you don't have to provide icons in a bunch of different sizes), and you can easily convert them into bitmap if you want to also distribute your program to e.g. Windows.</p>
<p>Terminal specifies whether you want to run your program in a text command terminal. With most graphical programs, you don't. Type will be "Application" for most ordinary programs.</p>
<p>Most graphical environments categorize programs into these categories. You can see a list of them all <a href="http://standards.freedesktop.org/menu-spec/latest/apa.html">here</a>. StartupNotifu (startup notification) is when the user's mouse cursor turns into a little clock, hourglass, or whatever, while your program starts up.</p>
<hr>
<h2>Generate and Check Result</h2>
<p>If everything went right, you're now ready to run your deb package generation script. Simply, start up a command line terminal, navigate to where your script is, and type <tt>sh packagedeb.sh</tt> -- you should now have a properly named .deb file in that directory. Try it out, see if it works; hopefully it does. To install it via the terminal, write <tt>sudo dpkg -i yourpackagename.deb</tt>.</p>
<p>Before you publish your deb file, you ought to check it for mistakes. There are a lot of policies it should adhere to, which are <a href="http://www.debian.org/doc/debian-policy/">all described in detail here</a>, and a great way to check whether your package does is via the lintian tool. If it's not installed on your system, type <tt>sudo apt-get install lintian</tt>. To check your package and pipe the result to the GEdit text editor, write: <tt>lintian -i packagename.deb | gedit &</tt></p>
<p>There is ONE thing that this guide doesn't satisfy with lintian: Every executable file placed in <tt>/bin</tt> should have a man page, which I don't describe here how to do. I think it's not crucial for a graphical program, but others may disagree. I think writing a man page might be a fun project for the future, so keep an eye out to see if suddenly I've updated this guide to include man page writing :-)</p>
<p>If you wondered which kind of program on which I originally based this, otherwise anonymised, guide, take a look at <a href="http://pryds.eu/spotmachine/">SpotMachine</a>; a program to record and play audio messages for an audience, e.g. commercial spots in supermarkets, malls, etc.</p>
Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-4519174235184012855.post-50254363606451775922012-07-18T09:04:00.000+02:002012-07-28T11:04:47.975+02:00Build Your Own Panoramic Head (Novice Approach)<p>If you're a hobby photographer like me, and you've had a chance to play a bit with panorama photographing and stitching, you've probably noticed that it's very hard to avoid the so-called parallax errors. This is especially the case if you're shooting by hand, and some of your objects are relatively close to the camera while others aren't.</p>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5OX1L1HdSird-V9qniiZUc-LwnlARbLhlgQQTb1KFBsyChsE5G7Hblqc1SVgykhS8zNWVPG7SYDK3e4Kl5I7yuV1Em7ugU5Z8mLAKV46G7xl79oD3CYnEuc0mqUhJ1QIzKY6ajMTICiQ/s1600/0a-finished.jpg" imageanchor="1" style="clear:right; float:right; margin-left:1em; margin-bottom:1em"><img border="0" height="225" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5OX1L1HdSird-V9qniiZUc-LwnlARbLhlgQQTb1KFBsyChsE5G7Hblqc1SVgykhS8zNWVPG7SYDK3e4Kl5I7yuV1Em7ugU5Z8mLAKV46G7xl79oD3CYnEuc0mqUhJ1QIzKY6ajMTICiQ/s400/0a-finished.jpg" /></a></div>
<p>During the stitching process, <a href="http://en.wikipedia.org/wiki/Image_stitching#Challenges_of_image_stitching">parallax errors</a> will cause some parts of the images to fit together with each other, while other parts are off. There are <a href="http://wiki.panotools.org/Parallax">very technical descriptions of this</a> phenomenon available, so I won't go into any kind of detail about that here. The important thing to avoid it, is to rotate the camera around the <a href="http://wiki.panotools.org/No-parallax_point">no-parallax point</a> in the camera's lens body.</p>
<a name='more'></a>
<p>Probably, the cheapest method to avoid parallax errors is the <a href="http://wiki.panotools.org/Philopod">Philopod</a>. Basically, a piece of string with a weight in the end, tied around your lens body. I've tried this approach, but while it might work just fine for you, I found that while it does decrease parallax errors, they are hard to avoid entirely. Especially, if you shoot using your camera's default lens at ~18 mm, like I do.</p>
<p>The more precise solution is to mount a panoramic head on your tripod, and then your camera on the panoramic head. These panoheads can be purchased for a relatively high price. Or, there is the hobbyist way: <i>Build your own</i>!</p>
<h2>How to build a simple panoramic head</h2>
<p>Building your own working panoramic head? That sounds hard to do... Well, it isn't, really. And I'm saying that, well knowing that I have ten thumbs when it comes to building physical stuff. Heavily inspired by <a href="http://www.nodalsamurai.co.uk/nodalsamurai.html">Pete Loud's excellent site on his home-built 'Nodal Samurai'</a>, here's what I did. A step-by-step novice approach guide to building your own panoramic head:</p>
<h2>1. Figure out what you need and buy the parts</h2>
<p>This simple type of panoramic head consists of an L-shaped piece, mounted on the tripod, and of a swinging arm that sits on the L piece. The camera will then be mounted on the swinging arm, allowing for portrait shooting, only.</p>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-rYWIziNbZDEYTErXlDIbxbsEMW9YU-uCj7P4Fdn1lxWJNjq9k6a5EiO9vy9zJyqlxApiY3QZtkKhbuV-g3hUS6YhNLAhF7wTwGIaoehgTYzFEP8b2Ji9q0d2hhqJVYJ3ysbTQaWNbl8/s1600/1b-parts.jpg" imageanchor="1" style="clear:right; float:right; margin-left:1em; margin-bottom:1em"><img border="0" height="225" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-rYWIziNbZDEYTErXlDIbxbsEMW9YU-uCj7P4Fdn1lxWJNjq9k6a5EiO9vy9zJyqlxApiY3QZtkKhbuV-g3hUS6YhNLAhF7wTwGIaoehgTYzFEP8b2Ji9q0d2hhqJVYJ3ysbTQaWNbl8/s400/1b-parts.jpg" /></a></div>
<p>I went to my local builder's merchant to buy these two pieces, which are essentially just two pieces of metal, where one is bent in a 90º angle. Try to get some with as few holes in them as possible, as we want to decide where the holes should be, ourselves.</p>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAOP4gKNrcoprevGwAS_xRo9MQYIgZyKd8t3rWP3YabAJ4pahfUu8VL-xyJimnS9j-VWQubFuUWx5PXBtCQv5MtNXLgo1_UQg_iRk_zlbhvpuXZ5F-izzCmStylqiTV0vvPZX0bpTy5to/s1600/1-parts.jpg" imageanchor="1" style="clear:right; float:right; margin-left:1em; margin-bottom:1em"><img border="0" height="225" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAOP4gKNrcoprevGwAS_xRo9MQYIgZyKd8t3rWP3YabAJ4pahfUu8VL-xyJimnS9j-VWQubFuUWx5PXBtCQv5MtNXLgo1_UQg_iRk_zlbhvpuXZ5F-izzCmStylqiTV0vvPZX0bpTy5to/s400/1-parts.jpg" /></a></div>
<p>Along with them I bought some nuts and bolts to fit the pieces together (size 'M6x20', i.e. 6 mm diameter, 20 mm long), and some <a href="http://en.wikipedia.org/wiki/Wingnut_(hardware)">wingnuts</a> so that it would be easy to adjust the panohead 'in the field', without the use of any tools. Oh, and some <a href="http://en.wikipedia.org/wiki/Washer_(hardware)">washers</a>.</p>
<p>The large bolt like piece on the left in the image is not one that I bought. It's from my tripod -- I'll get back to that later.</p>
<p>If you don't have it already, you will also need to get some tools to drill a few holes in the metal pieces, and to cut off the excess parts of the metal pieces.</p>
<h2>2. Drill some holes</h2>
<p>My metal pieces came with pre-drilled holes, of which some were placed so that I could use them for assembling the pieces. If yours don't, you'll need to drill a hole in one end of each piece which will allow for the joint of the two pieces.</p>
<p>Two distances are essential to a panoramic head like this one: The distance from the swinging arm to the hole where the L piece is mounted onto the tripod, and the distance from the L piece/swinging arm joint to the hole where the camera is mounted on the swinging arm. You can either measure these distances yourself or use the great <a href="http://wiki.panotools.org/Entrance_Pupil_Database">Entrance Pupil Database</a>.</p>
<h3>A hole in the L piece</h3>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTGlMPIiNCqkXpzJbmZinDuT2JCGCNOKU-M4Tlp38-J09tyofEj8VgWC0_TeknjtCTZ5UWxuDGrRdzwvNo52BRDK5umUsKJjpfKif_rvZntAYZJAK2PRHomGUzQlgbYl1Pwvu7zYe_zs4/s1600/2a-hole-in-l-piece.jpg" imageanchor="1" style="clear:right; float:right; margin-left:1em; margin-bottom:1em"><img border="0" height="225" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTGlMPIiNCqkXpzJbmZinDuT2JCGCNOKU-M4Tlp38-J09tyofEj8VgWC0_TeknjtCTZ5UWxuDGrRdzwvNo52BRDK5umUsKJjpfKif_rvZntAYZJAK2PRHomGUzQlgbYl1Pwvu7zYe_zs4/s400/2a-hole-in-l-piece.jpg" /></a></div>
<p>The former distance (sometimes called the 'tripod mount height') needs to correspond to the vertical distance from the camera's mounting point to the centre of the lens. This is easiest to measure by putting the camera on a flat surface, like a table. Or find it in the database mentioned above. You will also need to check that the 'tripod mount off-center' is 0 in the database for your camera, or you will need to take this into account when drilling your hole. As an example, for a Canon 500D, this value is 38.5 mm.</p>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZwoB480sZqIEDUpyyyKn-KnYKI-69JafBxghA0Ljyg5UGGEPlkGOTE48nS6v6ppW4vp9o0f6qeI-ZnbtcXE1hVY8YJsf0Z_p00OqoOVh44YvT5ua05qc_kLN8msa8yuy7dU3jX7zRZXA/s1600/2b-hole-in-l-piece.jpg" imageanchor="1" style="clear:right; float:right; margin-left:1em; margin-bottom:1em"><img border="0" height="225" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZwoB480sZqIEDUpyyyKn-KnYKI-69JafBxghA0Ljyg5UGGEPlkGOTE48nS6v6ppW4vp9o0f6qeI-ZnbtcXE1hVY8YJsf0Z_p00OqoOVh44YvT5ua05qc_kLN8msa8yuy7dU3jX7zRZXA/s400/2b-hole-in-l-piece.jpg" /></a></div>
<p>On my L piece I ran into a problem, since a pre-drilled hole would interfere with the hole that I was about to drill. I solved this by putting a spacer made from excess metal that I cut off (see below) between the L piece and the swinging arm. But remember to add the thickness of this spacer to the distance to the hole.</p>
<h3>A hole in the swinging arm</h3>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJ1dJnDHt2TH6dS7-Cxpfsw6Xmfbws1aErdTgoyHCvOHRF4-GY7cn9Ehu54KnLsSujg_3Nckq9VGsZmzXcs0BLaZwbnX401rTIIk06xQ3nFv1jZ08QhKrM2tb_6KKzIPNWO_DF9d-oN04/s1600/3-hole-in-swinging-arm.jpg" imageanchor="1" style="clear:right; float:right; margin-left:1em; margin-bottom:1em"><img border="0" height="225" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJ1dJnDHt2TH6dS7-Cxpfsw6Xmfbws1aErdTgoyHCvOHRF4-GY7cn9Ehu54KnLsSujg_3Nckq9VGsZmzXcs0BLaZwbnX401rTIIk06xQ3nFv1jZ08QhKrM2tb_6KKzIPNWO_DF9d-oN04/s400/3-hole-in-swinging-arm.jpg" /></a></div>
<p>The latter distance needs to correspond to the distance from the camera's mounting point to the no-parallax point in the lens body. This is probably the hardest thing to measure, as the no-parallax point is located <i>inside</i> the lens body. Also, it will change when you chance lenses, or if you use the zoom on a zoom lens. The easiest way to find this distance is probably to calculate it from values found at the database mentioned above. Find the 'tripod mount length' for your camera, and the 'entrance pupil length' for your lens at a given focal length, and add these two numbers together. For my standard Canon 18-55 mm lens at 18 mm on a Canon 500D, it would be around 39 mm + 47 mm = 86 mm.</p>
<h2>3. Assemble pieces and cut off excess parts</h2>
<p>I then assembled the L piece with the swinging arm by putting a bolt through the holes and tightening a wingnut onto it. Remember to also put on a washer, right before the (wing)nut.</p>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuhZm8Y2Unta1-g2JzIhQ08WLjKR5qo-PWaK80qZblf-S5vmgTE-s7V6ABbZ_vC2c7BFFQwJZbdbh3SbL5Xno42qLTFlzcuLbK3eHhal1fislAmQizSBOVY-JrgN9nH6S56HGWpq3eVMw/s1600/6c-sawing-and-filing.jpg" imageanchor="1" style="clear:right; float:right; margin-left:1em; margin-bottom:1em"><img border="0" height="225" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuhZm8Y2Unta1-g2JzIhQ08WLjKR5qo-PWaK80qZblf-S5vmgTE-s7V6ABbZ_vC2c7BFFQwJZbdbh3SbL5Xno42qLTFlzcuLbK3eHhal1fislAmQizSBOVY-JrgN9nH6S56HGWpq3eVMw/s400/6c-sawing-and-filing.jpg" /></a></div>
<p>Once the L piece and the swinging arm are assembled, in my case, both parts have rather long, unnecessary parts sticking out to the side. I cut these off (and used some of the cut-off material for the spacer mentioned above) and filed the ends a bit to avoid sharp edges.</p>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEih_YHRc9XRkZKKsfy-qVobBn6RVuDhbbI1rJzIhdD4TAgRWteX-fTol_0I4yvUO1ZIbNPX36U9J-b27B4ccLjehbvOu_24vaaWYhU6275WY4H-usdQkJ-zWwgfvJVTLQVsjtF6mOqT4WI/s1600/6d-welding.jpg" imageanchor="1" style="clear:right; float:right; margin-left:1em; margin-bottom:1em"><img border="0" height="225" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEih_YHRc9XRkZKKsfy-qVobBn6RVuDhbbI1rJzIhdD4TAgRWteX-fTol_0I4yvUO1ZIbNPX36U9J-b27B4ccLjehbvOu_24vaaWYhU6275WY4H-usdQkJ-zWwgfvJVTLQVsjtF6mOqT4WI/s400/6d-welding.jpg" /></a></div>
<p>I was lucky enough to know someone with a welding machine, which enabled me to have the bolt welded onto the swinging arm. This way, it won't just turn around when I'm trying to tighten the wingnut in the middle of shooting a panorama.</p>
<p>Also, I had the spacer welded onto the L piece so that it will just sit there nicely when loosening and tightening the wingnut. I guess the same effect can be achieved with a piece of double-sided tape, since most of the time it's held tightly into place by the metal parts.</p>
<h2>4. Mount the panohead on your tripod</h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcJvAM3APNzjtwQcP-99d4HkAcVJFwQRrY_HDYixgYvAnH1PDhLYyEfsCFqzj1Wrzv1xLSSbEbvAWeUySbhBirJU1LqjH2lVoey2_UJO4YVQC5C-yt4jQ2hxgOav_uuUoswmoHWbNNsp0/s1600/5a-tripod.jpg" imageanchor="1" style="clear:right; float:right; margin-left:1em; margin-bottom:1em"><img border="0" height="225" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcJvAM3APNzjtwQcP-99d4HkAcVJFwQRrY_HDYixgYvAnH1PDhLYyEfsCFqzj1Wrzv1xLSSbEbvAWeUySbhBirJU1LqjH2lVoey2_UJO4YVQC5C-yt4jQ2hxgOav_uuUoswmoHWbNNsp0/s400/5a-tripod.jpg" /></a></div>
<p>My original idea was that if using the correctly sized nuts and bolts, I would just mount the L piece on the tripod by fitting a (winged) nut on the tripod's screw threaded bolt piece where you'd normally mount the camera. Likewise, I'd planned to mount the camera onto the swinging arm by using a simple bolt. However, I found out that cameras and tripods use screw threads called <a href="en.m.wikipedia.org/wiki/British_Standard_Whitworth">British Standard Whitworth</a>, while where I am located, you will find only ISO threaded bolts in your average hardware store. So, even if the nuts and bolts appear to have the correct diameters, you can't mount them on your camera and tripod without breaking either.</p>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVHHmjnXnANYOKvKdySpkr-mKwictxSPMcxnPmVD3ahrsEy2x6vR_3uluzEmk81L29IU-2PAJQgjOKQBFfhbmd4IYh-ImHmwPoZ4PXvJeqIqCRFtRjumTzrLGA7Z6p4wXVAujv_dNLYVg/s1600/5b-tripod-bolt.jpg" imageanchor="1" style="clear:right; float:right; margin-left:1em; margin-bottom:1em"><img border="0" height="225" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVHHmjnXnANYOKvKdySpkr-mKwictxSPMcxnPmVD3ahrsEy2x6vR_3uluzEmk81L29IU-2PAJQgjOKQBFfhbmd4IYh-ImHmwPoZ4PXvJeqIqCRFtRjumTzrLGA7Z6p4wXVAujv_dNLYVg/s400/5b-tripod-bolt.jpg" /></a></div>
<p>Therefore, I ended up switching to an old tripod that I could take apart. I removed its bolt piece, replacing it with one of my newly-bought bolts. This bolt piece from the tripod was then used to mount the camera onto the swinging arm instead. The nut you see on the image is just for spacing, since the tripod's bolt piece would otherwise (now dismounted from the tripod) be too long to fit into the camera. If you live in America, this probably won't be a problem (either way, it would be nice to hear about your experiences with this).</p>
<h2>Done!</h2>
<p>With this home-brew panoramic head, my panoramas are now much less prone to parallax errors. I found that, while before parallax was my main headache in stitching a panorama, I now mostly struggle with moving branches, clouds, and the like -- something a panoramic head will, of course, never solve.</p>
<p>I deliberately used mounting holes instead of a slots for the camera. I want to be able to quickly mount and demount without having to worry about putting the camera in the exact right place each time. If, at a later point, I decide to get a wide angle lens, I should be able to drill another hole that fits this camera/lens combination perfectly.</p>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_LlQGWdBuI7zsVhmclGkAGLEYSANVrcusxJfKA0ceeGS0MgbDpRizUZHIpk2gdoO8BsLgfdKtBvdap5UV2RsVM0APjWr94rdzRdoI-4JgGoRKe7Z8sU4O0ZJfmUJX14ssFF7T2-cmW24/s1600/0b-closed.jpg" imageanchor="1" style="clear:right; float:right; margin-left:1em; margin-bottom:1em"><img border="0" height="225" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_LlQGWdBuI7zsVhmclGkAGLEYSANVrcusxJfKA0ceeGS0MgbDpRizUZHIpk2gdoO8BsLgfdKtBvdap5UV2RsVM0APjWr94rdzRdoI-4JgGoRKe7Z8sU4O0ZJfmUJX14ssFF7T2-cmW24/s400/0b-closed.jpg" /></a></div>
<p>Actually, there is one thing that I would like to change before I consider the panohead completely finished. For assembling the L piece with the swinging arm, I used a set of nut and bolt which has a larger diameter than the other nuts and bolts. I did this in order to make use of the pre-drilled holes that were in the metal pieces when I bought them. However, this larger bolt also has a larger "head" than I originally planned on, which means that for my camera lens not to rest against this "bolt head", I had to put a couple of washers between the swinging arm and the camera. This, in turn, places the camera a few millimetres off its ideal placing, and it leaves me with a couple of tiny, loose parts to handle when (re)mounting the camera onto the device. I'm not sure if the slight displacement has any negative effect in practice, though, but the solution should be quite simple: File off some millimetres of the "bolt head".</p>
<p>Also, if I were to do the panohead again from scratch, I would have chosen an L piece which was <i>slightly</i> longer. Currently, I'm not able to point the camera straightly upwards, or the camera will hit the bottom part of the device. It would have been nice to be able to shoot zenith(s) without moving the tripod. As a work-around, I shoot both zenith and nadir, only when I'm done shooting everything else, and thus can safely move the setup.</p>
<p><center><iframe title="pannellum panorama viewer" width="550" height="309" webkitAllowFullScreen mozallowfullscreen allowFullScreen style="border-style:none;" id="pannellum_6lAMOgcQqy" src="http://pryds.eu/pannellum/pannellum.htm?panorama=have-gimped-small.jpg&title=Garden&author=Thomas%20Pryds"></iframe><br />
<small><i>Quick panorama shot using my homemade panohead.</i><br />Only WebGL/HTML5 enabled browsers (no IE), others <a href="http://www.360cities.net/image/garden-denmark">click here</a></small></center></p>
<!-- evaluating stuff, example, etc. -->Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4519174235184012855.post-22145235737430189572012-03-25T22:11:00.000+02:002016-03-23T12:38:58.911+01:00How to run Wordfeud and other Android Market apps on your desktop computer<p>Recently, I got rather hooked on the Wordfeud game, like so many others. Unfortunately, they don't offer any desktop version for either Windows, Mac or Linux -- it's strictly handheld-only, and it has to be installed from the Android Market (now Google Play). And unfortunately, my "smartphone" is one of the last Nokias to carry the now obsolete Symbian system, so no luck getting Wordfeud to run on that.</p>
<p>But, there is a solution to those ill-fortuned, like me. It is possible to run an (official) Android device emulator on your desktop computer, load Android onto it, and install your favourite Android apps, like Wordfeud, on this emulated phone. It requires a few ninja tricks, but here's how I did it on my Ubuntu Linux system. There are several guides on how to get it to work on Windows out there, but you can probably use this guide to extrapolate directions on how to do it on Windows and Mac, too, since it's shouldn't be too different a process.</p>
<a name='more'></a>
<h2>How to set it up on Ubuntu</h2>
<ol>
<li>Install Java, if you don't have it already. I use the official Java from Oracle, but the OpenJDK Java Runtime should be fine, too. Install it from e.g. the Ubuntu Software Center.</li>
<li>Download <a href="http://developer.android.com/sdk/index.html">the Android SDK</a> which contains an Android device emulator.</li>
<li>Unpack the downloaded file to somewhere of your liking, for instance on the Desktop, in your user directory, or whatever you prefer. Go to the "tools" subdirectory, and start the "android" program by double-clicking it and selecting "Run".</li>
<li>Tick the "Android 1.5 (API 3)" item (and thereby every subitem) and click "Install x packages..."<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDiZ5gGZFkvJcR3YBQIAuwFm6AwmWPTNePOhgmnuH22oYRtjffkGsNukVt7Eb4tbEAR9uiU2vdOUyvr4UcaYRV-aAJyqX8IdrbevuqcP2asNxIGLvwDnmblBqXZFDY3_MtolmK9El5Hk8/s1600/androidemu1.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="207" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDiZ5gGZFkvJcR3YBQIAuwFm6AwmWPTNePOhgmnuH22oYRtjffkGsNukVt7Eb4tbEAR9uiU2vdOUyvr4UcaYRV-aAJyqX8IdrbevuqcP2asNxIGLvwDnmblBqXZFDY3_MtolmK9El5Hk8/s400/androidemu1.png" /></a></div></li>
<li>Accept licenses by clicking "Install", and wait a good while. Then exit the Android SDK Manager.</li>
<li>Go to <a href="http://techdroid.kbeanie.com/2009/11/android-market-on-emulator.html">Tech Droid</a> and download the 1.5 image.</li>
<li>If you aren't able to open .rar files, do
<pre>sudo apt-get install rar</pre>
in a terminal window, and you'll be able to extract it from your file manager.</li>
<li>Copy the contents of the .rar file (a file and a directory) to ~/.android/avd/ (create the directory, if necessary).<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmxbX2-JoYz2rg2hy_-MZ0h3FK0w_b2ncIaXzdfi3hR4q0tYGnmq_-arw_MNlwr8DDI4nHpofTJq8jIDaJIqcm_XpD0g9rnk3w6gVWj5-LKwtZc-0X7y0frP6zV8OVOJQlzSYbhUjwJWY/s1600/androidemu2.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="204" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmxbX2-JoYz2rg2hy_-MZ0h3FK0w_b2ncIaXzdfi3hR4q0tYGnmq_-arw_MNlwr8DDI4nHpofTJq8jIDaJIqcm_XpD0g9rnk3w6gVWj5-LKwtZc-0X7y0frP6zV8OVOJQlzSYbhUjwJWY/s400/androidemu2.png" /></a></div></li>
<li>Open the AndEmu.ini file in a text editor (e.g. gedit) and change the path to
<pre>path=/home/yourusername/.android/avd/AndEmu.avd</pre>
where "yourusername" is your system user name. Note, the line already shows a Windows path with backslashes (\), so make sure to only use forward slashes (/).<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2cd1UrvVJaFB1evooSHjTRQKI9tcAUhJ2dd9eBBTXOW_8Vzgdt-Q4UaWrFu1hDwUPrEC-vV914NERD0PQ-rR7c-SGGU66XxbvNe3p2-LEjzizzoaVhpsV1n9D3f45KKBfxw0XOVAoaoU/s1600/androidemu3.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="251" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2cd1UrvVJaFB1evooSHjTRQKI9tcAUhJ2dd9eBBTXOW_8Vzgdt-Q4UaWrFu1hDwUPrEC-vV914NERD0PQ-rR7c-SGGU66XxbvNe3p2-LEjzizzoaVhpsV1n9D3f45KKBfxw0XOVAoaoU/s400/androidemu3.png" /></a></div></li>
<li>Start the Android SDK Manager again (the "android" program in the "tools" directory of the Android SDK download).</li>
<li>Select "Tools" and "Manage AVDs". Then select the "AndEmu" line. If it has an icon which implies that it's "repairable", click "Repair". Then start it by clicking the "Start" button, then "Launch". A virtual phone will now appear on your screen.<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSZdUxWVNV3m6R9c7-Am3A9BErD7c3Oce7KsvrJcGS9judPBvpH7T6oiAGYd1XgmxBd8rVi95AaV7KN6Jf1rX10nuXJfJIhyUCazau5nfs4D0U17TeBVKqxwNH3QEKKcDWklIvqMAVaqw/s1600/androidemu4.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="226" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSZdUxWVNV3m6R9c7-Am3A9BErD7c3Oce7KsvrJcGS9judPBvpH7T6oiAGYd1XgmxBd8rVi95AaV7KN6Jf1rX10nuXJfJIhyUCazau5nfs4D0U17TeBVKqxwNH3QEKKcDWklIvqMAVaqw/s400/androidemu4.png" /></a></div><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLp0pYyrrd1C66BZJCLrEgmvI5lrmlHayhNC0h3yl0RNORC1Kyr-auLTkh99mTGJM3I_BlFEp_h7kl3kc5ekIXsXK9sHBgR6aYEI2_R970_gV5Bb1arobaQISpMoXzj-wNMz76PI_eKQI/s1600/androidemu5.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="338" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLp0pYyrrd1C66BZJCLrEgmvI5lrmlHayhNC0h3yl0RNORC1Kyr-auLTkh99mTGJM3I_BlFEp_h7kl3kc5ekIXsXK9sHBgR6aYEI2_R970_gV5Bb1arobaQISpMoXzj-wNMz76PI_eKQI/s400/androidemu5.png" /></a></div></li>
<li>Follow the instructions on the screen to complete the setup of the "phone". One of the steps is to connect it to your Google account (or create a new one), which is vital for connecting to Android Market. I had problems when I had to type in my details, since the Android system asked me to slide the phone open (and the emulator didn't seem to have a way to emulate this), so I chose "Skip" and then entered my details upon the first run of Android Market instead.</li>
<li>Select the "Market" icon on the desktop of the emulated phone, search for your favourite app, and you're good to go.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCLLbQW8udv1DpR04Jnrq5wLwX1gOpCuFx1gB9espik1avugT_fauBci16j7lJyE_tjZgKGFUfynhjj-gG1cHjRWYU1D02TsPuuymwex-S0SQkW5BCJZbwlLmRLhow8RHSHgoLNB2X-Ac/s1600/androidemu6.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="400" width="222" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCLLbQW8udv1DpR04Jnrq5wLwX1gOpCuFx1gB9espik1avugT_fauBci16j7lJyE_tjZgKGFUfynhjj-gG1cHjRWYU1D02TsPuuymwex-S0SQkW5BCJZbwlLmRLhow8RHSHgoLNB2X-Ac/s400/androidemu6.png" /></a></div>
</li>
</ol>Unknownnoreply@blogger.com6tag:blogger.com,1999:blog-4519174235184012855.post-26197125871727170622012-02-29T23:51:00.001+01:002016-03-23T12:38:31.954+01:00How to set up Box.com autosync on Ubuntu<p>I was one of the lucky ones who got my hands on a free 50 GB account on <a href="http://www.box.com/">Box.com</a> (former Box.net) with their campaign to launch their new Android app (<a href="http://blog.box.com/2012/02/android-users-get-50gb-free-get-your-box50gb-and-enter-the-box-mobile-giveaway/">the campaign</a> runs until March 23, 2012). A similar campaign ran earlier with their IPhone/IPad app. Unfortunately, they don't offer a Linux sync app, so here I describe, step by step, how I did some ninja tricks in order to be able to automatically synchronize a certain directory on my harddrive with my Box.com account from my Ubuntu 11.10 (Oneiric Ocelot) installation.</p>
<a name='more'></a>
<div class="separator" style="clear: both; float: right; border-style: dashed; border-color: red; width: 200px; padding: 5px;"><small>Note: Use with caution and make a backup of your data before attempting this. Especially be careful if adding more than one computer to the same Box account. The last added computer might convince rsync that there are no files, and thus delete files that are already on your Box account.<br />If you don't feel like experimenting with this, I can recommend the fairly new similar service <a href="https://copy.com?r=GAYcv6">Copy.com</a> which comes with a Linux sync app and gives you 15 GB for free (invite your friends and get up to 50 GB in total). If you follow <a href="https://copy.com?r=GAYcv6">this link</a>, you'll get 20 GB initially.</small></div>
<p>The trick is this: Using WebDav you can mount your Box.com account as if it was a normal harddisc. Then, once mounted, set up an rsync script to synchronize your selected local directory with the WebDav mount. Personally, I use it to keep an always updated online backup of my family photograph directory, which tends to take up several gigabytes, and counting. Just remember, Box.com will only allow each file to take up a maximum of 100 MB for free accounts. Something similar to this procedure will also work for other services that offer WebDav connections, e.g. <a href="http://one.me/datswpra">One.com</a>.</p>
<p>This how-to might work on other versions of Ubuntu, too (maybe even on other flavours of Linux), perhaps with a few changes here and there, or it might not work for you at all, even though your setup is exactly the same as mine. Use with caution, and at your own risk. Be sure to backup your data before attempting this. But here goes...</p>
<h2>A. Install and set up WebDav</h2>
<ol>
<li>Open a terminal window, and install the WebDav file system package:
<pre>sudo apt-get install davfs2</pre></li>
<li>Make sure you can mount as your normal user (not just root)
<pre>sudo chmod u+s /sbin/mount.davfs
sudo usermod -a -G davfs2 mylinuxusername</pre>
Of course, change "mylinuxusername" into your linux user name.</li>
<li>Tell the system how and where to mount the Box.com account. Edit the /etc/fstab file as root:
<pre>sudo gedit /etc/fstab</pre>
Add this line to the file:
<pre>https://dav.box.com/dav /home/mylinuxusername/box.com davfs rw,user,auto 0 0</pre></li>
<li>Let the system know your Box.com user name and password to enable automatic mounting. Edit the /etc/davfs2/secrets file as root and add this line:
<pre>https://dav.box.com/dav myboxusername myboxpassword</pre></li>
<li>Tell WebDav not to use locks, as this won't work with Box.com. Edit the /etc/davfs2/davfs2.conf file as root and add this line:
<pre>use_locks 0</pre></li>
<li>Make the mountpoint (an empty directory) for the Box.com account, and mount for the first time:
<pre>cd ~
mkdir box.com
mount box.com</pre></li>
</ol>
<h2>B. Create a sync script and make it execute once an hour</h2>
<ol start="7">
<li>Create a script that synchronizes your local directory of choice with the Box.com account. Create a new text file somewhere which will contain the command(s) to do the sync. I suggest ~/bin/boxcomsync . Add the following lines to the file:
<pre>#!/bin/bash
rsync -avr --delete /home/mylinuxusername/directorytosync/ /home/mylinuxusername/box.com/</pre>
This will put the files in the root of your Box.com account. You can also create a directory in Box.com and sync the files to there instead. If you want several local directories synced, you can repeat the rsync line for every directory.</li>
<li>Make the script executable:
<pre>chmod u+x ~/bin/boxcomsync</pre></li>
<li>Test your script to see if everything works as expected. Also, if you have a lot of data to sync, it is probably best to do the first run manually, so that the automated runs will only handle changes to the synced files.
<pre>~/bin/boxcomsync</pre></li>
<li>Set up a cronjob to run the sync script every hour. Run the command:
<pre>crontab -e</pre>
A text editor will appear (probably nano). Add the following line to the file which has been opened, save, and exit the editor.
<pre>0 * * * * /home/mylinuxusername/bin/boxcomsync</pre>
See e.g. <a href="http://www.scrounge.org/linux/cron.html">this guide with examples</a> of how to set other times. Don't set it too often, though, as one run must have time to finish before another is executed.
</li>
</ol>Unknownnoreply@blogger.com24