Solar-charged 12V battery box

Now that we’re spending more time outdoors, further from civilization and with more equipment needing power, I decided to build a solar-charged 12V battery set up, inspired by a post I saw on Instructables: Ammo Can Solar Power Supply

My version is a very similar set up, except I used Anderson PowerPole connectors throughout. This allows me to use the solar charge controller and/or battery with some of my other equipment (such as my ham and CB radios).

First, the shopping list (all from Amazon):

About Anderson Powerpoles:

ARES (Amateur Radio Emergency Services) adopted the Anderson Powerpole for interoperability during emergencies. Using this same standard on my equipment makes it easy for me to switch parts in and out, and in theory, would make it easier for me to swap equipment with others.

The solar charge controller:

Solar Charge Controller

The solar charge controller has 3 connections – from left to right, the solar panel, the battery, and the load (having your devices on the load connection, rather than the battery, allows the controller to charge the battery while also providing power).

The wiring diagram:

Solar charger wiring diagram

The wiring is pretty simple – the positive and negative leads from the solar panel and the battery are connected to their respective ports on the controller. The solar panel I used has its own connector, so I wired it directly to the controller. I placed a Powerpole connector between the battery and the charger (allowing me to easily swap batteries). For the load connection, I placed a 30A fuse on the positive lead, and then placed a Powerpole connector between that and the on/off switch for the panel (allowing me to easily connect something else to the load line, such as my ham or CB radio).

The panel:

The panel is wired up according to its included wiring diagram, with the power starting at the on/off switch. The panel includes a voltage meter, two 5V 2.1A USB ports, and a 12V socket. I considered getting a Powerwerx PanelPole adapter for one of the holes, but it was a little too pricey for something I already had inside the box.

 The setup in use:

The setup works! The controller was charging the battery, and my phone was charging off the front port while taking this picture.


My total cost for this project came to just over $200, but that included tools that I only needed to purchase once. To build a second box, the total today would be just under $130.

Raspberry Pi Tidbits

When I upgraded my Raspbian image from Jessie to Stretch, my wifi adapter stopped working. I thought perhaps the adapter had died, so I swapped it out, but the problem continued. Thinking the filesystem had been corrupted, I burned a new image on the SD card. Even with the new version, the wifi adapter still wasn’t connecting to the network.

After hours of beating my head against the wall, I stumbled across a Raspberry Pi forum post that finally led me to the right answer. I discovered that the ctrl_interface line was missing from wpa_supplicant.conf. After adding it and rebooting, the Pi connected to the wifi network:


Since I rebuilt the system, I was struggling to remember how I’d previously set it up to boot directly into kiosk mode. It took another google-based reminder that you have to modify the  local LXDE autostart file, not the system file. I replaced the contents of /home/pi/.config/lxsession/LXDE-pi/autostart with the following:

@xset s off
@xset -dpms
@xset s noblank
@chromium-browser --kiosk /home/pi/kiosk/start.html

AT&T MMS APN Settings

I discovered today that I was not able to receive any MMS messages on my new Microsoft Lumia 950. Both picture messages and group messages were showing up in the Messaging app as “Media content in this message” with a download button. Pressing the download button did nothing, and some internet sluthing led me to check my MMS APN settings on my phone, which I assumed had been set up already by AT&T — turns out, I was wrong.

The following settings worked for me, and immediately after applying these settings, messages I had received started grouping themselves together and downloading.

  • APN: Phone
  • User name: -blank-
  • Password: -blank-
  • Type of sign-in info: PAP
  • IP type: IPv4v6
  • Proxy server:
  • Proxy port: 80
  • MMSC (URL):
  • MMSC port: -blank-
  • Maximum MMS size (KB): -blank-

I entered the settings in the MMS APN section of Settings in Windows Phone.

To get there: Settings -> Network & Wireless -> Cellular & SIM -> SIM Settings -> Add an MMS APN

Setting up a daily apt-get check with email

I don’t log into my Debian webhost every day, so one of the first things I do out of habit now is to check and see there are any updates available for the system with your usual:

$ sudo apt-get update
$ sudo apt-get upgrade

Why not automate the process, and have the system automatically check for me, and let me know when there are updates available?

Of course, I’m not the first person to think of this, so there is a lot of prior work out there. I used Mattias Wikström’s Apt Update script as my foundation.

The script

The script is pretty basic – it runs apt-get update, and if it returns successful, runs a simulated upgrade with apt-get --simulate upgrade. If the output from that includes “Inst”, there were packages that would have been installed, so the update_found variable is set to true.

The script then builds the email message, using the email variable as the main part of the message, and appends the output from the simulated upgrade, and finally sends the email using msmtp, as I previous described and set up.

# Cron Script - place in /etc/cron.daily
# Runs "apt-get update" and prints the output of a simulated
# upgrade if any package would be installed.
# script from:

Subject: Updates are available for your server
Mime-Version: 1.0
Content-Type: text/html

<h2>Updates are available</h2>
<p>Run apt-get upgrade to install the following updates:</p>"

apt-get update | grep -q '^Get' \
        && sim=$(apt-get --simulate upgrade) \
        && echo "$sim" | grep -q '^Inst' \
        && update_found=true

if [ "$update_found" = "true" ]; then
    email="$email $sim"
    echo "$email" | msmtp

exit 0

Save the script to /etc/cron.daily folder without the .sh extension (this is surprisingly important – it took me a bit to figure out why it wasn’t working at first), and then chmod it to be executable.

$ sudo touch /etc/cron.daily/apt-get_email
$ sudo vim /etc/cron.daily/apt-get_email
$ sudo chmod +x /etc/cron.daily/apt-get_email

Setting up cron

Now that the script is created, we need to set up cron to run this script on a daily basis.

Cron logs are, by default, stored in /var/log/syslog. Since I’m going to be doing stuff with cron, I decided I wanted to have cron logs go to their own log file. Thankfully, changing the setting for this is simple – in /etc/rsyslog.conf, find the cron line under “Rules” that is commented out, and remove the comment (it was on line 63 for me), and then restart rsyslog:

-- Edit /etc/rsyslog.conf
$ sudo vim /etc/rsyslog.conf

-- Find and remove # on cron line
# cron.*              /var/log/cron.log

-- Restart rsyslog
$ sudo systemctl restart rsyslog.service

Testing the script

Finally, we’re ready to test the script. Keep in mind – if there’s not currently any updates available, the script won’t send an email. If this is the case, you can change the value of update_found on line 21 from false to true, which will cause the email to be sent regardless if there are updates available or not.

You can either run the script manually, or trigger cron to rerun it’s daily scripts manually:

$ sudo run-parts /etc/cron.daily/

Once the cron.daily scripts run, you should be see output in your new cron log:

$ sudo cat /var/log/cron.log
Jul 21 20:33:18 -username- anacron[16255]: Updated timestamp for job `cron.daily' to 2016-07-21

If everything worked correctly, you should receive an email with the output of the simulated apt-get update.

My first mechanical keyboard

Select Series - Full Size Red Switch Mechanical Keyboard from Monoprice

I picked up my first mechanical keyboard from Monoprice – the Select Series – Full Size Red Switch Mechanical Keyboard on sale for $40.

Mine came with Gateron red switches, which, like the Cherry MX red switches they are copied from, are linear switches. There’s no “bump” for the key to stop before it bottoms out, so as I’m getting used to using this keyboard, I’ve found myself occasionally holding down a key without realizing it.

The really unique thing about this keyboard, though, is the layout – it’s an all-ANSI layout, with the exception of the Enter key! The Enter key is an ISO-enter key, so the | (slash/pipe) key is ANSI-sized, and moved to where I would normally hit the enter key with my pinkie. This has taken a little getting used to.

I created a layout for this keyboard at Keyboard Layout Editor.

The keycaps that come with this keyboard have little ridges at all 4 corners of the keys that I find a little annoying – apparently I drag my fingers across the keys as I type, so I’ve been really aware of the ridges. This video review of the keyboard claims they’re for “targeting” your fingers to the center of the keys:

Overall, the keyboard is pretty great, especially for the price, and I’m pretty happy with it.

Setting up msmtp for FastMail

I recently decided to set up a basic mail sender on my Debian install, and chose msmtp. I use FastMail as my mail host.

The first step, of course, is to install msmtp (and ca-certificates, if you don’t already have them):

$ sudo apt-get update
$ sudo apt-get install msmtp ca-certificates

Once the install is done, msmtp --version will show me that the install is working:

$ msmtp --version
msmtp version 1.4.32
Platform: i486-pc-linux-gnu
TLS/SSL library: GnuTLS
Authentication library: GNU SASL
Supported authentication methods:
plain scram-sha-1 cram-md5 external digest-md5 login ntlm 
IDN support: enabled
NLS: enabled, LOCALEDIR is /usr/share/locale
Keyring support: none
System configuration file name: /etc/msmtprc
User configuration file name: /home/jared/.msmtprc

Copyright (C) 2014 Martin Lambers and others.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License <>.
There is NO WARRANTY, to the extent permitted by law.

I decided to set up a global (system) configuration, and from the above version information, I can see that the config file for that should be located at /etc/msmtprc

This file does not exist by default, so I will create it:

$ sudo vim /etc/msmtprc

Using the documentation from msmtp and FastMail’s SMTP settings, I created the configuration file below. A few notes:

  • FastMail’s SMTP is on port 465
  • FastMail uses TLS, and STARTTLS needs to be disabled.
  • You will want to consider creating an alternative login for your FastMail account – I created one just for msmtp, which allows me to disable just that login in FastMail if something happens to my server.
  • Consider carefully before using my password advice! msmtp supports a couple different authentication methods, and mine is not really the best.
# ---------------------------------------
# msmtp System Wide Configuration file
# ---------------------------------------
# A system wide configuration is optional.
# If it exists, it usually defines a default account.
# This allows msmtp to be used like /usr/sbin/sendmail.
# ---------------------------------------
# Account
# ---------------------------------------
# FastMail
account fastmail

auth on
port 465
password **your alternate login password**

tls on
tls_trust_file /usr/share/ca-certificates/mozilla/DigiCert_High_Assurance_EV_Root_CA.crt
tls_starttls off

# ---------------------------------------
# Configuration
# ---------------------------------------

# Syslog logging with facility LOG_MAIL instead of the default LOG_USER.
syslog LOG_MAIL

# Set a default account
account default : fastmail
# ---------------------------------------

Once the file is created, we can use msmtp’s --pretend option to display the configuration settings:

$ msmtp --pretend

If everything is set up correctly, your configuration settings should be displayed (your password will be displayed as *)

The next step is to test the configuration, and the easiest way to do that is to send an email to yourself:

$ echo "This is a test email" | msmtp --debug

If everything is set up correctly, you’ll see msmtp print your configuration settings, and then you’ll see the conversation msmtp has with FastMail as it delivers the message. Moments later, you should have a new email waiting.

If you want to include a subject, or have a more complex email, you have to send the mail headers as well. You can do this easily by creating a text file and then piping that over to msmtp.

The email file:

Subject: This is the email subject
Mime-Version: 1.0
Content-Type: text/html

<h1>HTML email</h1>
This is how you can <strong>easily</strong> send <span style="color:red; font-weight:bold;">HTML</span> mail from the command line.

To send this email:

cat mymessage.mail | msmtp

Powerball Simulator

The LA Times put out a really fun Powerball Simulator.

The odds of winning the Powerball jackpot are 1 in 292,201,338. But someone has to win, right? We decided to put that idea to the test.

This game starts with $100 to play against multiple lottery drawings. Pick your numbers and watch the money disappear. Based on the odds, you’re likely to hit numbers that pay out smaller prizes.

So, I played some of my favorite numbers (backwards, because the powerball has to be between 1 and 26). I didn’t do so well, even after throwing $10,100 at the problem:

You’ve played the lottery 5,516 times over about 53 years and spent $11,032, but won $932. You’re in the hole $10,100. So why not throw some more money at that problem?

(Side note: people have actually won playing those numbers)

This site only has you use your “favorite” set of numbers once per drawing – it doesn’t take show you the changes in odds if you were to do 10 quick-picks per lotto drawing, for example.

MagSpoof: Emulating magnetic stripes on credit cards

MagSpoof – “wireless” credit card/magstripe spoofer

The MagSpoof is a very cool little device that can emulate a credit card swipe by manipulating an electromagnetic field near a card reader – because of how card readers read cards, the MagSpoof can do this wirelessly on non-wireless card readers.

While the device is cool, the most interesting part of the article was the explanation of how magnetic stripes on credit cards work, and the fact that you can see the data by coating the stripe with a little black iron oxide (as seen in the gif above).