Build Guide
Intro
Welcome to the Build Guide! This guide will give you instructions and links to resources that will help you design and build your femtosat.
Choosing a Sensor
Your femtosat must include at least one sensor. We currently recommend and provide support for two sensors:
- The BME280 atmospheric sensor, which measures humidity, pressure (altitude), and temperature.
- The ADXL345 inertial measurement unit, which measures 3-axis acceleration.
You may supply a different sensor of your choice, but you will be on your own when learning how to use it.
Designing the Printed Circuit Board
Installing EAGLE
For PCB design, we will be using a program called Autodesk EAGLE. Before beginning, you'll want to follow this guide by SparkFun to download and install EAGLE and to learn your way around: How to Install and Setup EAGLE. While the free version has all the features you will need for femtosat, you can unlock additional features if you create an account with your BYU email and request academic access.
- Navigate to "C:\EAGLE 9.x" and find the file "LIBEAY32.dll".
- Rename the .dll by appending .bak at the end of the file name: "LIBEAY32.dll.bak".
- Start Eagle again, the program should open with no issue.
Schematic
Next, you will want to follow a guide to learn how to use EAGLE to create a schematic diagram. This guide from SparkFun is a good place to start: Using EAGLE Schematic.
Note that some of the parts we are using will not be found in the default EAGLE libraries. You will be given a link to download additional parts (like the sensors) to add to your schematic and board layout.
The datasheets for the active components contain suggestions for wiring. You should follow these guides to know how to wire the active components, what passive components are needed, and how to connect them. The datasheets can be found here:
Instructions
- Add the active components to the schematic, which can be found in the provided Femtosat library.
- the battery connector
- the voltage regulator
- the processor
- the sensor(s)
- the radio
- Add passive components. Capacitors, resistors, and LEDs should be size 0805.
- capacitors from the rcl>C-US library
- resistors from the rcl>R-US library
- LEDs from the led>LED library
- antenna from the discrete library
- connectors from the pinhead library
- The power supply:
- Connect the voltage regulator according to the datasheet.
- Connect the battery connector to the voltage regulator. The battery connector should be wired as follows:
Pin 1 Battery voltage (positive) Pin 2 Ground - Add a resistor and LED to the output of the voltage regulator. This will be your power indicator.
- Name the output of the voltage regulator 3V3. This is your voltage supply for the rest of the circuit.
- The processor:
- Connect VCC, AVCC, and AREF to 3V3. Connect GND to ground.
- Add a 100nF decoupling capacitor between the supply voltage 3V3 and ground.
- Connect MOSI, MISO, and SCK to your SPI bus. Use pin 13 as the SS/CS line for the radio.
- Connect SDA and SCL to the I2C bus.
- Connect a 10k pull-up resistor to RESET.
- Optional: you may also add an LED to one of the digital output pins (PD2-PD7) for status indication.
- ICSP header:
- This is a 2x3 header for programming the bootloader onto the ATMega. It should be connected as follows:
Pin 1 SPI MISO Pin 2 No connection (NC) Pin 3 SPI SCK Pin 4 SPI MOSI Pin 5 ATMega RESET (pin 29) Pin 6 Ground
- This is a 2x3 header for programming the bootloader onto the ATMega. It should be connected as follows:
- UART header:
This is a 1x6 header for programming your code onto the ATMega. It should be connected as follows:
Pin 1 ATMega RESET through a 100nF series capacitor Pin 2 ATMega pin 31 Pin 3 ATMega pin 30 Pin 4 No connection (NC) Pin 5 Ground Pin 6 Ground
- The radio:
- Connect according to the datasheet. Note that the datasheet schematic shows the radio connected to a PIC16 microcontroller. We are not using a PIC16, so you don't need to worry about that part of the circuit.
- Connect MOSI, MISO, and SCK to your SPI bus. Connect NSS to the SS/CS line for the radio.
- The sensors:
- Connect according to their respective datasheets.
- Data connections via I2C are preferred over SPI.
- The I2C pull-up resistors:
- Your I2C bus should have a 4.7k pull-up resistor on both the clock and data line.
- LEDs:
- You'll need a series resistor to limit current through the LED to about 10mA. You can find a resistor calculator here.
Board Layout
Next, you'll want to turn your schematic into a PCB design. This guide from SparkFun is a good place to start: Using EAGLE Board Layout.
Requirements
- Your board must be no larger than 20x70 mm.
- Your board must have rounded corners with 3 mm radius.
- Your board must have a hole to attach a string from which it will hang.
- Your board must only have two copper layers (top and bottom).
- All SMD components must be on the top layer.
- Include space for the battery on the bottom of the board.
- Include holes for attaching battery with a zip-tie (2.5 mm diameter).
- The antenna must be as close as possible to the antenna port on the radio.
- The antenna must be as close as possible to the shorter edge of the PCB so that the entire length can extend from the PCB.
Ordering Your PCB
Your PCB will be manufactured by JLCPCB. There you will upload your Gerber files and choose your manufacturing settings. The settings can be left at their default values (although you may want to set "Mark on PCB" to "Remove Mark" to prevent the order number from being printed on the PCB).
You'll also want to order a solder stencil from OSH Stencils. There you will upload the same Gerber files. You'll want to choose Polyimide Film 5mil for the material.
Assembling the PCB
The components you need will be stocked at the Experiential Learning Center (ELC or ECEn Shop) where they will be available for purchase. Some components, like those specific to this project, may be consolidated in a single location. Other components will be in their usual places throughout the shop, and you will need to locate them.
We will be soldering components onto the PCB using the stencil and reflow technique. There are many good tutorials for how to do this, and you may want to explore several before you begin. Here is a video by SparkFun to get you started: Stenciling Tutorial. The headers are through-hole parts that you will solder by hand after the stencil/reflow soldering is complete. You can find some tutorials for through-hole soldering on the ELC website: How-To Videos. The ELC has the soldering equipment you will need for your femtosat.
When adding components to your PCB, keep in mind the following:
- Integrated circuits (like the ATMega, sensors, and radio) must be oriented correctly. This is usually done by aligning the dot on the package (marking pin 1) with a dot on the PCB. Note: due to a last-minute change in the supplier for the radio, the radio will not align in this way. You should check the pin labels on the back to orient it correctly.
- LEDs are polarized, so orientation matters. You can check the polarity of an LED by setting a multi-meter to the diode setting and probing the LED. When the orientation is correct, the LED should glow.
- Resistors and most capacitors are not polarized. However, the 10 uF capacitor that the ELC has in stock is polarized, so you must verify the orientation. The stripe marks the positive terminal.
- The antenna is just a piece of solid wire cut to 1/4 of the wavelength.
Programming the Flight Computer
Loading the Bootloader
Before you can load code onto your processor, you must program the bootloader. This will be done through the ICSP header. You can learn more about this here. This requires an Arduino with a logic level shifter which will be provided for you.
The Hardware Interface
The ATMega processor can not be connected directly to the USB port of a computer. This is because the USB protocol is complex and the ATMega doesn't support it. Instead, the ATMega can be programmed through a simple serial UART interface. To bridge the gap between USB and UART, a special USB-UART converter chip is used. This chip is built-in on Arduino boards, but for simplicity, it is not included on the femtosat boards. Instead, we will use a separate module with one of these USB-UART chips to interface between USB and the femtosat board.
The USB-UART programming module will connect to the UART header on your femtosat. When connecting the two boards together, be careful of the orientation of the connector. Be sure that the wires on the USB-UART module connect to the correct wires on the femtosat. Reversing the connector could damage your femtosat.
The Arduino IDE
For programming your femtosat, you'll want to use the Arduino IDE. A guide for getting started can be found here: Getting Started with Arduino Products.
Unlike most Arduino boards, your femtosat doesn't use an external 16 MHz crystal oscillator. Instead, it uses the 8 MHz oscillator inside the ATMega chip. You'll need to add a board definition to tell the IDE to use the internal oscillator or it will be unable to communicate with the ATMega. Here is a good guide for how to do this: Configure Arduino IDE for Atmega 328P to Use 8MHz Internal Clock.
At this point you should try uploading a simple example sketch (like Blink) to check that you can upload to your ATMega successfully.
Next, you'll want to install the libraries for the sensors you're using.
To be continued...