Raspberry Pi in Hotspot Mode

My last project was setting up a wireless, battery-operated Raspberry Pi time lapse video shooting rig. This works very well when it is able to connect to a WiFi network that it is familiar with. When at home, I can easily get the Pi to connect to my home WiFi and remote into it with VNC Viewer from my iPad or Macbook. However, if I’m out of my WiFi network’s range, I can’t connect to preview my camera’s view or to verify that it’s working.

So, instead of having the Pi connect to WiFi, I turned the built-in WiFi card into an access point. This was all made possible by an excellent tutorial by Phillip Martin. Now I can connect my iPad or Macbook directly to the Pi to preview the images captured by the camera, tweak the script that takes the pictures or to transfer folders of images from the device to my computer.

When the picture-taking has finished, I can connect to the same access point with my Macbook and copy files and folders from the Pi to my computer for processing. Since I know I’ll forget the specifics and come back here to find them. I need to first connect to the AP (ssid: RPi4VNC, password hint:Luther Long) and then open a terminal window and use secure copy (scp):

scp -r pi@172.24.1.1:/home/pi/09-23_21-26-02 ~/Desktop/09-23_21-26-02

-r Means recursively
pi@ Means logging in as user “pi”
172.24.1.1 is the static ip address set up in Phrillip’s blog post
/home/pi/09-23_21-26-02 is the folder I’m copying
~/Desktop/09-23_21-26-02 is the destination folder on my Macbook

Raspberry Pi Automated Time Lapse (Updated Sept. 18, 2017)

Update: If you want a Time Lapse Raspberry Pi image you can burn to an SD card? Click here to download the zipped image. Just extract and burn to a 16GB SD card, pop it into a Pi with a camera module and you'll be on your way.
Update #2: Following Phillip Martin's blog post, I set up the Pi's WiFi adapter as an access point so I can connect my iPad and Macbook directly to it without needing to rely on another WiFi network. Now I can remote into it with VNC Viewer in any location I'm recording. See this post for details.

We’re working on some cool video pieces to showcase the awesomeness happening on our campus. As part of that effort, we built an automated time lapse video recorder using a Raspberry Pi 3, case, camera and an Anker PowerCore battery pack. Set this puppy down, point it in the right direction and let it sit for an hour (or 12). Then, stop the script and combine your hundreds (or thousands) of photos into a cool time lapse video.

Here’s a quick example of what’s possible.

Some pictures, with an explanation to follow.

 Front of Raspberry Pi time lapse camera 

Physical build, challenges and prototyping

During the early iterations, the camera module was external to the case and basically taped it to the outside making it vulnerable to damage. Cutting a small hole in the front cover to allow the camera lens to see through and taping the camera module down to hold it in place resolved the issue. There were some small plastic tabs on the inside that needed to be removed in order to get the camera to sit flush. Depending on your case, you’ll likely need to make similar modifications. Be careful to avoid damaging the ribbon cable as it can be kinked, pinched or come loose.

One early frustration was the need to tote around a keyboard, mouse, monitor and power adapter to each filming location. To get around this, a little script runs on startup so that the Raspberry Pi will just start taking pictures as soon as it boots up. Adding the Anker battery pack (perfectly sized to work with the Pi’s case), attached with 3M Command Strip hook and loop fasteners resolved the power issue. Now, it can be set up anywhere. Just attach the power cable and let it run. As soon as it boots, the camera starts taking pictures – one each second, until the power is disconnected or the device is shut down. While we haven’t timed it exactly, the 10000 mAh battery looks like it might be able to run the Pi for  24 hours or longer.

Another challenge was not being able to see how the pictures looked to frame the shot without a monitor. So a VNC server was installed on the Pi. Now an iPad can be used to remote into the Pi to see the pics as they are being taken. Looking at the first few pictures allows adjustments to be made to get the best shot.

How it works [updated 09/03/2017]

This line is added to /home/pi/.config/lxsession/LXDE-pi/autostart file:

@/home/pi/lapsescript

This runs a one-line script named lapsescript stored in the home directory. To create the lapsescript file:

  1. Open the Terminal app on the Pi
  2. Type “cd ~” and hit enter to be sure you’re in the home folder
  3. Type “sudo nano lapsescript” and press enter to create the lapsescript file in the nano text editor
  4. Type lxterminal -e sudo /usr/bin/python2 /home/pi/lapse.py in the nano editor
  5. Press “ctrl-x” to exit nano
  6. Press “y” to save the file
  7. Press enter to confirm saving the file
  8. Now that you’re back in the Terminal window, type “sudo chmod a+x lapsescript” and press enter. This makes the script executable.

So, when the Pi boots up, the line at the top of this section runs lapsescript. If you read the lapsescript line from left to right, lxterminal is executed (opened), the Python interpreter starts, and runs the lapse.py Python script. This script creates a new folder with the current date and time in the home directory and stores pictures (taken one per second – customizable in the script), storing each with a sequential filename of image0000.jpg, image0001.jpg, image0002.jpg, etc. Each time the script runs, a new folder is created so that different shots don’t need to be separated by hand – each has its own folder. Note that this all happens automagically when the Pi boots. No need to type anything. Just set it down where you want to shoot, plug in the external battery and let it sit for as long as you’d like. The Python script will continue to run until you shut it down (Ctrl-c, disconnect the power or otherwise shut down the Pi) or your sd card gets filled.

These pics can then be converted to a movie on the Pi with avconv or transfer them to your favorite video editor. Navigate to the pictures folder in Terminal and use the following command to create a 24 frames/sec mp4 video named timelapse.mp4 scaled to 1280×720:

avconv -r 24 -i image%04d.jpg -r 24 -vcodec libx264 -vf scale=1280:720 timelapse.mp4

How to put it together:

These instructions assume you want to set up your Raspbian installation from scratch. If you just want to download an image that’s all ready to go, just download the image linked at the top of this post, write it to your SD card, pop it in your Pi, point your camera somewhere interesting and turn on the power.

  1. First, connect and enable a camera module. Once connected, open the Pi’s configuration (Preferences > Raspberry Pi Configuration) and select the Interfaces tab. Ensure that the camera is enabled. Also enable VNC and ssh if you want to access your Pi remotely.
  2. Python script creates a directory in the Pi home directory using the current date and time to keep each time lapse sequence separated. The linked .txt file would need to be renamed timelapse.py and in order to work with this automated setup and saved to the home (/home/pi/) directory. To change the length of time between pictures, change the number in the sleep(1) line. The number in parenthesis is the number of seconds to pause between pictures. You can also change the resolution to suit your particular camera module.
  3. To run the script at startup, add the line
    @/home/pi/lapsescript
    to /home/pi/.config/lxsession/LXDE-pi/autostart file. To do this, open a terminal window and type:
    sudo nano /home/pi/.config/lxsession/LXDE-pi/autostart
    This opens an editor with the autostart file. At the bottom of the file, add the line “@/home/pi/lapsescript/” at the bottom. Press control-x, then ‘y’ then enter to save the file.

Future upgrades

A dynamic DNS service would help make the VNC server accessible regardless of the current network or ip address (future upgrade). Ideally, it would have some buttons in order to shut down the Pi properly rather than just disconnecting the power and to change the time between shots. The newer 8MP camera module and a touchscreen are being shipped with hopes that the higher resolution will look awesomer on our new 4k displays. The touchscreen may just help with setup and preclude the need for a VNC/iPad monitor setup. Alternatively, I’d like to add some buttons that could pause or stop the script, change the image resolution and/or the length of time between pictures. I’ll update the post as those get implemented.

Links used in researching this project.

Some links to resources.

  1. Setting up VNC server on the Raspberry Pi
  2. Running Python script on startup. This was particularly helpful. In earlier setups, the script would run, but there was no way of shutting it off. This method opens a Terminal window so that Ctrl-c will interrupt the script.
  3. Python code inspiration came from the second page of this post.
  4. Other Raspberry Pi time lapse posts:
    1. Trevor Appleton
    2. Jeff Geerling – Headless Pi Zero

PowerSchool Custom Reports Notes

This is just a notepad for me to record tips for PowerSchool Custom Reports.

  1. Enter a custom field from any table
    • ^([table number]custom field name)
  2. Get fields from StudentCoreFields into a report
    • ~([Students.StudentCoreFields]PSCORE_LEGAL_FIRST_NAME)
  3. Customizing the “generalDemographics” page to use new legal names
    • <input type=”text” name=”[Students.StudentCoreFields]PSCORE_LEGAL_FIRST_NAME” value=”” size=”25″ maxlength=”50″ id=”firstName”

Remove Jamf framework

To remove JAMF’s Self Service App and all jamf components, enter the following in a Terminal window:

sudo /usr/local/bin/jamf removeFramework

Keep in mind that this will also remove things like any WiFi passwords that were installed using Jamf policies.

IF THE TERMINAL APP IS NOT ACCESSIBLE:

An old version of our MDM setup disabled student access to the Terminal app. Getting it back takes some doing:

  1. Create a new Admin user account.
  2. Log into the new Admin account.
  3. In Applications > Utilities, copy the Terminal app and paste a copy on the Desktop.
  4. Rename the Desktop Terminal app to T2.
  5. Run the T2 app.
  6. paste “sudo /usr/local/bin/jamf removeFramework” in the T2 app and press return.
    (This should remove the JamfFramework, MDM settings and Self Service app.)
  7. If successful, log out and log back into the student’s account and delete the just-created admin account.

Use INDEX with MATCH instead of VLOOKUP in Spreadsheets

VLOOKUP returns janky values if the value you’re looking up doesn’t exist in the lookup column. Combine INDEX and MATCH for more reliable results.

For the long explanation, head over to Ablebits. If you’re Paul and just looking for a reminder of the format, here it is:
=INDEX (column to return a value from, MATCH (lookup valuecolumn to lookup against, 0))

NWEA MAP Import and Export from PowerSchool

This post was shamelessly stolen from PSUG-Asia and is posted here only in case the referenced post disappears. [note to Paul: search your Google Drive for “NWEA MAP Rosters Directions” for a helpful spreadsheet]

This content is from Douglas Sirkka, Educational Technology Coordinator and PowerSchool Administrator from St. Mary’s International School.

You can download the PowerSchool Export Template File Here: MAPExportMap

Or Copy the code below and make your own:

TITLE CONTENTS

School Name ^(decode;^([schools]name);<<your school names here>>
Instructor Last Name [teachers]last_name
Instructor Middle Initial
Bus_Stop
Student First Name [students]first_name
Student Gender [students]gender
Previous Instructor ID
Bus_Stop
Period (Delete)
Expression Instructor ID [teachers]teachernumber
Instructor First Name [teachers]first_name
User Name [teachers]Email_addr
Email Address [teachers]Email_addr
Class Name [courses]course_name
Student ID [students]student_number
Student Date Of Birth [students]DOB
Student Grade [students]grade_level
Student Ethnic
Group Name
Bus_Stop
Student Last Name [students]last_name
Previous Student ID
Bus_Stop
Student Middle Initial
Bus_Stop
*Where it says ‘Bus_Stop’ that’s where I needed a blank in the file. With the TSV file above you can sort by SEQ field.

MAP Testing CRF Import In PowerSchool

  1. select the students who you need to create/update on NWEA.
    1. This will usually be the entire ES, the entire MS, or grades 9 and 10.
  2. In Group Functions, select Export Using a Template Type of Export: Student Schedules
  3. Export template: MapsCourseInforExport
    1. Select Only schedules for the selected… and Submit.
  4. Save the resulting export file and then open.
  5. Filter and select courses you want to associate with student profiles.
  6. Delete Period/Expression column at the end of the file. (this is for sorting/filtering purposes)
  7. Save as CSV (required)
  8. Login to NWEA Select Import Profiles
  9. Select Start New Import Select Combined
  10. Select the appropriate term.
  11. Add the Roster File.
  12. Click Next Check the data (Check student DOB this sometimes gets changed to a number) Reconcile Errors (Beyond scope of theses instructions but pretty straight forward)
  13. I think there is an error in the Export Template the needs a capital S in Not Specified… RP (Grade_Level 0) needs to be reconciled with K.
  14. Post the valid records.

Hope this makes your job a little easier.

Get your Global Entry Approval (and TSA Pre✓ authorization) Fast

Global Entry LogoA few years ago I signed up for the US Custom and Border Patrol (CBP) Global Entry Program available to Americans and others. Getting approved and acquiring a “Known Traveler Number” (KTN) allows me to skip the lines at passport control in the US, using Global Entry kiosks instead. Adding my KTN number to my airline accounts also results in the “TSA Pre” stamp automagically appearing on my boarding passes. This lets me take the faster, shorter lanes at TSA checkpoints, leaving my laptop in its case, shoes on my feet and belt on my jeans.

I arranged an appointment at O’Hare airport for about 6 weeks in the future, the earliest available appointment at the time. I burned frequent flyer miles to fly down from my local airport just for the appointment. Unfortunately, when I got to the CBP office at O’Hare, I realized I had flown down one day too early. The CBP agent at the counter had me stick around and about an hour later they fit me in between appointments. I had a short interview, they took my picture and sent me on my way. My card and KTN arrived a few weeks later in the mail.

I was reminded of this experience today when I ran across a Lifehacker article suggesting that you might try just walking in when you have an extended layover in an airport with a CBP Enrollment Center. You’ll want to make sure you’ve gone through the steps outlined in the “How to Apply” page first. But then try walking in and getting in without an appointment.

Cheap Passport Photos

Sooner or later, you’re going to need passport photos. Get them now and have them when you need them. I do this by filling an 8×10 print with passport photos and sending it to the local Walgreens photo department. This gives me 20 2×2 passport photos for $3.99 rather than 2 passport photos for $13.99 using Walgreens passport photo service. If you need information for visa photo requirements for a specific country, check visafoto.com.

The following instructions are for US passport photos (2″ x 2″) but can be adapted for other photo sizes. First, get a headshot photo that satisfies the necessary requirements. Then get the photo into PhotoShop or your favorite photo editing program and crop it to a square to look something like this:

Dwight D Eisenhower Portrait
Dwight D Eisenhower

Next, resize the image to 2 inches square and set the canvas size to 8 inches by 10 inches. Duplicate the 2×2″headshot three times and arrange the image four layers across the top of the canvas. You should have one row complete, looking something like this:

Then merge those four image layers into one and duplicate it four more times, arranging them to fill the 8×10:

Now just flatten the image, save it as a jpg file and upload it to your Walgreens Photo account. Print it as an 8×10 for $3.99 and pick it up in an hour or just have it mailed to you for $0.99 more.

Pro tip: Check the Walgreens Photo Promo page, look for the current month’s special discount code. There’s often a 40% off or free 8×10 code you can enter at checkout for an even better deal.

Google Fi – Cellular and Data for the World Traveler

[Updated: June 07,2022]
OK, they’re on to us. Google Fi’s Terms of Service state that Fi is intended for residents on the US. Before 2022, they seemed not to intent on enforcing this section of their terms. But since I had been using Fi outside of the US for several consecutive months without connecting to a US cell tower, they discontinued my data access, although I can still make calls, and send and receive SMS messages while abroad. While Fi may be a good option for people who often travel internationally from the United States, it is a less attractive option for permanent overseas residents.

The following is my original post from like 2017:

Google Fi service costs $20/month and $10 per GB of data (after the first 6GB data – the next 9GB are free). International calls cost an additional $0.20/minute, but I just use Skype, Messenger, WhatsApp or Hangouts and call for free using data. Add another line for an additional $15/month (in this case the free data doesn’t kick in until 10GB). You can also add a data-only SIM card for a tablet or compatible phone for free; just pay $10 for each GB of data it uses.

Google Fi works in most countries and there’s no need to switch settings or cards when traveling. Land in another country, turn off airplane mode and you’re online within a few minutes. Anyone calling your US number reaches you regardless of what country you’re in.

Fi also allows you to suspend service for up to three months at a time. Some people get the service just for travelling. They use a local cellular contract, suspending the Fi service when they’re at home and re-enabling it  when they travel. In this case, many couples also use just one line and get an additional data-only SIM card for the other spouse.

There are a few downsides. First, using Project Fi means I have a US number and not a local Korean number. This isn’t a big problem for me as virtually all of my communication is via messaging services.  Second, when I do make a phone call from outside the US, it costs $0.20/minute. But, if I need to make a lengthy call, I’ll usually use Skype or Hangouts and use data or Wi-Fi instead. Third, many Korean institutions expect users to have a Korean cell phone number to receive SMS messages. I finally relented and got a super cheap prepaid Korean SIM just for this purpose.

Crunching the numbers, I find that I’m paying a little more on average while in Korea than I would with a locally available plan (about $70/month vs. approx. $55). But in the summer, I’m no longer paying $120 for 2 months of AT&T’s prepaid plan while still paying for my $55/month Korean plan. I’m also not paying $20-50 to get a prepaid card every time I land in another country. I just keep paying about $70/month to burn through an average of 5GB of data through Google Fi. Due to the 6GB cap on data cost, my bill is never over $80 (plus tax).

If you’re interested in using the service, just head over to https://fi.google.com and feel free to use this referral code https://g.co/fi/r/9CV9YJ to get a $20 credit on your account.

Non-Fi Countries as of May, 2019

Roughneck Totes as Checked Baggage

Rubbermaid’s 25 gallon Roughneck Tote is the best container to use as checked baggage when transporting a lot of stuff via intercontinental flights. The length + width + height dimensions are the maximum allowed by airlines, maximizing the volume per piece of baggage, they stack nicely on airport carts and the handles make loading and unloading convenient. I have used this method since 2008, moving back and forth from the U.S. to Kuwait, Nigeria and South Korea, taking a couple dozen of these totes on several dozen flights. I’ve never had a problem and never lost a tote or lid.

They’re available at most Ace Hardware stores. On Amazon.com, the shipping charges are prohibitive. But if you visit my favorite hometown Blain’s Farm and Fleet, you can get 4 of them shipped just about anywhere in the US for around $20 each. While you’re there, throw in your 14″ zip ties, colored duct tape, packing tape, and Sharpie.

The only challenge is closing them up to remain sealed during travel. But, there is an easy way of handling this. I use a 5/16″ drill bit (8mm) to put 12 holes strategically placed around the lid which accept plastic zip-ties or 16 gauge solid-core copper wire to keep the tote sealed.

It’s important to put the holes in the right place so that if you use several totes, any lid will be able to be used on any tote with the lid and tote holes lining up perfectly. Check out my video for the details: