78 May/June 2018
APPROACHING THE FINAL FRONTIER
Step 3: Start Programming the Pi to
Use its Expansion PCB
After five copies of the PCB I designed arrived in
the mail, I soldered one up and attached the Pi to its
receptacle (I first had to solder a 2x20 header to the Pi).
As I began learning how to program the Pi, I realized that
it required some configuration changes for it to work (I
wasn’t expecting this since it doesn’t happen with the
PICAXE).
I went into the Pi’s Configuration Menu (found under
Preferences in the main window) program and the Pi’s
Terminal to add and remove several functions. In the
Configuration Menu, I added the camera, I2C, and verified
that the Pi’s serial ability was already installed. After all that,
I still had trouble getting the Pi to operate I2C and serial
properly. So, I tried making changes using the Terminal.
My Windows PC doesn’t require access privileges;
anyone can just boot it up and make any changes to the
PC they want. The Pi is a different
beast. Only a super user can make
changes to the configuration and
boot up files of a Pi. This set me on
a journey to learn about Raspbian
commands.
To make changes to the Pi’s
configuration using the Terminal
program, I discovered one has to evoke
the super user. This is accomplished by
preceding commands with the word
SUDO (or Super User Do). To edit
configuration files, you need to start
Nano (a simple text editor). You need
to type SUDO before Nano since one
needs access privileges to edit these
files.
To configure my Pi to boot up the
way I wanted, I used Nano to remove
the text console=serial 0,115200
from the file cmdline.txt and add the
text core_freq=250. I then added
the following text to config.txt file:
dtparam=i2c=on and dtparam=i2c_
arm=on.
For good measure (while still in the
Terminal program), I typed sudo apt-get
install –y python-smbus to make sure
the appropriate I2C files (or library?) are
copied to the Pi when it boots up. This
was followed by sudo apt-get install python-smbus and
sudo aduser pi i2c. To be honest, this list probably isn’t
complete and some of it may not have been necessary.
I did a lot of flailing around trying to get my Pi to
boot up the way I wanted, and in desperation (at times),
tried a lot of commands that I read on the Internet. Once
this was done, I later discovered that I can also run the
raspi-config program from the Terminal to make some of
these changes.
Background on the Flight Computer
Design
Now that I’ve taken you this far, let me describe the
PCB in more detail. The PCB is designed to do several
things. First, it interfaces the EEPROM and PICAXE to the Pi
over GPIO25. Second, it creates a standard DB9 port for
the GPS receiver that provides it with power (a jumper lets
you select 3. 3 or five volts) and ground. Third, it creates
four analog and two digital sensor ports for the PICAXE
that provide power, ground, and I/O to each sensor.
Finally, it expands the remaining Pi’s GPIO in a way
that makes them easier to access. Next is a list of the
Python commands that I’ve discovered are needed to
The schematic of the Raspberry Pi Zero near space flight
computer that I designed. I used FreePCB to do the layout work
and PCBWay to manufacture five copies of the board.