Hypermiling – what makes the difference.

I came across a new tactic yesterday that I have to share. I have been trying to get the most out of my Chevy Volt over the last few months on my 115 km commute.

Until a few days ago, I had successfully extended my EV range to almost 80 km on the trip to work. Then suddenly, to my dismay, I was struggling to get 60 km. I searched the web for what could cause this drastic drop, and came to the theory that ambient temperature was the problem. It is the beginning of Autumn, and air temperatures have dropped to high single digits celcius overnight. I noticed that the kilometres bled away most drastically at the very beginning of my drive, when I would lose about 20 km range in only 10 km driven.

I tried this morning a slight variation on my routine. As soon as I was dressed, I popped out and started the car, leaving it connected to the 240V. I unplugged and drove away about 10 minutes later, and the car was all warmed up and ready. Lo – I achieved 80 km EV range to work. Yay internet!

Posted in technical | Leave a comment

The perfect Raspberry Pi development platform

I have been using Samsung Chromebook Plus for a while now as my primary computing tool. It really is a great little device and the display is fantastic (Quad HD 12″ touchscreen). My only gripe is the keyboard, which has very little travel, but worse than that (to me) is the fact that it is cramped on the left and right hand edges in a way that seems unnecessary. A fraction less case bezel on each edge would have yielded enough room for “normal” tab, shift, enter and backspace keys.

However I digress. The reason I vote my Chromebook as the best Pi development machine is actually the CPU. Being an Arm (Rockchip RK3399) CPU means I can do certain things natively on my Chromebook that I can’t on an Intel PC. Cross compile I hear you say – and indeed it is much quicker for compiled apps for me to use the excellent GCC Arm suite on my Intel box than to compile natively. However, I don’t do a lot of actual compiling. A lot of what I do is customising a distro with the right pre-built packages for a particular application. And for that, the Chromebook is awesome.

I can use ‘losetup’ to create /dev/loop devices for a disk image. Then I can mount that image on a mountpoint within my dev shell. Then I can chroot into that image, and actually run commands such as ‘apt-get update; apt-get upgrade; apt-get install’ on the image before using “dd” to copy it to an SD card.

Posted in technical | 1 Comment

In Transition

After limping along with a corrupt database on my PiServr, I finally took the plunge and set up a parallel server and started migrating my services to the new box.

For hardware it is an upgrade from the Raspberry Pi2 model B to the Raspberry Pi 3 Model B. I have taken the opportunity to integrate a LiPo battery power pack (RPi Power Pack V1.2) for UPS, and again the Western Digital 1TB PiDrive provides disk space.

For Software, I have hopped onto the Devuan bus. Since I was already disabling systemd, this was a natural step for me, and I hope to have an even better Linux server experience with one less thing to worry about – the upstream maintainers will be taking care of keeping packages up to date without dependencies on systemd.

The first service to transition is this one: my wordpress blog. I have also enabled MediaWiki – and I am going to transfer it’s data. I’ll keep posting to this blog on my progress.

I have missed being able to post here: the mysql corruption meant the database only operated in read-only mode and made posting impossible. I did make a few posts to my google blogger, but it just didn’t feel the same.

Posted in technical | Leave a comment

Sensor network

Further to my last post about the water level sensor, I have perused the interwebz and discovered the MySensor site. These fine folk have created a library for using the nRF24L01 or RFM69 radio transceivers along with Arduino technology and a slew of sensors to create a wireless sensor network communicating with a gateway.

easypcb_rfm96_9

They sell an nRF24 based board that includes the microcontroller, however, the RFM69 transceivers have better range characteristics. I have borrowed the (open source) pcb for the “NewbiePCB” for the RFM69 and ordered a few from Oshpark, and a pcb for a Raspberry Pi header connector for an RFM69. These boards will allow an easier and neater integration. I am not a great solder maven to begin with, so loose wires dangling will quickly become a tangled web of poor connections. Hopefully the PCBs will make for reliable connections and allow me to concentrate on software and functionality.

 

Among the sensors I am prototyping are the Bosch BME280 combined temperature, pressure and humidity sensor, an FS5 air flow sensor, and an addition BMP280 pressure sensor (for differential pressure). I intend to use these on the SPI bus (using a separate GPIO as CS for each sensor and the radio). The FS5 returns an analog reading, so it will have its own input.

Posted in technical | Leave a comment

Water Level Sensor

As mentioned over on my farming blog, I want to measure the water level in my water cistern. We depend on the cistern for all our drinking water needs at the farm. However, short of putting in a dip-stick, I have no way of knowing how much water I have left.

I am going to use an ultra-sonic sensor to measure the distance to the water (from the cap on top), and transmit that data via an nRF24L01 transceiver to my server. The sensor and transceiver will be hooked up to a mini arduino, and a battery pack. I may salvage a garden LED solar lamp for power.

The basic operation will be sleep for a minute. Wake up. Initialize the radio. Ping the sensor and take a reading. Send the data over the air. Go back to sleep.

I have outlined some of the communication protocol stuff here.

Posted in technical | Leave a comment

Samsung Chromebook Plus – quick review

After a strange experience with Amazon, I picked up my Chromebook Plus yesterday (Canadian Thanksgiving). At first glance, this is an impressive product. Sleek and crisp are the first two adjectives that came to mind as I removed it from the box. The stylish magnesium alloy body, the firm but smoothly opening hinges, the edge switches (power and volume), and the very thin rim around the ever so slightly recessed screen all contribute to a very classy looking machine.

The usual (I am so used to it I no longer notice it) lower case keyboard – the only nit I have so far is that the right hand edge of the keyboard seems ever so slightly truncated, leaving a narrow backspace, and a none-too wide return key. The screen is superbly crisp and bright (2400 x 1600). The pen (thankfully) has a positive “click in, click out” insertion dock, so I won’t lose it as easily as I have several of my seemingly identical Samsung Note pens.

Powering up, the keyboard has decent feel and travel. the trackpad is faithful and smooth – or at least it was until I used it with a wet finger, after which it messed up semi-randomly until it dried out completely around the edges – don’t do that! I was able to rescue myself as soon as I remembered that it also has a touchscreen. The overall interaction is buttery smooth, with a wonderful glidey feel to scrolling and moving around the screen.

I appreciate the 3:2 screen aspect ratio, which looks as good in portrait mode as it is in landscape, indispensable when you flip the keyboard and turn your laptop into a tablet. I intend to use it as a music score – and my initial tests show it as admirably suited.

The second thing I tried (because of the music score requirement) was Android. It ran the play store upgrade, and synched up the apps I own from my phone. The guitar tab app I use worked just fine (as one might expect from an app that is designed for tablet). I haven’t tried any more sophisticated android apps or games, because, well, time. I did have time to notice (in retrospect) that my brain treated it as an Android tablet once the keyboard was out of the way, but I had a hard time remembering the touchscreen in laptop mode.

The next thing I had to try (as I lay in bed late) was to install Crouton. This is the Linux side-by-side ChromeOS install from David Schneider. The machine took about 5 minutes to switch to developer mode (if you are going to try this, do it early, as it wipes your drive). Crouton xfce installed completely (I had to restart it once because I noticed an instruction for the Chromebook Pixel to add touch screen support right after starting it the first time), but it would shutdown the Chromebook every time I tried to run it. A quick google search revealed that the “xiwi” method might work (as opposed to the regular xorg driver). I ran the crouton installer again with the “-t xiwi -u” options (to upgrade the existing install, and make the xiwi driver default). I had to then add an X driver separately to complete the update, and lo – “sudo startxfce4” worked, and not only did I have Ubuntu running, but it would also run inside a Chrome browser tab (which I can “fullscreen” using the dedicated key). Neat. I then installed “build essential” and some of my favourite apps (gimp, Libre Office), and things are off to a flying start before I succumb to the need for sleep.

The USB C charger is neat and much smaller than the power brick that came with my previous Chromebook. I still look for the “up” label on the plug – USB C doesn’t have it and doesn’t need it. Yay.

The speakers are much louder than the ones in my older Chromebook – audible over the hum of an A/C, and good enough when it is sitting on a bed (I used to put my Chromebook on a hardcover book in bed so I could hear it). They sound quite good, and it has a headphone jack for private/quality listening.

So far, everything seems just fine. Samsung and Google have a solid winner here. I find it hard to find fault with a solid product that meets every requirement I have for it, and looks and feels good besides. Given that my original Chromebook became my daily driver for the last 4+ years, I foresee a bright future for the “Plus”.

Posted in technical | Leave a comment

Mail server with local and virtual users

OK, so I wanted an Eierlegendewollmilchsau (Egg laying woolly milk pig). But Linux obliges (hooray), with postfix, dovecot, spamassassin and clamav. Postfix is the basic sendmail transport layer. Dovecot is the imap mailbox handler.

To add to complexity, my ISP doesn’t allow incoming traffic on port 25, so I use Ghettosmtp to relay mail on a non-conventional port to my home. Then I wrapped everything up in ssl using Letsencrypt.

Ports to forward on the router:

2525 => 25 (smtp)
143 => 143 (imap)
993 => 993 (imaps)
587 => 587 (smtps)

I ask Ghettosmtp to forward my mail to my server on port 2525. I configure my nameserver to point its MX records to ghettosmtp as per their specifications. It takes 24 hours for them to honour the request.

Sending mail is another hurdle. I setup postfix to relay outbound e-mail through my service provider.

My main resource for this setup task was the appropriate Ubuntu community help page. Some fidly bits include adding some “standard” folders that were ommited from the add-virtual-user scripts: Archives and Templates – although it seems that Thunderbird will cause auto-creation of the archive folder (and a year folder inside it) when you archive something. I also added a couple of stanzas to the dovecot.conf to allow local unix users to be hosted as well as virtual users, and SSL is not covered by the linked help document.

Finally, when I noticed that the spam-bots of the world had discovered me after only 4 days of operation, I added spamassassin to my setup. Details for setup including configuration files.

Posted in technical | Leave a comment

Add Development tools to the PiServr

As a developer, I would like continuous integration set up on my home server. I am most familiar with Jenkins, and that is part of the debian distro – so I decided to go that route.


$ sudo apt-get install jenkins

Connect via localhost, and configure security (before the next part). use local database, and matrix based permissions. Make sure to “allow users to sign up”, and add read overall permission to anonymous before adding another user and giving them full permissions. Then add yourself (as the full permissions user). Then you can go back and disable allowing users to sign up.

Edited /etc/default/jenkins to enable listening on the actual network interface so you can connect from your network (and port-forward your router to connect from the internet).

Posted in technical | Leave a comment

Privacy, security, low cost – The Self Hosted PiServr.

Your very own slice of Raspberry Pi can host all your personal cloud needs, with real privacy, for less than $100 all told.

piservr

Pictured above is a Raspberry Pi single board computer sitting atop a Western Digital Pi Drive – in my case a 1TB disc, which hosts this blog and a few other services.

A complete server solution, including MariaDB (open source SQL) and Apache web server. Not on the cloud. In your living room, or your office shelf. Consuming a few measly watts – cents per month. No Amazon bills, none of your data need be in the hands of the data giants. Now you can have your Pi and eat it.

Hardware costs in USD:

Raspberry Pi                          35.00
WD PiDrive Foundation edition 250 GB  28.99
Blue Square enclosure                 14.99
3A Power supply                       12.99
                                     ======
Total                                 91.97

The 1TB drive I use is available for a mere $30 more.

What can it do? I have more than 600 GB of files (mostly movies and music) on it. It hosts my blog sites, and a mediawiki site which I use for project documentation. I have two printers (an HP laser and an Epson inkjet) connected to it, so we can print from anywhere in the house (including from my phone or Chromebook). I can play my music through a connected stereo. I can even access the Pi remotely, using either ssh and a command line or using X11 forwarding to run graphical software from any X Window capable computer (running Linux or Cygwin X-Window).

This project will make available a downloadable image, which you copy to a micro-SD card. This image boots your Pi. Then you connect to your Pi using a web browser (Chrome, Firefox) and enter some simple configuration details to enable each web service. Modify your router’s forwarding to connect your Pi’s services to the internet. Then use a dynamic DNS service to locate your server from the outside world.

Posted in technical | Leave a comment

Now super secure-ish!

Whoopie! I have just successfully installed strong ssl encryption (https) for this WordPress blog. Thanks entirely to the great folks at letsencrypt – with a generous G+ prompt in my feed from +Steven Vaughan Nichols. I say Secure-ish because I hate to tempt fate (or hackers) with over confidence, and as has been said, WordPress has a reputation for insecurity.

Posted in technical | Leave a comment