NeoSQLite is a drop-in PyMongo replacement that stores your documents in SQLite rather than a MongoDB server. That should get your attention. It means you write the same insert_one(), find(), update_many(), and aggregation pipeline code you’d write against a real MongoDB instance — but under the hood, everything is persisted to a single database file on disk. No server daemon. No replica sets. No port forwarding. No systemctl start mongod. Just a file.
The project, maintained on GitHub at github.com/cwt/neosqlite, has evolved into something pretty impressive. Recent versions added full GridFS support with the modern GridFSBucket API, comprehensive aggregation pipeline support that runs natively in SQLite where possible — with a Python fallback for more complex operations. The library automatically detects and uses SQLite’s JSONB column type if your system supports it. NeoSQLite requires Python 3.10 or newer and prefers SQLite 3.45.0 or newer.
My use case spans three very different environments: a Raspberry Pi Zero, a headless Ubuntu 22.04 server, and my Mac running macOS 26.3 with Python 3.14. The exact same code runs on all three with zero changes!
On the Pi Zero especially, NeoSQLite is awesome! That little board has 512MB of RAM and no realistic path to running MongoDB — I’ve tried, and it’s not pretty. But NeoSQLite under Raspberry Pi OS– Bookworm or Trixie– installs with a single pip command, uses whatever RAM your documents actually need, and stores everything in a single SQLite file. For one of my astronomy projects, which tracks astronomical objects, observation sessions, and equipment metadata, this is perfect. The data model is naturally document-oriented — each observation is a self-contained JSON blob with nested fields — and NeoSQLite handles it beautifully without forcing me to flatten everything into relational tables.
The Ubuntu server gets the same library, and here it’s useful for a different reason: rapid prototyping. I can develop locally on the Mac, push to the server, and the database layer doesn’t change at all. When and if I ever have a project that grows sufficiently large, or that requires replica sets or shards, i.e. warrants a real MongoDB deployment, migration is straightforward — the query syntax is already MongoDB-compatible.
One quick Mac-specific note before diving in: macOS ships with an old system Python that you should never use for development work, and it won’t meet NeoSQLite’s Python 3.10+ requirement anyway. The cleanest solution is to install a current Python via Homebrew:
brew install python@3.14
After that, use python3.14 and pip3.14 (or set up your shell PATH accordingly) to make sure you’re working with the right version. On the Pi Zero and Ubuntu server, apt or pip installs are straightforward with no such gotcha.
Installation of NeoSQLite itself is simple (but watch out for the need for a virtual environment). I use the not recommended global install as root. You should do better – LOL.
sudo pip install neosqlite --break-system-packages
Here’s a basic example showing how natural the PyMongo-compatible API feels. This could be storing observation sessions from a sky-watching app:
import neosqlite
# Open (or create) a local database file
client = neosqlite.Connection('astro.db')
observations = client.observations
# Insert a document — just like PyMongo
observations.insert_one({
"object": "M42",
"name": "Orion Nebula",
"date": "2026-03-23",
"location": "Redwood City, CA",
"equipment": {
"telescope": "8-inch Dobsonian",
"eyepiece": "25mm Plössl"
},
"seeing": 4,
"notes": "Outstanding detail in the Trapezium cluster tonight."
})
# Query with MongoDB-style syntax
tonight = observations.find({
"seeing": {"$gte": 4},
"equipment.telescope": "8-inch Dobsonian"
})
for obs in tonight:
print(f"{obs['date']} — {obs['name']}: {obs['notes']}")
If you’ve used PyMongo before, that code needs no explanation. If you haven’t, it reads like plain Python working with dictionaries, not SQL joins and schema migrations.
NeoSQLite also supports MongoDB’s aggregation pipeline, which is where document databases really shine for analytics. Here’s an example that groups observations by object and counts them — the kind of query you might run to find your most-observed targets:
import neosqlite
client = neosqlite.Connection('astro.db')
observations = client.observations
pipeline = [
{"$match": {"seeing": {"$gte": 3}}},
{"$group": {
"_id": "$object",
"count": {"$sum": 1},
"avg_seeing": {"$avg": "$seeing"}
}},
{"$sort": {"count": -1}},
{"$limit": 5}
]
results = observations.aggregate(pipeline)
print("Most-observed objects (good seeing nights only):")
for r in results:
print(f" {r['_id']}: {r['count']} sessions, avg seeing {r['avg_seeing']:.1f}/5")
NeoSQLite’s aggregation pipeline support compiles these stages to native SQLite SQL where possible — which means it’s genuinely fast, not just a Python-level simulation — and falls back gracefully for more complex operators.
NeoSQLite is not MongoDB. If you need multi-node replication, massive concurrent write throughput, or you’re building something that ten developers will hammer simultaneously, you want the real thing. The library itself is transparent about the small number of API differences — for instance, its options() method returns detailed SQLite schema info rather than MongoDB’s empty {} response. And as with any SQLite-backed solution, it’s best suited to single-process access patterns.
But for small projects, Raspberry Pi deployments, development environments, and anything running on memory-constrained hardware, it’s a genuinely excellent tool. The fact that I can write an app’s database layer once and have it run identically on a Pi Zero, an Ubuntu server, and macOS — all without starting up a single server process — is exactly the kind of pragmatic elegance I love in open-source software.
If you’re a MongoDB fan who’s ever been frustrated by hardware constraints or deployment complexity, give NeoSQLite a serious look. You might be surprised how much of your existing PyMongo code just works. If you just want an easy-to-use, No-SQL document database, this is it!
]]>
I’m frequently asked about running MongoDB on Raspberry PI. My old binaries, on this blog, no longer work as some required libraries have evolved and/or have lost support and distribution. All is not lost! You CAN run the latest version 8.0.x (as of mid-January 2025) on Raspberry Pi 5 with 8GB or 16GB RAM. I focus on the open source community distribution so I don’t need proprietary software of any type. You may miss some features of the commercial version. Ubuntu 24.04 OS is required to get things running. I could not get MongoDB to natively compile on the R-Pi. The good news is that MongoDB, the company, fully(?) supports an ARM version that runs on Ubuntu. Support in that a community version is available as a binary with full install scripts.
Installing is simple if you follow the instructions on the MongoDB website – providing you can find them – lol. In short from:
You can find detailed install instructions on the MongoDB website in the MongoDB Docs (https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/#std-label-install-mdb-community-ubuntu)
I hope this post helps folks that might be a bit lost in getting MongoDB running on a Pi 5! You can ask questions in the comments…
]]>
As mentioned in my other posts, I like to use no-SQL, document-oriented, databases for my various projects. My favorite is MongoDB but that requires running Ubuntu OS on the Raspberry Pi. I also use CouchDB and it has worked nicely in single node configuration on various Raspberry Pi. I have compiled CouchDB from source in the past and attempted to do that for my Raspberry Pi 5 under Raspberry OS (version 12, bookworm). I could not get it to compile using instructions found on the Apache CouchDB website (https://couchdb.apache.org). Certain required libraries could not be found in the R-Pi repositories – and I could I not build these from source. Looking a little deeper into the CouchDB docs, I found that there are install binaries for Debian OS, the basis for Raspberry OS. I also discovered that there are ARM binaries! SO, it turns out, you can install CouchDB using the documented convenience binary package found at https://docs.couchdb.org/en/latest/install/unix.html#installation-using-the-apache-couchdb-convenience-binary-packages You enable the CouchDB repository and install using normal “sudo apt install couchb” Install, along with configuration, was easy from a terminal (local or via ssh). I used the generic server bind address of “0.0.0.0” so I could connect from other devices on my network. You also need to setup an admin account with the latest 3.4 version – which required me to then add credentials to my URL/GET scripts. Hope this note helps some folks out as I did not find much recent info with the normal Google search.
]]>
A decent DIY Allsky Camera can easily cost over $400 USD to build. A “low-cost” Raspberry Pi 4B based system with HQ camera and wide-angle lens with enclosure will cost over $250 USD to build. If that price range is too steep for you, you might consider a very low cost option. It will not be an ALL sky camera but will provide a fun experience with quality images and videos. Consider building an inexpensive sky camera that covers about 1/4 of the sky. This will still provide good coverage and captures very impressive day and night sky images and time-lapse videos using the Allsky software found on github: https://github.com/thomasjacquin/allsky There is an updated version of this software, currently in test (February 2023), that supports the Pi Camera Module 3. I expect that it will escape soon 
You can build a compact component-based sky camera for less than $75 USD or about $100 USD with a very nice enclosure.

So, how do you build a compact component-based Allsky camera for less than $75 USD or about $100 USD with a very nice enclosure? You do this by using a Raspberry Pi Zero 2 W SBC with the new Raspberry Pi Camera Module 3 with wide-angle lens. The original Pi Zero is not recommended for this project as it does not have the required horsepower. The Pi Zero 2 W is about $15 USD (if you can find one), the camera with wide-angle lens is $35 USD and a power supply is about $10 USD. Add an enclosure for the Pi for about $10 USD and a camera mount for about $5 USD. Total build cost is about $70 USD. You might want to spring for a waterproof enclosure with clear acrylic dome for the Pi Zero and camera, instead of individual cases, for about $35 USD. Total cost of this system with miscellaneous screws, nuts, bolts, etc., is about $100 USD. Parts list below the sky images.

Allsky software
https://github.com/thomasjacquin/allsky
Free – open source software!
DJC Supply Co. 4″ x 4″ x 2.4″ Weather & Dust Proof PS Plastic Junction Conduit Box
https://www.amazon.com/dp/B07ZBNY44T
$13.00
SUPREMETECH Acrylic Dome/Plastic Hemisphere – Clear – 2″ Diameter
https://www.amazon.com/dp/B07HWWZYD5
$11.00
Raspberry Pi Camera Module 3 – 120 Degree Wide Angle Lens
https://www.adafruit.com/product/5658
$35.00
Raspberry Pi Zero 2 W
https://www.adafruit.com/product/5291
$15.00
Adhesive Black Rubber Pad Sheet Thin Silicone Rubber Gasket Sheet 12X12 inch,1/25 Inch
https://www.amazon.com/dp/B07GL9MHW7
$13.00
Raspberry Pi Zero Camera Cable
https://www.adafruit.com/product/3157
$6.00
QIANRENON 90° Micro USB Panel Flush Mount Waterproof Extension Cable Micro USB
https://www.amazon.com/dp/B0BBQKGBQZ
$11.00
CanaKit 5V 2.5A Raspberry Pi Power Supply/Adapter
https://www.amazon.com/CanaKit-Raspberry-Supply-Adapter-Listed/dp/B00MARDJZ4
$10.00
LitOrange M2 Male Female Nylon Hex Spacer Standoff Screw Nut Assortment Kit
https://www.amazon.com/dp/B07D78PFQL
$14.00

A couple of months back, I put together an all sky camera system for the Martz-Kohl Observatory near Jamestown, in Western New York. An all sky camera provides a (near) 180-degree fisheye view of the sky. This project was a joint effort with other members of the observatory. One member supplied parts for the system enclosure while another donated a Raspberry Pi 4B single board computer and ZWO ASI224MC astro-camera and lens. Others donated time and expertise for assembling and mounting the system on top of the observatory. There were definite lesons learned as the original assembly leaked under severe weather. The fight with dew and frost is ongoing. It will take some effort and thought to automate a method of keeping the dome clear. For now, an occasional cleaning of the dome’s’s exterior keeps everything working 

SO, with lessons learned, I built a version 2 all sky camera system! As opposed to the PVC pipe enclosure, I went with a waterproof box, similar to what other DIY folks have used. I used parts that I had lying around: a Raspberry Pi 4B, R-Pi HQ camera, an Argon Fan HAT and a USB 3 SSD that I was no longer using. I purchased a lens, dome, USB C cable mount, and various hardware and sealants.
On both systems, I use the Allsky software which is open source and available on github.
A complete parts list of the new system is below. The particular enclosure I purchased came with a breadboard with perfectly spaced holes that fit the Raspberry Pi and HQ camera mounting holes. I used a variety of spacers, screws and nuts to attach things to the board. I was fortunate to find a nice lens on ebay- a Fujinon Fisheye Lens: CF2.7HA-L1 C-Mount, f1.8, 2.7mm. This does not cover an entire 180 degrees on the R-Pi but is close at about 150 degrees. I added the Argon Fan HAT to the Pi, both to keep the Pi cool in summer heat and also to try to keep dew from forming on the dome. Time will tell if this works or if I’ll need to add some kind of additional heating element. This system is located in Northern California and does not experience as severe weather as the system in Western New York.
A few lessons that I learned from from an experienced maker: If using silicone sealant, make sure you put it on under pressure. I.e. put the sealant on the dome and mounting surface and then mount and tighten screws to create a good waterproof seal. Don’t just add sealant after mounting the dome. If you are using anything threaded to assemble a waterproof system, add silicone grease to threads and seals. This will help keep things waterproof and enable you to remove/unscrew as needed. If you are going for an enclosed system (as opposed to one with vents), use as many silica gel desiccant packets that will fit AND make sure you can replace/recharge in the future.
Rather than doing a step-by-step tutorial on how to build, I am showing various pictures of the process. Different folks will start from different experiences and will have a variety of tools and parts. I’m happy to answer questions in the comments section…






MAKERELE Waterproof Electronic DIY Projects Cable Enclosure 6.89”x6.89”x3.94” (175x175x100mm)
https://smile.amazon.com/dp/B08PB4N3SK
$23.00
Raspberry Pi 4B w/ 4GB RAM
https://www.adafruit.com/product/4296
$55.00
Raspberry Pi High Quality HQ Camera
https://www.adafruit.com/product/4561
$50.00
Argon Fan HAT for Raspberry Pi 4
https://smile.amazon.com/dp/B07Y9LFP1J
$13.00
OBVIS USB Type C 3.1 Male to Female Flush Mount Cable Waterproof Kit
https://smile.amazon.com/dp/B09HWSFRP1
$8.00
MCMASKE 450PCS M2.5 Nylon Assortment Kit (screws, nuts, standoffs)
https://smile.amazon.com/dp/B0B5LTQXX8
$15.00
USB C Adapters – 5 Pack: Up&Down, Middle Bend, Side Bend, 90 Degree Right Angle
https://smile.amazon.com/gp/product/B0B48911J6
$15.00
Silicone Waterproof Sealant (tube)
https://smile.amazon.com/dp/B0002BBX3U
$6.50
Silicone grease SG02, USDA rated H1 food grade lubricant (tube)
https://smile.amazon.com/dp/B08QFQ8LFR
$10.00
Wisedry 50 Gram [10 Pack] Silica Gel Desiccant Packets
https://smile.amazon.com/dp/B07TCGPZXK
$17.00
Trolleyshop Diameter 3.15inch/80mm w/ 4 Holes Acrylic Flange Plastic Hemisphere
https://smile.amazon.com/dp/B07L6FBMXF
$14.00
OR
Trolleyshop Diameter 3.94 inch/100MM w/ 4 Holes Acrylic Dome
https://smile.amazon.com/F-ber-Diameter-Acrylic-Replacement-Security/dp/B07L6GLTNP
$15.50
Arducam 120 Degree Ultra Wide Angle CS Lens (3.2mm) for Raspberry Pi HQ Camera
https://smile.amazon.com/gp/product/B08GLYR572
$35.00
Fujinon Fisheye Lens-185 Degree-Model: CF2.7HA-L1 C-Mount, f1.8, 2.7mm (eBay)
https://www.ebay.com/b/C-Mount-Camera-Lenses/3323/bn_15898649
about $100.00
Focusafe 5 Megapixel CS Mount Fisheye Lens f2, 1.55mm (AliExpress, China)
https://www.aliexpress.us/item/2251832726956909.html
about $75.00
AllSky Optics ltd – 180-degree FOV 1/2” 1.55mm f2 CS mount AllSky camera lens (UK)
https://www.allskyoptics.com/store
about $110.00

[UPDATED: 12 Jan 2022 with MongoDB 5.0.5 binaries] There is no official support from MongoDB for Debian ARM 64 or Raspbian64 Linux OS (now known as Raspberry Pi OS 64-bit). You can, however, compile the MongoDB Community Edition from source. I did just that
It did, however, take three days and a burnt Raspberry Pi 4 to accomplish
I’ll provide a link to instructions to create the executables for mongod, mongos and mongo — as well as provide a few tips to successfully compile. Better and easier than that, I provide links to already compiled versions with instructions on how to install and use.
I recently decided to “check-in” on the status of Raspbian64, the 64 bit version of Raspberry Pi OS which is not yet released. I had been using Ubuntu Server 20.04 ARM 64-bit on a couple of Raspberry Pi 4s for various projects. One benefit of Ubuntu was official support for MongoDB. I was looking for a complete optimized Raspbian OS with GUI AND MongoDB. Searching around, I did not find what I wanted. I decided to try and create it.
You’ll need to find and install the latest Raspbian64 image. Use the “full” version as opposed to “lite” as you need all the tools, such as dev libraries, g++-8 and git that come with the full version. Not that you could not use “lite” and install everything needed
This is the version I use with its GUI as it has great internet and development tools. I can also use via VNC in headless mode.
If you really want to compile MongoDB Community Edition 4.4.8 from source, you can find instructions in this thread in the MongoDB Community Forums. NOTE that you will need to add at least a 4GB swap file on your 4GB RAM R-Pi 4. You should change the git command that grabs version 4.2.8 so that you get the latest: 4.4.8 or 5.0.5.
git clone -b r4.4.8 https://github.com/mongodb/mongo.git
OR, for version 5.0.5
git clone -b r5.0.5 https://github.com/mongodb/mongo.git
Compiling is straightforward but I had a few issues along the way. I used a Raspberry Pi 4 in a Flirc case with a USB 3 attached SSD. I have had my Pi 4 overclocked to 2GHz with no issues or overheating for quite some time. I love the Flirc case as it looks good and the whole aluminum case is a big heatsink. The first couple of times I tried to compile MongoDB from source, the build would just die after an hour or so. By monitoring the Pi with another ssh login, it looked like it was running out of real and swap memory. I could also see the 4 cores were running at over 90% usage. I upped the swap file to 2GB and tried again. This time, the build lasted over 4 hours before hanging (died silently). I picked up the Pi 4 case and almost burned my hand (ouch!). Being foolish, I tried again — with, of course the same result — a hung Pi that now had the electronic overheat smell
I moved the SSD to my *stock* Raspberry Pi 400 and tried again. Fortunately, the compile (more-or-less) picked up where it died. After about 5 hours, the compile completed without errors. I now had executable binaries for mongod, mongos and mongo (the “old” Javascript shell).
I am providing the 4.4.8 binaries and 5.0.5 binaries to save folks time and effort.
MongoDB 4.4.8:
sha256: 1b50ab43f5ee39b74603563ce7c88ff2654338dca7ed58df24569900aaf44f08 raspbian_mongodb_4.4.8.gz
MongoDB 5.0.5:
sha256: 9eaf5797bf2a54ba73adb4652668dfe5bf0d54efc387053b6241a5e3c38c7cc9 raspbian_mongodb_5.0.5.gz
The usual disclaimers apply: use at your own risk, no warranties of any kind, your mileage may vary, etc. Please do NOT directly link to the file. You can link to this blog or specific blog entry.
Install and use
Ensure you are running the latest version of Raspbian64 OS with all updates. Download and unzip the raspbian_mongodb_4.4.8.gz or raspbian_mongodb_5.0.5.gz file. You’ll have 3 files, mongod, mongos and mongo. Move the executables to /usr/bin and change owner and group to root. Ensure permissions are set to executable.
For version 4.4.8:
tar zxvf raspbian_mongodb_4.4.8.gz
sudo mv mongo* /usr/bin
sudo chown root:root /usr/bin/mongo*
sudo chmod 755 /usr/bin/mongo*
Create the mongodb user.
sudo adduser --no-create-home --disabled-login mongodb
Create the configuration file: /etc/mongodb.conf and add the following lines:
sudo vi /etc/mongodb.conf
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# Where and how to store data.
storage:
dbPath: /data/db
journal:
enabled: true
# engine:
# wiredTiger:
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1 # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses
#security:
#operationProfiling:
#replication:
#sharding:
## Enterprise-Only Options
#auditLog:
#snmp:
Create the log file and data directory. Change owner and group.
sudo mkdir -p /var/log/mongodb/
sudo chown -R mongodb:mongodb /var/log/mongodb/
sudo mkdir /data
sudo chmod 777 /data
sudo mkdir -p /data/db
sudo chown -R mongodb:mongodb /data/db
Create the systemctl service file to stop/start mongod process and add the following lines:
sudo vi /lib/systemd/system/mongodb.service
[Unit]
Description=An object/document-oriented database
Documentation=man:mongod(1)
After=network.target
[Service]
User=mongodb
Group=mongodb
# Other directives omitted
# (file size)
LimitFSIZE=infinity
# (cpu time)
LimitCPU=infinity
# (virtual memory size)
LimitAS=infinity
# (locked-in-memory size)
LimitMEMLOCK=infinity
# (open files)
LimitNOFILE=64000
# (processes/threads)
LimitNPROC=64000
ExecStart=/usr/bin/mongod --quiet --config /etc/mongodb.conf
[Install]
WantedBy=multi-user.target
You can now start/stop the mongodb service (mongod). Remember to stop gracefully before rebooting your system!
$ sudo service mongodb start
$ sudo service mongodb status
● mongodb.service - An object/document-oriented database
Loaded: loaded (/lib/systemd/system/mongodb.service; disabled; vendor preset: enabled)
Active: active (running) since Sat 2021-08-07 11:27:26 PDT; 1 day 1h ago
Docs: man:mongod(1)
Main PID: 1771 (mongod)
Tasks: 33 (limit: 4164)
CGroup: /system.slice/mongodb.service
└─1771 /usr/bin/mongod --quiet --config /etc/mongodb.conf
You can also now run mongo, an interactive JavaScript shell interface to MongoDB
$ mongo
MongoDB shell version v4.4.8
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("328da768-3ae6-4638-9df3-5fb4d32156ff") }
MongoDB server version: 4.4.8
> show databases;
admin 0.000GB
config 0.000GB
local 0.000GB
Let me know in the comments if you have issues or questions.
]]>
Have a Raspberry Pi 4 with 4GB or 8GB of RAM and want to run the popular noSQL database, MongoDB? Read on for installing and running the latest 64-bit versions of MongoDB and Ubuntu 20.04.
The short (TL;DR) instructions are to read and follow the official install guides for 64-bit Ubuntu Server 20.04 and MongoDB 4.4 for ARM 64. The longer detailed instructions follow…
Installing Ubuntu Server 20.04
While you can download the Ubuntu Server 20.04 image from ubuntu.com and manually copy to an SD Card or SSD, it is way easier to use the official Raspberry Pi Imager app. It is available for Windows, macOS, Ubuntu Linux and Raspberry Pi OS on the raspberry.org download page.
The Imager App asks you choose an OS and destination. Included in the OS choices is the top-level Ubuntu and sub-level Ubuntu 20.04.1 LTS, 64-bit server for arm64 architectures. Select this option for the OS and select your destination SD Card or USB hard drive or USB SSD. Click the WRITE button and confirm write and verify. You now have the bootable media with Ubuntu for your R-Pi 4.

Boot your R-Pi as normal. Note the username and password is “ubuntu” The OS comes with ssh enabled but does NOT configure WiFi – and the normal addition of files (ssh and wpa_supplicant.conf) to the boot partition does not work.
There are several guides, if you Google, that show you how to enable & configure WiFi under Ubuntu 20.04. I used this one from “Huobur:” How to Setup WiFi on Raspberry Pi 4 with Ubuntu 20.04 LTS 64-bit ARM Server. I’ve copied and pasted the most relevant part below. If you do not need WiFi and just use an ethernet connection, you can skip the WiFi configuration section.
WiFi configuration
1. You need 3 pieces of info in order to setup your WiFi:
You should already know your WiFi login name and password, the only info we need is WiFi name.
To clearly illustrate how to setup, let’s assume that your WiFi login name is “MyWiFi” and your password is “MyPass”.
2. Find WiFi card name:
$ ls /sys/class/neteth0 lo wlan0
on my machine, it’s “wlan0”. To simplify our demo, assume that yours is “wlan0” as well.
3. Edit, using nano or vi, the network configuration file to add WiFi info:
$ sudo vi /etc/netplan/50-cloud-init.yaml
After adding your WiFi info such that it should look something like the following:
# This file is generated from information provided by the datasource. Changes
# to it will not persist across an instance reboot. To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
ethernets:
eth0:
dhcp4: true
optional: true
version: 2
wifis:
wlan0:
optional: true
access-points:
"MyWiFi":
password: "MyPass"
dhcp4: true
4. Make sure that the 3 pieces of info above is replaced with yours.
wlan0
MyWiFi
MyPass
And also please make sure that you are a very careful person to input the above info with exact format as original file started, and all indents should be typed with spaces (4 spaces each level), NOT tabs, which is very important!
5. Save the file and reboot
you should have your WiFi setup when the machine is up and running again.
Installing MongoDB 4.4
You can install MongoDB as any user with “sudo” permissions. My instructions assume user, “ubuntu” You can follow the install instructions for MongoDB Community Version 4.4 under Ubuntu 20.04 in the latest MongoDb 4.4 manual. I show my installation for R-Pi 4 below.
These instructions use the official mongodb-org package, which is maintained and supported by MongoDB Inc.
1. Import the public key used by the package management system
ubuntu@ubuntu:~$ wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
2. Create a list file for MongoDB
ubuntu@ubuntu:~$ echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
3. Reload local package database
ubuntu@ubuntu:~$ sudo apt-get update
4. Install the MongoDB packages
ubuntu@ubuntu:~$ sudo apt-get install -y mongodb-org
5. Check install and run
ubuntu@ubuntu:~$ sudo service mongod status
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: https://docs.mongodb.org/manual
ubuntu@ubuntu:~$ sudo service mongod start
ubuntu@ubuntu:~$ sudo service mongod status● mongod.service - MongoDB Database ServerLoaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)Active: active (running) since Tue 2020-10-20 21:05:40 UTC; 58s agoDocs: https://docs.mongodb.org/manualMain PID: 5030 (mongod)CGroup: /system.slice/mongod.service└─5030 /usr/bin/mongod --config /etc/mongod.conf
6. Launch the mongo shell to confirm good install
ubuntu@ubuntu:~$ mongo
MongoDB shell version v4.4.1
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("9bba35f3-7edc-4f28-8063-975f46ca8463") }
MongoDB server version: 4.4.1
Welcome to the MongoDB shell.
For interactive help, type "help"
Onward…
You can quit the mongo shell with the command, “exit”. You can start MongoDB via “service” commands using “sudo”.
sudo service mongod start
sudo service mongod stop
LMK if you have questions or issues in the comments.
]]>
What is MathTerms? Here is the description from the Apple App Store.
MathTerms is an illustrated glossary of mathematics terms in English and Spanish. The free iOS app includes almost 500 entries for middle- and high-school mathematical concepts. To help learners master speaking as well as reading, it encompasses audio pronunciations of terms, by English and Spanish native speakers. A flash-card quiz game is included, enabling students to study selected terms in an interactive environment.
A few years back, I created a mobile app that was a glossary of mathematics terms for middle- and high-school students and teachers. It was written in a now defunct Javascript-based framework. As iOS evolved, my app no longer functioned – and I dropped it from the Apple App Store.
Apple recently introduced its SwiftUI framework that is a tool to build user interfaces with a declarative Swift syntax. You can simply drag and drop widgets and then add logic via the Swift programming language. I decided to revisit my old MathTerms app as a good way to learn about this new framework and make MathTerms available again.
You can learn more about the app using the MathTerm menus at the top of this page.

View your Raspberry Pi (Zero, 2, 3, 4) display on-the-go without VNC or prior configuration. Great inexpensive device for your toolbox! Laptop required 
I have a bunch of R-Pis of various flavors. I also use R-Pi cameras (regular, IR and HQ) on a regular basis. I don’t always know the WiFi or network config for where I’m going. Sure, you can change files on your SD Card to configure things for WiFi or connect to a laptop via VNC (if you know about access point configs or know the network ahead of time). A GREAT tool I’ve added to my toolbox is an inexpensive video encoder – also known as an HDMI Video Capture USB Device. I picked up 2, at different times, off eBay for about $15/each. They are very small and light – about 2″ x 1″.

I was prompted to write this as I saw an Adafruit Tweet that mentioned their (new) product, “USB 2.0 to HDMI Video Capture Adapter.” A good deal at $20 with HDMI cable. All you do is plug your video-out from an R-Pi into the HDMI input and plug-in the adapter to a USB port. It then acts like a webcam in that you can use apps to view the R-Pi display on Mac, PC or Linux laptop (or desktop). This is an awesome, easy way to view video to focus a camera or preview an image or video stream – without stutter or dropped frames – that you get using VNC.
]]>This is yet another take on how-to create a time-lapse video. In my case, a website updates a photo of the sky on a regular basis. I wanted to turn that into a time-lapse video and deploy to another, or possibly the same, website. I decided to use a Raspberry Pi 4 that was “sitting around.”
My project evolved as I tried different techniques and apps. I ended up creating a couple of bash scripts to do the job. I used the “ffmpeg” audio/video framework as it was bash command line friendly. I have tested my scripts on my Raspberry Pi 4 with Raspbian OS as well as on different Linux boxes running Ubuntu and Debian.
For how-to scripts with instructions, click on “more“
The first script I developed was to grab a remote image and store it locally in order to process images into video frames. I copy the remote image file using curl. If you have file access to the remote server, you might prefer to use ftp, sftp or scp. I rename the downloaded file (mv) to avoid processing a file that is not finished downloading. I occasionally saw an unfinished frame (top part of image only) when viewing video. Waiting for a completed download – and then renaming – fixed this issue. The stored files are named with the date and time and image type suffix – in my case “.jpg” Some other possibilities are .png, .jpeg, .tiff, etc. You should ensure correct conversion to video by using “ffmpeg” options for input file type, if needed.
#!/bin/bash
#
# grab_frames.sh
# copy remote image file to local directory
# - rename file to current date + time
# - sleep for set amount of seconds and loop
# - 120 seconds is a good choice for time-lapse video creation
# replace with your image URL
IMAGE_URL="https://server.com/subdir/webcam.jpg"
FRAMES_DIR="/home/pi/lapse_frames"
WAIT_SECS=120
while(true)
do
curl -s -o $FRAMES_DIR/temp_image.bin $IMAGE_URL
DATE=$(date +"%Y-%m-%d_%H%M")
mv $FRAMES_DIR/temp_image.bin $FRAMES_DIR/$DATE.jpg
sleep $WAIT_SECS
done
On my Raspberry Pi, as user Pi, I created a file in the home directory, “grab_files.sh” with the above shell script. After editing, change the permissions to make executable. My script saves the video frames to a directory, “/home/pi/lapse_frames” You need to create this dir before running the script 😉
pi@Pi4:~ $ vi grab_frames.sh #copy script into this file
pi@Pi4:~ $ chmod 755 grab_frames.sh
pi@Pi4:~ $ mkdir lapse_frames
To start the script in the background and keep it running even after logout, you use the “nohup” command in conjunction with (send to background) “&” You can also save any error messages to a log file:
pi@Pi4:~ $ nohup ./grab_frames.sh > grab_errors.log &
[1] 18053
nohup: ignoring input and redirecting stderr to stdout
The nohup command will return a process ID that you can use to kill the process – when you want it to stop. You’ll also (probably) see a message indicating that output (standard and errors) will be sent to “stdout” – which was set tp the file, “grab_errors.log” You can also find the process ID later or from a different terminal session using the “ps” command. See below for an example on how to find the PID and stop (kill) the process:
pi@Pi4:~ $ ps aux | grep -i grab_frames
pi 18053 0.0 0.0 7676 2476 pts/0 S 13:30 0:00 /bin/bash ./grab_frames.sh
pi@Pi4:~ $ kill 18053
OK, we now have a process running that will grab a remote image every 2 minutes and download to a local directory with date and time-stamp formatted name. We need to process the images (frames) into a video and clean-up the directory, as needed, so we don’t end up with a bunch of files that use up our disk space. I chose to make a cumulative video every 20 minutes for a single day. I also decided to create the video(s) only during daylight hours – as my need was for tracking clouds.
Create and edit “make_video.sh” in the Pi home directory. I use “vi” as my text editor but you may prefer another 😉
pi@Pi4:~ $ cd
pi@Pi4:~ $ vi make_video.sh #copy script into this file
pi@Pi4:~ $ chmod 755 make_video.sh
#!/bin/sh
# make_video.sh - Andy Felong - 15 Mar 2020
# grabs images from local dir: /home/pi/lapse_frames/
# filters images to today and selected (daylight) hours
# creates H.264, MP4 video file - set path below in $VIDEO_OUT
# set directory for input images (frames)
FRAMES_DIR="/home/pi/lapse_frames"
# set video output file
VIDEO_OUT="/home/pi/my_video_H264.mp4"
# set number of seconds between loops (1200 is 20 minutes)
LOOP_SECS=1200
# set debug flag to see more info
DEBUG=false
# Handle passed flags
# Handles "-" once-char and simple "--" one word flags
OPTS=`getopt -o hvd -l help,verbose,debug -- "$@"`
if [ $? != 0 ]
then
exit 1
fi
eval set -- "$OPTS"
while true ; do
case "$1" in
-h) echo "make_video.sh: usage: make_video.sh -[dhv]"; shift;;
-v) DEBUG=true; shift;;
-d) DEBUG=true; shift;;
--help) echo "make_video.sh: usage: make_video.sh -[dhv]"; shift;;
--verbose) DEBUG=true; shift;;
--debug) DEBUG=true; shift;;
--) shift; break;;
esac
done
#start of main loop
while(true) ; do
DATE=$(date +"%Y-%m-%d_")
YESTERDAY=$(date -d "yesterday 13:00" +"%Y-%m-%d")
if $DEBUG; then
echo 'date: '$DATE
echo 'yesterday: '$YESTERDAY
printf 'number of jpg files: '
ls $FRAMES_DIR/*.jpg | wc -w
fi
# creating video for today - delete old images from yesterday (if any)
rm $FRAMES_DIR/$YESTERDAY'_'*.jpg 2> /dev/null
# file names are in the format: YYYY-MM-DD_HHMM
# An example: 2020-03-17_1249.jpg
#
# I'm looking for daylight images - from 6am - only
# delete time entries with hours "00" to "05"
#
# NOTE: you may need to allow for time zone difference of your source!
# 6am Eastern is 3am Pacific - you may need to use "[012]" instead of "[012345]"
rm $FRAMES_DIR/$DATE'0'[012345]*.jpg 2> /dev/null
# assumes nighttime around 20:00 (8pm) - delete later images
# NOTE: you may need to allow for time zone difference of your source!
rm $FRAMES_DIR/$DATE'2'[0123]*.jpg 2> /dev/null
# clean-up for video creation - delete old video and index files
rm $VIDEO_OUT
rm /tmp/img*
# ffmpeg needs frames indexed (ordered and numbered)
# create index files in "/tmp" dir
x=1
for i in $FRAMES_DIR/*jpg
do
counter=$(printf %03d $x)
ln "$i" /tmp/img"$counter".jpg
x=$(($x+1))
done
# use ffmpeg to create video
# - ffmpeg has many options - check its manual page
# if DEBUG flag is set - show lots of info
# - if not set, keep silent
if $DEBUG; then
ffmpeg \
-f image2 \
-i /tmp/img%03d.jpg \
-vf format=yuv420p \
-framerate 24 \
-c:v libx264 \
-preset veryslow \
-qp 18 \
$VIDEO_OUT
else
ffmpeg \
-loglevel quiet \
-f image2 \
-i /tmp/img%03d.jpg \
-vf format=yuv420p \
-framerate 24 \
-c:v libx264 \
-preset veryslow \
-qp 18 \
$VIDEO_OUT
fi
# COPY video to a destination if desired using cp, scp, ftp, sftp, etc.
# ensure you have keys in place for no-login or add user + password to destination URL
# you do NOT want to enter authorization info every 20 minutes!
scp $VIDEO_OUT userame@remote_server.com:~
# wait/sleep for LOOP_SECS seconds (set above) and loop
sleep $LOOP_SECS
done
You can change the script to have complete 24 hour coverage if/as needed. You could also filter for specific hours as I have done. Remove or edit the “rm” statements in lines 65 & 69.
You can start/stop video creation using the same method as the frame-grabber script.
#start
pi@Pi4:~ $ nohup ./make_video.sh > make_video.log &
[2] 29007
nohup: ignoring input and redirecting stderr to stdout
#stop
pi@Pi4:~ $ ps aux | grep -i make_video
pi 29007 0.2 0.0 1940 1276 pts/0 S 17:42 0:00 /bin/sh ./make_video.sh
pi@Pi4:~ $ kill 29007
You can modify the scripts for your own needs. They could be turned into services that auto-start at system boot. I’ve run different pieces on different servers. My images already have the date and time in the lower right corner but, if desired, you could use “ImageMagick” tools to manipulate the images or add text with the “convert” command – such as a title or date and time.
LMK if you have questions or issues in the comments.
]]>