Booting

A big difference between normal desktop Linux and Raspbian is that the Pi does ont seem to use GRUB. Things are configured in /boot/config.txt. (Which sounds like an improvement!)

What is vcgencmd? Seems to be a Raspberry Pi specific thing that does general interaction/configuration to the "VideoCore".

Hardware Problems

If the Pi is restarting repeatedly and/or you see the little yellow lightning bolt icon in the upper right of the display, that generally means its not happy with the power supply. I think the Pi is pretty lax about power but HDMI monitors and USB peripherals may not be. You can (and should) test the voltage by checking pin 1(+5) and 3(GND) for +5VDC; pin 1 is the one closest to the corner of the board, or, looking down on the header with it at the top of the board, 1, 2 (tied to 1 for +5DC BTW), and three are the first left to right 3 on the top (close to edge) row.

If it really doesn’t want to boot even with a good power supply, there may be a real hardware error. Check the pin on the far left second (non-edge) row to see if it has 3.3VDC to the ground shields. If it is 0, then this is bad.

Here is a good troubleshooting list.

WARNING

This makes me think I may have shorted the two pins farthest away from the USB ports on a Pi 3+ turning it into an adorable tiny brick. I would recommend covering the headers with an unconnected jumper block and taping the back. Super annoying!!!

Pins

Raspberry Pi Pin Out

Good detailed information about the GPIO electrical properties.

Locale Issues

Raspberry Pi is a British thing but my keyboards are not.

The main place to start for curing such problems is raspi-config. Look for "Set up language and regional settins to match your location."

Default Password

Username: pi Password: raspberry

Date And Time

The Pi has no offline battery-powered hardware clock and so when it wakes up, it has no idea what time it is. The normal situation is that it grabs on to the configured network and reaches out to an ntpd server and gets the base time. From there it can actively use its internal clock to accurately keep time.

But what if you don’t have an internet connection yet you want to keep many Pis synchronized? The answer is "orphan mode" in ntp. Here is a description of it and tips for applying it to Pis.

Capslock

Solution described at: http://xed.ch/h/capslock#pi

SSH

The Pi comes with SSH but it is turned off. To turn it on:

sudo raspi-config

Then choose Interfacing Options from the menu. Then enable SSH.

Serial Interface

I’m quite at home dealing with computers that are far away. The correct way to do this is generally with SSH (my notes). However, sometimes you need to tinker with a computer when SSH or networking isn’t quite ready. Compound this with maybe having an embedded situation where there is no traditional keyboard and display and it becomes useful to have another way.

While you can rustle up a monitor and a keyboard (like a crash cart in a server room), the Pi actually makes it pretty easy to use another technique that’s just as good for fundamental interaction. There are serial pins that you can connect to using a serial to USB adaptor (e.g. the USB end goes into a laptop whose screen and keyboard you can use).

Camera

There are two versions and only V2 works on the Jetson Nano. There is a little black retaining clip on the ribbon cable connector — they can break off. So if it seems like something is missing that could properly hold down the ribbon cable, it probably is.

To enable camera peripherals, go to

sudo raspi-config

Select #5, "Interfacing Options". Then select "P1 Camera" and enable it. It may be essential to reboot the device after setting this.

Here are some official hints on how to use the camera.

Video

The normal command to capture video with the pi camera is raspivid. The documentation is mostly here and most of the details can be found here here.

The Pi camera using raspivid seems to only dump a raw h264 formatted stream. This is really pretty useless without further post processing.

You can play it with ffplay and specifying the format.

ffplay -f h264 video.h264

I was able to pack that into a container by doing this.

ffmpeg -f h264 -i video.h264 propervidfile.mp4

I believe this must be done on a different computer. I tried converting a short clip on a Pi Zero and it stumbled to a halt.

That technique re-encoded it. To just keep the video as recorded but pack it into a container, this works much more quickly keeping the encoding as is.

ffmpeg -i video.h264 -codec copy proper2.mp4

This seems like the best way to preserve all data that was captured.

If you want to record a lot of video it could be reasonable to do something like this.

while true; do raspivid -n -t 300000 -o pivid-$(date '+%y%m%d%H%M%S').h264 ; done

This should record raw 5 minute files which will be timestamped. The -n is to prevent a preview window. The -t time option is in milliseconds (300,000 ms shown) .

OpenCV On Pi

On Pi Zero from source. Not happening at this time.

Wifi

To enable.

sudo raspi-config

Could be a good time to disable bluetooth too if you won’t be using it. Considerations for choosing the correct radio profile: wifi is 14x faster, 75% of latency — though wifi consumes ~30x power.

You can try setting the network details directly by editing /etc/wpa_supplicant/wpa_supplicant.conf. It needs to have a section that looks like this.

network={
    ssid="MyAccessPointName"
    psk="ThePassword!"
}

These lines can be generated (along with less public PSK hashes) with the wpa_passphrase command.

Also in that file you might want to change the country=GB to US if you’re a US person.

Details and weird cases can be researched here. This may also maybe relevant.

AP Wifi Hotspot

Can two Pis talk without a third "router" host? Should be possible.

Look into hostapd. Here are some good tips describing the process.

RaspAP is some kind of GUI "Wifi Configuration Portal" for managing such things.

GPIO Control

  • total supply maximum of 51mA on all GPIO pins (3.3 and 5v)

  • each 5v pin has maximum of 16mA

Run with ./gpio_ctl 1 to turn on and ./gpio_ctl 0 to turn off.

#!/usr/bin/python
import RPi.GPIO as GPIO
import sys

#GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(23,GPIO.OUT)

if sys.argv[1] == "1":
    print("Turning on pin.")
    GPIO.setup(23,True)
else:
    print("Turning off pin.")
    GPIO.setup(23,False)

Jetson Nano

Power

The Jetson Nano lives right on the edge of what is doable in a small form factor. It has different power modes for different applications. If you want to really use the serious machine learning power of the GPU, you’ll have to go above the 10W mode. This is 2A at the Jetson’s 5V. This is all you’re likely to get with a USB power supply. To go bigger you’ll need a much bigger power supply. I bought an Alitove JC0515 75W supply that seems to fit.

Note that, as this guy points out, the barrel jack could fit in any number of devices which may not use 5V. It is strongly recommended to enhance the labeling of this device to avoid any smokey mistakes.

To use this supply, you must first short jumper 48 which is located right behind the barrel jack. It is labeled "ADD JUMPER TO DISABLE USB PWR" so keep that in mind if you’re switching back.

This little beast gets quite hot and I bought this Noctua NF-A4x20 5V PWM fan. I didn’t use their inappropriate mounting hardware but just used micro zip ties and it seems fine. Very quiet.

Setup

Here’s a decently clear outline of a strategy that uses conda. Not sure if this would work but noting it.

Adrian seems to have a good process worked out. I’m already running into trouble with versions and details that have changed since I first tried this a couple of days ago. Most of my procedure is based on this.

First thing to do is to turn off all Idiot-Ubuntu screensavers. Make sure you find the thing that locks you out if the screensaver triggers and kill that. This installation can take an absurdly long time and coming back to a machine that is too bogged down to let you log back in is a strong possibility. I even like to have an htop (_ apt install htop) running where I can see it so I can know that the process hasn’t just locked up.

$ sudo apt install git cmake libatlas-base-dev gfortran libhdf5-serial-dev hdf5-tools python3-dev
$ wget https://bootstrap.pypa.io/get-pip.py
$ sudo python3 get-pip.py
$ rm get-pip.py # Optionally
$ sudo pip install virtualenv virtualenvwrapper

I don’t know where /home/dev/.cache/pip got owned by root:root, but this might be a good time to fix that stupid situation — use -R. There’s also a pip --no-cache-dir FWIW.

Add this to ~/.bashrc.

# virtualenv and virtualenvwrapper
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
source /usr/local/bin/virtualenvwrapper.sh

Resource shell environment and continue in this environment. Less sudo now.

$ . ~/.bashrc
$ mkvirtualenv deep_learning -p python3
$ pip install numpy

Things get dodgy here. I used this to go off piste with a slight variant of Adrian’s procedure that actually worked.

$ pip3 install --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v42 tensorflow-gpu==1.13.1+nv19.4
$ pip install scipy
$ pip install keras
    $ git clone https://github.com/dusty-nv/jetson-inference
    $ cd jetson-inference
    $ git submodule update --init
    $ mkdir build
    $ cd build
    $ cmake .. # Wait for credentials..
$ make
$ sudo make install