@ -0,0 +1,313 @@
|
|||||||
|
#include <Wire.h>
|
||||||
|
#include <Adafruit_Sensor.h>
|
||||||
|
#include <Adafruit_BME280.h>
|
||||||
|
#include <MPU6050_tockn.h>
|
||||||
|
#include <EEPROM.h>
|
||||||
|
#include <TinyGPS.h>
|
||||||
|
|
||||||
|
#define SEALEVELPRESSURE_HPA (1013.25)
|
||||||
|
|
||||||
|
Adafruit_BME280 bme;
|
||||||
|
MPU6050 mpu6050(Wire);
|
||||||
|
TinyGPS gps;
|
||||||
|
|
||||||
|
long timer = 0;
|
||||||
|
int bmePresent;
|
||||||
|
int RXLED = 17; // The RX LED has a defined Arduino pin
|
||||||
|
int greenLED = 9;
|
||||||
|
int blueLED = 8;
|
||||||
|
int Sensor1 = 0;
|
||||||
|
int Sensor2 = 0;
|
||||||
|
float Sensor3 = 0;
|
||||||
|
void eeprom_word_write(int addr, int val);
|
||||||
|
short eeprom_word_read(int addr);
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
|
||||||
|
Serial.begin(9600); // Serial Monitor for testing
|
||||||
|
|
||||||
|
Serial1.begin(9600); // Pi UART
|
||||||
|
Serial2.begin(9600); // GPS on STM32 pins PA2, PA3
|
||||||
|
Serial.println("Starting!");
|
||||||
|
|
||||||
|
blink_setup();
|
||||||
|
|
||||||
|
blink(500);
|
||||||
|
delay(250);
|
||||||
|
blink(500);
|
||||||
|
delay(250);
|
||||||
|
led_set(greenLED, HIGH);
|
||||||
|
delay(250);
|
||||||
|
led_set(greenLED, LOW);
|
||||||
|
led_set(blueLED, HIGH);
|
||||||
|
delay(250);
|
||||||
|
led_set(blueLED, LOW);
|
||||||
|
|
||||||
|
if (bme.begin(0x76)) {
|
||||||
|
bmePresent = 1;
|
||||||
|
} else {
|
||||||
|
Serial.println("Could not find a valid BME280 sensor, check wiring!");
|
||||||
|
bmePresent = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
mpu6050.begin();
|
||||||
|
|
||||||
|
if (eeprom_word_read(0) == 0xA07)
|
||||||
|
{
|
||||||
|
Serial.println("Reading gyro offsets from EEPROM\n");
|
||||||
|
|
||||||
|
float xOffset = ((float)eeprom_word_read(1)) / 100.0;
|
||||||
|
float yOffset = ((float)eeprom_word_read(2)) / 100.0;
|
||||||
|
float zOffset = ((float)eeprom_word_read(3)) / 100.0;
|
||||||
|
|
||||||
|
Serial.println(xOffset, DEC);
|
||||||
|
Serial.println(yOffset, DEC);
|
||||||
|
Serial.println(zOffset, DEC);
|
||||||
|
|
||||||
|
mpu6050.setGyroOffsets(xOffset, yOffset, zOffset);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Serial.println("Calculating gyro offsets and storing in EEPROM\n");
|
||||||
|
|
||||||
|
mpu6050.calcGyroOffsets(true);
|
||||||
|
|
||||||
|
eeprom_word_write(0, 0xA07);
|
||||||
|
eeprom_word_write(1, (int)(mpu6050.getGyroXoffset() * 100.0) + 0.5);
|
||||||
|
eeprom_word_write(2, (int)(mpu6050.getGyroYoffset() * 100.0) + 0.5);
|
||||||
|
eeprom_word_write(3, (int)(mpu6050.getGyroZoffset() * 100.0) + 0.5);
|
||||||
|
|
||||||
|
Serial.println(eeprom_word_read(0), HEX);
|
||||||
|
Serial.println(((float)eeprom_word_read(1)) / 100.0, DEC);
|
||||||
|
Serial.println(((float)eeprom_word_read(2)) / 100.0, DEC);
|
||||||
|
Serial.println(((float)eeprom_word_read(3)) / 100.0, DEC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
|
||||||
|
if (Serial.available() > 0) {
|
||||||
|
blink(50);
|
||||||
|
char result = Serial.read();
|
||||||
|
// Serial.println(result);
|
||||||
|
|
||||||
|
if (result == 'R') {
|
||||||
|
Serial.println("OK");
|
||||||
|
delay(500);
|
||||||
|
setup();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result == '?')
|
||||||
|
{
|
||||||
|
if (bmePresent) {
|
||||||
|
Serial.print("OK BME280 ");
|
||||||
|
Serial.print(bme.readTemperature());
|
||||||
|
Serial.print(" ");
|
||||||
|
Serial.print(bme.readPressure() / 100.0F);
|
||||||
|
Serial.print(" ");
|
||||||
|
Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA));
|
||||||
|
Serial.print(" ");
|
||||||
|
Serial.print(bme.readHumidity());
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
Serial.print("OK BME280 0.0 0.0 0.0 0.0");
|
||||||
|
}
|
||||||
|
mpu6050.update();
|
||||||
|
|
||||||
|
Serial.print(" MPU6050 ");
|
||||||
|
Serial.print(mpu6050.getGyroX());
|
||||||
|
Serial.print(" ");
|
||||||
|
Serial.print(mpu6050.getGyroY());
|
||||||
|
Serial.print(" ");
|
||||||
|
Serial.print(mpu6050.getGyroZ());
|
||||||
|
|
||||||
|
Serial.print(" ");
|
||||||
|
Serial.print(mpu6050.getAccX());
|
||||||
|
Serial.print(" ");
|
||||||
|
Serial.print(mpu6050.getAccY());
|
||||||
|
Serial.print(" ");
|
||||||
|
Serial.print(mpu6050.getAccZ());
|
||||||
|
|
||||||
|
Serial.print(" XS ");
|
||||||
|
Serial.print(Sensor1);
|
||||||
|
Serial.print(" ");
|
||||||
|
Serial.print(Sensor2);
|
||||||
|
Serial.print(" ");
|
||||||
|
Serial.println(Sensor3);
|
||||||
|
|
||||||
|
float rotation = sqrt(mpu6050.getGyroX()*mpu6050.getGyroX() + mpu6050.getGyroY()*mpu6050.getGyroY() + mpu6050.getGyroZ()*mpu6050.getGyroZ());
|
||||||
|
float acceleration = sqrt(mpu6050.getAccX()*mpu6050.getAccX() + mpu6050.getAccY()*mpu6050.getAccY() + mpu6050.getAccZ()*mpu6050.getAccZ());
|
||||||
|
// Serial.print(rotation);
|
||||||
|
// Serial.print(" ");
|
||||||
|
// Serial.println(acceleration);
|
||||||
|
|
||||||
|
if (acceleration > 1.2)
|
||||||
|
led_set(greenLED, HIGH);
|
||||||
|
else
|
||||||
|
led_set(greenLED, LOW);
|
||||||
|
|
||||||
|
if (rotation > 5)
|
||||||
|
led_set(blueLED, HIGH);
|
||||||
|
else
|
||||||
|
led_set(blueLED, LOW);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Serial1.available() > 0) {
|
||||||
|
|
||||||
|
blink(50);
|
||||||
|
char result = Serial1.read();
|
||||||
|
// Serial1.println(result);
|
||||||
|
|
||||||
|
if (result == 'R') {
|
||||||
|
Serial1.println("OK");
|
||||||
|
delay(500);
|
||||||
|
setup();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result == '?')
|
||||||
|
{
|
||||||
|
if (bmePresent) {
|
||||||
|
Serial1.print("OK BME280 ");
|
||||||
|
Serial1.print(bme.readTemperature());
|
||||||
|
Serial1.print(" ");
|
||||||
|
Serial1.print(bme.readPressure() / 100.0F);
|
||||||
|
Serial1.print(" ");
|
||||||
|
Serial1.print(bme.readAltitude(SEALEVELPRESSURE_HPA));
|
||||||
|
Serial1.print(" ");
|
||||||
|
Serial1.print(bme.readHumidity());
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
Serial1.print("OK BME280 0.0 0.0 0.0 0.0");
|
||||||
|
}
|
||||||
|
mpu6050.update();
|
||||||
|
|
||||||
|
Serial1.print(" MPU6050 ");
|
||||||
|
Serial1.print(mpu6050.getGyroX());
|
||||||
|
Serial1.print(" ");
|
||||||
|
Serial1.print(mpu6050.getGyroY());
|
||||||
|
Serial1.print(" ");
|
||||||
|
Serial1.print(mpu6050.getGyroZ());
|
||||||
|
|
||||||
|
Serial1.print(" ");
|
||||||
|
Serial1.print(mpu6050.getAccX());
|
||||||
|
Serial1.print(" ");
|
||||||
|
Serial1.print(mpu6050.getAccY());
|
||||||
|
Serial1.print(" ");
|
||||||
|
Serial1.print(mpu6050.getAccZ());
|
||||||
|
|
||||||
|
Serial1.print(" XS ");
|
||||||
|
Serial1.print(Sensor1);
|
||||||
|
Serial1.print(" ");
|
||||||
|
Serial1.print(Sensor2);
|
||||||
|
Serial1.print(" ");
|
||||||
|
Serial1.println(Sensor3);
|
||||||
|
|
||||||
|
float rotation = sqrt(mpu6050.getGyroX()*mpu6050.getGyroX() + mpu6050.getGyroY()*mpu6050.getGyroY() + mpu6050.getGyroZ()*mpu6050.getGyroZ());
|
||||||
|
float acceleration = sqrt(mpu6050.getAccX()*mpu6050.getAccX() + mpu6050.getAccY()*mpu6050.getAccY() + mpu6050.getAccZ()*mpu6050.getAccZ());
|
||||||
|
// Serial.print(rotation);
|
||||||
|
// Serial.print(" ");
|
||||||
|
// Serial.println(acceleration);
|
||||||
|
|
||||||
|
if (acceleration > 1.2)
|
||||||
|
led_set(greenLED, HIGH);
|
||||||
|
else
|
||||||
|
led_set(greenLED, LOW);
|
||||||
|
|
||||||
|
if (rotation > 5)
|
||||||
|
led_set(blueLED, HIGH);
|
||||||
|
else
|
||||||
|
led_set(blueLED, LOW);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bool newData = false;
|
||||||
|
unsigned long chars;
|
||||||
|
unsigned short sentences, failed;
|
||||||
|
|
||||||
|
// For one second we parse GPS data and report some key values
|
||||||
|
for (unsigned long start = millis(); millis() - start < 100;) // 1000;)
|
||||||
|
{
|
||||||
|
while (Serial2.available())
|
||||||
|
{
|
||||||
|
char c = Serial2.read();
|
||||||
|
Serial.write(c); // uncomment this line if you want to see the GPS data flowing
|
||||||
|
if (gps.encode(c)) // Did a new valid sentence come in?
|
||||||
|
newData = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (newData)
|
||||||
|
{
|
||||||
|
float flon, flat;
|
||||||
|
unsigned long age;
|
||||||
|
gps.f_get_position(&flat, &flon, &age);
|
||||||
|
Sensor1 = flat * 100;
|
||||||
|
Sensor2 = flon * 100;
|
||||||
|
Sensor3 = (float) gps.altitude()/100.0;
|
||||||
|
}
|
||||||
|
// delay(100);
|
||||||
|
}
|
||||||
|
|
||||||
|
void eeprom_word_write(int addr, int val)
|
||||||
|
{
|
||||||
|
EEPROM.write(addr * 2, lowByte(val));
|
||||||
|
EEPROM.write(addr * 2 + 1, highByte(val));
|
||||||
|
}
|
||||||
|
|
||||||
|
short eeprom_word_read(int addr)
|
||||||
|
{
|
||||||
|
return ((EEPROM.read(addr * 2 + 1) << 8) | EEPROM.read(addr * 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
void blink_setup()
|
||||||
|
{
|
||||||
|
#if defined(ARDUINO_ARCH_STM32F0) || defined(ARDUINO_ARCH_STM32F1) || defined(ARDUINO_ARCH_STM32F3) || defined(ARDUINO_ARCH_STM32F4) || defined(ARDUINO_ARCH_STM32L4)
|
||||||
|
// initialize digital pin PB1 as an output.
|
||||||
|
pinMode(PC13, OUTPUT);
|
||||||
|
pinMode(PB9, OUTPUT);
|
||||||
|
pinMode(PB8, OUTPUT);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined __AVR_ATmega32U4__
|
||||||
|
pinMode(RXLED, OUTPUT); // Set RX LED as an output
|
||||||
|
// TX LED is set as an output behind the scenes
|
||||||
|
pinMode(greenLED, OUTPUT);
|
||||||
|
pinMode(blueLED,OUTPUT);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void blink(int length)
|
||||||
|
{
|
||||||
|
#if defined(ARDUINO_ARCH_STM32F0) || defined(ARDUINO_ARCH_STM32F1) || defined(ARDUINO_ARCH_STM32F3) || defined(ARDUINO_ARCH_STM32F4) || defined(ARDUINO_ARCH_STM32L4)
|
||||||
|
digitalWrite(PC13, LOW); // turn the LED on (HIGH is the voltage level)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined __AVR_ATmega32U4__
|
||||||
|
digitalWrite(RXLED, LOW); // set the RX LED ON
|
||||||
|
TXLED0; //TX LED is not tied to a normally controlled pin so a macro is needed, turn LED OFF
|
||||||
|
#endif
|
||||||
|
|
||||||
|
delay(length); // wait for a lenth of time
|
||||||
|
|
||||||
|
#if defined(ARDUINO_ARCH_STM32F0) || defined(ARDUINO_ARCH_STM32F1) || defined(ARDUINO_ARCH_STM32F3) || defined(ARDUINO_ARCH_STM32F4) || defined(ARDUINO_ARCH_STM32L4)
|
||||||
|
digitalWrite(PC13, HIGH); // turn the LED off by making the voltage LOW
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined __AVR_ATmega32U4__
|
||||||
|
digitalWrite(RXLED, HIGH); // set the RX LED OFF
|
||||||
|
TXLED0; //TX LED is not tied to a normally controlled pin so a macro is needed, turn LED OFF
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void led_set(int ledPin, bool state)
|
||||||
|
{
|
||||||
|
#if defined(ARDUINO_ARCH_STM32F0) || defined(ARDUINO_ARCH_STM32F1) || defined(ARDUINO_ARCH_STM32F3) || defined(ARDUINO_ARCH_STM32F4) || defined(ARDUINO_ARCH_STM32L4)
|
||||||
|
if (ledPin == greenLED)
|
||||||
|
digitalWrite(PB9, state);
|
||||||
|
else if (ledPin == blueLED)
|
||||||
|
digitalWrite(PB8, state);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined __AVR_ATmega32U4__
|
||||||
|
digitalWrite(ledPin, state);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
@ -0,0 +1,105 @@
|
|||||||
|
/*
|
||||||
|
Blink
|
||||||
|
Turns on an LED on for one second, then off for one second, repeatedly.
|
||||||
|
Most Arduinos have an on-board LED you can control. On the Uno and
|
||||||
|
Leonardo, it is attached to digital pin 13. If you're unsure what
|
||||||
|
pin the on-board LED is connected to on your Arduino model, check
|
||||||
|
the documentation at http://arduino.cc
|
||||||
|
This example code is in the public domain.
|
||||||
|
modified 8 May 2014
|
||||||
|
by Scott Fitzgerald
|
||||||
|
|
||||||
|
Modified by Roger Clark. www.rogerclark.net for Maple mini 25th April 2015 , where the LED is on PC13
|
||||||
|
|
||||||
|
Added CubeSatSim Payload tests for STM32 and Pro Micro by Alan Johnston, KU2Y
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
int sensorValue = 0;
|
||||||
|
int greenLED = 9;
|
||||||
|
int blueLED = 8;
|
||||||
|
// Calibration data for diode temperature sensor
|
||||||
|
float T1 = 25; // Temperature data point 1
|
||||||
|
float R1 = 373; // Reading data point 1
|
||||||
|
float T2 = 17; // Temperature data point 2
|
||||||
|
float R2 = 405; // Reading data point 2
|
||||||
|
|
||||||
|
// the setup function runs once when you press reset or power the board
|
||||||
|
void setup() {
|
||||||
|
|
||||||
|
#if defined(ARDUINO_ARCH_STM32F0) || defined(ARDUINO_ARCH_STM32F1) || defined(ARDUINO_ARCH_STM32F3) || defined(ARDUINO_ARCH_STM32F4) || defined(ARDUINO_ARCH_STM32L4)
|
||||||
|
// initialize digital pin PB1 as an output.
|
||||||
|
pinMode(PB9, OUTPUT);
|
||||||
|
pinMode(PB8, OUTPUT);
|
||||||
|
pinMode(PA0, INPUT_ANALOG);
|
||||||
|
pinMode(PA1, INPUT_ANALOG);
|
||||||
|
pinMode(PA2, INPUT_ANALOG);
|
||||||
|
|
||||||
|
T2 = 25; // Temperature data point 1
|
||||||
|
R2 = 2111; // Reading data point 1
|
||||||
|
T1 = 23; // Temperature data point 2
|
||||||
|
R1 = 2097; // Reading data point 2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined __AVR_ATmega32U4__
|
||||||
|
pinMode(greenLED, OUTPUT);
|
||||||
|
pinMode(blueLED,OUTPUT);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Serial.begin(9600);
|
||||||
|
}
|
||||||
|
|
||||||
|
// the loop function runs over and over again forever
|
||||||
|
void loop() {
|
||||||
|
ledWrite(greenLED, HIGH); // turn the LED on (HIGH is the voltage level)
|
||||||
|
ledWrite(blueLED, LOW); // turn the LED on (HIGH is the voltage level)
|
||||||
|
delay(1000); // wait for a second
|
||||||
|
ledWrite(greenLED, LOW); // turn the LED off by making the voltage LOW
|
||||||
|
ledWrite(blueLED, HIGH); // turn the LED on (HIGH is the voltage level)
|
||||||
|
delay(1000); // wait for a second
|
||||||
|
|
||||||
|
sensorValue = readAnalog(0);
|
||||||
|
// Serial.println(sensorValue);
|
||||||
|
sensorValue = readAnalog(1);
|
||||||
|
|
||||||
|
float temp = T1 + (sensorValue - R1) *(T2 - T1)/(R2 - R1);
|
||||||
|
Serial.print("Temperature: ");
|
||||||
|
Serial.print(temp);
|
||||||
|
Serial.println(" C");
|
||||||
|
|
||||||
|
sensorValue = readAnalog(2);
|
||||||
|
// Serial.println(sensorValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ledWrite(int ledPin, bool state)
|
||||||
|
{
|
||||||
|
#if defined(ARDUINO_ARCH_STM32F0) || defined(ARDUINO_ARCH_STM32F1) || defined(ARDUINO_ARCH_STM32F3) || defined(ARDUINO_ARCH_STM32F4) || defined(ARDUINO_ARCH_STM32L4)
|
||||||
|
if (ledPin == greenLED)
|
||||||
|
digitalWrite(PB9, state);
|
||||||
|
else if (ledPin == blueLED)
|
||||||
|
digitalWrite(PB8, state);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined __AVR_ATmega32U4__
|
||||||
|
digitalWrite(ledPin, state);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
int readAnalog(int pin)
|
||||||
|
{
|
||||||
|
int value = 0;
|
||||||
|
#if defined(ARDUINO_ARCH_STM32F0) || defined(ARDUINO_ARCH_STM32F1) || defined(ARDUINO_ARCH_STM32F3) || defined(ARDUINO_ARCH_STM32F4) || defined(ARDUINO_ARCH_STM32L4)
|
||||||
|
if (pin == 0)
|
||||||
|
value = analogRead(PA0);
|
||||||
|
else if (pin == 1)
|
||||||
|
value = analogRead(PA1);
|
||||||
|
else if (pin == 2)
|
||||||
|
value = analogRead(PA2);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined __AVR_ATmega32U4__
|
||||||
|
value = analogRead(pin);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return(value);
|
||||||
|
}
|
||||||
@ -0,0 +1,79 @@
|
|||||||
|
// --------------------------------------
|
||||||
|
// i2c_scanner
|
||||||
|
//
|
||||||
|
// Version 1
|
||||||
|
// This program (or code that looks like it)
|
||||||
|
// can be found in many places.
|
||||||
|
// For example on the Arduino.cc forum.
|
||||||
|
// The original author is not know.
|
||||||
|
// Version 2, Juni 2012, Using Arduino 1.0.1
|
||||||
|
// Adapted to be as simple as possible by Arduino.cc user Krodal
|
||||||
|
// Version 3, Feb 26 2013
|
||||||
|
// V3 by louarnold
|
||||||
|
// Version 4, March 3, 2013, Using Arduino 1.0.3
|
||||||
|
// by Arduino.cc user Krodal.
|
||||||
|
// Changes by louarnold removed.
|
||||||
|
// Scanning addresses changed from 0...127 to 1...119,
|
||||||
|
// according to the i2c scanner by Nick Gammon
|
||||||
|
// https://www.gammon.com.au/forum/?id=10896
|
||||||
|
// Version 5, March 28, 2013
|
||||||
|
// As version 4, but address scans now to 127.
|
||||||
|
// A sensor seems to use address 120.
|
||||||
|
// Version 6, November 27, 2015.
|
||||||
|
// Added waiting for the Leonardo serial communication.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// This sketch tests the standard 7-bit addresses
|
||||||
|
// Devices with higher bit address might not be seen properly.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <Wire.h>
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Wire.begin();
|
||||||
|
|
||||||
|
Serial.begin(9600);
|
||||||
|
while (!Serial); // Leonardo: wait for serial monitor
|
||||||
|
Serial.println("\nI2C Scanner");
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
int nDevices = 0;
|
||||||
|
|
||||||
|
Serial.println("Scanning...");
|
||||||
|
|
||||||
|
for (byte address = 0x43; address < 127; ++address) {
|
||||||
|
// The i2c_scanner uses the return value of
|
||||||
|
// the Write.endTransmisstion to see if
|
||||||
|
// a device did acknowledge to the address.
|
||||||
|
|
||||||
|
|
||||||
|
Wire.beginTransmission(address);
|
||||||
|
Serial.print(address, HEX);
|
||||||
|
byte error = Wire.endTransmission();
|
||||||
|
|
||||||
|
if (error == 0) {
|
||||||
|
Serial.print("\nI2C device found at address 0x");
|
||||||
|
if (address < 16) {
|
||||||
|
Serial.print("0");
|
||||||
|
}
|
||||||
|
Serial.print(address, HEX);
|
||||||
|
Serial.println(" !");
|
||||||
|
|
||||||
|
++nDevices;
|
||||||
|
} else if (error == 4) {
|
||||||
|
Serial.print("Unknown error at address 0x");
|
||||||
|
if (address < 16) {
|
||||||
|
Serial.print("0");
|
||||||
|
}
|
||||||
|
Serial.println(address, HEX);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (nDevices == 0) {
|
||||||
|
Serial.println("No I2C devices found\n");
|
||||||
|
} else {
|
||||||
|
Serial.println("\ndone\n");
|
||||||
|
}
|
||||||
|
delay(5000); // Wait 5 seconds for next scan
|
||||||
|
}
|
||||||
@ -0,0 +1,134 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo $1
|
||||||
|
|
||||||
|
if [ "$1" = "-r" ]; then
|
||||||
|
echo "Restarting CubeSatSim"
|
||||||
|
sudo systemctl restart cubesatsim
|
||||||
|
exit
|
||||||
|
elif [ "$1" = "-a" ]; then
|
||||||
|
echo "changing CubeSatSim to AFSK mode"
|
||||||
|
sudo echo "ARG1=a" > .mode
|
||||||
|
sudo systemctl restart cubesatsim
|
||||||
|
exit
|
||||||
|
elif [ "$1" = "-f" ]; then
|
||||||
|
echo "changing CubeSatSim to FSK mode"
|
||||||
|
sudo echo "ARG1=f" > .mode
|
||||||
|
sudo systemctl restart cubesatsim
|
||||||
|
exit
|
||||||
|
elif [ "$1" = "-b" ]; then
|
||||||
|
echo "changing CubeSatSim to BPSK mode"
|
||||||
|
sudo echo "ARG1=b" > .mode
|
||||||
|
sudo systemctl restart cubesatsim
|
||||||
|
exit
|
||||||
|
elif [ "$1" = "-s" ]; then
|
||||||
|
echo "changing CubeSatSim to SSTV mode"
|
||||||
|
sudo echo "ARG1=s" > .mode
|
||||||
|
sudo systemctl restart cubesatsim
|
||||||
|
exit
|
||||||
|
elif [ "$1" = "-h" ]; then
|
||||||
|
echo "./configh.sh [OPTIONS]"
|
||||||
|
echo
|
||||||
|
echo "Changes CubeSatSim mode, resets, or modifies configuration file"
|
||||||
|
echo
|
||||||
|
echo " -h This help info"
|
||||||
|
echo " -a Change to AFSK/APRS mode"
|
||||||
|
echo " -f Change to FSK/DUV mode"
|
||||||
|
echo " -b Change to BPSK mode"
|
||||||
|
echo " -s Change to SSTV mode"
|
||||||
|
echo " -r Restarts CubeSatsim software"
|
||||||
|
echo " -m Modified the configuration file sim.cfg"
|
||||||
|
echo " You can change callsign, reset count, or"
|
||||||
|
echo " latitude and longitude (used for APRS)"
|
||||||
|
echo
|
||||||
|
exit
|
||||||
|
|
||||||
|
elif [ "$1" = "-m" ]; then
|
||||||
|
|
||||||
|
echo -e "\nConfiguration script for CubeSatSim\n"
|
||||||
|
|
||||||
|
echo -e "Return keeps current value."
|
||||||
|
|
||||||
|
echo -e "Current sim.cfg configuration file: \n"
|
||||||
|
|
||||||
|
value=`cat sim.cfg`
|
||||||
|
|
||||||
|
echo "$value"
|
||||||
|
|
||||||
|
echo
|
||||||
|
|
||||||
|
set -- $value
|
||||||
|
|
||||||
|
#echo $1 $2 $3 $4
|
||||||
|
|
||||||
|
echo -e "Input callsign (all capitals): "
|
||||||
|
|
||||||
|
read callsign
|
||||||
|
|
||||||
|
if [ -z $callsign ] ; then
|
||||||
|
|
||||||
|
callsign="$1"
|
||||||
|
echo "Keeping value of" $callsign
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "Input reset count (integer): "
|
||||||
|
|
||||||
|
read resets
|
||||||
|
|
||||||
|
if [ -z $resets ] ; then
|
||||||
|
resets="$2"
|
||||||
|
echo "Keeping value of" $resets
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! [[ $resets =~ ^[0-9]+$ ]] ; then
|
||||||
|
echo "Error: not an integer!"
|
||||||
|
resets="$2"
|
||||||
|
echo "Keeping value of" $resets
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "Input latitude (decimal degrees, positive is north): "
|
||||||
|
|
||||||
|
read lat
|
||||||
|
|
||||||
|
if [ -z $lat ] ; then
|
||||||
|
|
||||||
|
lat="$3"
|
||||||
|
echo "Keeping value of" $lat
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! [[ $lat =~ ^[+-]?[0-9]+([.][0-9]+)?$ ]] ; then
|
||||||
|
|
||||||
|
echo "Error: not a number!"
|
||||||
|
lat="$3"
|
||||||
|
echo "Keeping value of" $lat
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "Input longitude (decimal degrees, positive is east): "
|
||||||
|
|
||||||
|
read long
|
||||||
|
|
||||||
|
if [ -z $long ] ; then
|
||||||
|
|
||||||
|
long="$4"
|
||||||
|
echo "Keeping value of" $long
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! [[ $long =~ ^[+-]?[0-9]+([.][0-9]+)?$ ]] ; then
|
||||||
|
|
||||||
|
echo "Error: not a number!"
|
||||||
|
long="$4"
|
||||||
|
echo "Keeping value of" $long
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n"
|
||||||
|
|
||||||
|
echo $callsign $resets $lat $long
|
||||||
|
|
||||||
|
echo $callsign $resets $lat $long > sim.cfg
|
||||||
|
|
||||||
|
echo "Restarting CubeSatSim with new configuraation file"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
sudo systemctl restart cubesatsim
|
||||||
|
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
Here is information about the CubeSatSim v1.0 hardware
|
||||||
|
|
||||||
|
There are files for the main board, battery board, and STEM payload board of these types:
|
||||||
|
|
||||||
|
* cubesatsim-STEM-1.0_gerbers.zip -- All gerber files used to fabricate PCBs
|
||||||
|
|
||||||
|
* cubesatsim-STEM-1.0_schematic.pdf -- Schematic
|
||||||
|
|
||||||
|
* cubesatsim-STEM-1.0_board.png -- View of board
|
||||||
|
|
||||||
|
* cubesatsim-STEM-1.0_board_fill.png -- View of board with fill
|
||||||
|
|
||||||
|
* cubesatsim-STEM-1.0_topPCB.png -- Top view of PCB generated by gerbers
|
||||||
|
|
||||||
|
* cubesatsim-STEM-1.0_bottomPCB.png -- Bottom view of PCB generated by gerbers
|
||||||
|
|
||||||
|
* cubesatsim-STEM-1.0_tNames.pdf -- Top outline of components
|
||||||
|
|
||||||
|
* cubesatsim-STEM-1.0_bNames.pdf -- Bottom outline of components
|
||||||
|
|
||||||
|
* cubesatsim-STEM-1.0.mnt -- top SMD component placement data
|
||||||
|
|
||||||
|
* cubesatsim-STEM-1.0.mnb -- bottom SMD component placement data
|
||||||
|
|
||||||
|
* cubesatsim-STEM-1.0_bom.csv.txt -- Bill of Materials in CSV format
|
||||||
|
|
||||||
|
|
||||||
|
I use PCBWay to fabricate PCBs https://pcbway.com
|
||||||
|
|
||||||
|
Board sets are available on the AMSAT Store:
|
||||||
|
https://www.amsat.org/product/amsat-cubesatsim-pcb/
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
JP4 38.30 64.49 180 JUMPER-SMT_2_NO_SILK SMT-JUMPER_2_NO_SILK
|
||||||
|
JP5 44.68 64.36 180 JUMPER-SMT_2_NO_SILK SMT-JUMPER_2_NO_SILK
|
||||||
|
JP17 11.25 36.42 90 JUMPER-SMT_2_NC_TRACE_SILK SMT-JUMPER_2_NC_TRACE_SILK
|
||||||
|
JP18 13.61 36.42 270 JUMPER-SMT_2_NO_SILK SMT-JUMPER_2_NO_SILK
|
||||||
|
JP19 6.99 36.42 90 JUMPER-SMT_2_NC_TRACE_SILK SMT-JUMPER_2_NC_TRACE_SILK
|
||||||
|
JP20 4.47 36.42 270 JUMPER-SMT_2_NO_SILK SMT-JUMPER_2_NO_SILK
|
||||||
@ -0,0 +1 @@
|
|||||||
|
J4 32.55 74.23 0 CONN_20X2 2X20
|
||||||
|
After Width: | Height: | Size: 1.6 MiB |
|
After Width: | Height: | Size: 1.6 MiB |
@ -0,0 +1,25 @@
|
|||||||
|
"Qty";"Value";"Device";"Package";"Parts";"Description";"PROD_ID";
|
||||||
|
"12";"";"M01NOSILK-KIT";"1X01NS-KIT";"JP1, JP2, JP3, JP6, JP7, JP8, JP9, JP10, JP11, JP14, JP15, JP16";"Header 1";"";
|
||||||
|
"1";"";"SPARKFUN_PRO_MICRO";"SPARKFUN_PRO_MICRO";"U1";"SparkFun Pro Micro";"";
|
||||||
|
"3";"100nF";"CAPPTH";"CAP-PTH-SMALL";"C1, C2, C3";"Capacitor";"";
|
||||||
|
"3";"10K";"RESISTORPTH-1/4W-VERT";"AXIAL-0.1";"R9, R10, R11";"Resistor";"";
|
||||||
|
"1";"1N4148";"DIODE-D-2.5";"D-2.5";"D4";"DIODE";"";
|
||||||
|
"3";"1N5817";"DIODE-D-2.5";"D-2.5";"D1, D2, D3";"DIODE";"";
|
||||||
|
"2";"1x20 female header";"M20NOSILK";"1X20_NOSILK";"J6, J7";"1x20 .1" header";"";
|
||||||
|
"2";"4.7k";"RESISTORPTH-1/4W-VERT";"AXIAL-0.1";"R1, R2";"Resistor";"";
|
||||||
|
"2";"470";"RESISTORPTH-1/4W-VERT";"AXIAL-0.1";"R3, R4";"Resistor";"";
|
||||||
|
"1";"BME280";"M04NO_SILK_ALL_ROUND";"1X04_NO_SILK_ALL_ROUND";"JP21";"Header 4";"";
|
||||||
|
"1";"Blue 5mm";"LED3MM";"LED3MM";"LED2";"LED";"";
|
||||||
|
"1";"CONN_20X2";"CONN_20X2";"2X20";"J4";"Multi connection point. Often used as Generic Header-pin footprint for 0.1 inch spaced/style header connections";"";
|
||||||
|
"1";"DNI-100";"RESISTORPTH-1/4W-VERT";"AXIAL-0.1";"R6";"Resistor";"";
|
||||||
|
"1";"DNI-1k";"RESISTORPTH-1/4W-VERT";"AXIAL-0.1";"R5";"Resistor";"";
|
||||||
|
"2";"DNI-1x2 pin header";"CONN_021X02_NO_SILK";"1X02_NO_SILK";"J1, J2";"Multi connection point. Often used as Generic Header-pin footprint for 0.1 inch spaced/style header connections";"";
|
||||||
|
"2";"DNI-1x3 pin header with jumper";"M031X03_NO_SILK";"1X03_NO_SILK";"JP12, JP13";"Header 3";"";
|
||||||
|
"1";"DNI-1x4 pin header";"CONN_041X04_NO_SILK";"1X04_NO_SILK";"J3";"Multi connection point. Often used as Generic Header-pin footprint for 0.1 inch spaced/style header connections";"CONN-09696";
|
||||||
|
"2";"DNI-4k";"RESISTORPTH-1/4W-VERT";"AXIAL-0.1";"R7, R8";"Resistor";"";
|
||||||
|
"1";"DNI-Blue 5mm";"LED3MM";"LED3MM";"LED4";"LED";"";
|
||||||
|
"1";"DNI-Green 5mm";"LED3MM";"LED3MM";"LED3";"LED";"";
|
||||||
|
"1";"Green 5mm";"LED3MM";"LED3MM";"LED1";"LED";"";
|
||||||
|
"2";"JUMPER-SMT_2_NC_TRACE_SILK";"JUMPER-SMT_2_NC_TRACE_SILK";"SMT-JUMPER_2_NC_TRACE_SILK";"JP17, JP19";"Normally closed trace jumper";"";
|
||||||
|
"4";"JUMPER-SMT_2_NO_SILK";"JUMPER-SMT_2_NO_SILK";"SMT-JUMPER_2_NO_SILK";"JP4, JP5, JP18, JP20";"Normally open jumper";"";
|
||||||
|
"1";"MPU6050";"M08NO_SILK_FEMALE_PTH";"1X08_NO_SILK";"J5";"Header 8";"CONN-08438";
|
||||||
|
After Width: | Height: | Size: 722 KiB |
|
After Width: | Height: | Size: 801 KiB |
|
After Width: | Height: | Size: 674 KiB |
|
After Width: | Height: | Size: 608 KiB |
@ -0,0 +1,5 @@
|
|||||||
|
"Qty";"Value";"Device";"Package";"Parts";"Description";"DESCRIPTION";"DIGI-KEY_PART_NUMBER";"MF";"MP";"PACKAGE";"PURCHASE-URL";
|
||||||
|
"2";"";"CONN_01PTH_NO_SILK_KIT";"1X01NS_KIT";"J1, J2";"Single connection point. Often used as Generic Header-pin footprint for 0.1 inch spaced/style header connections";"";"";"";"";"";"";
|
||||||
|
"1";"AA battery holder BH3AA-PC";"BH3AA-PC";"BAT_BH3AA-PC";"BT1";"Holder Batt 3-Aa Cells Pc Mount";" Battery Holder (Open) AA 3 Cell PC Pin ";"BH3AA-PC-ND";"MPD";"BH3AAPC";"None";"https://pricing.snapeda.com/search/part/BH3AAPC/?ref=eda";
|
||||||
|
"1";"CONN_20X2";"CONN_20X2";"2X20";"JP13";"Multi connection point. Often used as Generic Header-pin footprint for 0.1 inch spaced/style header connections";"";"";"";"";"";"";
|
||||||
|
"1";"Micro JST";"M02JST-PTH-VERT";"JST-2-PTH-VERT";"JP15";"Standard 2-pin 0.1" header. Use with";"";"";"";"";"";"";
|
||||||
|
After Width: | Height: | Size: 306 KiB |
|
After Width: | Height: | Size: 498 KiB |
@ -0,0 +1 @@
|
|||||||
|
JP3 11.99 33.49 90 VDD-EN SMT-JUMPER_2_NC_TRACE_SILK
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
C1 16.43 73.32 270 1pF C0603
|
||||||
|
C2 16.43 71.86 270 1pF C0603
|
||||||
|
C3 20.17 72.63 0 20pF C0603
|
||||||
|
C4 21.64 72.63 0 20pF C0603
|
||||||
|
J1 32.55 66.61 0 CONN_20X2 2X20
|
||||||
|
L1 11.32 74.74 180 30nH L0603
|
||||||
|
L2 13.44 73.30 180 13nH L0603
|
||||||
|
L3 18.69 75.60 90 1.5nH L0603
|
||||||
|
L4 18.67 72.61 90 1.5nH L0603
|
||||||
|
R2 47.96 59.89 0 DNI-1k R0603
|
||||||
|
R6 55.98 59.79 0 DNI-1k R0603
|
||||||
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 1.6 MiB |
@ -0,0 +1,30 @@
|
|||||||
|
"Qty";"Value";"Device";"Package";"Parts";"Description";"MPN";"VALUE";
|
||||||
|
"1";"";"CN3085-MODULE";"CN3085-MODULE";"U6";"";"";"";
|
||||||
|
"2";"1.5nH";"SMD-FERRITE-CHIP-120-OHM-500MA(0603)";"L0603";"L3, L4";"303030001";"BLM18AG121SN1D";"120";
|
||||||
|
"1";"13nH";"SMD-FERRITE-CHIP-120-OHM-500MA(0603)";"L0603";"L2";"303030001";"BLM18AG121SN1D";"120";
|
||||||
|
"1";"1K";"RESISTORPTH-1/4W-VERT-KIT";"AXIAL-0.1EZ";"R1";"Resistor";"";"";
|
||||||
|
"7";"1N5817";"DIODE-D-2.5";"D-2.5";"D1, D2, D3, D4, D5, D6, D7";"DIODE";"";"";
|
||||||
|
"1";"1V-5V Boost 5V Regulator";"USB-BOOST";"USB-BOOST";"U7";"";"";"";
|
||||||
|
"2";"1pF";"CERAMIC-10PF-50V-5%-NPO(0603)";"C0603";"C1, C2";"302010097";"";"10pf";
|
||||||
|
"2";"20pF";"CERAMIC-10PF-50V-5%-NPO(0603)";"C0603";"C3, C4";"302010097";"";"10pf";
|
||||||
|
"1";"30nH";"SMD-FERRITE-CHIP-120-OHM-500MA(0603)";"L0603";"L1";"303030001";"BLM18AG121SN1D";"120";
|
||||||
|
"2";"4.7k";"RESISTORPTH-1/4W-VERT-KIT";"AXIAL-0.1EZ";"R3, R4";"Resistor";"";"";
|
||||||
|
"3";"470";"RESISTORPTH-1/4W-VERT-KIT";"AXIAL-0.1EZ";"R11, R12, R13";"Resistor";"";"";
|
||||||
|
"1";"5V1 Zener 1W";"ZENER-DIODEZD-2.5";"ZDIO-2.5";"D8";"Z-Diode";"";"";
|
||||||
|
"1";"Blue 5mm";"LED3MM";"LED3MM";"LED2";"LED";"";"";
|
||||||
|
"1";"CFP2-2RC4-AW";"SWITCH-DPDTOS";"OS";"S1";"DPDT Version of the COM-00597";"";"";
|
||||||
|
"1";"CONN_20X2";"CONN_20X2";"2X20";"J1";"Multi connection point. Often used as Generic Header-pin footprint for 0.1 inch spaced/style header connections";"";"";
|
||||||
|
"2";"DNI-0R";"RESISTORPTH-1/4W-VERT-KIT";"AXIAL-0.1EZ";"R9, R10";"Resistor";"";"";
|
||||||
|
"1";"DNI-1K";"RESISTORPTH-1/4W-VERT-KIT";"AXIAL-0.1EZ";"R5";"Resistor";"";"";
|
||||||
|
"2";"DNI-1k";"R-EU_R0603";"R0603";"R2, R6";"RESISTOR, European symbol";"";"";
|
||||||
|
"2";"DNI-4.7k";"RESISTORPTH-1/4W-VERT-KIT";"AXIAL-0.1EZ";"R7, R8";"Resistor";"";"";
|
||||||
|
"1";"DNI-5V1 Zener 1W";"ZENER-DIODEZD-2.5";"ZDIO-2.5";"D9";"Z-Diode";"";"";
|
||||||
|
"1";"Green 5mm";"LED3MM";"LED3MM";"LED1";"LED";"";"";
|
||||||
|
"8";"INA219 purple board";"INA219";"INA219";"U1, U2, U3, U4, U5, U8, U9, U10";"";"";"";
|
||||||
|
"8";"Micro JST";"M02JST-PTH-VERT";"JST-2-PTH-VERT";"JP1, JP2, JP4, JP5, JP6, JP7, JP8, JP10";"Standard 2-pin 0.1" header. Use with";"";"";
|
||||||
|
"1";"PTCPTH";"PTCPTH";"PTC";"F1";"Resettable Fuse PTC";"";"";
|
||||||
|
"1";"Red 5mm";"LED3MM";"LED3MM";"LED3";"LED";"";"";
|
||||||
|
"1";"SC1464-ND";"PG203J";"PG203J";"X1";"MIC/HEADPHONE JACK";"";"";
|
||||||
|
"1";"SMA-VERT";"SMA-VERT";"SMA-VERT";"X11";"";"";"";
|
||||||
|
"1";"VDD-EN";"JUMPER-SMT_2_NC_TRACE_SILK";"SMT-JUMPER_2_NC_TRACE_SILK";"JP3";"Normally closed trace jumper";"";"";
|
||||||
|
"1";"micro USB breakout board";"M05NO_SILK";"1X05_NO_SILK";"JP9";"Header 5";"";"";
|
||||||
|
After Width: | Height: | Size: 692 KiB |
|
After Width: | Height: | Size: 879 KiB |
|
After Width: | Height: | Size: 143 KiB |
|
After Width: | Height: | Size: 218 KiB |
|
After Width: | Height: | Size: 188 KiB |
|
After Width: | Height: | Size: 321 KiB |
|
After Width: | Height: | Size: 664 KiB |
|
After Width: | Height: | Size: 493 KiB |
|
After Width: | Height: | Size: 614 KiB |
|
After Width: | Height: | Size: 738 KiB |
|
Can't render this file because it contains an unexpected character in line 23 and column 114.
|
@ -0,0 +1,18 @@
|
|||||||
|
"Qty";"Value";"Device";"Package";"Parts";"Description";"PROD_ID";
|
||||||
|
"12";"";"M01NOSILK-KIT";"1X01NS-KIT";"JP10, JP11, JP12, JP14, JP15, JP17, JP18, JP19, JP20, JP21, JP22, JP23";"Header 1";"";
|
||||||
|
"3";"100nF";"CAPPTH";"CAP-PTH-SMALL";"C3, C7, C8";"Capacitor";"";
|
||||||
|
"3";"10K";"RESISTORPTH-1/4W-VERT";"AXIAL-0.1";"R6, R8, R9";"Resistor";"";
|
||||||
|
"1";"1N4148";"DIODE-D-2.5";"D-2.5";"D4";"DIODE";"";
|
||||||
|
"3";"1N5817";"DIODE-D-2.5";"D-2.5";"D3, D5, D8";"DIODE";"";
|
||||||
|
"2";"1x2 pin header";"CONN_02";"1X02";"J4, J5";"Multi connection point. Often used as Generic Header-pin footprint for 0.1 inch spaced/style header connections";"";
|
||||||
|
"2";"1x20 female header";"M20NOSILK";"1X20_NOSILK";"J10, U2";"1x20 .1" header";"";
|
||||||
|
"2";"1x3 pin header with jumper";"M03PTH";"1X03";"JP24, JP25";"Header 3";"";
|
||||||
|
"2";"4.7k";"RESISTORPTH-1/4W-VERT";"AXIAL-0.1";"R14, R15";"Resistor";"";
|
||||||
|
"4";"470";"RESISTORPTH-1/4W-VERT";"AXIAL-0.1";"R1, R2, R3, R4";"Resistor";"";
|
||||||
|
"1";"ARDUINO_PRO_MICRO";"ARDUINO_PRO_MICRO";"ARDUINO_PRO_MICRO";"U1";"";"";
|
||||||
|
"1";"BME280";"M04NO_SILK_ALL_ROUND";"1X04_NO_SILK_ALL_ROUND";"JP16";"Header 4";"";
|
||||||
|
"2";"Blue 5mm";"LED3MM";"LED3MM";"D2, D7";"LED";"";
|
||||||
|
"1";"CONN_20X2";"CONN_20X2";"2X20";"JP13";"Multi connection point. Often used as Generic Header-pin footprint for 0.1 inch spaced/style header connections";"";
|
||||||
|
"2";"DNI-4k";"RESISTORPTH-1/4W-VERT";"AXIAL-0.1";"R12, R13";"Resistor";"";
|
||||||
|
"2";"Green 5mm";"LED3MM";"LED3MM";"D1, D6";"LED";"";
|
||||||
|
"1";"MPU6050";"M08NO_SILK_FEMALE_PTH";"1X08_NO_SILK";"J3";"Header 8";"CONN-08438";
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
"Qty";"Value";"Device";"Package";"Parts";"Description";"DESCRIPTION";"HEIGHT";"MANUFACTURER_NAME";"MANUFACTURER_PART_NUMBER";"MOUSER_PART_NUMBER";"MOUSER_PRICE-STOCK";
|
||||||
|
"1";"12BH331P-GR";"12BH331P-GR";"12BH331PGR";"U1";"Cylindrical Battery Contacts, Clips, Holders & Springs 3 "AA" PC LEADS BLK";"Cylindrical Battery Contacts, Clips, Holders & Springs 3 "AA" PC LEADS BLK";"17mm";"Eagle Plastic Devices";"12BH331P-GR";"12BH331P-GR";"https://www.mouser.com/Search/Refine.aspx?Keyword=12BH331P-GR";
|
||||||
|
"1";"CONN_20X2";"CONN_20X2";"2X20";"JP13";"Multi connection point. Often used as Generic Header-pin footprint for 0.1 inch spaced/style header connections";"";"";"";"";"";"";
|
||||||
|
"1";"Micro JST";"M02JST-PTH-VERT";"JST-2-PTH-VERT";"JP15";"Standard 2-pin 0.1" header. Use with";"";"";"";"";"";"";
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
"Qty";"Value";"Device";"Package";"Parts";"Description";"MPN";"PARTNO";"PNPROTATION";"VALUE";
|
||||||
|
"1";"0.1uf";"CERAMIC-2.2UF-10V-10%-X7R(0603)";"C0603";"C14";"302010054";"CC0603KRX7R6BB225";"";"";"2.2uf";
|
||||||
|
"2";"1.5nH";"SMD-FERRITE-CHIP-120-OHM-500MA(0603)";"L0603";"L3, L11";"303030001";"BLM18AG121SN1D";"";"";"120";
|
||||||
|
"1";"100nF";"CERAMIC-100NF-50V-10%-X7R(0603)";"C0603";"C15";"302010138";"CC0603KRX7R9BB104";"";"";"100nf";
|
||||||
|
"1";"10uf";"CERAMIC-2.2UF-10V-10%-X7R(0603)";"C0603";"C8";"302010054";"CC0603KRX7R6BB225";"";"";"2.2uf";
|
||||||
|
"1";"13nH";"SMD-FERRITE-CHIP-120-OHM-500MA(0603)";"L0603";"L12";"303030001";"BLM18AG121SN1D";"";"";"120";
|
||||||
|
"1";"1N5817";"DIODE-D-2.5";"D-2.5";"D9";"DIODE";"";"";"";"";
|
||||||
|
"2";"1pF";"CERAMIC-10PF-50V-5%-NPO(0603)";"C0603";"C11, C20";"302010097";"";"";"";"10pf";
|
||||||
|
"2";"1x2 pin header";"M021X02_NO_SILK";"1X02_NO_SILK";"JP1, JP4";"Standard 2-pin 0.1" header. Use with";"";"";"";"";
|
||||||
|
"2";"20pF";"CERAMIC-10PF-50V-5%-NPO(0603)";"C0603";"C5, C12";"302010097";"";"";"";"10pf";
|
||||||
|
"2";"27R";"SMD-RES-1.2K-1%-1/10W(0603)";"R0603";"R9, R10";"301010206";"RC0603FR-071K2L";"";"";"1.2K";
|
||||||
|
"2";"3.3K";"RESISTORPTH-1/4W-VERT-KIT";"AXIAL-0.1EZ";"R1, R2";"Resistor";"";"";"";"";
|
||||||
|
"1";"30nH";"SMD-FERRITE-CHIP-120-OHM-500MA(0603)";"L0603";"L9";"303030001";"BLM18AG121SN1D";"";"";"120";
|
||||||
|
"2";"47pF";"CERAMIC-2.2UF-10V-10%-X7R(0603)";"C0603";"C1, C6";"302010054";"CC0603KRX7R6BB225";"";"";"2.2uf";
|
||||||
|
"1";"Blue 3mm";"LED3MM";"LED3MM";"D7";"LED";"";"";"";"";
|
||||||
|
"1";"CFP2-2RC4-AW";"SWITCH-DPDTOS";"OS";"S1";"DPDT Version of the COM-00597";"";"";"";"";
|
||||||
|
"1";"CONN_20X2";"CONN_20X2";"2X20";"JP13";"Multi connection point. Often used as Generic Header-pin footprint for 0.1 inch spaced/style header connections";"";"";"";"";
|
||||||
|
"2";"DNI/1K";"RESISTORPTH-1/4W-VERT-KIT";"AXIAL-0.1EZ";"R3, R8";"Resistor";"";"";"";"";
|
||||||
|
"2";"DNI/1K";"SMD-RES-1.2K-1%-1/10W(0603)";"R0603";"R11, R12";"301010206";"RC0603FR-071K2L";"";"";"1.2K";
|
||||||
|
"1";"FT231XQ-R ";"AS-ITM-00223";"QFN20";"U5";"IC USB SERIAL FULL UART 20QFN";"";"AS-ITM-00223";"270";"FT231XQ-R ";
|
||||||
|
"1";"Green 3mm";"LED3MM";"LED3MM";"D6";"LED";"";"";"";"";
|
||||||
|
"1";"JUMPER_SOLDER_1X2";"JUMPER_SOLDER_1X2";"JUMPER_SOLDER_1X2";"J1";"";"";"";"";"";
|
||||||
|
"1";"OR";"FERRITE-0603";"FB603";"L1";"Ferrite bead in various packages";"";"";"";"";
|
||||||
|
"1";"SC1464-ND";"PG203J";"PG203J";"3.5MM_JACK";"MIC/HEADPHONE JACK";"";"";"";"";
|
||||||
|
"1";"SMA-VERT";"SMA-VERT";"SMA-VERT";"X3";"";"";"";"";"";
|
||||||
|
"1";"ST-USB-001G";"MICRO-USB-SMD-B-WITHOUT-POST-W/P(ST-USB-001G)";"MICRO-USB5+4P-SMD-0.65-B";"USB1";"320010000";"ST-USB-001G";"";"";"ST-USB-001G";
|
||||||
|
"1";"USB4-2.0-90D";"DIP-USB-A-TYPE-FMAL(4+2P-2.0-90D)";"USB4+2P-2.0-90D";"USB2";"320010007";"";"";"";"USB4-2.0-90D";
|
||||||
|
"1";"zener 5.2v";"ZENER-DIODEZD-2.5";"ZDIO-2.5";"D2";"Z-Diode";"";"";"";"";
|
||||||
@ -0,0 +1,128 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo -e "\ninstallation script for CubeSatSim\n"
|
||||||
|
|
||||||
|
sudo apt-get update && sudo apt-get dist-upgrade -y
|
||||||
|
|
||||||
|
sudo apt-get install -y wiringpi git libasound2-dev i2c-tools cpulimit
|
||||||
|
|
||||||
|
cd /tmp
|
||||||
|
|
||||||
|
wget https://project-downloads.drogon.net/wiringpi-latest.deb
|
||||||
|
|
||||||
|
sudo dpkg -i wiringpi-latest.deb
|
||||||
|
|
||||||
|
|
||||||
|
cd
|
||||||
|
|
||||||
|
sudo apt install -y python3-pip python-smbus
|
||||||
|
|
||||||
|
sudo pip3 install --upgrade setuptools
|
||||||
|
|
||||||
|
sudo pip3 install adafruit-blinka RPI.GPIO adafruit-extended-bus adafruit-circuitpython-ina219
|
||||||
|
|
||||||
|
|
||||||
|
cd ~/CubeSatSim
|
||||||
|
|
||||||
|
git pull
|
||||||
|
|
||||||
|
make debug
|
||||||
|
|
||||||
|
FILE=/home/pi/CubeSatSim/.mode
|
||||||
|
if [ -f "$FILE" ]; then
|
||||||
|
echo "$FILE exists."
|
||||||
|
else
|
||||||
|
echo "creating $FILE"
|
||||||
|
echo "ARG1=f" >> .mode
|
||||||
|
fi
|
||||||
|
|
||||||
|
FILE=/home/pi/CubeSatSim/sim.cfg
|
||||||
|
if [ -f "$FILE" ]; then
|
||||||
|
echo "$FILE exists."
|
||||||
|
else
|
||||||
|
echo "creating $FILE"
|
||||||
|
echo $1 >> sim.cfg
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd
|
||||||
|
|
||||||
|
git clone https://github.com/alanbjohnston/direwolf.git
|
||||||
|
|
||||||
|
cd direwolf
|
||||||
|
|
||||||
|
make -j
|
||||||
|
|
||||||
|
sudo make install
|
||||||
|
|
||||||
|
make install-rpi
|
||||||
|
|
||||||
|
cd
|
||||||
|
|
||||||
|
git clone https://github.com/alanbjohnston/pi-power-button.git
|
||||||
|
|
||||||
|
cd pi-power-button
|
||||||
|
|
||||||
|
./script/install
|
||||||
|
|
||||||
|
cd
|
||||||
|
|
||||||
|
git clone https://github.com/F5OEO/rpitx.git
|
||||||
|
|
||||||
|
cd rpitx
|
||||||
|
|
||||||
|
./install.sh
|
||||||
|
|
||||||
|
cd
|
||||||
|
|
||||||
|
sudo cp ~/CubeSatSim/systemd/cubesatsim.service /etc/systemd/system/cubesatsim.service
|
||||||
|
|
||||||
|
sudo systemctl enable cubesatsim
|
||||||
|
|
||||||
|
sudo cp ~/CubeSatSim/systemd/rpitx.service /etc/systemd/system/rpitx.service
|
||||||
|
|
||||||
|
sudo systemctl enable rpitx
|
||||||
|
|
||||||
|
|
||||||
|
sudo cp /boot/config.txt /boot/config.txt.0
|
||||||
|
|
||||||
|
sudo cp /boot/cmdline.txt /boot/cmdline.txt.0
|
||||||
|
|
||||||
|
sudo raspi-config nonint do_i2c 0
|
||||||
|
|
||||||
|
#if [ "$1" = "u" ]; then
|
||||||
|
#fi
|
||||||
|
|
||||||
|
sudo sed -i 's/console=serial0,115200 //g' /boot/cmdline.txt
|
||||||
|
|
||||||
|
sudo sed -i 's/#dtparam=i2c_arm=on/dtparam=i2c_arm=on/g' /boot/config.txt
|
||||||
|
|
||||||
|
if [[ $(grep 'dtoverlay=i2c-gpio,bus=3,i2c_gpio_delay_us=1,i2c_gpio_sda=23,i2c_gpio_scl=24' /boot/config.txt) ]]; then
|
||||||
|
echo "dtoverlay=i2c-gpio already in /boot/config.txt"
|
||||||
|
else
|
||||||
|
echo "adding dtoverlay=i2c-gpio to /boot/config.txt"
|
||||||
|
sudo sh -c 'echo "\ndtoverlay=i2c-gpio,bus=3,i2c_gpio_delay_us=1,i2c_gpio_sda=23,i2c_gpio_scl=24" >> /boot/config.txt'
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $(grep 'dtoverlay=pi3-miniuart-bt' /boot/config.txt) ]]; then
|
||||||
|
echo "dtoverlay=pi3-miniuart-bt already in /boot/config.txt"
|
||||||
|
else
|
||||||
|
echo "adding dtoverlay=pi3-miniuart-bt to /boot/config.txt"
|
||||||
|
sudo sh -c 'echo "\ndtoverlay=pi3-miniuart-bt" >> /boot/config.txt'
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $(grep 'dtoverlay=dwc2' /boot/config.txt) ]]; then
|
||||||
|
echo "dtoverlay=dwc2 aalready in /boot/config.txt"
|
||||||
|
else
|
||||||
|
echo "adding dtoverlay=dwc2 to /boot/config.txt"
|
||||||
|
sudo sh -c 'echo "\ndtoverlay=dwc2" >> /boot/config.txt'
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $(grep 'modules-load=dwc2,g_ether' /boot/cmdline.txt) ]]; then
|
||||||
|
echo "modules-load=dwc2,g_ether already in /boot/cmdline.txt"
|
||||||
|
else
|
||||||
|
echo "adding modules-load=dwc2,g_ether to /boot/cmdline.txt"
|
||||||
|
sudo sed -i 's/ rootwait/ rootwait modules-load=dwc2,g_ether/g' /boot/cmdline.txt
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "You need to reboot to complete the installation\n"
|
||||||
|
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo -e "\nupdate script for CubeSatSim\n"
|
||||||
|
|
||||||
|
if [ "$1" = "u" ]; then
|
||||||
|
|
||||||
|
sudo apt-get update && sudo apt-get dist-upgrade -y
|
||||||
|
|
||||||
|
sudo apt-get install -y wiringpi git libasound2-dev i2c-tools cpulimit
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd /home/pi/CubeSatSim
|
||||||
|
|
||||||
|
git pull > .updated
|
||||||
|
|
||||||
|
make debug
|
||||||
|
|
||||||
|
FLAG=0
|
||||||
|
|
||||||
|
if [[ $(grep 'cubesatsim.service' /home/pi/CubeSatSim/.updated) ]]; then
|
||||||
|
echo "copying cubesatsim.service"
|
||||||
|
sudo cp systemd/cubesatsim.service /etc/systemd/system/cubesatsim.service
|
||||||
|
FLAG=1
|
||||||
|
else
|
||||||
|
echo "no changes to cubesatsim.service"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $(grep 'rpitx.service' /home/pi/CubeSatSim/.updated) ]]; then
|
||||||
|
echo "copying rpitx.service"
|
||||||
|
sudo cp systemd/rpitx.service /etc/systemd/system/rpitx.service
|
||||||
|
FLAG=1
|
||||||
|
else
|
||||||
|
echo "no changes to rpitx.service"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $FLAG -eq 1 ]; then
|
||||||
|
echo "systemctl daemon-reload"
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
else
|
||||||
|
echo "systemctl restart cubesatsim"
|
||||||
|
sudo systemctl restart cubesatsim
|
||||||
|
fi
|
||||||