- Max Polzin
- Keyanna Coghlan
- Hooman Jazebizadeh
This document outlines the design of software and hardware for a eletrical power distribution system (EPS) used in "flatsat", a teaching aid simulating a cubesat, aimed for class-room use. This repository contains the telemetry, control, and interface software for this system.
The two main sections of this repo are the EDUSAT Web Application Code (in the folder "EDUSAT_App"), and the EDUSAT Telemetry code for MCU data collection (in the folder "EDUSAT_Telem").
To set up this project:
- Clone the git repository. Tutorial for basic git functions found here.
- Install nodejs:
- Install yarn. It is the prefered package manager, and can be installed via nodejs's npm. We use classic yarn (v1), but other versions should be compatible.
- Run the EDUSAT.bat file (Windows Only). Two new command prompt windows will open up, as well as a webpage in your browser at localhost:8085.
NOTE: An EDUSAT.sh file for Linux based systems is being created, but has not been added to the git repository yet.
NOTE: If you close the command prompt windows, the GUI will no longer work. Keep them open.
EDUSAT's telemtry is visualized in a Web interface powered by Typescipt and Nodejs. Nodejs allows for Javascript and Typescript to be excuted outside of a browser, in this case it is neccesary as it allows for direct acces to the serial port to commuincate with the microcontroller gathering the telemetry.
To make any changes to this project, knowledge of the software and libraries used to develop it will be required. Edits to the overall look of the code can be made by modifying the index.html and style.css files.
Edits to the look of specific features of the UI can be made by altering snippets of code contained within <React.Fragment></React.Fragment>
braces found in the App.tsx file (EDUSAT>EDUSAT_App>webpage>src>App.tsx
).
If any additional library dependencies are required, they can be added to the package.json manually, or with yarn by running the following command in the EDUSAT>EDUSAT_App>webpage
folder:
yarn add DEPENDENCY_NAME
For more information about React (if you would like to use React to add more features), follow this link.
Changes made to the micro-controller code can simply be made in your editor of choice and flashed onto the Arduino in the system.
Changes to the hardware schematics can be made by editing the schematic file provided in the Google drive (please email for access to this). EasyEDA can be used to edit this files, simply upload the file at the following link
- EDUSAT.bat: Main script needed to be excuted, launches web-app.
- Hardware: All hardware documentation.
- EDUSAT_App: Talks to MCU and gathers data via serial port, sends data to a server and another client recieves this data and displays it on a webpage.
- serial: Local client responsible for serial communcation.
- src:
- index.tsx: Sets up websockets to connect to server, also deals with serial communication to MCU.
- interfaces.ts: Data structure definitions.
- src:
- socket_server: Locally hostedn server for communication between serial and webpage clients.
- src:
- main.ts: Creates a Socket.IO server (nodejs), also handles writing of data to csv.
- interfaces.ts: Data structure definitions.
- src:
- webpage: Local client responsible for displaying webpage.
- src:
- App.tsx: Creates React components for the GUI.
- interfaces.ts: Data structure definitions.
- index.tsx: Connects to Socket.IO server and handles all graphs in the GUI.
- index.html: Defines webpage structure.
- style.css: Defines style for webpage.
- src:
- serial: Local client responsible for serial communcation.
- EDUSAT_Telem: Gathers data from circuit using voltage, current, and temperature sensors and sends it via serial connetion to a connected computer.
- EDUSAT_Telem.ino: Main control logic to read and write data to serial ports and GPIO pins of the MCU.
- MUX.cpp: Class file to describe multiplexer (MUX) behaviour.
- MUX.h: Header describing MUX class.
- Sensors.cpp: Class file to describe a individual sensor.
- Sensors.h: Header describing sensors class.
- SystemStatus.cpp: Class file for which coordinates individual sensor objects and MUX object.
- SystemStatus.h: Header describing systemstatus class.
The main components of EDUSAT can be seen in the diagram below:
More detailed schematics can be found in the following sections.
Note the potentiometer values (components VR1, VR2, VR3), these are used to allow for a 12V input and a 7.4V output.
A prototype version is pictured below:
Note the colours around each component:
- RED = MPPT and system input (either through a solar panel or a PSU).
- BLUE = Telemetry boards, the one on the left is full of current sensors and amplifiers. The one on the right has the voltage divider, MUX, and arduino. Headers are used to connect the current sensing board and temperature sensors to the MUX.
- Green = DC-DC conversion and system output. The top board is the 9V buck-boost, then the 3V3 and 5V boards are mounted side by side on the telemetry board.
- Yellow = A 800 mAH 2S 7.4V Lipo in a 3D printed mount and a extra board that serves as a junction between all the components.
On the MPPT and system input boards, there are three potentiometers. From top to bottom, these potentiometers correspond to VR2, VR3, and VR1 in the MPPT schematic. Their values indicated in the schematic allow for a 7.4V output to the COM7/BATT+ output to charge the battery.
The below tables outline the main unique components of each subsystem. A detailed BOM containing all components can be found in the Project Google Drive.
Component | Part Number | Description | Source |
---|---|---|---|
Max Peak Power Tracking Chip | LT3652EMSE#PBF | IC BATT CHG MULTI-CHEM 12MSOP | Digikey |
Chip Adapter | IPC0078 | MSOP-12 TO DIP-16 SMT ADAPTER | Digikey |
Shunt Resistor | PWR220T-20-1R00F | 1 Ohm 1% Resistor | Digikey |
Component | Part Number | Description | Source |
---|---|---|---|
Sparkfun Buck-Boost Converter | COM15208 | Buck Boost Convert with Variable output (3.3V, 5V, or custom) | Digikey |
Variable Output Buck-Boost Converter | - | 5V to 30V input, 1.25V to 30V output, DC-DC Converter | Amazon |
Component | Part Number | Description | Source |
---|---|---|---|
Sparkfun MUX | BOB-09056 | 16 Channel Analog to Analog Mux | Digikey |
Temperature Sensors | NXRT15XM202EA1B040 | THERMISTOR NTC 2KOHM 3500K BEAD | Digikey |
Current Sensor | MAX4080FASA+T | Current Sensor | Digikey |
SMD Adapter | 1528-1071-ND | Adapter for mounting the MAX4080 | Digikey |
EDUSAT's telemetry in the form of voltages, currents, and temperatures are gathered on the MCU. This data is then sent via serial port to the client running on the connected computer.
The MCU can be easily flashed using the Arduino IDE's built in tools or through VS Code's Arduino Extension. See this link for more information on the extension.
The number of sensors being read is currently limited by the number of channels on the CD74HC4067 MUX (link. Currently 16 sensors are used, the SystemStatus object keeps a list of the voltage, current, and temperature sensors. The size is set via the V_SENSE_SIZE, I_SENSE_SIZE, T_SENSE_SIZE parameters in SystemStatus.h.
Data from the sensors is updated via the SystemStatus's updateStatus function. Telemetry is then sent over the serial connection using the sendTelemtry function. Note that this data is sent in the following format:
H,0-V,...,5-V,0-C,...,5-C,0-T,...,3-T,F
Where the V,C, and T represent a integer voltage, current, or temperature. The H and F are used to denote the start and end of a individual message.
Voltage Sensors: Voltage sensing is achieved by simply connecting various points of the system to the pins of the MUX, seen in the Telemetry schematic on pins 16-21 of the MUX (U2). Since the arduino is limited to 5V on its digital and analog pins some votlage dividers are used when measuring certain parts of the system. For example the 9V DC-DC output is measured and run through a voltage divider to ensure the pins of the Arduino are not damaged. The calculations to convert the reduced voltage back to the actual value at the test point are found below for each sensor in the circuit.
Voltage Sensor Number | Gain |
---|---|
0 & 1 | 1 |
2 & 3 | 3 |
4 | 1.7 |
5 | 2 |
Actual Voltage = Measured Voltage * Gain
Current Sensors: Current sensing is achieved using the MA4080 in series with various points throughout the system as shown in the Telemetry schematic. Since the measured currents are sometimes small and the MAX4080 outputs a voltage equivalent to the measured current, LM348N amplifiers are used between the current sensors and the MUX to allow for a more realiable measurement on-board the Arduino. The calculation to convert these measurements back to current is shown below.
Actual Current = Measured Voltage / Current Gain
The Current Gain for the sensors in this circuit is 3. (This value is defined in Sensors.h
.)
Temperature Sensors: 2 kOhm, 3500K thermistors are used to measure temperature at various points throughout the system. These are mechanically mounted on various IC's such as the LT3652 used in the MPPT system. The circuitry for the thermistors is very similar to that of the voltage dividers (see the Telemetry schematic, R29,31,33,35), as such the measured signal is fed directly into the MUX and small calculation is performed by the Arduino to convert the measured voltage to a temperature, as shown below.
Rt = 10000 * (5/V - 1)
Temperature = (1 / ((1 / 298.15) + (log(Rt / 2000) / 3500))) - 273.15
This above formula provides temperature in Celsius.
EDUSAT's main interface is a web-client that can be viewed in any web browser and launched from any computer. In order to launch and open the app, follow the instructions below:
In the main folder, there is a batch script (" .bat" extension). To run this script, simply double click the script file in your file explorer. If the computer that you are running on does not allow you run these scripts, follow the command line setup instructions below.
- Open up a command prompt
- Navigate to the "EDUSAT_App" folder
- Type the following command and press enter:
start cd serial && start cd socket_server && cd webpage
- Now there are three instances of command prompt running, one in each subfolder of the EDUSAT_App
- In the command prompt window in the
serial
subfolder, type the following commands, pressing enter after each command. Note: this may not work if you do not have an arduino connected, as an arduino is necessary for monitoring the system. For running the entire system, you must be connected to the onboard arduino.yarn setup
yarn build
yarn start
- In the command prompt window in the
socket_server
subfolder, type the following commands, pressing enter after each command:yarn setup
yarn build
yarn start
- In the command prompt windows in the
webpage
subfolder, type the following commands, pressing enter after each command:yarn setup
yarn serve
- In this command prompt as the previous step, you should see something similar to the following:
yarn run v1.22.4
$ parcel serve --port 8085 src/index.html
Server running at http://localhost:8085
- In a web browser, go to the address on the last line, either by copying and pasting, or by clicking the address itself in your command prompt window
After setting up the web client using either the bash script or the command line instructions provided aobve, you will be able to access the web-client through the web browser.
To select which data points are being graphed on each graph, toggle each dataset on and off by clicking on their legend entry.
To download the data into a csv:
- Click the "Prepare CSV" Button
- Click the "DOWNLOAD BUTTON" and a .csv file named with the current date and time will be downloaded to your computer. It will contain all data entries since the last time data was prepared and downloaded
Once done with the system, it can be closed by pressing CTRL+C
in each command prompt browser, followed by: y
then ENTER
when the command prompt asks if you wish to terminate the program.
If issues arise during the setup, installation, or use of this code or you need access to the Google drive, feel free to contact: [email protected] or [email protected].