ubo code booklet - build ubobuildubo.co.uk/.../2017/02/ubo-code-booklet.small_.pdf · teensy 3.6...

31
Welcome SPACE To

Upload: others

Post on 21-Jun-2020

15 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: UBO Code Booklet - Build UBObuildubo.co.uk/.../2017/02/UBO-Code-Booklet.small_.pdf · Teensy 3.6 Teensy 3.5 Teensy 3.0 Teensy LC Teensy++ 2.0 Teensy 2.0 USB Type “Serial” CPU

WelcomeSPACE

To

Page 2: UBO Code Booklet - Build UBObuildubo.co.uk/.../2017/02/UBO-Code-Booklet.small_.pdf · Teensy 3.6 Teensy 3.5 Teensy 3.0 Teensy LC Teensy++ 2.0 Teensy 2.0 USB Type “Serial” CPU

Cheat SheetPin List

- 39- 43

Glossary - 45

23Test your uboSoftware Introduction - 24

- 30VerifyingFunctionalityWriting aProgram - 34

38Are you lost

Page 3: UBO Code Booklet - Build UBObuildubo.co.uk/.../2017/02/UBO-Code-Booklet.small_.pdf · Teensy 3.6 Teensy 3.5 Teensy 3.0 Teensy LC Teensy++ 2.0 Teensy 2.0 USB Type “Serial” CPU

GettingStarted

test

uboyour

23

Page 4: UBO Code Booklet - Build UBObuildubo.co.uk/.../2017/02/UBO-Code-Booklet.small_.pdf · Teensy 3.6 Teensy 3.5 Teensy 3.0 Teensy LC Teensy++ 2.0 Teensy 2.0 USB Type “Serial” CPU

Introducing the software and setting up the ground station

Step-1:

Double Click on the Arduino application within The Folder

Extract the Zip File to your PC

You should now have a Blank Sketch Window

File Edit

blank Arduino 1.6.12

Sketch

Arduino/

Tools Help

blank

void setup() { // put your setup code, here to run once: }

void loop() { // put your main code here, to run repeatedly: }

123456789

10111213141516171819202122232425262728293031323334

File Edit

blank Arduino 1.6.12

Sketch Tools Help

blank

void setup() { // put your setup code, here to run once: }

void loop() { // put your main code here, to run repeatedly: }

12345678910111213141516171819202122232425262728293031323334

24

Page 5: UBO Code Booklet - Build UBObuildubo.co.uk/.../2017/02/UBO-Code-Booklet.small_.pdf · Teensy 3.6 Teensy 3.5 Teensy 3.0 Teensy LC Teensy++ 2.0 Teensy 2.0 USB Type “Serial” CPU

Edit

sketch Arduino 1.6.12

Sketch

Arduino/

Tools Help

#include

blank

File

New

Open...

Ctrl+N

Ctrl+O

Ctrl+W

Ctrl+S

Ctrl+Shift+S

OpenRecent

Sketchbook

Close

Save

Save As...

Built-in Examples

01.Basics

02.Digital

03.Analog

04.Communication

05.Control

06.Sensors

07.Display

08.Strings

09.USB

10.StarterKit_BaseKit

11.ArduinoSP

Components

Missions

Camera

Diagnostics

Power

Radio

Sensors

Serial

Teensy

Ctrl+Shift+PPage Setup

Ctrl+PPrint

Ctrl+CommaPreferences

Ctrl+QQuit

Cube

Blink

Examples

Tutorials

Open The Blink Sketch

File Edit

Blink Arduino 1.6.12

Sketch Tools Help

// Including the cube library// Provides code for all of the satellite functions#include "Cube.h"

void setup() { // Setting the blue LED pin as a digital output // LED_BLUE is defined in the cube library pinMode(LED_BLUE, );}

void loop() { // The code in this loop() will be continually repeated digitalWrite(LED_BLUE, ); // Turning on the blue LED delay (1000); // Waiting one second digitalWrite(LED_BLUE, ); // Turning off the blue LED delay(1000); // Waiting one second}

Blink

123456789

10111213141516171819

After selecting File > Examples > Cube > Getting Started > Blink you should geta Digital Sketch Document containing code to make a Blue LED Turn On/Off.

File > Examples > Cube > Tutorials > Blink

25

Page 6: UBO Code Booklet - Build UBObuildubo.co.uk/.../2017/02/UBO-Code-Booklet.small_.pdf · Teensy 3.6 Teensy 3.5 Teensy 3.0 Teensy LC Teensy++ 2.0 Teensy 2.0 USB Type “Serial” CPU

File Edit

Blink Arduino 1.6.12

Sketch

Teensy 3.2 / 3.1, Serial, 48 MHz reduce code size, United Kingdom on COM14

Tools Help

// Including the cube library// Provides code for all of the satellite functions#include "Cube.h"

void setup() { // Setting the blue LED pin as a digital output // LED_BLUE is defined in the cube library pinMode(LED_BLUE, );}

void loop() { // The code in this loop() will be continually repeated digitalWrite(LED_BLUE, ); // Turning on the blue LED delay (1000); // Waiting one second digitalWrite(LED_BLUE, ); // Turning off the blue LED delay(1000); // Waiting one second}

Blink

123456789

1011121314151617

Tools

Auto Format

Archive Sketch

Ctrl+T

Ctrl+Shift+M

Ctrl+Shift+L

Fix Encoding & Reload

Serial Monitor

Serial Plotter

WiFi101 Firmware Updater

Keyboard

Keyboard + Touch Screen

Keyboard + Mouse + Joystick

Serial + Keyboard + Mouse + Joystick

MIDI

Serial + MIDI

Audio

CPU Speed “48 MHz reduce code size”

Keyboard Layout “United Kingdom”

Port: “COM14 (Adafruit Feather M0 (Native USB Port))”

Get Board Info

Programmer “AVRISP mkii”

Burn Bootloader

Keyboard + Mouse + Touch Screen

Board: “Teensy3.2/3.1”

USB Type “Serial” Serial

Find The Correct Board

File Edit

Blink Arduino 1.6.12

Sketch

Teensy 3.2 / 3.1, Serial, 48 MHz reduce code size, United Kingdom on COM14

Tools Help

// Including the cube library// Provides code for all of the satellite functions#include "Cube.h"

void setup() { // Setting the blue LED pin as a digital output // LED_BLUE is defined in the cube library pinMode(LED_BLUE, );}

void loop() { // The code in this loop() will be continually repeated digitalWrite(LED_BLUE, ); // Turning on the blue LED delay (1000); // Waiting one second digitalWrite(LED_BLUE, ); // Turning off the blue LED delay(1000); // Waiting one second}

Blink

123456789

1011121314151617

Tools

Auto Format

Archive Sketch

Ctrl+T

Ctrl+Shift+M

Ctrl+Shift+L

Fix Encoding & Reload

Serial Monitor

Serial Plotter

WiFi101 Firmware UpdaterBoards Manager...

Teensyduino

Teensy 3.6

Teensy 3.5

Teensy 3.0

Teensy LC

Teensy++ 2.0

Teensy 2.0

USB Type “Serial”

CPU Speed “48 MHz reduce code size”

Keyboard Layout “United Kingdom”

Port: “COM14 (Adafruit Feather M0 (Native USB Port))”

Get Board Info

Programmer “AVRISP mkii”

Burn Bootloader

Teensy 3.2/3.1

Board: “Teensy3.2/3.1”

Set The USB Type

The selected Board will be shown here

Tools > Board > Teensy 3.2/3.1

Tools > USB Type > Serial

26

Page 7: UBO Code Booklet - Build UBObuildubo.co.uk/.../2017/02/UBO-Code-Booklet.small_.pdf · Teensy 3.6 Teensy 3.5 Teensy 3.0 Teensy LC Teensy++ 2.0 Teensy 2.0 USB Type “Serial” CPU

Set the CPU Speed

File Edit

Blink Arduino 1.6.12

Sketch

Teensy 3.2 / 3.1, Serial, 48 MHz reduce code size, United Kingdom on COM14

Tools Help

// Including the cube library// Provides code for all of the satellite functions#include "Cube.h"

void setup() { // Setting the blue LED pin as a digital output // LED_BLUE is defined in the cube library pinMode(LED_BLUE, );}

void loop() { // The code in this loop() will be continually repeated digitalWrite(LED_BLUE, ); // Turning on the blue LED

delay (1000); // Waiting one second digitalWrite(LED_BLUE, ); // Turning off the blue LED delay(1000); // Waiting one second}

Blink

123456789

1011121314151617

Tools

Auto Format

Archive Sketch

Ctrl+T

Ctrl+Shift+M

Ctrl+Shift+L

Fix Encoding & Reload

Serial Monitor

Serial Plotter

WiFi101 Firmware Updater

72 MHz optimize speed

48 MHz optimize speed

96 MHz reduce code size (overclock)

72 MHz reduce code size

24 MHz reduce code size

16 MHz reduce code size (no USB)

Keyboard Layout “United Kingdom”

Port: “COM14 (Adafruit Feather M0 (Native USB Port))”

Get Board Info

Programmer “AVRISP mkii”

Burn Bootloader

24 MHz optimize speed

Board: “Teensy3.2/3.1”

USB Type “Serial”

96 MHz optimize speed (overclock)CPU Speed “48 MHz reduce code size”

48 MHz reduce code size

Running the CPU at lower speeds reduces The power consumption. However, this also reduces the performance and capabilities of the chip.

Slide out the Solar Panel and Then use the Red Power Jumper to power Up your Satellite

Tools > CPU Speed > 48 MHz reduce code size

27

Page 8: UBO Code Booklet - Build UBObuildubo.co.uk/.../2017/02/UBO-Code-Booklet.small_.pdf · Teensy 3.6 Teensy 3.5 Teensy 3.0 Teensy LC Teensy++ 2.0 Teensy 2.0 USB Type “Serial” CPU

Upload the Sketch

Uploadint ledBlue = 33; // LED pin definition

void setup() { // Setting the blue LED pin as a digital output pinMode(ledBlue, );}

void loop() { // The code in this loop() will be continually repeated digitalWrite(ledBlue, ); // Turning on the blue LED delay (1000); // Waiting one second digitalWrite(ledBlue, ); // Turning off the blue LED delay(1000); // Waiting one second}

123456789

1011121314

Compiling sketch...

You’ve done it

If you get this message

Teensy 3.2 / 3.1, Serial, 48 MHz reduce code size, United Kingdom on COM14

File Edit

Blink Arduino 1.6.12

Sketch Tools Help

// Including the cube library// Provides code for all of the satellite functions#include "Cube.h"

void setup() { // Setting the blue LED pin as a digital output // LED_BLUE is defined in the cube library pinMode(LED_BLUE, );}

void loop() { // The code in this loop() will be continually repeated digitalWrite(LED_BLUE, ); // Turning on the blue LED delay (1000); // Waiting one second digitalWrite(LED_BLUE, ); // Turning off the blue LED delay(1000); // Waiting one second}

Blink

123456789

1011121314151617

File Operation Help

Reboot OK

Blink.ino.hex 4% used

Auto

Done uploading

C:\Users\

Operate the program erase button to make

The Satellite reprogrammable

Teensy 3.2 / 3.1, Serial, 48 MHz reduce code size, United Kingdom on COM14

int ledBlue = 33; // LED pin definition

void setup() { // Setting the blue LED pin as a digital output pinMode(ledBlue, );}

void loop() { // The code in this loop() will be continually repeated digitalWrite(ledBlue, ); // Turning on the blue LED delay (1000); // Waiting one second digitalWrite(ledBlue, ); // Turning off the blue LED delay(1000); // Waiting one second}

123456789

1011121314

Done uploading

C:\Users\Teensy did not respond to a USB-based request to automatically reboot.Please press the PROGRAM MODE BUTTON on your Teensy to upload your sketch.

programme erase button

OBC

28

Page 9: UBO Code Booklet - Build UBObuildubo.co.uk/.../2017/02/UBO-Code-Booklet.small_.pdf · Teensy 3.6 Teensy 3.5 Teensy 3.0 Teensy LC Teensy++ 2.0 Teensy 2.0 USB Type “Serial” CPU

Do you know you can change the colour of the L.E.D?

Try Achieving these Colours

Can you make the L.e.d blink faster or slower?

void loop() { // The code in this loop() will be continually repeated digitalWrite(LED_BLUE, ); // Turning on the blue LED delay (1000); // Waiting one second digitalWrite(LED_BLUE, ); // Turning off the blue LED delay(1000); // Waiting one second}

void setup() { // Put your setup code here, to run once pinMode(LED_BLUE, );}

LED_GREEN LED_YELLOW LED_AMBER

sec

1 sec

1

(1000) (1000)

29

Page 10: UBO Code Booklet - Build UBObuildubo.co.uk/.../2017/02/UBO-Code-Booklet.small_.pdf · Teensy 3.6 Teensy 3.5 Teensy 3.0 Teensy LC Teensy++ 2.0 Teensy 2.0 USB Type “Serial” CPU

Verifying functionality of the satellite

Step-2:

Press upload and wait for The sketch to compile. (this may take some time)

Select the appropRiate Com PortTools > Port > Com

Serial Monitor

Go ToFile > Examples > Cube > Basics > DIagnostics

...x

Your Com port Could be any number ( ). There should just be ONe Com Port Option.

...x

Click on the serial Monitor icon tothe right of the arduino window

Select the speed of communication Between the PC and Satellite with the scroll down menu to [ Baud 115200 ]

COM ...x

Send

No line endingAutoscroll 115200 baud

9600 baud19200 baud38400 baud57600 baud74880 baud

230400 baud250000 baud

115200 baud

30

Page 11: UBO Code Booklet - Build UBObuildubo.co.uk/.../2017/02/UBO-Code-Booklet.small_.pdf · Teensy 3.6 Teensy 3.5 Teensy 3.0 Teensy LC Teensy++ 2.0 Teensy 2.0 USB Type “Serial” CPU

Run a full system self test report under the system report menu

Type in a number from the options shown inthe serial monitor window and hit Enter.

COM ...x

Send

No line endingAutoscroll 115200 baud

--------------------------------------------

--------------------------------------------

Ubo diagnostics shell: main menu1) System report2) Component interface3) Storage interface

1

Satellites go through rigorous tests to be mission ready.

This Serial Window is a way to communicate to the internal satellite functions to check the System for faults.

Send

--------------------------------------------

--------------------------------------------

Ubo diagnostics shell: System Report1) Basic system information2) Current status3) Full system self test report4) < Main menu

3

31

Page 12: UBO Code Booklet - Build UBObuildubo.co.uk/.../2017/02/UBO-Code-Booklet.small_.pdf · Teensy 3.6 Teensy 3.5 Teensy 3.0 Teensy LC Teensy++ 2.0 Teensy 2.0 USB Type “Serial” CPU

can you return a light sensor reading?

There are three light sensor readings to choose from. Choose one and get a reading.

Look at the system Report did everything initialize correctly? were there any faults?

You have Communicated with the satellitethrough a Text based Interface as opposed to a (GUI) Graphical User Interface.

A graphical user interface in this contextis the screen of your PC. To interact withyour PC’s screen you use a (TUI) Tangible User Interface (your computer mouse.)

COM ...x

Send

No line endingAutoscroll 115200 baud

--------------------------------------------

--------------------------------------------

Ubo diagnostics shell: Component interface1) Camera

3

2) Inertial Measurement Unit (IMU)3) Light sensor4) Tempreture sensor5) SD card6) Radio7) Electric Power System (EPS)8) < Main menu

Light sensor readings can be important in the space environment. an example would be Changing the satellites orientation so the solar panels get a sufficient amount of sunlight.

32

Page 13: UBO Code Booklet - Build UBObuildubo.co.uk/.../2017/02/UBO-Code-Booklet.small_.pdf · Teensy 3.6 Teensy 3.5 Teensy 3.0 Teensy LC Teensy++ 2.0 Teensy 2.0 USB Type “Serial” CPU

explore the rest of thefunctions on thesatellite to discoverwhat else you can do.

Can you think of anymission ideas?

33

Page 14: UBO Code Booklet - Build UBObuildubo.co.uk/.../2017/02/UBO-Code-Booklet.small_.pdf · Teensy 3.6 Teensy 3.5 Teensy 3.0 Teensy LC Teensy++ 2.0 Teensy 2.0 USB Type “Serial” CPU

Using what we know to write a program for the satellite

Step-3:

Write a program that shows the temperature of the satellites current environment

The temperature needs to be printed to theserial monitor every second

ubo.telemetry.getTemperature()Returns the current temperature in degrees Celcius

#include “Cube.h”allows you to access satellite specific code

Cube ubo;allows you to access satellite Functions

ubo.initialise()Sets Up Default settings

Serial.println()Shows you the contents of thebrackets in the serial monitor

What you need to know

sec

1 delay(1000)Prints the Tempreature every other second

h

34

Page 15: UBO Code Booklet - Build UBObuildubo.co.uk/.../2017/02/UBO-Code-Booklet.small_.pdf · Teensy 3.6 Teensy 3.5 Teensy 3.0 Teensy LC Teensy++ 2.0 Teensy 2.0 USB Type “Serial” CPU

COM ...x

Send

No line endingAutoscroll 115200 baud

Welcome to ubo, initialisation sequence has completed.The external temperature is 24.20 degress celciusThe external temperature is 24.14 degress celciusThe external temperature is 24.16 degress celciusThe external temperature is 24.20 degress celciusThe external temperature is 24.20 degress celciusThe external temperature is 24.22 degress celcius

If you managed to do This you should getthe Pop up window below on your screen

The temperature needs to be printed to theserial monitor every second

What do you need to do

sec

1

35

Page 16: UBO Code Booklet - Build UBObuildubo.co.uk/.../2017/02/UBO-Code-Booklet.small_.pdf · Teensy 3.6 Teensy 3.5 Teensy 3.0 Teensy LC Teensy++ 2.0 Teensy 2.0 USB Type “Serial” CPU

How it should look

File Edit

Temperature Arduino 1.6.12

Sketch Tools Help

// Including the cube library// Provides code for all of the satellite functions#include "Cube.h"

// Declaring an instance of the cube class, ubo.// We access the class functions through this instance.Cube ubo;

void setup() { // Initialising the satellite with default settings // This will start the serial monitor and wait for us to open it // Default buad rate: 115200 ubo.initialise();}

void loop() { // Creating a variable to hold the temperature reading float temperature;

// Setting our variable equal to the returned value of the function // ubo.telemetry.getTemperature() temperature = ubo.telemetry.getTemperature();

// Printing the temperature to the serial monitor Serial.print("The external temperature is "); Serial.print(temperature, 2); // To two decimal places Serial.print(" degrees celcius"); Serial.print("\n"); // New line

// Waiting one second before repeating delay(1000);}

Temperature

123456789

101112131415161718192021222324252627282930313233

Teensy 3.2 / 3.1, Serial, 48 MHz reduce code size, United Kingdom on COM14

36

Page 17: UBO Code Booklet - Build UBObuildubo.co.uk/.../2017/02/UBO-Code-Booklet.small_.pdf · Teensy 3.6 Teensy 3.5 Teensy 3.0 Teensy LC Teensy++ 2.0 Teensy 2.0 USB Type “Serial” CPU

The temperature in low earth orbit is also important to monitor the same way the light sensor readings were important. Temperature can vary in space from plus 80°C to minus 40°C. This means the battery can Overheat.

Overheating can cause the satellite to burst apart. Monitoring the temperature allows you to decide how much charge you are going to give the batteries. This inconjunction with deciding the orientation of your satellite through light sensor readings will keep your satellite active.

Satellite needs Charge reducing as it is closer to the sun

Satellite needs to be orientated so it makes use of the sun

Why Monitoring the Temperature of your satellite is important

+ 80°C- 40°C

37

Page 18: UBO Code Booklet - Build UBObuildubo.co.uk/.../2017/02/UBO-Code-Booklet.small_.pdf · Teensy 3.6 Teensy 3.5 Teensy 3.0 Teensy LC Teensy++ 2.0 Teensy 2.0 USB Type “Serial” CPU

GettingStarted

Are

Lostyou

?

38

Page 19: UBO Code Booklet - Build UBObuildubo.co.uk/.../2017/02/UBO-Code-Booklet.small_.pdf · Teensy 3.6 Teensy 3.5 Teensy 3.0 Teensy LC Teensy++ 2.0 Teensy 2.0 USB Type “Serial” CPU

Icons, Functions & Definitions

Cheat Sheet:ubo.serialInitialise(rate, timeout)Initialises serial communications for the satelliteSets the serial baudrate to default 115200. timeoutis the time to wait (in seconds) for a serial connection

ubo.telemetry.getTemperature()Returns a (float) value for the current temperature indegrees Celsius measured by the TMP102 sensor

Returns a (unsigned 16-bit integer) value for the UltraViolet reading measured by the SI1145 sensor

ubo.telemetry.getUV()

Returns a (unsigned 16-bit integer) value for the infraRed reading as measured by the SI1145 sensor

ubo.telemetry.getIR()

Returns a (unsigned 16-bit Integer) value for the visible light reading as measured by the SI1145 sensor

ubo.telemetry.getVisible()

Telemetry functions

Returns a (unsigned 16-bit) value for the acceleration measured in the x axis by the LSM9DS1 IMU

ubo.telemetry.getAccelX()

Returns a (unsigned 16-bit) value for theacceleration measured in the y axis by the LSM9DS1 IMU

ubo.telemetry.getAccelY()y

x

ubo.telemetry.getAccelZ()Returns a (unsigned 16-bit) value for theacceleration measured in the z axis by the LSM9DS1 IMU

z

39

Page 20: UBO Code Booklet - Build UBObuildubo.co.uk/.../2017/02/UBO-Code-Booklet.small_.pdf · Teensy 3.6 Teensy 3.5 Teensy 3.0 Teensy LC Teensy++ 2.0 Teensy 2.0 USB Type “Serial” CPU

x

y

ubo.telemetry.getMagX()Returns a (unsigned 16-bit) value for the magneticfield measured in the x axis by the LSM9DS1 IMU

Returns a (unsigned 16-bit) value for the magneticfield measured in the y axis by the LSM9DS1 IMU

ubo.telemetry.getMagY()

Returns a (unsigned 16-bit) value for the magneticfield measured in the z axis by the LSM9DS1 IMU

ubo.telemetry.getMagZ()

Returns a (unsigned 16-bit) value for the rotationrate measured in the x axis by the LSM9DS1 IMU

ubo.telemetry.getGyroX()

Returns a (unsigned 16-bit) value for the rotation rate measured in the y axis by the LSM9DS1 IMU

ubo.telemetry.getGyroY()

Returns a (unsigned 16-bit) value for the rotationrate measured in the z axis by the LSM9DS1 IMU

ubo.telemetry.getGyroZ()

x

y

z

z

Returns a (float) value for the roll angleof the satellite in degrees based on accelerometer data

ubo.telemetry.getRoll()

Returns a (float) value for the pitch angleof the satellite in degrees based on accelerometer data

ubo.telemetry.getPitch()

Returns a (float) value for the yaw angleof the satellite in degrees based on magnetometer data

ubo.telemetry.getYaw()

40

Page 21: UBO Code Booklet - Build UBObuildubo.co.uk/.../2017/02/UBO-Code-Booklet.small_.pdf · Teensy 3.6 Teensy 3.5 Teensy 3.0 Teensy LC Teensy++ 2.0 Teensy 2.0 USB Type “Serial” CPU

ubo.radio.initialise(NODEID, NETWORKID)Takes a node ID and a network ID as parameters. The defaultnetwork ID is 100, radios can only communicate with otherradios on the same network. The default node ID is 2. Messagescan be addressed to specific nodes, allowing satellites tocommunicate with each other or a groundstation Node ID 1Returns 1 on successful initialisation, 0 on failure

Radio functions

Takes a number between 1 and 31 as a parameter and sets thetransmission power of the radio. 1 is lowest power, 31 isThe highest power. Higher transmission power uses more energy

ubo.radio.setPower(level)

Takes an array of 16 bytes as an encryption key. This key isused to encrypt transmitted messages and decryptreceived messages. Encryption key must match betweentwo communicating devices for the messages to be read.Default value is 0 (no encryption)

ubo.radio.setEncrypt(key)

ubo.radio.sendMessage(message, ID, ack, Transmits a message to the provided ID. Set ack to TRUEif receiver acknowledgment is required. Returns 1 if anack is received, else returns 0

ubo.radio.messageAvailable()Returns 1 if a new message is available, else 0

ubo.radio.receiveMessage(messageBuffer)Will place the latest received message in a buffer

1 31

41

Page 22: UBO Code Booklet - Build UBObuildubo.co.uk/.../2017/02/UBO-Code-Booklet.small_.pdf · Teensy 3.6 Teensy 3.5 Teensy 3.0 Teensy LC Teensy++ 2.0 Teensy 2.0 USB Type “Serial” CPU

Electric Power System functions

ubo.eps.watchdogTimeoutSet(time);Takes an integer value for the watchdog timeout periodin seconds. A value of 0 disables the watchdog

Takes no input parameters Resets the watchdog counter. Mustbe called within the timeout period, or the satellite will restart.

ubo.eps.watchdogKick()

Resets the satellite by powering down all systems and restartingubo.eps.reset()

Takes no input parameters Updates the Output boolean variables(ubo.eps.busReg1, ubo.eps.busReg2, ubo.eps.busReg3, ubo.eps.busRaw1, ubo.eps.busRaw2)

ubo.eps.outputGET()

ubo.eps.outputSET(output, value)Takes the output and the boolean value to set it toinputs. Output is of the form 'output_3V3_1' or output_BAT_2for example. A value of 1 is enabled, a value of 0 is disabled

ubo.eps.batteryVoltage()Takes no input parameters Returns an (unsigned 16-bit)value for the battery voltage as measured by the EPS

ubo.eps.mpptVoltage()Takes no input parameters Returns an (unsigned 16-bit)value for the generated solar voltage as measured by the EPS

ubo.eps.systemCurrent()Takes no input parameters Returns an (unsigned 16-bit)value for the current used by system devices on the 3V3 line as measured by the EPS

ubo.eps.mpptCurrent()Takes no input parameters Returns an (unsigned 16-bit) valuefor the solar current produced, as measured by the EPS

iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii

iiiiii

i

i

1 60

42

Page 23: UBO Code Booklet - Build UBObuildubo.co.uk/.../2017/02/UBO-Code-Booklet.small_.pdf · Teensy 3.6 Teensy 3.5 Teensy 3.0 Teensy LC Teensy++ 2.0 Teensy 2.0 USB Type “Serial” CPU

ubo.eps.batteryCurrent()Takes no input parameters Returns a (signed 16-bit value)Value for the total battery current measured by the EPS.A positive value indicates a charging battery, a negativevalue indicates a discharging battery..

Takes no input parameters Returns an (unsigned 16-bit)Value for the total current used on the rawbattery buses as measured by the EPS

ubo.eps.rawBusCurrent()

ubo.eps.regBusCurrent()Takes no input parameters Returns an (unsigned 16-bit)value for the total current used onthe switched 3V3 buses as measured by the EPS

Definitions, Pins and comments

Pin List:Definition

pin

Comment

g7

g5

g3

g1

GPIO_7GPIO_5GPIO_3GPIO_1

392914

g8g6

g4g2

SCL

DI

RST

USBV

sda

DO

SCK

GND

3V3 g0

Digital IO, Can TX, PWM

GPIO_0 2 Digital Io, EPS IRQ

Digital IO, UARt rXDigital IO, 12C SCLDigital IO, 12-bit true analogue DAC

gPio_8gPio_6gPio_4gPio_2

2041030

Digital IO, 12-bit ADC, PWMDigital IO, Can RX, PWMDigital IO, UART TXDigital IO, 12C SDA

BUS_I2C_SCL 19 Serial Clock (12c) BUS_I2C_SDA 18 SeriaL Data (12c)

BUS_SPI_MiSo 12 SPI Master In Slave Out (bus, DI)

Reset Pin Reset pin, pull low to reset satellite

BUS_SPI_MOSI 11 SPI Master Out Slave In (bus, DO)BUS_SPI_SCK 13 SPI clock (bus, CLK)

USB Voltage 5V usb (when plugged in)3.3v line system 3.3v line, powered

whenever satellite is on

Ground Use to measure Voltage

Prototyping Board Pins on right side

43

Page 24: UBO Code Booklet - Build UBObuildubo.co.uk/.../2017/02/UBO-Code-Booklet.small_.pdf · Teensy 3.6 Teensy 3.5 Teensy 3.0 Teensy LC Teensy++ 2.0 Teensy 2.0 USB Type “Serial” CPU

switch Voltage to Line 3

GPIO_9 13 Digital IO, 13-bit differential / 12-bit single ended ADCGPIO_10 12

GPIO_11 5GPIO_12 21

g10

v1v3

rst

3v3 gnd

g12

v2

b1

b2

g11

g9

SD card chip select (Allows payloads access to the SD card.)

CS_RFM 15 Radio Chip Select

NIrQ_RFM 15 Radio IRQ Pin

Digital IO, 12-bit ADC, PWM

Voltage Line Indicator LED

Battery Indicator LED

Power Indicator LED

Power Indicator LED

Volt Line 1 Volt Line 2Volt Line 3

Line conected to Radio Line conected to camera

switch Battery Line to line 2Battery Line 1Battery Line 2

switch Battery Line to line 1

Reset Pin

3.3v line system 3.3v line, powered whenever satellite is on

Ground Use to measure Voltage

LED_green 0Program Erase Button

LED_Yellow 1

LED_Amber 12

LED_Blue 33

Prototyping Board Pins on Left side and LED’s

OnBoard Computer Pins and LED’s

44

Page 25: UBO Code Booklet - Build UBObuildubo.co.uk/.../2017/02/UBO-Code-Booklet.small_.pdf · Teensy 3.6 Teensy 3.5 Teensy 3.0 Teensy LC Teensy++ 2.0 Teensy 2.0 USB Type “Serial” CPU

Glossary:an instrument for measuring the acceleration of a moving or vibrating body.

accelerometer

A number related to the speed of data transmission in a system. The rate indicates the number of electrical oscillations per second that occurs within a data transmission. The higher the baud rate, the more bits per second that are transferred.

Baudrate

In computer science, the Boolean data type Is data that has two values (usually denoted true and false), intended to represent the truth values of logic and Boolean algebra.

Boolean

In this instance a Bus refers to a system that communicates between internal components. Communications could be using SPI or I2C functions.

Bus

A Bit is a binary Value that is either the number 1 or 0.Bit

A byte is made up of 8 Binary Bits. Byte

COM (Communication port) is the original, yet still common, name of the serial port interface.

Com

An electric current is the rate of flow of an electric circuit. this charge is often carried by moving electrons in a wire.

Current

Is a signal on a communication bus for keeping multiple devices in sync.Clock Line

45

Page 26: UBO Code Booklet - Build UBObuildubo.co.uk/.../2017/02/UBO-Code-Booklet.small_.pdf · Teensy 3.6 Teensy 3.5 Teensy 3.0 Teensy LC Teensy++ 2.0 Teensy 2.0 USB Type “Serial” CPU

A datA type in C , for storing values containing a decimal pointFloat

IMU stands for Inertial measure unit. The IMU consists of the accelerometer, Magnetometer and gyrosope.

IMU

Decryption is the process of taking encoded or encrypted text or other data and converting it back into text that you or the computer can read and understand.

Decryption

The process of converting information or data into a code, especially to prevent unauthorized access. To read an encrypted file, you must have access to a secret key or password that enables you to decrypt it.

encryption

Electrical Power System. The circuit board responsible for charging the battery from the solar panels and providing power to the rest of the satellite.

EPS

GPIO (General Purpose Input/Output). Are microcontroller pins that can be used for various applications. GPIOs will support outputting a high or a low logic level. Many will also have additional functionality beyond basic IO (input output).

GPIO

I2C Inter-Integrated circuit (Pronounced I squared C). A synchronous serial communications protocol for communicating between microcontrollers or similar embedded systems. The I2C ensure the master and slave pins are in sync.

I2C

Infrared radiation (IR) refers to the red non visible end of the electromagnetic spectrum. One of the most common uses for infrared is to produce thermal imaging.

InfraRed

A integer is a whole value that doesn’t have a decimal point. A integer can only be a whole number e.g 1 2 3 etc...

Integer

46

Page 27: UBO Code Booklet - Build UBObuildubo.co.uk/.../2017/02/UBO-Code-Booklet.small_.pdf · Teensy 3.6 Teensy 3.5 Teensy 3.0 Teensy LC Teensy++ 2.0 Teensy 2.0 USB Type “Serial” CPU

Is an abbreviation of interrupt. An iRQ is an interruption to the processors main routine allowing it to serve the requirments of the interupting process

IRQ

The device that initialises communication and has control over the slave device.

Master

A Logic level can be high or low. A logic level that is high refers to 3.3 volts, a logic level that is low refers to the voltage of ground.

Logic Level

An magnetometer is an instrument that measures magnetic field strengths. The onboard kit can measure it in all 3 axises.

Magnetomter

The maximum power point tracker (MPPT). Is a algorithgmic chip that controls voltage, current and ultimately the relationship between. This ensures that maximum power is held and controlled.

MPPT

A node in this instance is Anything with a radio. Nodes are addressable devices on a network.

Node

The On board computer is the main processor of the satellite. The OBC is responsible for controlling all the other systems and all program code.

OBC

Is the angle between the axis running from wing to wing of a spacecraft. Pitch is the difference in angle of the nose using that axis.

Pitch Angle

The PCB Printed Circuit Board. Typically is a fibreglass board with copper traces used to connect electronic components together.

PCB

47

Page 28: UBO Code Booklet - Build UBObuildubo.co.uk/.../2017/02/UBO-Code-Booklet.small_.pdf · Teensy 3.6 Teensy 3.5 Teensy 3.0 Teensy LC Teensy++ 2.0 Teensy 2.0 USB Type “Serial” CPU

is the process of sending data one bit at a time. Serial communication is done over a text based interface.

Serial Communication

The payload interface board Contains a light and temperature sensor, and a camera as an example payload. Additional payloads can also be integrated here.

PSB

Radio Frequency Plate. PCB mount for our radio antenna and base of the satellite.

RFP

The roll angle is based on the rotation about the axis running from the nose to tail of the spacecraft.

Roll Angle

a signed value can be positive or negative Number.Signed

A device that listens to the master devices communication and must do the process the master tells it to do.

Slave

Serial Peripheral Interface. is Another synchronous serial communications protocol, like I2C this uses a clock line to synchronise master and slave devices, however it uses two data lines, Master In Slave Out (MISO) and Master Out Slave In (MOSI) to transfer data. This enables faster data transfers.

SPI

a string in computer science is a sequence of characters.String

Universal Asynchronous Receive Transmit - An asynchronous communications protocol. Is a protocol that does not require a separate clock line, instead it relies on the two devices running at the same speed to interpret data correctly. It has separate lines for receiving and transmitting data, like SPI. Often referred to as serial communication.

UArt

48

Page 29: UBO Code Booklet - Build UBObuildubo.co.uk/.../2017/02/UBO-Code-Booklet.small_.pdf · Teensy 3.6 Teensy 3.5 Teensy 3.0 Teensy LC Teensy++ 2.0 Teensy 2.0 USB Type “Serial” CPU

an electromotive force or potential difference which is expressed in the unit Volts.

Voltage

Used to describe rays of light on the electromagnetic spectrum that cannot be seen and that are slightly shorter than the rays of violet light. UV light is naturally found in sunlight.

Ultra Violet

A unsigned value can only be a positive number.Unsigned

Measures the intensity of light in the visible range of the spectrum.Visible Light reading

Allows you to reset the satellite when you can’t physical reach it must be reset within the timout period to avoid resetting the satellite. Allows it to autonomously recover from faults itself.

WatchDog Timer

The yaw angle is shown in the difference between the nose being more left or right on the axis running up and down the middle of the spacecraft.

Yaw Angle

49

Page 30: UBO Code Booklet - Build UBObuildubo.co.uk/.../2017/02/UBO-Code-Booklet.small_.pdf · Teensy 3.6 Teensy 3.5 Teensy 3.0 Teensy LC Teensy++ 2.0 Teensy 2.0 USB Type “Serial” CPU

You areNowReadytoLaunch

50

Page 31: UBO Code Booklet - Build UBObuildubo.co.uk/.../2017/02/UBO-Code-Booklet.small_.pdf · Teensy 3.6 Teensy 3.5 Teensy 3.0 Teensy LC Teensy++ 2.0 Teensy 2.0 USB Type “Serial” CPU

@BuildUBO

BuildUbo.co.uk