Commit 592713d7 authored by Ondřej Kučera's avatar Ondřej Kučera

update SW examples & HW designs, general cleanup

parent a1190eb2
Pipeline #12 failed with stages
This diff is collapsed.
#include <Adafruit_BME280.h>
#define Serial SerialUSB
#define BME280_ADDRESS 0x77
#define SEALEVELPRESSURE_HPA (1013.25)
Adafruit_BME280 bme;
int ms_delay = 500;
float temperature_bme280 = 0;
float pressure_bme280 = 0;
float altitude_bme280 = 0;
float humidity_bme280 = 0;
void setup()
{
Serial.begin(9600);
while(!Serial);
Serial.println("CANSAT kit BME280 test started.");
if (!bme.begin(BME280_ADDRESS))
{
Serial.println("Could not find a valid BME280 sensor, check wiring!");
return;
}
Serial.println();
}
void loop()
{
temperature_bme280 = bme.readTemperature();
pressure_bme280 = bme.readPressure() / 100.0F;
altitude_bme280 = bme.readAltitude(SEALEVELPRESSURE_HPA);
humidity_bme280 = bme.readHumidity();
Serial.println("Temperature = " + (String) temperature_bme280 + " °C");
Serial.println("Pressure = " + (String) pressure_bme280 + " hPa");
Serial.println("Approx altitude = " + (String) altitude_bme280 + " m");
Serial.println("Humidity = " + (String) humidity_bme280 + " %");
Serial.println();
delay(ms_delay);
}
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>
#define SerialUSB Serial;
#define Serial SerialUSB
Adafruit_BMP280 bmp; // I2C
#define BMP280_ADDRESS 0x76
#define BMP280_CHIPID 0x58
Adafruit_BMP280 bmp;
// number of ms between another measurement
int ms_delay = 2000;
float temperature_bmp280 = 0;
......@@ -16,20 +15,20 @@ float altitude_bmp280 = 0;
void setup()
{
int a = 1;
Serial.begin(9600);
while(!Serial);
Serial.println("CANSAT kit BMP280 test started.");
if (!bmp.begin())
if (!bmp.begin(BMP280_ADDRESS, BMP280_CHIPID))
{
Serial.println("Could not find a valid BMP280 sensor, check wiring!");
while (1);
return;
}
Serial.println();
}
// the loop function runs over and over again forever
void loop()
{
temperature_bmp280 = bmp.readTemperature();
......
// EN: Official USB serial console for SAM21D core
// CZ: Oficiální USB serial port pro SAM21D
#define Serial SerialUSB
// EN: Variables setting
// CZ: Nastavení proměnných
int d13_led = 42;
int tx_led = 31;
int rx_led = 30;
int m_led = 36;
// EN: Number of ms between led ON and OFF
// CZ: Počet milisekund pro prodlevu mezi zanutím a vypnutím LED diod
int ms_delay = 1000;
// EN: Setup function runs once
// CZ: Nastavení parametrů, které proběhne jen jednou
void setup()
{
Serial.begin(9600);
//EN: Wait until Serial connection is ready
//CZ: Čekej dokud nebude sériová linka připravena
while(!Serial);
Serial.println("CANSAT kit LED test.");
pinMode(d13_led, OUTPUT);
pinMode(tx_led, OUTPUT);
pinMode(rx_led, OUTPUT);
pinMode(m_led, OUTPUT);
}
//EN: The loop function runs over and over again forever
//CZ: Nekonečná smyčka
void loop()
{
Serial.println("Zapnutí LED diod (D13, TX, RX, MLED).");
digitalWrite(d13_led, HIGH);
digitalWrite(tx_led, LOW);
digitalWrite(rx_led, LOW);
digitalWrite(m_led, HIGH);
//EN: Wait on set ms_delay
//CZ: Počkej nastavený počet milisekund
delay(ms_delay);
Serial.println("Vypnutí LED diod (D13, TX, RX, MLED).");
digitalWrite(d13_led, LOW);
digitalWrite(tx_led, HIGH);
digitalWrite(rx_led, HIGH);
digitalWrite(m_led, LOW);
//EN: Wait on set ms_delay
//CZ: Počkej nastavený počet milisekund
delay(ms_delay);
}
#include <Wire.h>
#define Serial SerialUSB
void setup()
{
Wire.begin();
Serial.begin(9600);
while(!Serial);
Serial.println("GPS started");
}
void loop()
{
Wire.requestFrom(0x42, 64);
while(Wire.available())
{
char c = Wire.read();
Serial.print(c);
}
Serial.println();
delay(500);
}
#include <Wire.h>
#include <Adafruit_INA219.h>
// EN: Official USB serial console for Arduino SAMD core
// CZ: Oficiální USB serial port pro Arduino SAMD
#define Serial SerialUSB
Adafruit_INA219 ina219;
Adafruit_INA219 ina219(0x40);
// EN: Number of ms between another measurement
// CZ: Počet milisekund mezi dalším měření
int ms_delay = 2000;
int ms_delay = 500;
// EN: Variables for measurement or calculation
// CZ: Proměnné pro měření nebo výpočet
......@@ -30,7 +28,6 @@ void setup(void)
while(!Serial);
Serial.println("CANSAT kit INA219 test.");
Serial.println();
ina219.begin();
}
......
//CanSat kit I/O test
#define D13SCK 42
#define D12MISO 39
#define D11MOSI 40
#define D10SS 41
#define D9 9
#define D8 8
#define D7 7
#define D6 6
#define D5 5
#define D4 4
#define D3 3
#define D2 2
#define TX 1
#define RX 0
#define A5 29
#define A4 28
#define A3 27
#define A2 26
#define A1 25
#define A0 24
#define SDA 37
#define SCL 38
void setup() {
//define all pins as output
pinMode(D13SCK, OUTPUT);
pinMode(D12MISO, OUTPUT);
pinMode(D11MOSI, OUTPUT);
pinMode(D10SS, OUTPUT);
pinMode(D9, OUTPUT);
pinMode(D8, OUTPUT);
pinMode(D7, OUTPUT);
pinMode(D6, OUTPUT);
pinMode(D5, OUTPUT);
pinMode(D4, OUTPUT);
pinMode(D3, OUTPUT);
pinMode(D2, OUTPUT);
pinMode(TX, OUTPUT);
pinMode(RX, OUTPUT);
pinMode(A5, OUTPUT);
pinMode(A4, OUTPUT);
pinMode(A3, OUTPUT);
pinMode(A2, OUTPUT);
pinMode(A1, OUTPUT);
pinMode(A0, OUTPUT);
pinMode(SDA, OUTPUT);
pinMode(SCL, OUTPUT);
}
void loop() {
digitalWrite(D13SCK, HIGH);
digitalWrite(D12MISO, HIGH);
digitalWrite(D11MOSI, HIGH);
digitalWrite(D10SS, HIGH);
digitalWrite(D9, HIGH);
digitalWrite(D8, HIGH);
digitalWrite(D7, HIGH);
digitalWrite(D6, HIGH);
digitalWrite(D5, HIGH);
digitalWrite(D4, HIGH);
digitalWrite(D3, HIGH);
digitalWrite(D2, HIGH);
digitalWrite(TX, HIGH);
digitalWrite(RX, HIGH);
digitalWrite(A5, HIGH);
digitalWrite(A4, HIGH);
digitalWrite(A3, HIGH);
digitalWrite(A2, HIGH);
digitalWrite(A1, HIGH);
digitalWrite(A0, HIGH);
digitalWrite(SDA, HIGH);
digitalWrite(SCL, HIGH);
delay(750);
digitalWrite(D13SCK, LOW);
digitalWrite(D12MISO, LOW);
digitalWrite(D11MOSI, LOW);
digitalWrite(D10SS, LOW);
digitalWrite(D9, LOW);
digitalWrite(D8, LOW);
digitalWrite(D7, LOW);
digitalWrite(D6, LOW);
digitalWrite(D5, LOW);
digitalWrite(D4, LOW);
digitalWrite(D3, LOW);
digitalWrite(D2, LOW);
digitalWrite(TX, LOW);
digitalWrite(RX, LOW);
digitalWrite(A5, LOW);
digitalWrite(A4, LOW);
digitalWrite(A3, LOW);
digitalWrite(A2, LOW);
digitalWrite(A1, LOW);
digitalWrite(A0, LOW);
digitalWrite(SDA, LOW);
digitalWrite(SCL, LOW);
delay(750);
}
#define Serial SerialUSB
#define D13_LED 42
#define M_LED 36
int ms_delay = 500;
void setup()
{
Serial.begin(9600);
while(!Serial);
Serial.println("CANSAT kit LED test.");
pinMode(D13_LED, OUTPUT);
}
void loop()
{
pinMode(M_LED, OUTPUT);
Serial.println("Zapnutí LED diod D13, MLED červená.");
digitalWrite(D13_LED, HIGH);
digitalWrite(M_LED, HIGH);
delay(ms_delay);
Serial.println("Vypnutí LED diody D13, zapnutí MLED modrá.");
digitalWrite(D13_LED, LOW);
digitalWrite(M_LED, LOW);
delay(ms_delay);
Serial.println("Vypnutí MLED.");
pinMode(M_LED, INPUT);
delay(ms_delay);
}
......@@ -2,59 +2,46 @@
#include <RH_RF69.h>
#define Serial SerialUSB
#define ss_pin 43 //radio chip select
#define interupt_pin 9 //radio interrupt
// Variables setting
int ss_pin = 43;
int tx_pin = 14;
int interupt_pin = 9;
RH_RF69 rf69(ss_pin, interupt_pin);
RH_RF69 rf69(ss_pin, interupt_pin); //create an RFM69 instance
// the setup function runs once
void setup()
{
Serial.begin(9600);
while(!Serial);
while(!Serial); //required for devices with native USB
Serial.println("CANSAT kit RFM69_rx test started.");
if (!rf69.init())
{
// initialize the radio
if (!rf69.init()) {
Serial.println("Init of RFM69 failed");
}
else
{
} else {
Serial.println("Init of RFM69 ok");
}
if (!rf69.setFrequency(433.0))
{
// set frequency
if (!rf69.setFrequency(433.0)) {
Serial.println("Set frequency failed.");
}
else
{
} else {
Serial.println("Set frequency ok.");
}
// ? needed
rf69.setTxPower(tx_pin);
}
void loop()
{
if (rf69.available())
{
uint8_t buf[RH_RF69_MAX_MESSAGE_LEN];
if (rf69.available()) {
uint8_t buf[RH_RF69_MAX_MESSAGE_LEN]; //create a huge buffer for received data
uint8_t len = sizeof(buf);
if (rf69.recv(buf, &len))
{
// receive to the buffer and print to serial
if (rf69.recv(buf, &len)){
Serial.print("Data received: ");
Serial.println((char*)buf);
}
else
{
} else {
Serial.println("Data receiving failed.");
}
}
......
#include <SPI.h>
#include <RH_RF69.h>
#define Serial SerialUSB
#define ss_pin 43 //radio chip select
#define interupt_pin 9 //radio interrupt
RH_RF69 rf69(ss_pin, interupt_pin); //create an RFM69 instance
// declaration of the structure and its variables
typedef struct {
bool BoolVariable;
int IntVariable;
} payloadIn;
//declaration of local variables; we'll put the received data here
bool boolVariable;
int intVariable;
payloadIn recvData;
// the setup function runs once
void setup()
{
Serial.begin(9600);
while(!Serial); //required for devices with native USB
Serial.println("CANSAT kit RFM69_rx test started.");
// initialize the radio
if (!rf69.init()) {
Serial.println("Init of RFM69 failed");
} else {
Serial.println("Init of RFM69 ok");
}
// set frequency
if (!rf69.setFrequency(433.0)) {
Serial.println("Set frequency failed.");
} else {
Serial.println("Set frequency ok.");
}
}
void loop() {
if (rf69.available()) {
// receive the structure
uint8_t len = sizeof(payloadIn);
rf69.recv((uint8_t *)&recvData, &len);
// load data where we want them
boolVariable = recvData.BoolVariable;
intVariable = recvData.IntVariable;
// print the received data to serial
Serial.println(boolVariable);
Serial.println(intVariable);
}
}
#include <SPI.h>
#include <RH_RF69.h>
#define Serial SerialUSB
#define ss_pin 43 //radio chip select
#define interupt_pin 9 //radio interrupt
int ms_delay = 100;
RH_RF69 rf69(ss_pin, interupt_pin);
// define our own struct with some variables; used to send stuff
typedef struct {
bool BoolVariable;
int IntVariable;
} payloadOut;
payloadOut senData; //create the struct variable
void setup() {
Serial.begin(9600);
//while(!Serial); //required for devices with native USB
Serial.println("CANSAT kit RFM69_tx test started.");
// initialize the radio
if (!rf69.init()) {
Serial.println("Init of RFM69 failed");
} else {
Serial.println("Init of RFM69 ok");
}
// set frequency
if (!rf69.setFrequency(433.0)) {
Serial.println("Set frequency failed.");
} else {
Serial.println("Set frequency ok.");
}
rf69.setTxPower(15); // set transmit power
// load some values into the variables; you'll probably want to do this somewhere in the loop
senData.BoolVariable = true;
senData.IntVariable = 123;
}
void loop()
{
// create buffer with data and transmit it
if(!rf69.send((uint8_t *)&senData, sizeof(senData))) {
Serial.println("Failed");
} else {
Serial.println("Sent");
}
delay(ms_delay); //wait
}
......@@ -2,13 +2,9 @@
#include <RH_RF69.h>
#define Serial SerialUSB
#define ss_pin 43 //radio chip select
#define interupt_pin 9 //radio interrupt
// Variables setting
int ss_pin = 43;
int tx_pin = 14;
int interupt_pin = 9;
// number of ms between receiving
int ms_delay = 100;
RH_RF69 rf69(ss_pin, interupt_pin);
......@@ -16,44 +12,36 @@ RH_RF69 rf69(ss_pin, interupt_pin);
void setup()
{
Serial.begin(9600);
while(!Serial);
while(!Serial); //required for devices with native USB
Serial.println("CANSAT kit RFM69_tx test started.");
if (!rf69.init())
{
// initialize the radio
if (!rf69.init()) {
Serial.println("Init of RFM69 failed");
}
else
{
} else {
Serial.println("Init of RFM69 ok");
}
if (!rf69.setFrequency(433.0))
{
// set frequency
if (!rf69.setFrequency(433.0)) {
Serial.println("Set frequency failed.");
}
else
{
} else {
Serial.println("Set frequency ok.");
}
// ? needed
rf69.setTxPower(tx_pin);
rf69.setTxPower(15); // set transmit power
}
void loop()
{
// create buffer with data and transmit it
uint8_t data[20] = "Cansat tx test!";
if(!rf69.send(data, sizeof(data)))
{
if(!rf69.send(data, sizeof(data))) {
Serial.println("Failed.");
}
else
{
} else {
Serial.println("Sended.");
}
delay(ms_delay);
delay(ms_delay); //wait
}
This diff is collapsed.
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE eagle SYSTEM "eagle.dtd">
<eagle version="8.2.2">
<eagle version="8.7.0">
<drawing>
<settings>
<setting alwaysvectorfont="no"/>
<setting keepoldvectorfont="yes"/>
<setting verticaltext="up"/>
</settings>
<grid distance="0.079375" unitdist="mm" unit="mm" style="lines" multiple="1" display="yes" altdistance="5" altunitdist="mil" altunit="mil"/>
......@@ -200,12 +201,13 @@
<vertex x="18.0975" y="20.0025"/>
<vertex x="18.0975" y="25.7175"/>
</polygon>
<text x="26.114375" y="56.35625" size="1.27" layer="16" font="vector" ratio="15" rot="MR0">RevA</text>
<text x="32.305625" y="57.62625" size="1.27" layer="16" font="vector" ratio="15" rot="MR180">PWR 2.0</text>
<text x="21.74875" y="56.435625" size="1.27" layer="1" font="vector" ratio="15">RevA</text>
<text x="40.3225" y="57.62625" size="1.27" layer="1" font="vector" ratio="15" rot="R180">PWR 2.0</text>
<text x="1.5875" y="33.02" size="1.778" layer="21" font="vector" ratio="15" rot="SR270">ACC</text>
<text x="40.48125" y="8.89" size="1.27" layer="1" font="vector" ratio="15" rot="R180">PowerBoard v2.0 RevA</text>
<text x="1.5875" y="33.02" size="1.778" layer="21" font="vector" ratio="15" rot="SR270">+ACU</text>
<text x="38.1" y="40.79875" size="1.5" layer="21" font="vector" ratio="15">500mA MAX</text>
<text x="17.859375" y="8.89" size="1.27" layer="16" font="vector" ratio="15" rot="MR180">PowerBoard v2.0 RevA</text>
<text x="27.46375" y="4.7625" size="1.27" layer="21" font="vector" ratio="15">openCanSat.eu</text>
<wire x1="27.14625" y1="4.524375" x2="28.41625" y2="4.524375" width="0.1524" layer="21"/>
<wire x1="29.05125" y1="4.524375" x2="41.5925" y2="4.524375" width="0.1524" layer="21"/>
</plain>
<libraries>
<library name="#my">
......@@ -349,7 +351,7 @@
<text x="12.7" y="-1.27" size="0.4064" layer="51" align="center">23</text>
<text x="-15.24" y="-3.175" size="0.6096" layer="21" font="vector" ratio="15" align="center">+3V3</text>
<text x="15.24" y="-3.175" size="0.6096" layer="21" font="vector" ratio="15" align="center">TX</text>
<text x="-12.7" y="-3.175" size="0.6096" layer="21" font="vector" ratio="15" align="center">+AKU</text>
<text x="-12.7" y="-3.175" size="0.6096" layer="21" font="vector" ratio="15" align="center">+ACU</text>
<text x="-10.16" y="-3.175" size="0.6096" layer="21" font="vector" ratio="15" align="center">GND</text>
<text x="-7.62" y="-3.175" size="0.6096" layer="21" font="vector" ratio="15" align="center">SCL</text>
<text x="-5.08" y="-3.175" size="0.6096" layer="21" font="vector" ratio="15" align="center">SCA</text>
......@@ -405,7 +407,7 @@
<wire x1="16.51" y1="-2.5" x2="16.51" y2="2.5" width="0.127" layer="22"/>
<text x="-15.24" y="-3.175" size="0.6096" layer="22" font="vector" ratio="15" rot="MR180" align="center">+3V3</text>
<text x="15.24" y="-3.175" size="0.6096" layer="22" font="vector" ratio="15" rot="MR180" align="center">TX</text>
<text x="-12.7" y="-3.175" size="0.6096" layer="22" font="vector" ratio="15" rot="MR180" align="center">+AKU</text>
<text x="-12.7" y="-3.175" size="0.6096" layer="22" font="vector" ratio="15" rot="MR180" align="center">+ACU</text>
<text x="-10.16" y="-3.175" size="0.6096" layer="22" font="vector" ratio="15" rot="MR180" align="center">GND</text>
<text x="-7.62" y="-3.175" size="0.6096" layer="22" font="vector" ratio="15" rot="MR180" align="center">SCL</text>
<text x="-5.08" y="-3.175" size="0.6096" layer="22" font="vector" ratio="15" rot="MR180" align="center">SCA</text>
......@@ -446,7 +448,7 @@
<text x="-4.58" y="18.24" size="3.81" layer="21" font="vector" ratio="15" align="center">+</text>
<text x="-19.67" y="20.17" size="3.81" layer="21" font="vector" ratio="15" rot="R90" align="center">-</text>
<text x="0" y="2" size="1.778" layer="21" font="vector" ratio="15" align="center">LiPo 3.7V</text>
<text x="0" y="-3" size="1.778" layer="21" font="vector" ratio="15" align="center">550mA</text>
<text x="0" y="-3" size="1.778" layer="21" font="vector" ratio="15" align="center">550mAh</text>
<wire x1="-20.5" y1="1.66" x2="-22.5" y2="3.16" width="0.2" layer="21" curve="-90"/>
<wire x1="-22.5" y1="3.16" x2="-22.5" y2="17" width="0.2" layer="21"/>
<wire x1="-20.5" y1="2.93" x2="-21.23" y2="3.66" width="0.2" layer="21" curve="-90"/>
......@@ -4341,10 +4343,11 @@ design rules under a new name.</description>
<param name="slThermalsForVias" value="0"/>
<param name="dpMaxLengthDifference" value="10mm"/>