Home photo server, part 1: Server Setup, SCP and FTP

While there are many, many options out there for photo storage, if you are looking for a home storage solution that does NOT involve just plugging in your phone and dumping the pictures to your hard drive, you have to get a little technical. (By the way, if that is what you have to do, there is no shame in it. It is probably a lot safer doing that than letting Google hold all of your photos.)

The first thing I needed was a server. Granted, you could use just about anything these days, and there are a lot of open source/open hardware type solutions, but I was gifted an older, generation 1 Dell PowerEdge 1950 from a friend. Granted, it was made in 2006, but it still is 64 bit, has two quad core Xeon 2 GHz processors, and I loaded it with 24 GB of ram. You can get them on eBay now for about $60. A little overkill for this sort of thing, but the price was right! As a bonus, it supported hardware raid, and I put two 2 TB drives in a mirror array, so that 2 TB of space that was backed up.

From there I loaded CentOS 7 on it per the usual installation method, and updated the system. I also purchased an APC battery backup unit, a Back-UPS 1350. This would only hold the power on for about 15 minutes, but it would help for brown outs, and frequent “blips” where the power goes out for only a second or so, which is common where I live. Later I’ll have to do a post on setting up the auto-shutdown and controls, because that was rather interesting.

So the next thing I needed, if I wanted this to work, was a domain. I needed a way to contact my home computer from my cell phone, especially while not at home. Granted, you could set all of this up so when you come home your phone would automatically back up your photos, but I wanted to be able to do this from abroad. Thus enter No-ip.com. I’ve used them before, and it is great if you are looking for a cheap, cheap solution. Because it is free.

Granted, a free account your hostname will need to be manually renewed every 30 days, but they send you an email, and all you have to do is click the link to keep it active, so it is pretty easy. After creating an account, logging in, getting a dynamic IP address, then all I had to do was install the DUC software. DUC is the Dynamic Update Client software that allows:

“Remote access your computer, DVR, webcam, security camera or any internet connected device easily. Dynamic DNS points an easy to remember hostname to your dynamic IP address.” (noip.com)

All you have to do is download the source code and compile it. It went like this:

$ cd noip-2.1.9-1/
$ make
$ sudo make install

After entering my password, it ran through an installation script and asked me for my account name, password for the account, and which DDNS I wanted to associate with this computer. It is interesting, you can have several.

From here, it then became a matter of preference on how to continue. I toyed with several options on my Android phone for how to get the photos from the phone to the computer over the internet.  One of the first methods I tried was using scp, or secure copy over ssh. So, I installed ssh on my server.

# yum install ssh-server

# cd /etc
# cd ssh/
# ls
# nano sshd_config

I then edited the sshd_config to my liking, there are a lot of guides on this on the internet, so I wont belabor the point here. I will note that I use non-standard ports as a form of extra security, however slight that may be, so you may consider doing the same, but essentially it works as is once installed. Then I opened the ports in the firewall – I list the standard ports here, for ease of following along:

# firewall-cmd
# firewall-cmd –help\
# firewall-cmd –help
# firewall-cmd –add-port=22/tcp
# firewall-cmd –add-port=22/tcp –permanent

And that worked great. Unfortunately, scp is slow and can be cumbersome from an Android phone, especially since I didn’t find any apps that would sync my directories automatically (that were open source so I knew what was really being sync’ed). However, I found several open source options that would sync automatically via FTP. So I decided to install “very Secure FTP”, or vsftp, like so:

# yum install vsftpd

# cd /etc/vsftpd/

# ls

# nano vsftpd.conf

Again, I set it up to my needs, but you can check out this guide for ideas. I also needed to punch some holes in the firewall for the service and for both active and passive mode, since several Android apps would use either.

# firewall-cmd –add-port=21/tcp
# firewall-cmd –add-port=21/tcp –permanent
# firewall-cmd –add-port=20/tcp
# firewall-cmd –add-port=20/tcp –permanent

# firewall-cmd –permanent –add-port=40000-50000/tcp

And viola! All that was left was a quick restart of the processes:

# firewall-cmd –reload

# systemctl restart vsftpd

And now I could use FTP apps on my Android phone to sync my pictures from my phone automatically to the home server! In case you are wondering, a great app for this is on F-Droid, the open source app repository of open source apps. It is called SyncTool, and it is very handy. It supports FTP sync one way, both ways, automatic scheduling or running jobs manually.

Wheeow, that was a long post, but now my photos were being automatically backed up. However, that’s only part of the story, because if I was convincing my wife to ditch Google Photos, I needed to also have a way to browse them online, share them, organize them, etc…. It was time for a web server. Guess we’ll cover that next.

Linux – keep it simple.


Using my Colido 3D DIY printer with Cura

As you’ve probably seen before, I’ve got a Colido 3D DIY printer that I’ve used for some of my projects. Prior to today, I was using Repitier-Host as the software for handling the printing, and it worked great. The thing is, I’m big into open source, so I wanted to find an OS alternative. I stumbled across Cura, but I couldn’t figure out how to input my own parameters for the printer, until today.

By default, Cura comes with the option to choose between multiple printers, unfortunately, my do it yourself printer wasn’t one of them. Not to worry, though, they created a feature where you can add a new type of printer. My only problem was, I didn’t know enough about 3D printers to fill in all the details.

So, after some tinkering, I found a setup that works great and produces great prints!


As you can see in the pictures, you will set the fields as follows:


  • X (width) 200 mm
  • Y (depth) 200 mm
  • X (height) 170 mm
  • Build plate shape rectangular
  • Uncheck Origin at center
  • Uncheck Heated bed
  • G-code flavor Repetier
  • X min 20
  • Y min 10
  • X max 10
  • Y max 10
  • Gantry height 999999999999 mm ( I think you can adjust this better, but for me it works, because it uses this at the end to go to the stop. )
  • Number of extruders 1

Extruder 1:

  • Nozzle size 0.35 mm
  • Compatible material 1.75 mm
  • Nozzle offset x 0 mm
  • Nozzle offset y 0 mm
  • Cooling fan number 0
  • End and start G-Code for the extruder can be left blank.

For the printer Start G-Code, use this:

M104 S195 ; set temperature

G28 ; home all axes

G1 Z5 F200 ; lift nozzle

M109 S195 ; wait for temperature to be reached

G21 ; set units to millimeters

G90 ; use absolute coordinates

M82 ; use absolute distances for extrusion

G92 E0

M106 S155.55

G1 E-3.00000 F2400.00000

G92 E0

And the printer end G-code, use this:

M104 S0 ; turn off temperature

M140 S0 ; set bed target temp

G28 X0 ; home X axis

M84 ; disable motors

G1 Z169 F200;

If you fill in these fields, then hopefully your Colido 3D DIY printer will work great for you too! It’s not the best printer, but for about $100 on Amazon, it’s a great starter kit for understanding and getting started with 3D printing!

Linux – keep it simple.

Going Gapp-Less, Again….


Don’t worry, you can put the tinfoil hats away. That being said, I’m going Google App Less (gappless) again. A few years back, I tried to go gappless, and it was rather difficult. Everything seemed to be tied into Google somehow, and I just couldn’t make it with the limited number of apps available outside the Google Play Store. This time around, however, is a different story.

With my new Xperia XA2 Ultra, I decided to flash LineageOS 16 (android pie), but I also decided not to flash the Google Apps package (Gapps). So, my phone was complete, without any of Google’s apps, such as the Play Store, Gmail, Google Photos, etc. It’s not that I distrust Google. I’m just not sure if I trust them. So, I thought I’d see how well it works to go without them for a while.

The truth is: I haven’t even noticed they’re gone.

The big things that you need to replace though, if you don’t have Google’s apps, are gmail, app stores, calendar, and photo backup and sharing.

The first thing I did was use the Chromium browser (the open source front runner of Google Chrome, essentially, Chrome without Google’s additives), and downloaded F-Droid. This app “store” is a repository of free and open source apps.

I know what you’re thinking, but F-Droid has come a long, long way since it’s humble beginnings. There are a lot of high quality apps on there now, covering just about every major category. Not only are there tons of apps in it, they are all free and open source. F-Droid even has an update system that makes sure you keep your apps current!


From there I downloaded QKSMS for all of my texting needs. It’s one of the best texting apps out there, open or closed source! (I borrowed the above picture so as not to show you all of my contacts….) It’s high quality, open source, easy to use and very nice to look at.

I also downloaded Librem Mail to handle all of my emails and replace the Gmail app. It supports multiple accounts, works great with Gmail and other mail accounts (like SDF) and supports PGP encryption as well. I really like it. The color coding and unified inbox is great.

Of course, I also downloaded AndBible, an open source Bible reading app, and FOSS Browser for web surfing, and AsteroidOS’s app to sync to my LG Watch Urbane smart watch (running AsteroidOS). A chess clock app, and several games like frozen bubble. Amaze for file browsing, Android CUPS for printing, GetBack GPS and PocketMaps and SatStat for GPS navigation, and a few other odds and ends.

I needed a calendar replacement, and I tried several, but Simple Calendar is my favorite. It can import “.ics” extensions, which you can export from your old Google calendar online and put onto your phone. It’s not synced with my Google calendar, but that is what I was trying to avoid anyways. I’d show some pics, but I have a lot of work related things on my calendar that I can’t show here. But it supports customization for color. The author likes orange, but I prefer blue, and fortunately you can change the color scheme.

The other big elephant in the room is a replacement for the Google Photo app with unlimited storage, which is really, really hard to beat. This is actually what started my most recent kick to try going gappless, as there is now more information about how they process photos is becoming more interesting and complex. Actually, they were talking about it in 2015 and 2017. For this reason, I set up my own home server running Piwigo photo manager.

I know you probably think I’m crazy, but consider this: on my home server version of Piwigo, without any AI intelligence looking at my photos, each photo comes in with exif data, which can (and usually does) include stats for each photo, date, time, location, phone/camera taken with, aperture data, etc. Without even trying, on the exif data alone, Google *could* know your location, what kind of phone you have, etc.

Even without location enabled, the date/time stamp plus amount of sunlight can narrow down where in the world you are with little effort (I know, I used to navigate a submarine in the Navy, and we would use stars and sun position to double check our navigation equipment). Let alone if they actually look at the photo. They would know all your friends, who you are related to, what you like to eat, what kind of car you drive, etc.

Anyways, off the hobby horse.

So, after installing Piwigo on my home server (you can host them online at BlueHost or other places as well), I then installed a simple app called SyncTool from F-Droid which allows me to FTP sync my phone’s camera folder to my home computer. For all of this, you don’t actually need something like Piwigo, but it is nice that my wife and I can use the open source app (there are non open source ones too) or a web browser to view our photos or share them with friends.

So far, it’s worked out really, really well. Albeit, you would need to be a little more tech savvy to set this up yourself. Fortunately, you could host it places that will help you with that, but then you get back to cloud storage. At least with my home server, I know exactly who’s looking at my photos.

On the other hand, all you need is a USB cable to just copy your photos to your computer every now and then. Just saying.

You might be wondering though, what about that closed source app I really need/want? Well, I have a few of those, like Bluino Loader, and arduino tool for using your phone to program arduino devices through the OTG cable. Well, it’s not open source, and not in the F-droid repository. Fortunately for me, though, there is Aptoide.

Aptoide comes in two variants, full and lite. I use the “lite” version myself. It uses less bandwidth and works faster, in my opinion. Aptoide is a Google Play Store alternative. The apps in this store are scanned with several virus scanners to ensure a good clean product. I’ve never had any issues with it myself.

For the most part, with a few exceptions, any non-paid app you can find on the Play Store seems to be here in Aptoide. It seems like they download the latest versions from the Play Store and host them here. Users can also make their own app store to host their own apps. (I did that once before… probably an old post about it on here somewhere.)

It has an update function, and you can also search back for old versions of the software, which is handy, like going back to the version before they started putting adds in! I’m not sure if it is regulated quite as well as the Play Store, and certainly not as well as F-Droid, so be careful to make sure the file scans virus free.

Another alternative is Amazon’s app store, which hosts all the usual paid apps you might need. One thing to keep in mind, though, is many apps require Google’s services running in the background to work. Thus far, I haven’t had a single issue with any of the apps I installed, though, which you can see is quite a few of them. Maybe you should try going gappless….

Linux – keep it simple.

Beginning AOKP Pie for the Xperia XA2 Ultra

I knew I couldn’t keep away from Android forever. It was only a matter of time before I jumped back into development. A lot has changed since my old rom building days. Back then everything was pre-treble, and there were no A/B partitions. That all changed for me with an Xperia XA2 Ultra.

It seems harder than I remember, and a lot more time intensive than it used to be. But, to kick things off, I started by building AOKP Pie for my new phone. To God be the glory, it does boot, but it doesn’t work right. Something is causing a pretty big hang up as soon as you are done with the setup. It locks up graphically once you get to the home screen for the first time.

Initial thoughts are perhaps tiles or menu item problems, but we will see.

Under the hood, though, everything is still running, even though the screen doesn’t update. If you use ADB, you can connect and do all the usual ADB command line stuff. But that doesn’t make for a very handy cell phone if you have to bring your computer everywhere so you can use it!

It’s also a bit harder as I had to switch to a nano sim card to be able to use the XA2. This is a problem because all of my other phones are not nano. It makes it difficult to switch to another phone while I test this out. Using a phone as your daily driver and for developing is a bit cumbersome and does slow me down quite a bit, but hopefully I’ll be able to work on it more later.

If you want to try out the “alpha” of my rom, you can download it on my MediaFire account. I will warn you, though, it doesn’t work very well.

Linux – keep it simple.

Fixing my bricked Sony Xperia XA2 Ultra


The photo above is not a mirrored image, it is actually two distinct Sony Xperia XA2 Ultra phones.

Whether it is fishing or phones, it all has to start with a story. Unlike fishing, though, this phone story really does start out as a big whopper! I guess I should back track to the beginning….

I was researching a new phone for Mom, and found that the Xperia XA2 Ultra is a really, really great phone. Sure, there are reviewers that were not enthusiastic, and some that were ecstatic, but I really felt that this would be a great phone for my mom. And I think it is. In fact, I liked it so much, that I picked up a slightly used one for myself. All was well.

Then, I decided to ditch the stock rom and start working on some custom stuff, as usual. The first thing I needed to do was test a current custom rom someone else made to make sure things work, and that I understand what’s going on under the hood. That is where things went horribly wrong.

I was following a guide on XDA. Several users had a similar guide, so I figure it must be right. Unfortunately, it not only didn’t work, but following the guide to a “T” bricked my phone. Here’s where I got hung up:

1. Download latest firmware with XperiFirm.
NOTE: When using mono XperiFirm will fail to unpack the firmware, you can do it manually using following commands:

for f in FILE_*; do unzip $f; done
unzip boot.zip -d boot

2. Go to the directory where the firmware got downloaded to and remove following files:
– kernel_X-FLASH-ALL-18AE_0x00.hash
– kernel_X-FLASH-ALL-18AE.sin
– persist_X-FLASH-ALL-18AE_0x00.hash
– persist_X-FLASH-ALL-18AE.sin
– system_other_X-FLASH-ALL-18AE_0x00.hash
– system_other_X-FLASH-ALL-18AE.sin
– system_other_X-FLASH-ALL-9B8D_0x00.hash
– system_X-FLASH-ALL-18AE_0x00.hash
– system_X-FLASH-ALL-18AE.sin
– system_X-FLASH-ALL-9B8D_0x00.hash
– userdata_X-FLASH-CUST-18AE.sin
– vendor_X-FLASH-ALL-18AE_0x00.hash
– vendor_X-FLASH-ALL-18AE.sin
– vendor_X-FLASH-ALL-9B8D_0x00.hash
3. Turn off your phone, hold vol dn and plug in the USB cable, the screen should be off and green LED lit.
4. Run Newflasher, it’ll flash entire FW to your current slot then unplug the USB cable and power on your phone.
5. Turn off your phone, hold vol up and plug in the USB cable, the screen should be off and blue LED lit.
6. Enter this command: `fastboot getvar current-slot`, it should return something like this:
current-slot: _b
Finished. Total time: 0.001s
7. Now switch to the opposite slot by entering command: `fastboot set_active a` if the current slot is `_b` or `fastboot set_active b` if its `_a`, you should see this:
Setting current slot to ‘a’…
OKAY [ 0.012s]
Finished. Total time: 0.014s
Setting current slot to ‘b’…
OKAY [ 0.012s]
Finished. Total time: 0.014s
8. Unplug usb cable and repeat steps: 3, 4
9. Profit?

At step 7, I was supposed to switch to the other slot. So I did, but when I unplugged the USB cable and repeat steps 3 and 4, it bricked the phone on the repeat of step 4. After that, it never booted up. All that happened when plugging it in or pressing any button combo was a triple blink of the green LED, and nothing else.

So, I made a post on the thread asking for help. But there was none to be found. Shortly after my post, others started posting as well. They all had the same issue. So, I take comfort in my misery loving company. Although I wish other’s phones had not also bricked, I was somewhat glad that I didn’t “mess up”, since several others following the instructions had the same results. What went wrong? I really don’t know.

The big question became, how do I fix it? I had about $100 invested in this useless paperweight, so I really wanted to turn a positive result. Thus enter ebay. I started bidding on phones with broken screens. I really just wanted to buy another main board, or motherboard for the phone, but I couldn’t find any suppliers. Eventually, I won a phone with a shattered screen.

The screen may have been shattered, but the phone still turned on and worked, so I simply disassembled the two phones (my brick and the one with the shattered screen) and swapped the main board! Now I had a working phone with the good screen, and I was back in business!

Next, I went about the process of installing Lineage 16 (pie) on the phone. According to the instructions, you have to update your phone to 50.1.A.13.123 to use this version of Lineage, but my phone was already 50.1.A.13.83, so I decided to try it as is, without updating the firmware. Praise God, it worked! So I was able to unlock the bootloader, boot TWRP, and flash LineageOS 16!

WARNING: This worked for me on software 50.1.A.13.83, but I don’t think it works if your software version is 50.2+! Try this at your own risk. I can’t promise that it won’t brick your phone.

Here’s what I did:

  • Went to Sony’s Unlock Bootloader section of their website and followed the specific instructions there to unlock the bootloader. You have to input your IMEI to generate a code that you use to unlock it in fastboot.
  • Downloaded TWRP for “discovery” (the nickname for XA2 Ultra).
  • Turned off my phone, held Volume up and plugged in the USB cable, which turned it on and put it in fastboot mode.
  • Typed fastboot boot ./twrp-3.2.3-0-discovery.img

fastboot boot ./twrp-3.2.3-0-discovery.img
downloading ‘boot.img’…
OKAY [ 1.431s]
OKAY [ 5.131s]
finished. total time: 6.562s

  • The phone rebooted into TWRP. I suggest making a backup at this point. I did, and copied it to my computer.
  • Download the latest LineageOS 16 (pie) rom for your XA2 Ultra. I used the 20190621 nightly, and it worked great for me.
  • Then, since I was ready to install LineageOS, select wipe, advanced, and wipe everything, then format data! Really important, if you don’t format data, you can’t boot lineageOS, as it will hang trying to unencrypt the data directory.
  • Still in TWRP, go to advanced, and select sideload.
  • On the computer, type:

adb sideload <name_of_lineage_zip.zip>

  • It will show a type of progress bar, and then will tell you when it is done. Don’t be alarmed if it “hangs” for a few minutes at the end, that was normal for me.
  • Reboot to system and enjoy LineageOS!

So, after a test run, I went back into TWRP, from fastboot, and flashed Magisk v19.3, and that worked great as well. I didn’t try Gapps, since I am actually going Gapp-less again. But that’s another post for another time….

Hopefully this was helpful for you. It was a lengthy process for me, and not optimal to say the least. If you do go this route, I will note that the Xperia XA2 ultra has been phenomenal for me. The battery life on Pie is incredible, the camera (that everyone loves or hates) is the best I’ve ever used, and I love it so far!

Linux – keep it simple.

LTE Project renamed “Bone Phone”!

Well, today is my last post on the LTE project. After showing it to my co-workers, it has now been renamed the “bone phone” because of it’s unique shape and color! I’ve also included the README.md at the end of this post with the full story.

To God be the glory, I learned a lot, and made a lot of functions with this phone. The main points are:

  • Send Text messages to any valid number
  • Receive and read text (SMS only) messages from anyone
  • Reply or delete text messages
  • Turn LTE on/off
  • Turn GPS on/off
  • Get your current location
  • Send your current location to someone else via text
  • Compass heading (must be moving to be accurate, based on GPS)
  • Status Bar with battery, GPS, cellular, and messages stats
  • Current local time

There was a lot more things that I wanted to do with this project. unfortunately, I ran out of memory:

Sketch uses 26938 bytes (83%) of program storage space. Maximum is 32256 bytes.
Global variables use 1567 bytes (76%) of dynamic memory, leaving 481 bytes for local variables. Maximum is 2048 bytes.
Low memory available, stability problems may occur.

As you can see from the warning, I’m running out of dynamic memory, or ram. I’ve tried adding a few more things, but anything I add tips it over the edge. Even just a few bytes added seems to make the device slow down so much that it is unusable. You are supposed to leave 512 bytes for running the program, and I’m only leaving 481, which slows it down a bit. But, be sure to check out the project on my GitLab for all the files, the pictures, videos, and 3d printer cad drawings and program! It’s all up for you to work on and improve!

Thanks for following along with me on this project! It’s been a really great learning experience! Not only that, but to God be the glory, it even works! You can read more about it in the readme if you’d like. This readme also includes operating instructions. (It’s easier to read by following the link to the mark down document, but I’ll post it here in case you need it.)

# LTE project (nickname: “Bone Phone”)

You can read more about this project on my blog: https://thealaskalinuxuser.wordpress.com
Just search for “LTE project” to see how you can build this open source hardware texting phone for yourself!

This phone can send and receive text messages. Runs off of a 9 volt battery, and has six buttons.

# Operating instructions:

1. Turn on the Bone Phone by flipping the power switch to the “on” position.
2. Once it boots up, you will be presented with the main screen. On every screen, use the numbered button that corosponds to the menu item to select it.
3. Any screen that has you input text or numbers, use the buttons to navigate, 1 is up, to scroll through the numbers or letters, 2 is down, to scroll through the numbers and letters. Whatever letter or number you select is not saved to that spot until you use button 3 (left) or button 4 (right), at which point the letter/number is saved/entered.
4. Some screens tell you to push the select button (button 5) to do special functions. If needed, the screen will display the action you should take.
5. At any time, you can press the “home” button (button 6), which will take you back to the main menu.

# Features

– Send/receive text messages
– Turn on/off data or gps
– View GPS location and send as text
– Compass heading screen if GPS is on
– View network info.
– Using serial over USB, you can do many more features such as download web pages, upload to the web, and more.

# Notes

– I tested this with StraightTalk and Hollogram.io simcards. Both worked, but only the hollogram card would allow data if using the serial over USB connection. Both worked for texting.
– When sending a text to a number, you need either of these two formats: +19078675309 or 19078675309. Some phones will not accept unless you have the “+” sign in front of the number. So far, all phones accept the text when you use the “+” sign.
– The device has 2 batteries. One 9 volt battery, which is disposable, and non-chargable. The second battery is a 3.7 volt battery for the modem, which is charged by power from either board input or the 9 volt battery. The power battery percentage from the phone on the status bar is actually for the modem battery, and doesn’t tell you how much battery power you have left in the 9 volt battery, unfortunately.
– The serial over USB works, and you can talk to the board that way, sending and receiving texts, etc.
– The included truth table outlines the different screens and button combinations.
– The bone phone was also supposed to have a mini browser/ftp/http get/put method, as well as a game, but I ran out of memory on the device. Come on, I only had 32 kb of space and 2 kb of ram to work with!

# About – Or, Why “bone phone”?

Well, the design is somewhat dog bone treat shaped, to protect the buttons. Add to that the fact that the original that I 3d printed was white, it did look like a big bone. While showing it to my co-workers one day, one of them said it’s a bone. One then said it was a bone phone. They then all started laughing and we nicknamed it the bone phone.

I built this phone so I can learn about cell phones, c and c++ programming, and work with open source open hardware on a project. This bone phone met all those goals. This bone phone cannot make phone calls, but can send or receive texts.

# Hardware Components

The main board is an Arduino Uno (or knock off), and a Botletics LTE shield, both of which are open source hardware. There is also a Nokia 5110 screen, a slider (on/off) dpst switch, and 6 momentary switches, made by QTEATAK. There were also 6 550 ohm resistors, and a 3.7v lithium cell phone battery that I took out of an old HTC sense cell phone, but any 3.7volt LiPo/Li-ion battery would do.

I also included the files for the 3d printed case that I made. I used a glue gun and glue sticks to hold most of the components and wiring in place. Please see my website for tutorials about how it was put together.

The hardware used was specifically selected because it is all open source hardware.

“Open source hardware is hardware whose design is made publicly available so that anyone can study, modify, distribute, make, and sell the design or hardware based on that design.”

# License

My portion of the software is licensed under the Apache2.0 license:

Copyright 2019 by AlaskaLinuxUser (https://thealaskalinuxuser.wordpress.com)

Licensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at


Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
See the License for the specific language governing permissions and
limitations under the License.
The software includes three libraries:

– The Adafruit Phona Library – Written by Limor Fried/Ladyada for Adafruit Industries. BSD license, all text above must be included in any redistribution. Which was modified by Botletics, maintaining the BSD license.
– The PCD8544 Library – The MIT License (MIT), Copyright (c) 2013 Carlos Rodrigues <cefrodrigues@gmail.com>
– The Arduino software serial library – GPL2.0

Linux – keep it simple.

LTE Project: GPS and Compass screens!


Another update on my LTE project. This one is fairly small, but I worked out the compass screen, which runs off of the GPS. You can see the whole commit here.  What is interesting about this is that I actually edited the library for the LTE shield itself to do what I wanted. Fortunately, it was pretty simple.

The problem is space. I’m running out of dynamic memory. I need to maintain around 500 bytes to run the sketch, but it is difficult when I start adding variables. The Arduino Uno only has 2 kb of ram. So, to call the GPS to get the heading, you need this:

boolean Adafruit_FONA::getGPS(float *lat, float *lon, float *speed_kph, float *heading, float *altitude,
uint16_t *year, uint8_t *month, uint8_t *day, uint8_t *hour, uint8_t *min, float *sec) {

But I only had room for one more float variable. But I found this in the library:

// only grab altitude if needed
if (altitude != NULL) {
// grab altitude
char *altp = strtok(NULL, “,”);
if (! altp) return false;
*altitude = atof(altp);

What does that mean? Well, a lot of variables in the above are allowed to be “null” or nothing. So, I edited the libraries/Botletics_SIMCom_Library_v1.0.0/Adafruit_FONA.h file from this:

boolean getGPS(float *lat, float *lon, float *speed_kph, float *heading, float *altitude,

To this:

boolean getGPS(float *lat, float *lon, float *speed_kph, float *heading, float *altitude = NULL,

Claiming the altitude is null. This is perfect because I can call one float, named heading, and then call the method with just one float instead of a bunch of them. Like this:

case 4:{ // Compass screen
                float heading;
                if (fona.getGPS(&heading, &heading, &heading, &heading)) {
                  lcd.setCursor(0, 1);
                  lcd.print("Heading: "); lcd.print(heading);

So, even though I technically need a float for lat, long, heading, and altitude, now I am just using the heading one and letting it be overwritten by lat, long, etc., and the last one written is the heading! Yes, this is cheating, but praise God, it worked! This LTE project is really coming along!

Linux – keep it simple.

LTE Project: SMS, read and reply!

Of course the Botletics shield that houses the modem was able to receive sms messages the moment I put a sim card in it, but now I can read them on my device! That’s right! Using nothing but the interface and buttons on the device, I can select which message to read, I can view it, and then reply or delete it!

Originally, I was going to have a scrolling screen that you could use the buttons to scroll through and read the text messages. This had several advantages, like being able to see a conversation flow. However, it had some disadvantages too. Namely, I don’t have enough memory left on this thing to hold the messages in the Arduino’s ram.

That said, I needed to just read the message and display it to the screen. I already have a buffer for sending a text message, and a buffer for what phone number to send it to (2 char arrays, the message one is 140, and the phone number is 21). This actually worked out in my favor greatly. With the read screen, you get to choose a message number to read, so I made a small int to hold that number and you can use up and down to change it, or move it by 10 with left and right.

Once you settle on the message to read, you press select, which then reads that message from line into the phone number send char array, and the from message into the send message char array. These are simply displayed on the screen.

With that done, it is actually really easy to delete the message, since you have a message number already, so selecting to delete it, it already knows which one to delete!

Also, replying becomes easy, since the send to phone number is already saved in the send to phone number char array! Also the text message is saved their too, so you can read the message you were sent while you write the new message. I think it is great! The only problem is this: if your wife texts you and says “what should we have for dinner tonight?”, when you hit reply, you have to overwrite that whole message so you can say, “tacos”. So I’m not sure, I may want to blank it out instead, but for now, it’s pretty hand for testing, since I can just hit reply and send the same message back for testing purposes.

Be sure to check out the entire commit for all the good details I missed here!

Linux – keep it simple.

LTE Project: Sent a text message!

Today was a great day for my LTE project! Today I sent a text message using only the buttons on the device itself! It was great to be able to do that from the gui/interface without the need for a serial over USB connection!

So, how does it work? Well, you can check out the entire commit on my GitLab, but I’ll highlight the main parts here. First, I needed a way to type with only 6 buttons, one of them permanently being the “home” button, and one always being the “select/ok” button. So really just 4 buttons. With that in mind, I made a simple interface that I’ve seen before: Up/Down to cycle through the letters/numbers, and Left/Right to move which place you are typing at.

To make that work, I added an array of characters that you can cycle through, like so:

char letterNumbers[91] = {'0','1','2','3','4','5','6','7','8','9',' ','A','B','C','D','E','F','G',

Notice that not every keyboard character is there. You have the forward slash, but not the back slash, due to an issue with char. I’m sure I can work it in, but I needed to get it working first, then I can edit it more later.

Then, I use a variable called curPos to mark which spot in the message you are, and numLetter to hold which number of the 91 characters you are trying to use. It looks like this:

case 30:{ // Screen 5 – Enter phone number screen.
// Up one character
if (numLetter >= 91){
numLetter = 0;
} else {
case 35:{
// Down one character
if (numLetter <= 0){
numLetter = 91;
} else {
case 40:{
// Left one position
if (curPos <= 0){
curPos = 0;
} else {
sendText[curPos] = letterNumbers[numLetter];
case 45:{
// Right one position
if (curPos >= 21){
curPos = 21;
} else {
sendText[curPos] = letterNumbers[numLetter];

It allows you to wrap around from character 91 back to character 0 in the list. Then when you press left or right, it saves the character you chose, say “A” in the spot where you were! It’s a little cumbersome, but it actually works!

The only thing I wonder is if the left button should be like delete, and leave a blank space instead of writing the current character and going left. I’m not sure which works better. I suppose a smart person can actually write the entire text backwards if they mess up and want to retype it…. maybe not.

It can be a little confusing, because it doesn’t save the letter/number/punctuation you have chosen until you move left or right, which appears like it is there, but it is not saved until you move off of it. You also can’t read what is under the “cursor” because it always displays the current chosen character you want to write. I’ll look at ways to fix that, but for now, it’s pretty functional, just not very pretty.

Linux – keep it simple.

LTE Project: Button it up.

Now that I shoved all the wires in there and soldered in the connections for the buttons, I was able to close the case. It still opens, you just have to unscrew the 4 screws to take it apart.

With that, I’ve also made progress on the button reading and programming. As we saw before, the program uses a “truth table” where based on the math formula of (btn# + screenNumber)*screenNumber = menu option, we can calculate all possible outputs and assign them to operations or values.

So, this is a compilation of four different commits:

  1. Update the truth table and screens.
  2. Adding button reading.
  3. Screen updates.
  4. Some small updates.

You can check out all of the above commits to see the process, but here I’ll cover the main part. This is the button reading function.

int read_LCD_buttons(){               // read the buttons
  adc_key_in = 0;
    //adc_key_in = analogRead(A0);       // read the value from the sensor 
    Serial.print("anolog0:"); Serial.println(adc_key_in);
    if (adc_key_in > 550)   return btnRIGHT;
    //adc_key_in = analogRead(A1);       // read the value from the sensor 
    Serial.print("anolog1:"); Serial.println(adc_key_in);
    if (adc_key_in > 550)   return btnUP;
    adc_key_in = analogRead(A2);       // read the value from the sensor 
    Serial.print("anolog2:"); Serial.println(adc_key_in);
    if (adc_key_in > 550)   return btnDOWN;
    adc_key_in = analogRead(A3);       // read the value from the sensor 
    Serial.print("anolog3:"); Serial.println(adc_key_in);
    if (adc_key_in > 550)   return btnLEFT;
    adc_key_in = analogRead(A4);       // read the value from the sensor 
    Serial.print("anolog4:"); Serial.println(adc_key_in);
    if (adc_key_in > 550)   return btnSELECT;
    adc_key_in = analogRead(A5);       // read the value from the sensor 
    Serial.print("anolog5:"); Serial.println(adc_key_in);
    if (adc_key_in > 550)   return btnBACK; 
    return btnNONE;                // when all others fail, return this.

At first, I have it log everything to serial so I can see what is happening. Essentially, I took a wire from 3.3vdc that goes to the button. Then the button goes to the analog input, with a jumper going to a resistor to ground. That way, when you are not pushing the button, then the analog pin is not floating, and reads 0. When you push a button, that input reads around 700. So, I put the threshold at greater than 550. This seems to work fairly well.

The only problem is that I didn’t arrange the buttons the way I thought that I was programming them to work. Rather than swap the button wires physically, I just re-ordered them in my program, saying one was two, etc.

Here is the call inside the loop, asking for which button is pressed:

int waiting = 0;
menuNumber = 0;
while ( waiting < 30 ){
lcd_key = read_LCD_buttons(); // read the buttons
// TESTING ONLY // Serial.print(lcd_key);
switch (lcd_key){

case btnUP:{
menuNumber = (1+screenNumber)*screenNumber;
case btnDOWN:{
menuNumber = (2+screenNumber)*screenNumber;
case btnLEFT:{
menuNumber = (3+screenNumber)*screenNumber;
case btnRIGHT:{
menuNumber = (4+screenNumber)*screenNumber;
case btnSELECT:{
menuNumber = 255;
case btnBACK:{
menuNumber = 256;
// TESTING ONLY // Serial.print(menuNumber);

The above call checks every 10 milliseconds to see if you pressed a button. After 30 checks, it continues through the process and refreshes the screens, etc. This works out to be about a half second, due to the length of the program. There is a small window of about a tenth of a second, where pushing a button doesn’t do anything, but I’ve found in test runs that it was really rare that pushing a button didn’t respond immediately.

If you don’t do this, it is refreshing the screen about 30 times a second as it rips through the program, and there is only a fraction of a second where pushing the button actually works. There is probably a better way to do this, but this works really well for my program.

Now I just need to make it send and receive text messages!

Linux – keep it simple.