diff --git a/README.md b/README.md index 36eb3595..c2a98d64 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ The CubeSat Simulator https://github.com/alanbjohnston/CubeSatSim/wiki is a low There are several hardware versions and software branches to go with them - see below for information. -See the Wiki Software Install page for more details: https://github.com/alanbjohnston/CubeSatSim/wiki/Software-Install. The software runs on any Raspberry Pi including the Raspberry Pi 4B, 3B, 3B+, Pi Zero or Pi Zero W. +See the Wiki Software Install page for more details: https://github.com/alanbjohnston/CubeSatSim/wiki/2.-Software-Install. The software runs on any Raspberry Pi including the Raspberry Pi 4B, 3B, 3B+, Pi Zero or Pi Zero W. There are two ways to get the CubeSatSim software for your Pi. @@ -17,12 +17,13 @@ The other option is to start with any Raspberry Pi OS (Rasbian) image and run th - pi-power-button - Direwolf - rpitx +- cpulimit - python3-pip - python-smbus ## Disk Image Option Steps -See the Wiki Software Install page for details: https://github.com/alanbjohnston/CubeSatSim/wiki/Software-Install. +See the Wiki Software Install page for details: https://github.com/alanbjohnston/CubeSatSim/wiki/2.-Software-Install. ## Installation Script Option Steps diff --git a/afsk/main.c b/afsk/main.c index 21a8d55d..e9acbc31 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -46,7 +46,6 @@ #define B 2 #define C 3 #define D 4 - #define PLUS_X 0 #define PLUS_Y 1 #define BAT 2 @@ -55,7 +54,6 @@ #define MINUS_Y 5 #define PLUS_Z 6 #define MINUS_Z 7 - #define TEMP 2 #define PRES 3 #define ALT 4 @@ -98,12 +96,14 @@ static int init_rf(); int socket_open = 0; int sock = 0; int loop = -1, loop_count = 0; -int firstTime = ON; +int firstTime = ON; // 0; long start; int testCount = 0; long time_start; - +char cmdbuffer[1000]; +FILE * file1; short int buffer[2336400]; // max size for 10 frames count of BPSK +FILE *sopen(const char *program); #define S_RATE (48000) // (44100) @@ -116,6 +116,8 @@ int rpitxStatus = -1; float amplitude; // = ; // 20000; // 32767/(10%amp+5%amp+100%amp) float freq_Hz = 3000; // 1200 +short int sin_samples; +short int sin_map[16]; int smaller; int flip_ctr = 0; @@ -134,7 +136,8 @@ char call[5]; int bitRate, mode, bufLen, rsFrames, payloads, rsFrameLen, dataLen, headerLen, syncBits, syncWord, parityLen, samples, frameCnt, samplePeriod; float sleepTime; -int sampleTime = 0, frames_sent = 0; +unsigned int sampleTime = 0; +int frames_sent = 0; int cw_id = ON; int vB4 = FALSE, vB5 = FALSE, vB3 = FALSE, ax5043 = FALSE, transmit = FALSE, onLed, onLedOn, onLedOff, txLed, txLedOn, txLedOff, payload = OFF; float batteryThreshold = 3.0, batteryVoltage; @@ -340,22 +343,48 @@ int main(int argc, char * argv[]) { strcpy(pythonStr, pythonCmd); strcat(pythonStr, busStr); strcat(pythonConfigStr, pythonStr); - strcat(pythonConfigStr, " c"); + strcat(pythonConfigStr, " c"); - // FILE* file1 = popen("python3 /home/pi/CubeSatSim/python/voltcurrent.py 1 11 c", "r"); - FILE * file1 = popen(pythonConfigStr, "r"); - char cmdbuffer[1000]; + fprintf(stderr, "pythonConfigStr: %s\n", pythonConfigStr); + + file1 = sopen(pythonConfigStr); // try new function + fgets(cmdbuffer, 1000, file1); + fprintf(stderr, "pythonStr result: %s\n", cmdbuffer); +/* + sleep(5); + fputc('\n', file1); fgets(cmdbuffer, 1000, file1); - // printf("pythonStr result: %s\n", cmdbuffer); - pclose(file1); + printf("pythonStr result2: %s\n", cmdbuffer); + + file1 = popen(pythonConfigStr, "w"); + fgets(cmdbuffer, 1000, file1); + printf("pythonStr result: %s\n", cmdbuffer); + fgets(cmdbuffer, 1000, file1); + printf("pythonStr resulta: %s\n", cmdbuffer); + fgets(cmdbuffer, 1000, file1); + printf("pythonStr resultb: %s\n", cmdbuffer); +// pclose(file1); + + sleep(5); + fputc('\n', file1); + fgets(cmdbuffer, 1000, file1); + printf("pythonStr result2: %s\n", cmdbuffer); + fgets(cmdbuffer, 1000, file1); + printf("pythonStr result2a: %s\n", cmdbuffer); + + sleep(5); + fputc('\n', file1); + fgets(cmdbuffer, 1000, file1); + printf("pythonStr result2: %s\n", cmdbuffer); +*/ // try connecting to Arduino payload using UART if (!ax5043 && !vB3) // don't test if AX5043 is present { payload = OFF; - if ((uart_fd = serialOpen("/dev/ttyAMA0", 9600)) >= 0) { + if ((uart_fd = serialOpen("/dev/ttyAMA0", 115200)) >= 0) { // was 9600 char c; int charss = (char) serialDataAvail(uart_fd); if (charss != 0) @@ -398,12 +427,12 @@ int main(int argc, char * argv[]) { i2c_bus3 = (test_i2c_bus(3) != -1) ? ON : OFF; // check for camera - char cmdbuffer1[1000]; +// char cmdbuffer1[1000]; FILE * file4 = popen("vcgencmd get_camera", "r"); - fgets(cmdbuffer1, 1000, file4); + fgets(cmdbuffer, 1000, file4); char camera_present[] = "supported=1 detected=1"; // printf("strstr: %s \n", strstr( & cmdbuffer1, camera_present)); - camera = (strstr( (const char *)& cmdbuffer1, camera_present) != NULL) ? ON : OFF; + camera = (strstr( (const char *)& cmdbuffer, camera_present) != NULL) ? ON : OFF; // printf("Camera result:%s camera: %d \n", & cmdbuffer1, camera); pclose(file4); @@ -411,8 +440,7 @@ int main(int argc, char * argv[]) { printf("INFO: I2C bus status 0: %d 1: %d 3: %d camera: %d\n", i2c_bus0, i2c_bus1, i2c_bus3, camera); #endif - // if ((i2c_bus1 == OFF) && (i2c_bus3 == OFF)) { - if (i2c_bus3 == OFF) { // i2c bus 13 can be turned off manually by editing /boot/config.txt + if (i2c_bus3 == OFF) { sim_mode = TRUE; @@ -484,38 +512,14 @@ int main(int argc, char * argv[]) { for (int i = 0; i < 17; i++) { sensor_min[i] = 1000.0; sensor_max[i] = -1000.0; - printf("Sensor min and max initialized!"); + // printf("Sensor min and max initialized!"); } for (int i = 0; i < 3; i++) { other_min[i] = 1000.0; other_max[i] = -1000.0; } - while (loop-- != 0) { - frames_sent++; - - #ifdef DEBUG_LOGGING - fprintf(stderr, "INFO: Battery voltage: %f V Battery Threshold %f V\n", batteryVoltage, batteryThreshold); - #endif - if ((batteryVoltage > 1.0) && (batteryVoltage < batteryThreshold)) // no battery INA219 will give 0V, no battery plugged into INA219 will read < 1V - { - fprintf(stderr, "Battery voltage too low: %f V - shutting down!\n", batteryVoltage); - digitalWrite(txLed, txLedOff); - digitalWrite(onLed, onLedOff); - sleep(1); - digitalWrite(onLed, onLedOn); - sleep(1); - digitalWrite(onLed, onLedOff); - sleep(1); - digitalWrite(onLed, onLedOn); - sleep(1); - digitalWrite(onLed, onLedOff); - - popen("sudo shutdown -h now > /dev/null 2>&1", "r"); - sleep(10); - } - - if (mode == FSK) { + if (mode == FSK) { bitRate = 200; rsFrames = 1; payloads = 1; @@ -556,12 +560,53 @@ int main(int argc, char * argv[]) { printf("\n BPSK Mode, bufLen: %d, %d bits per frame, %d bits per second, %d seconds per frame %d ms sample period\n", bufLen, bufLen / (samples * frameCnt), bitRate, bufLen / (samples * frameCnt * bitRate), samplePeriod); + + sin_samples = S_RATE/freq_Hz; + printf("Sin map: "); + for (int j = 0; j < sin_samples; j++) { + sin_map[j] = (short int)(amplitude * sin((float)(2 * M_PI * j / sin_samples))); + printf(" %d", sin_map[j]); + } + printf("\n"); + } + + long int loopTime; + loopTime = millis(); + + while (loop-- != 0) { + fflush(stdout); + fflush(stderr); +// frames_sent++; + + printf("++++ Loop time: %d +++++\n", millis() - loopTime); + loopTime = millis(); + + #ifdef DEBUG_LOGGING + fprintf(stderr, "INFO: Battery voltage: %f V Battery Threshold %f V\n", batteryVoltage, batteryThreshold); + #endif + if ((batteryVoltage > 1.0) && (batteryVoltage < batteryThreshold)) // no battery INA219 will give 0V, no battery plugged into INA219 will read < 1V + { + fprintf(stderr, "Battery voltage too low: %f V - shutting down!\n", batteryVoltage); + digitalWrite(txLed, txLedOff); + digitalWrite(onLed, onLedOff); + + sleep(1); + digitalWrite(onLed, onLedOn); + sleep(1); + digitalWrite(onLed, onLedOff); + sleep(1); + digitalWrite(onLed, onLedOn); + sleep(1); + digitalWrite(onLed, onLedOff); + + popen("sudo shutdown -h now > /dev/null 2>&1", "r"); + sleep(10); } // sleep(1); // Delay 1 second ctr = 0; #ifdef DEBUG_LOGGING - fprintf(stderr, "INFO: Getting TLM Data\n"); +// fprintf(stderr, "INFO: Getting TLM Data\n"); #endif if ((mode == AFSK) || (mode == CW)) { @@ -572,7 +617,7 @@ int main(int argc, char * argv[]) { } #ifdef DEBUG_LOGGING - fprintf(stderr, "INFO: Getting ready to send\n"); +// fprintf(stderr, "INFO: Getting ready to send\n"); #endif } @@ -641,6 +686,10 @@ void get_tlm(void) { FILE * txResult; for (int j = 0; j < frameCnt; j++) { + + fflush(stdout); + fflush(stderr); + digitalWrite(txLed, txLedOn); #ifdef DEBUG_LOGGING printf("Tx LED On\n"); @@ -652,12 +701,13 @@ void get_tlm(void) { int count1; char * token; - char cmdbuffer[1000]; +// char cmdbuffer[1000]; - FILE * file = popen(pythonStr, "r"); - fgets(cmdbuffer, 1000, file); - // printf("result: %s\n", cmdbuffer); - pclose(file); +// FILE * file = popen(pythonStr, "r"); + fputc('\n', file1); + fgets(cmdbuffer, 1000, file1); + printf("Python result: %s\n", cmdbuffer); +// pclose(file); const char space[2] = " "; token = strtok(cmdbuffer, space); @@ -696,7 +746,7 @@ void get_tlm(void) { cpuTemp /= 1000; #ifdef DEBUG_LOGGING - printf("CPU Temp Read: %6.1f\n", cpuTemp); +// printf("CPU Temp Read: %6.1f\n", cpuTemp); #endif } @@ -819,7 +869,8 @@ void get_tlm(void) { char header_long[10]; char header_str4[] = "hi hi "; char footer_str1[] = "\' > t.txt && echo \'"; - char footer_str[] = ">CQ:010101/hi hi ' >> t.txt && gen_packets -o telem.wav t.txt -r 48000 > /dev/null 2>&1 && cat telem.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.9e3 > /dev/null 2>&1"; +// char footer_str[] = ">CQ:010101/hi hi ' >> t.txt && gen_packets -o telem.wav t.txt -r 48000 > /dev/null 2>&1 && cat telem.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.9e3 > /dev/null 2>&1"; + char footer_str[] = ">CQ:010101/hi hi ' >> t.txt && touch ready"; // transmit is done by rpitx.py if (ax5043) { strcpy(str, header_str); @@ -885,7 +936,7 @@ void get_tlm(void) { int i = 0; serialPutchar(uart_fd, '?'); - printf("Querying payload with ?\n"); +// printf("Querying payload with ?\n"); waitTime = millis() + 500; int end = FALSE; while ((millis() < waitTime) && !end) { @@ -903,7 +954,7 @@ void get_tlm(void) { } // sensor_payload[i++] = '\n'; sensor_payload[i] = '\0'; - printf("Payload string: %s", sensor_payload); + printf("Payload string: %s\n", sensor_payload); strcat(str, sensor_payload); // append to telemetry string for transmission } @@ -954,6 +1005,7 @@ void get_tlm(void) { if (transmit) { FILE * file2 = popen(str, "r"); pclose(file2); + sleep(2); } else { fprintf(stderr, "\nNo CubeSatSim Band Pass Filter detected. No transmissions after the CW ID.\n"); fprintf(stderr, " See http://cubesatsim.org/wiki for info about building a CubeSatSim\n\n"); @@ -982,7 +1034,7 @@ void get_tlm(void) { void get_tlm_fox() { // Reading I2C voltage and current sensors - +/* FILE * uptime_file = fopen("/proc/uptime", "r"); fscanf(uptime_file, "%f", & uptime_sec); uptime = (int) uptime_sec; @@ -990,7 +1042,7 @@ void get_tlm_fox() { printf("Reset Count: %d Uptime since Reset: %ld \n", reset_count, uptime); #endif fclose(uptime_file); - +*/ int i; // long int sync = SYNC_WORD; long int sync = syncWord; @@ -999,8 +1051,13 @@ void get_tlm_fox() { // short int b[DATA_LEN]; short int b[dataLen]; + short int b_max[dataLen]; + short int b_min[dataLen]; + memset(b, 0, sizeof(b)); - + memset(b_max, 0, sizeof(b_max)); + memset(b_min, 0, sizeof(b_min)); + // short int h[HEADER_LEN]; short int h[headerLen]; memset(h, 0, sizeof(h)); @@ -1046,151 +1103,43 @@ void get_tlm_fox() { // delay for sample period digitalWrite(txLed, txLedOn); #ifdef DEBUG_LOGGING - printf("Tx LED On\n"); +// printf("Tx LED On\n"); #endif - +/* while ((millis() - sampleTime) < (unsigned int)samplePeriod) sleep((unsigned int)sleepTime); - +*/ +// if (mode == FSK) + sleep(2.3); // No sleep at all! +// else +// sleep(1.3); + digitalWrite(txLed, txLedOff); #ifdef DEBUG_LOGGING - printf("Tx LED Off\n"); +// printf("Tx LED Off\n"); #endif - printf("Sample period: %d\n", millis() - (unsigned int)sampleTime); - sampleTime = (int) millis(); +// printf("Sample period: %d\n", millis() - (unsigned int)sampleTime); + sampleTime = (unsigned int) millis(); } else printf("first time - no sleep\n"); - - int count1; - char * token; - char cmdbuffer[1000]; - - FILE * file = popen(pythonStr, "r"); - fgets(cmdbuffer, 1000, file); - // printf("result: %s\n", cmdbuffer); - pclose(file); - - const char space[2] = " "; - token = strtok(cmdbuffer, space); - + float voltage[9], current[9], sensor[17], other[3]; + char sensor_payload[500]; memset(voltage, 0, sizeof(voltage)); memset(current, 0, sizeof(current)); memset(sensor, 0, sizeof(sensor)); - memset(other, 0, sizeof(other)); - - for (count1 = 0; count1 < 8; count1++) { - if (token != NULL) { - voltage[count1] = (float) atof(token); - #ifdef DEBUG_LOGGING - // printf("voltage: %f ", voltage[count1]); - #endif - token = strtok(NULL, space); - if (token != NULL) { - current[count1] = (float) atof(token); - if ((current[count1] < 0) && (current[count1] > -0.5)) - current[count1] *= (-1.0f); - #ifdef DEBUG_LOGGING - // printf("current: %f\n", current[count1]); - #endif - token = strtok(NULL, space); - } - } - } - - // printf("\n"); - - batteryVoltage = voltage[map[BAT]]; - if (batteryVoltage < 3.5) { - NormalModeFailure = 1; - printf("Safe Mode!\n"); - } else - NormalModeFailure = 0; - - FILE * cpuTempSensor = fopen("/sys/class/thermal/thermal_zone0/temp", "r"); - if (cpuTempSensor) { - double cpuTemp; - fscanf(cpuTempSensor, "%lf", & cpuTemp); - cpuTemp /= 1000; - - #ifdef DEBUG_LOGGING - printf("CPU Temp Read: %6.1f\n", cpuTemp); - #endif - - other[IHU_TEMP] = (double)cpuTemp; - - // IHUcpuTemp = (int)((cpuTemp * 10.0) + 0.5); - } - fclose(cpuTempSensor); - - char sensor_payload[500]; - - if (payload == ON) { - STEMBoardFailure = 0; - - char c; - int charss = (char) serialDataAvail(uart_fd); - if (charss != 0) - printf("Clearing buffer of %d chars \n", charss); - while ((charss--> 0)) - c = (char) serialGetchar(uart_fd); // clear buffer - - unsigned int waitTime; - int i = 0; - serialPutchar(uart_fd, '?'); - printf("Querying payload with ?\n"); - waitTime = millis() + 500; - int end = FALSE; - // int retry = FALSE; - while ((millis() < waitTime) && !end) { - int chars = (char) serialDataAvail(uart_fd); - while ((chars--> 0) && !end) { - c = (char) serialGetchar(uart_fd); - // printf ("%c", c); - // fflush(stdout); - if (c != '\n') { - sensor_payload[i++] = c; - } else { - end = TRUE; - } - } - } - sensor_payload[i++] = ' '; - // sensor_payload[i++] = '\n'; - sensor_payload[i] = '\0'; - printf("Payload string: %s \n", sensor_payload); - - if ((sensor_payload[0] == 'O') && (sensor_payload[1] == 'K')) // only process if valid payload response - { - int count1; - char * token; - // char cmdbuffer[1000]; - - // FILE *file = popen("python3 /home/pi/CubeSatSim/python/voltcurrent.py 1 11", "r"); - // fgets(cmdbuffer, 1000, file); - // printf("result: %s\n", cmdbuffer); - // pclose(file); - - const char space[2] = " "; - token = strtok(sensor_payload, space); - for (count1 = 0; count1 < 17; count1++) { - if (token != NULL) { - sensor[count1] = (float) atof(token); - #ifdef DEBUG_LOGGING - printf("sensor: %f ", sensor[count1]); - #endif - token = strtok(NULL, space); - } - } - printf("\n"); - - } - - } - - if (sim_mode) { - // simulated telemetry + memset(other, 0, sizeof(other)); + + FILE * uptime_file = fopen("/proc/uptime", "r"); + fscanf(uptime_file, "%f", & uptime_sec); + uptime = (int) uptime_sec; +// #ifdef DEBUG_LOGGING +// printf("INFO: Reset Count: %d Uptime since Reset: %ld \n", reset_count, uptime); +// #endif + fclose(uptime_file); + + if (sim_mode) { // simulated telemetry double time = ((long int)millis() - time_start) / 1000.0; @@ -1200,11 +1149,6 @@ void get_tlm_fox() { printf("\n\nSwitching eclipse mode! \n\n"); } - /* - double Xi = eclipse * amps_max[0] * sin(2.0 * 3.14 * time / (46.0 * speed)) * fabs(sin(2.0 * 3.14 * time / (46.0 * speed))) + rnd_float(-2, 2); - double Yi = eclipse * amps_max[1] * sin((2.0 * 3.14 * time / (46.0 * speed)) + (3.14/2.0)) * fabs(sin((2.0 * 3.14 * time / (46.0 * speed)) + (3.14/2.0))) + rnd_float(-2, 2); - double Zi = eclipse * amps_max[2] * sin((2.0 * 3.14 * time / (46.0 * speed)) + 3.14 + angle[2]) * fabs(sin((2.0 * 3.14 * time / (46.0 * speed)) + 3.14 + angle[2])) + rnd_float(-2, 2); - */ double Xi = eclipse * amps_max[0] * (float) sin(2.0 * 3.14 * time / (46.0 * speed)) + rnd_float(-2, 2); double Yi = eclipse * amps_max[1] * (float) sin((2.0 * 3.14 * time / (46.0 * speed)) + (3.14 / 2.0)) + rnd_float(-2, 2); double Zi = eclipse * amps_max[2] * (float) sin((2.0 * 3.14 * time / (46.0 * speed)) + 3.14 + angle[2]) + rnd_float(-2, 2); @@ -1261,79 +1205,214 @@ void get_tlm_fox() { // end of simulated telemetry } + else { + int count1; + char * token; +// char cmdbuffer[1000]; +/**/ +// FILE * file = popen(pythonStr, "r"); + fputc('\n', file1); + fgets(cmdbuffer, 1000, file1); + fprintf(stderr, "Python read Result: %s\n", cmdbuffer); +// pclose(file); +/**/ + const char space[2] = " "; + token = strtok(cmdbuffer, space); + + for (count1 = 0; count1 < 8; count1++) { + if (token != NULL) { + voltage[count1] = (float) atof(token); + #ifdef DEBUG_LOGGING + // printf("voltage: %f ", voltage[count1]); + #endif + token = strtok(NULL, space); + if (token != NULL) { + current[count1] = (float) atof(token); + if ((current[count1] < 0) && (current[count1] > -0.5)) + current[count1] *= (-1.0f); + #ifdef DEBUG_LOGGING + // printf("current: %f\n", current[count1]); + #endif + token = strtok(NULL, space); + } + } + } + // printf("\n"); + +// sleep(0.5); +// printf("Sleep over\n"); + + batteryVoltage = voltage[map[BAT]]; + if (batteryVoltage < 3.5) { + NormalModeFailure = 1; + printf("Safe Mode!\n"); + } else + NormalModeFailure = 0; - for (count1 = 0; count1 < 8; count1++) { - if (voltage[count1] < voltage_min[count1]) - voltage_min[count1] = voltage[count1]; - if (current[count1] < current_min[count1]) - current_min[count1] = current[count1]; - - if (voltage[count1] > voltage_max[count1]) - voltage_max[count1] = voltage[count1]; - if (current[count1] > current_max[count1]) - current_max[count1] = current[count1]; + FILE * cpuTempSensor = fopen("/sys/class/thermal/thermal_zone0/temp", "r"); + if (cpuTempSensor) { + double cpuTemp; + fscanf(cpuTempSensor, "%lf", & cpuTemp); + cpuTemp /= 1000; - printf("Vmin %f Vmax %f Imin %f Imax %f \n", voltage_min[count1], voltage_max[count1], current_min[count1], current_max[count1]); - } + #ifdef DEBUG_LOGGING +// printf("CPU Temp Read: %6.1f\n", cpuTemp); + #endif - if ((sensor_payload[0] == 'O') && (sensor_payload[1] == 'K')) { - for (count1 = 0; count1 < 17; count1++) { - if (sensor[count1] < sensor_min[count1]) - sensor_min[count1] = sensor[count1]; - if (sensor[count1] > sensor_max[count1]) - sensor_max[count1] = sensor[count1]; + other[IHU_TEMP] = (double)cpuTemp; - printf("Smin %f Smax %f \n", sensor_min[count1], sensor_max[count1]); + // IHUcpuTemp = (int)((cpuTemp * 10.0) + 0.5); } - } + fclose(cpuTempSensor); - for (count1 = 0; count1 < 3; count1++) { - if (other[count1] < other_min[count1]) - other_min[count1] = other[count1]; - if (other[count1] > other_max[count1]) - other_max[count1] = other[count1]; + if (payload == ON) { // -55 + STEMBoardFailure = 0; - printf("Other min %f max %f \n", other_min[count1], other_max[count1]); - } + char c; + int charss = (char) serialDataAvail(uart_fd); + if (charss != 0) + printf("Clearing buffer of %d chars \n", charss); + while ((charss--> 0)) + c = (char) serialGetchar(uart_fd); // clear buffer +/* + charss = (char) serialDataAvail(uart_fd); + if (charss != 0) + printf("Clearing buffer of %d chars \n", charss); + while ((charss--> 0)) + c = (char) serialGetchar(uart_fd); // clear buffer +*/ + + unsigned int waitTime; + int i = 0; + serialPutchar(uart_fd, '?'); +// printf("Querying payload with ?\n"); + waitTime = millis() + 500; + int end = FALSE; + // int retry = FALSE; + while ((millis() < waitTime) && !end) { + int chars = (char) serialDataAvail(uart_fd); + while ((chars--> 0) && !end) { + c = (char) serialGetchar(uart_fd); + // printf ("%c", c); + // fflush(stdout); + if (c != '\n') { + sensor_payload[i++] = c; + } else { + end = TRUE; + } + } + } + sensor_payload[i++] = ' '; + // sensor_payload[i++] = '\n'; + sensor_payload[i] = '\0'; + printf("Payload string: %s", sensor_payload); - if (mode == FSK) { - if (loop % 8 == 0) { - printf("Sending MIN frame \n"); - frm_type = 0x03; - for (count1 = 0; count1 < 17; count1++) { - if (count1 < 3) - other[count1] = other_min[count1]; - if (count1 < 8) { - voltage[count1] = voltage_min[count1]; - current[count1] = current_min[count1]; + if ((sensor_payload[0] == 'O') && (sensor_payload[1] == 'K')) // only process if valid payload response + { + int count1; + char * token; + // char cmdbuffer[1000]; + + // FILE *file = popen("python3 /home/pi/CubeSatSim/python/voltcurrent.py 1 11", "r"); + // fgets(cmdbuffer, 1000, file); + // printf("result: %s\n", cmdbuffer); + // pclose(file); + + const char space[2] = " "; + token = strtok(sensor_payload, space); + for (count1 = 0; count1 < 17; count1++) { + if (token != NULL) { + sensor[count1] = (float) atof(token); + #ifdef DEBUG_LOGGING + // printf("sensor: %f ", sensor[count1]); + #endif + token = strtok(NULL, space); + } + } + printf("\n"); } - if (sensor_min[count1] != 1000.0) // make sure values are valid - sensor[count1] = sensor_min[count1]; } - } - if ((loop + 4) % 8 == 0) { - printf("Sending MAX frame \n"); - frm_type = 0x02; - for (count1 = 0; count1 < 17; count1++) { - if (count1 < 3) - other[count1] = other_max[count1]; - if (count1 < 8) { - voltage[count1] = voltage_max[count1]; - current[count1] = current_max[count1]; - } - if (sensor_max[count1] != -1000.0) // make sure values are valid - sensor[count1] = sensor_max[count1]; + if ((sensor_payload[0] == 'O') && (sensor_payload[1] == 'K')) { + for (count1 = 0; count1 < 17; count1++) { + if (sensor[count1] < sensor_min[count1]) + sensor_min[count1] = sensor[count1]; + if (sensor[count1] > sensor_max[count1]) + sensor_max[count1] = sensor[count1]; + // printf("Smin %f Smax %f \n", sensor_min[count1], sensor_max[count1]); + } } } - } +// if (mode == FSK) + { // just moved + for (int count1 = 0; count1 < 8; count1++) { + if (voltage[count1] < voltage_min[count1]) + voltage_min[count1] = voltage[count1]; + if (current[count1] < current_min[count1]) + current_min[count1] = current[count1]; + + if (voltage[count1] > voltage_max[count1]) + voltage_max[count1] = voltage[count1]; + if (current[count1] > current_max[count1]) + current_max[count1] = current[count1]; + +// printf("Vmin %4.2f Vmax %4.2f Imin %4.2f Imax %4.2f \n", voltage_min[count1], voltage_max[count1], current_min[count1], current_max[count1]); + } + for (int count1 = 0; count1 < 3; count1++) { + if (other[count1] < other_min[count1]) + other_min[count1] = other[count1]; + if (other[count1] > other_max[count1]) + other_max[count1] = other[count1]; + + // printf("Other min %f max %f \n", other_min[count1], other_max[count1]); + } + if (mode == FSK) + { + if (loop % 8 == 0) { + printf("Sending MIN frame \n"); + frm_type = 0x03; + for (int count1 = 0; count1 < 17; count1++) { + if (count1 < 3) + other[count1] = other_min[count1]; + if (count1 < 8) { + voltage[count1] = voltage_min[count1]; + current[count1] = current_min[count1]; + } + if (sensor_min[count1] != 1000.0) // make sure values are valid + sensor[count1] = sensor_min[count1]; + } + } + if ((loop + 4) % 8 == 0) { + printf("Sending MAX frame \n"); + frm_type = 0x02; + for (int count1 = 0; count1 < 17; count1++) { + if (count1 < 3) + other[count1] = other_max[count1]; + if (count1 < 8) { + voltage[count1] = voltage_max[count1]; + current[count1] = current_max[count1]; + } + if (sensor_max[count1] != -1000.0) // make sure values are valid + sensor[count1] = sensor_max[count1]; + } + } + } + else + frm_type = 0x02; // BPSK always send MAX MIN frame + } + +// if (mode == FSK) { // remove this +// } memset(rs_frame, 0, sizeof(rs_frame)); memset(parities, 0, sizeof(parities)); - +/* FILE * uptime_file = fopen("/proc/uptime", "r"); fscanf(uptime_file, "%f", & uptime_sec); uptime = (int) uptime_sec; fclose(uptime_file); printf("Reset Count: %d Uptime since Reset: %ld \n", reset_count, uptime); +*/ + //sleep(1); + //printf("Sleep over\n"); h[0] = (short int) ((h[0] & 0xf8) | (id & 0x07)); // 3 bits // printf("h[0] %x\n", h[0]); @@ -1368,7 +1447,6 @@ void get_tlm_fox() { negZv = (int)(voltage[map[MINUS_Z]] * 100); batt_c_v = (int)(voltage[map[BAT]] * 100); - battCurr = (int)(current[map[BAT]] + 0.5) + 2048; PSUVoltage = (int)(voltage[map[BUS]] * 100); PSUCurrent = (int)(current[map[BUS]] + 0.5) + 2048; @@ -1376,9 +1454,6 @@ void get_tlm_fox() { if (payload == ON) STEMBoardFailure = 0; - // if (payload == ON) - // STEMBoardFailure = 0; - // read payload sensor if available encodeA(b, 0 + head_offset, batt_a_v); @@ -1427,8 +1502,122 @@ void get_tlm_fox() { encodeB(b, 25 + head_offset, negXi); encodeA(b, 27 + head_offset, negYi); encodeB(b, 28 + head_offset, negZi); - } - + + encodeA(b_max, 12 + head_offset, (int)(voltage_max[map[PLUS_X]] * 100)); + encodeB(b_max, 13 + head_offset, (int)(voltage_max[map[PLUS_Y]] * 100)); + encodeA(b_max, 15 + head_offset, (int)(voltage_max[map[PLUS_Z]] * 100)); + encodeB(b_max, 16 + head_offset, (int)(voltage_max[map[MINUS_X]] * 100)); + encodeA(b_max, 18 + head_offset, (int)(voltage_max[map[MINUS_Y]] * 100)); + encodeB(b_max, 19 + head_offset, (int)(voltage_max[map[MINUS_Z]] * 100)); + + encodeA(b_max, 21 + head_offset, (int)(current_max[map[PLUS_X]] + 0.5) + 2048); + encodeB(b_max, 22 + head_offset, (int)(current_max[map[PLUS_Y]] + 0.5) + 2048); + encodeA(b_max, 24 + head_offset, (int)(current_max[map[PLUS_Z]] + 0.5) + 2048); + encodeB(b_max, 25 + head_offset, (int)(current_max[map[MINUS_X]] + 0.5) + 2048); + encodeA(b_max, 27 + head_offset, (int)(current_max[map[MINUS_Y]] + 0.5) + 2048); + encodeB(b_max, 28 + head_offset, (int)(current_max[map[MINUS_Z]] + 0.5) + 2048); + + encodeA(b_max, 9 + head_offset, (int)(current_max[map[BAT]] + 0.5) + 2048); + encodeA(b_max, 3 + head_offset, (int)(voltage_max[map[BAT]] * 100)); + encodeA(b_max, 30 + head_offset, (int)(voltage_max[map[BUS]] * 100)); + encodeB(b_max, 46 + head_offset, (int)(current_max[map[BUS]] + 0.5) + 2048); + + encodeB(b_max, 37 + head_offset, (int)(other_max[RSSI] + 0.5) + 2048); + encodeA(b_max, 39 + head_offset, (int)(other_max[IHU_TEMP] * 10 + 0.5)); + encodeB(b_max, 31 + head_offset, ((int)(other_max[SPIN] * 10)) + 2048); + + if (sensor_min[0] != 1000.0) // make sure values are valid + { + encodeB(b_max, 4 + head_offset, (int)(sensor_max[ACCEL_X] * 100 + 0.5) + 2048); // Xaccel + encodeA(b_max, 6 + head_offset, (int)(sensor_max[ACCEL_Y] * 100 + 0.5) + 2048); // Yaccel + encodeB(b_max, 7 + head_offset, (int)(sensor_max[ACCEL_Z] * 100 + 0.5) + 2048); // Zaccel + + encodeA(b_max, 33 + head_offset, (int)(sensor_max[PRES] + 0.5)); // Pressure + encodeB(b_max, 34 + head_offset, (int)(sensor_max[ALT] * 10.0 + 0.5)); // Altitude + encodeB(b_max, 40 + head_offset, (int)(sensor_max[GYRO_X] + 0.5) + 2048); + encodeA(b_max, 42 + head_offset, (int)(sensor_max[GYRO_Y] + 0.5) + 2048); + encodeB(b_max, 43 + head_offset, (int)(sensor_max[GYRO_Z] + 0.5) + 2048); + + encodeA(b_max, 48 + head_offset, (int)(sensor_max[XS2]) + 2048); + encodeB(b_max, 49 + head_offset, (int)(sensor_max[XS3] * 100 + 0.5) + 2048); + encodeB(b_max, 10 + head_offset, (int)(sensor_max[TEMP] * 10 + 0.5)); + encodeA(b_max, 45 + head_offset, (int)(sensor_max[HUMI] * 10 + 0.5)); + } + else + { + encodeB(b_max, 4 + head_offset, 2048); // 0 + encodeA(b_max, 6 + head_offset, 2048); // 0 + encodeB(b_max, 7 + head_offset, 2048); // 0 + +// encodeA(b_max, 33 + head_offset, (int)(sensor_max[PRES] + 0.5)); // Pressure +// encodeB(b_max, 34 + head_offset, (int)(sensor_max[ALT] * 10.0 + 0.5)); // Altitude + encodeB(b_max, 40 + head_offset, 2048); + encodeA(b_max, 42 + head_offset, 2048); + encodeB(b_max, 43 + head_offset, 2048); + + encodeA(b_max, 48 + head_offset, 2048); + encodeB(b_max, 49 + head_offset, 2048); +// encodeB(b_max, 10 + head_offset, (int)(sensor_max[TEMP] * 10 + 0.5)); +// encodeA(b_max, 45 + head_offset, (int)(sensor_max[HUMI] + 0.5)); + } + encodeA(b_min, 12 + head_offset, (int)(voltage_min[map[PLUS_X]] * 100)); + encodeB(b_min, 13 + head_offset, (int)(voltage_min[map[PLUS_Y]] * 100)); + encodeA(b_min, 15 + head_offset, (int)(voltage_min[map[PLUS_Z]] * 100)); + encodeB(b_min, 16 + head_offset, (int)(voltage_min[map[MINUS_X]] * 100)); + encodeA(b_min, 18 + head_offset, (int)(voltage_min[map[MINUS_Y]] * 100)); + encodeB(b_min, 19 + head_offset, (int)(voltage_min[map[MINUS_Z]] * 100)); + + encodeA(b_min, 21 + head_offset, (int)(current_min[map[PLUS_X]] + 0.5) + 2048); + encodeB(b_min, 22 + head_offset, (int)(current_min[map[PLUS_Y]] + 0.5) + 2048); + encodeA(b_min, 24 + head_offset, (int)(current_min[map[PLUS_Z]] + 0.5) + 2048); + encodeB(b_min, 25 + head_offset, (int)(current_min[map[MINUS_X]] + 0.5) + 2048); + encodeA(b_min, 27 + head_offset, (int)(current_min[map[MINUS_Y]] + 0.5) + 2048); + encodeB(b_min, 28 + head_offset, (int)(current_min[map[MINUS_Z]] + 0.5) + 2048); + + encodeA(b_min, 9 + head_offset, (int)(current_min[map[BAT]] + 0.5) + 2048); + encodeA(b_min, 3 + head_offset, (int)(voltage_min[map[BAT]] * 100)); + encodeA(b_min, 30 + head_offset, (int)(voltage_min[map[BUS]] * 100)); + encodeB(b_min, 46 + head_offset, (int)(current_min[map[BUS]] + 0.5) + 2048); + + encodeB(b_min, 31 + head_offset, ((int)(other_min[SPIN] * 10)) + 2048); + encodeB(b_min, 37 + head_offset, (int)(other_min[RSSI] + 0.5) + 2048); + encodeA(b_min, 39 + head_offset, (int)(other_min[IHU_TEMP] * 10 + 0.5)); + + if (sensor_min[0] != 1000.0) // make sure values are valid + { + encodeB(b_min, 4 + head_offset, (int)(sensor_min[ACCEL_X] * 100 + 0.5) + 2048); // Xaccel + encodeA(b_min, 6 + head_offset, (int)(sensor_min[ACCEL_Y] * 100 + 0.5) + 2048); // Yaccel + encodeB(b_min, 7 + head_offset, (int)(sensor_min[ACCEL_Z] * 100 + 0.5) + 2048); // Zaccel + + encodeA(b_min, 33 + head_offset, (int)(sensor_min[PRES] + 0.5)); // Pressure + encodeB(b_min, 34 + head_offset, (int)(sensor_min[ALT] * 10.0 + 0.5)); // Altitude + encodeB(b_min, 40 + head_offset, (int)(sensor_min[GYRO_X] + 0.5) + 2048); + encodeA(b_min, 42 + head_offset, (int)(sensor_min[GYRO_Y] + 0.5) + 2048); + encodeB(b_min, 43 + head_offset, (int)(sensor_min[GYRO_Z] + 0.5) + 2048); + + encodeA(b_min, 48 + head_offset, (int)(sensor_min[XS2]) + 2048); + encodeB(b_min, 49 + head_offset, (int)(sensor_min[XS3] * 100 + 0.5) + 2048); + encodeB(b_min, 10 + head_offset, (int)(sensor_min[TEMP] * 10 + 0.5)); + encodeA(b_min, 45 + head_offset, (int)(sensor_min[HUMI] * 10 + 0.5)); + } + else + { + encodeB(b_min, 4 + head_offset, 2048); // 0 + encodeA(b_min, 6 + head_offset, 2048); // 0 + encodeB(b_min, 7 + head_offset, 2048); // 0 + +// encodeA(b_min, 33 + head_offset, (int)(sensor_max[PRES] + 0.5)); // Pressure +// encodeB(b_min, 34 + head_offset, (int)(sensor_max[ALT] * 10.0 + 0.5)); // Altitude + encodeB(b_min, 40 + head_offset, 2048); + encodeA(b_min, 42 + head_offset, 2048); + encodeB(b_min, 43 + head_offset, 2048); + + encodeA(b_min, 48 + head_offset, 2048); + encodeB(b_min, 49 + head_offset, 2048); +// encodeB(b_min, 10 + head_offset, (int)(sensor_max[TEMP] * 10 + 0.5)); +// encodeA(b_min, 45 + head_offset, (int)(sensor_max[HUMI] + 0.5)); + } + } encodeA(b, 30 + head_offset, PSUVoltage); // encodeB(b, 31 + head_offset,(spin * 10) + 2048); encodeB(b, 31 + head_offset, ((int)(other[SPIN] * 10)) + 2048); @@ -1478,10 +1667,14 @@ void get_tlm_fox() { printf("TX Antenna Deployed!\n"); } - if (mode == BPSK) { // WOD field experiments - encodeA(b, 63 + head_offset, 0xff); - encodeB(b, 74 + head_offset, 0xff); - } + if (mode == BPSK) { // wod field experiments + unsigned long val = 0xffff; + encodeA(b, 64 + head_offset, 0xff & val); + encodeA(b, 65 + head_offset, val >> 8); + encodeA(b, 63 + head_offset, 0x00); + encodeA(b, 62 + head_offset, 0x01); + encodeB(b, 74 + head_offset, 0xfff); + } short int data10[headerLen + rsFrames * (rsFrameLen + parityLen)]; short int data8[headerLen + rsFrames * (rsFrameLen + parityLen)]; @@ -1498,8 +1691,29 @@ void get_tlm_fox() { data8[ctr1++] = rs_frame[j][i]; // printf ("data8[%d] = %x \n", ctr1 - 1, rs_frame[j][i]); } else { - rs_frame[j][i] = b[ctr3 % dataLen]; - update_rs(parities[j], b[ctr3 % dataLen]); + if (mode == FSK) + { + rs_frame[j][i] = b[ctr3 % dataLen]; + update_rs(parities[j], b[ctr3 % dataLen]); + } else // BPSK + if ((int)(ctr3/dataLen) == 3) + { + rs_frame[j][i] = b_max[ctr3 % dataLen]; + update_rs(parities[j], b_max[ctr3 % dataLen]); + } + else if ((int)(ctr3/dataLen) == 4) + { + rs_frame[j][i] = b_min[ctr3 % dataLen]; + update_rs(parities[j], b_min[ctr3 % dataLen]); + } + else + { + rs_frame[j][i] = b[ctr3 % dataLen]; + update_rs(parities[j], b[ctr3 % dataLen]); + } + { + } + // printf("%d rs_frame[%d][%d] = %x %d \n", // ctr1, j, i, b[ctr3 % DATA_LEN], ctr3 % DATA_LEN); data8[ctr1++] = rs_frame[j][i]; @@ -1520,6 +1734,9 @@ void get_tlm_fox() { printf("\n"); */ #endif + + //sleep(1); + //printf("Sleep over\n"); int ctr2 = 0; memset(data10, 0, sizeof(data10)); @@ -1659,15 +1876,30 @@ void get_tlm_fox() { if (!error && transmit) { // digitalWrite (0, LOW); - printf("Sending %d buffer bytes over socket after %d ms!\n", ctr, (long unsigned int)millis() - start); + // printf("Sending %d buffer bytes over socket after %d ms!\n", ctr, (long unsigned int)millis() - start); start = millis(); int sock_ret = send(sock, buffer, (unsigned int)(ctr * 2 + 2), 0); - printf("Millis5: %d Result of socket send: %d \n", (unsigned int)millis() - start, sock_ret); - + printf("Millis6: %d Result of socket send: %d \n\n", (unsigned int)millis() - start, sock_ret); + if (sock_ret < (ctr * 2 + 2)) { - printf("Not resending\n"); - // sock_ret = send(sock, buffer[sock_ret], ctr * 2 + 2 - sock_ret, 0); - // printf("Millis10: %d Result of socket send: %d \n", millis() - start, sock_ret); + // printf("Not resending\n"); + sleep(0.5); + sock_ret = send(sock, &buffer[sock_ret], (unsigned int)(ctr * 2 + 2 - sock_ret), 0); + printf("Millis7: %d Result of socket send: %d \n\n", millis() - start, sock_ret); + } + + if (mode == BPSK) + { + start = millis(); // send frame a second time + sock_ret = send(sock, buffer, (unsigned int)(ctr * 2 + 2), 0); + printf("Millis8: %d Result of socket send: %d \n\n", (unsigned int)millis() - start, sock_ret); + + if (sock_ret < (ctr * 2 + 2)) { + // printf("Not resending\n"); + sleep(0.5); + sock_ret = send(sock, &buffer[sock_ret], (unsigned int)(ctr * 2 + 2 - sock_ret), 0); + printf("Millis9: %d Result of socket send: %d \n\n", millis() - start, sock_ret); + } } if (sock_ret == -1) { @@ -1682,13 +1914,42 @@ void get_tlm_fox() { } // digitalWrite (0, HIGH); - if (mode == FSK) - firstTime = 0; - else if (frames_sent > 0) //5) +// if (mode == FSK) firstTime = 0; +// else if (frames_sent > 0) //5) +// firstTime = 0; return; } + +// code by https://stackoverflow.com/questions/25161377/open-a-cmd-program-with-full-functionality-i-o/25177958#25177958 + + FILE *sopen(const char *program) + { + int fds[2]; + pid_t pid; + + if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) < 0) + return NULL; + + switch(pid=vfork()) { + case -1: /* Error */ + close(fds[0]); + close(fds[1]); + return NULL; + case 0: /* child */ + close(fds[0]); + dup2(fds[1], 0); + dup2(fds[1], 1); + close(fds[1]); + execl("/bin/sh", "sh", "-c", program, NULL); + _exit(127); + } + /* parent */ + close(fds[1]); + return fdopen(fds[0], "r+"); + } + /* * TelemEncoding.h * @@ -1889,10 +2150,11 @@ void write_wave(int i, short int *buffer) else { if ((ctr - flip_ctr) < smaller) - buffer[ctr++] = (short int)(amplitude * 0.4 * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); - else - buffer[ctr++] = (short int)(amplitude * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); - } +// buffer[ctr++] = (short int)(amplitude * 0.4 * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); buffer[ctr++] = (short int)(amplitude * 0.4 * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); + buffer[ctr++] = (short int)(phase * sin_map[ctr % sin_samples] / 2); + else +// buffer[ctr++] = (short int)(amplitude * 0.4 * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); buffer[ctr++] = (short int)(amplitude * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); + buffer[ctr++] = (short int)(phase * sin_map[ctr % sin_samples]); } // printf("%d %d \n", i, buffer[ctr - 1]); } @@ -1955,7 +2217,7 @@ int test_i2c_bus(int bus) // printf("%s error: %d \n", &command, error); if (error != 0) { - printf("ERROR: %sd bus has a problem \n Check I2C wiring and pullup resistors \n", busDev); + printf("ERROR: %s bus has a problem \n Check I2C wiring and pullup resistors \n", busDev); output = -1; } } else diff --git a/arduino/Payload_BME280_MPU6050_XS.ino b/arduino/Payload_BME280_MPU6050_XS.ino index b7280828..9173fa97 100644 --- a/arduino/Payload_BME280_MPU6050_XS.ino +++ b/arduino/Payload_BME280_MPU6050_XS.ino @@ -81,6 +81,8 @@ void setup() { Serial.println(((float)eeprom_word_read(2)) / 100.0, DEC); Serial.println(((float)eeprom_word_read(3)) / 100.0, DEC); } + pinMode(greenLED, OUTPUT); + pinMode(blueLED, OUTPUT); } void loop() { @@ -271,7 +273,7 @@ void blink(int length) #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 + TXLED0; //TX LED macro to turn LED ON #endif } diff --git a/config b/config new file mode 100755 index 00000000..d881c326 --- /dev/null +++ b/config @@ -0,0 +1,209 @@ +#!/bin/bash + +# echo $1 + +if [ "$1" = "" ]; then + echo "Include a configuration option:" + echo + set -- "-h" +fi + +if [ "$1" = "-i" ]; 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 "config OPTION" + 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 " -i Restarts CubeSatsim software" + echo " -c Change the CALLSIGN in the configuration file sim.cfg" + echo " -r Change the Resets Count in the configuration file sim.cfg" + echo " -l Change the Latitude and Longitude in the configuration file sim.cfg" + echo " Only used for APRS telemetry" + echo + exit + +elif [ "$1" = "-c" ]; then + + echo + echo "Editing the CALLSIGN in the" + echo "configuration file for CubeSatSim" + echo + echo "Return keeps current value." +# echo -e "Current sim.cfg configuration file:" +# echo + + value=`cat /home/pi/CubeSatSim/sim.cfg` + echo "$value" > /dev/null + set -- $value + + echo "Current value of CALLSIGN is" + echo $1 + echo + +# echo $1 $2 $3 $4 + + echo "Enter callsign in all capitals: " + read callsign + + if [ -z $callsign ] ; then + + callsign="$1" + echo "Keeping value of" $callsign + fi + + echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n" + + echo $callsign $2 $3 $4 + echo $callsign $2 $3 $4 > /home/pi/CubeSatSim/sim.cfg + echo + echo "Restarting CubeSatSim with new configuraation file" + echo + + sudo systemctl restart cubesatsim + +elif [ "$1" = "-r" ]; then + + echo + echo "Editing the Reset Count in the" + echo "configuration file for CubeSatSim" + echo + echo "Return keeps current value." +# echo -e "Current sim.cfg configuration file:" +# echo + + value=`cat /home/pi/CubeSatSim/sim.cfg` + echo "$value" > /dev/null + set -- $value + + echo + echo "Current value of Reset Count is" + echo $2 + echo + +# echo $1 $2 $3 $4 + + echo -e "Enter 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 "\nCubeSatSim configuraation sim.cfg file updated to: \n" + + echo $1 $resets $3 $4 + echo $1 $resets $3 $4 > /home/pi/CubeSatSim/sim.cfg + echo + echo "Restarting CubeSatSim with new configuraation file" + echo + + sudo systemctl restart cubesatsim + +elif [ "$1" = "-l" ]; then + + echo + echo "Editing latitude and longitude in the" + echo "configuration file for CubeSatSim" + echo "(Only used for APRS telemetry)" + echo + echo "Return keeps current value." +# echo -e "Current sim.cfg configuration file:" +# echo + + value=`cat /home/pi/CubeSatSim/sim.cfg` + echo "$value" > /dev/null + set -- $value + + echo + echo "Current value of latitude is" + echo $3 + echo + +# echo $1 $2 $3 $4 + + echo -e "Enter 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 + echo "Current value of longitude is" + echo $4 + echo + + echo -e "Enter 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 $1 $2 $lat $long + echo $1 $2 $lat $long > /home/pi/CubeSatSim/sim.cfg + echo + echo "Restarting CubeSatSim with new configuraation file" + echo + + sudo systemctl restart cubesatsim +fi + +# sudo systemctl restart cubesatsim diff --git a/demo.sh b/demo.sh index de318527..84b71b50 100755 --- a/demo.sh +++ b/demo.sh @@ -15,8 +15,9 @@ if [[ ("$1" = "a" ) || (("$1" = "c") && ("$(($y %4))" = 3)) ]]; then echo "Mode is continuous AFSK" /home/pi/CubeSatSim/radioafsk afsk elif [[ ("$1" = "b" ) || (("$1" = "c") && ("$(($y %4))" = 1)) ]]; then - echo "Mode is continuous BPSK" - /home/pi/CubeSatSim/radioafsk bpsk + echo "Mode is continuous BPSK" + sudo cpulimit -l 2.5 -b -P radioafsk + /home/pi/CubeSatSim/radioafsk bpsk elif [[ ("$1" = "s" ) || (("$1" = "c") && ("$(($y %4))" = 2)) ]]; then echo "Mode is continuous SSTV" while true; do sleep 5; done diff --git a/log b/log new file mode 100755 index 00000000..f551c284 --- /dev/null +++ b/log @@ -0,0 +1,9 @@ +#!/bin/bash + +echo -e "\nLog file script for CubeSatSim\n" + +sudo journalctl -u cubesatsim > log.txt +cat log.txt + +echo -e "\nLog file also saved as /home/pi/CubeSatSim/log.txt" + diff --git a/python/voltcurrent.py b/python/voltcurrent.py index f34e9e52..c5d0fce6 100644 --- a/python/voltcurrent.py +++ b/python/voltcurrent.py @@ -1,20 +1,22 @@ """Sample code and test for adafruit_in219""" # Reads all voltage and current sensors for two I2C buses - +import time import sys #import board import busio from adafruit_extended_bus import ExtendedI2C as I2C from adafruit_ina219 import INA219 +from adafruit_ina219 import ADCResolution, BusVoltageRange if __name__ == "__main__": # print 'Length: ', len(sys.argv) buses = [1, 3] # default I2C buses config = False + one = two = three = four = five = six = seven = eight = 0 if (len(sys.argv)) > 1: -# print("There are arguments!") +# print("There are arguments!", file=sys.stderr) # if (('a' == sys.argv[1]) or ('afsk' in sys.argv[1])): buses[0] = int(sys.argv[1], base=10) if (len(sys.argv)) > 2: @@ -22,45 +24,325 @@ if __name__ == "__main__": if (len(sys.argv)) > 3: if sys.argv[3] == "c": config = True - from adafruit_ina219 import ADCResolution, BusVoltageRange + +# print(buses[0]) +# print(buses[1]) addresses = [0x40, 0x41, 0x44, 0x45] #INA219 addresses on the bus -# print("buses: ", buses, " addr: ", addresses) - for x in buses: - try: - i2c_bus = I2C(x) # Device is /dev/i2c-x - for y in addresses: - # print(x,y) - try: +# print("buses: ", buses, " addr: ", addresses, file=sys.stderr) + +# config + +# for x in buses: +# try: +# i2c_bus = I2C(x) # Device is /dev/i2c-x +# for y in addresses: +# print(x,y) +# try: # Create library object using Extended Bus I2C port -# print("bus: ", x, " addr: ", y) - if x == 0 and y == 0x45: +# print("bus: ", x, " addr: ", y) +# if x == 0 and y == 0x45: # print("Reading INA219 in MoPower Board") - i2c_bus = I2C(1) - ina219 = INA219(i2c_bus, 0x4a) - else: - ina219 = INA219(i2c_bus, y) - -# print("ina219 test") - if config: -# print("Configuring") +# i2c_bus = I2C(1) +# ina219 = INA219(i2c_bus, 0x4a) +# else: +# ina219 = INA219(i2c_bus, y) +# print("ina219 test") + +# print("Configuring") # optional : change configuration to use 32 samples averaging for both bus voltage and shunt voltage - ina219.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S - ina219.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S +# ina219.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S +# ina219.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S # optional : change voltage range to 16V - ina219.bus_voltage_range = BusVoltageRange.RANGE_16V +# ina219.bus_voltage_range = BusVoltageRange.RANGE_16V +# except: +# print("Python Error 2", file=sys.stderr, flush=True) +# except: +# print("Python Error 1", file=sys.stderr, flush=True) +# No try checking yet + +# if buses[0] == 0 and addresses[0] == 0x45: +# print("Reading INA219 in MoPower Board") +# ina219_one = INA219(I2C(1), 0x4a) +# else: + if (buses[0] != -1): + try: + i2c_one = I2C(buses[0]) + try: + ina219_one = INA219(i2c_one, addresses[0]) + ina219_one.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) + ina219_one.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) + ina219_one.bus_voltage_range = BusVoltageRange.RANGE_16V + time.sleep(0.01) + one = 1 + except: +# print("Python Error 3", file=sys.stderr, flush=True) + one = 0 + try: + ina219_two = INA219(i2c_one, addresses[1]) + ina219_two.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) + ina219_two.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) + ina219_two.bus_voltage_range = BusVoltageRange.RANGE_16V + time.sleep(0.01) + two = 1 + except: +# print("Python Error 3", file=sys.stderr, flush=True) + two = 0 + + try: + ina219_three = INA219(i2c_one, addresses[2]) + ina219_three.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) + ina219_three.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) + ina219_three.bus_voltage_range = BusVoltageRange.RANGE_16V + time.sleep(0.01) + three = 1 + except: +# print("Python Error 3", file=sys.stderr, flush=True) + three = 0 + + try: + ina219_four= INA219(i2c_one, addresses[3]) + ina219_four.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) + ina219_four.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) + ina219_four.bus_voltage_range = BusVoltageRange.RANGE_16V + time.sleep(0.01) + four = 1 + except: + four = 0 +# print("Python Error 3", file=sys.stderr, flush=True) + except: + print("Python Error 5", file=sys.stderr, flush=True) + + if (buses[1] != -1): + try: + i2c_two = I2C(buses[1]) +# print(i2c_two) + try: + ina219_five = INA219(i2c_two, addresses[0]) + ina219_five.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) + ina219_five.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) + ina219_five.bus_voltage_range = BusVoltageRange.RANGE_16V + time.sleep(0.01) + five = 1 + except: +# print("Python Error 3", file=sys.stderr, flush=True) + five = 0 + try: + ina219_six = INA219(i2c_two, addresses[1]) + ina219_six.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) + ina219_six.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) + ina219_six.bus_voltage_range = BusVoltageRange.RANGE_16V + time.sleep(0.01) + six = 1 + except: +# print("Python Error 3", file=sys.stderr, flush=True) + six = 0 + try: + ina219_seven = INA219(i2c_two, addresses[2]) + ina219_seven.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) + ina219_seven.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) + ina219_seven.bus_voltage_range = BusVoltageRange.RANGE_16V + time.sleep(0.01) + seven = 1 + except: +# print("Python Error 3", file=sys.stderr, flush=True) + seven = 0 + try: + ina219_eight = INA219(i2c_two, addresses[3]) + ina219_eight.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) + ina219_eight.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) + ina219_eight.bus_voltage_range = BusVoltageRange.RANGE_16V + time.sleep(0.01) + eight = 1 + except: +# print("Python Error 3", file=sys.stderr, flush=True) + eight = 0 + except: + print("Python Error 5", file=sys.stderr, flush=True) + + while (True): + error = 0 + try: + time.sleep(0.01) + print("{:6.3f} ".format(ina219_one.bus_voltage), "{:6.3f} ".format(ina219_one.current) , end = '') + except: + + try: + ina219_one = INA219(i2c_one, addresses[0]) + ina219_one.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) + ina219_one.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) + ina219_one.bus_voltage_range = BusVoltageRange.RANGE_16V + time.sleep(0.01) + print("{:6.3f} ".format(ina219_one.bus_voltage), "{:6.3f} ".format(ina219_one.current) , end = '') + error = 1 + + except: +# print("Python Error 3", file=sys.stderr, flush=True) + print("{:6.3f} ".format(0), "{:6.3f} ".format(0), end = '') + + + try: + time.sleep(0.01) + print("{:6.3f} ".format(ina219_two.bus_voltage), "{:6.3f} ".format(ina219_two.current) , end = '') + except: + + try: + ina219_two = INA219(i2c_one, addresses[1]) + ina219_two.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) + ina219_two.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) + ina219_two.bus_voltage_range = BusVoltageRange.RANGE_16V + time.sleep(0.01) + print("{:6.3f} ".format(ina219_two.bus_voltage), "{:6.3f} ".format(ina219_two.current) , end = '') + error = 1 + + except: +# print("Python Error 3", file=sys.stderr, flush=True) + print("{:6.3f} ".format(0), "{:6.3f} ".format(0), end = '') - bus_voltage = ina219.bus_voltage # voltage on V- (load side) -# shunt_voltage = ina219.shunt_voltage # voltage between V+ and V- across the shunt - current = ina219.current # current in mA - if x == 0 and y == 0x45: - current = current * 10 -# INA219 measure bus voltage on the load side. So PSU voltage = bus_voltage + shunt_voltage -# print("{:6.3f}".format(bus_voltage + shunt_voltage)) - print("{:6.3f} ".format(bus_voltage), "{:6.3f} ".format(current) , end = '') - except: - print("{:6.3f} ".format(0), "{:6.3f} ".format(0), end = '') + + try: + time.sleep(0.01) + print("{:6.3f} ".format(ina219_three.bus_voltage), "{:6.3f} ".format(ina219_three.current) , end = '') + except: + + try: + ina219_three = INA219(i2c_one, addresses[2]) + ina219_three.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) + ina219_three.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) + ina219_three.bus_voltage_range = BusVoltageRange.RANGE_16V + time.sleep(0.01) + print("{:6.3f} ".format(ina219_three.bus_voltage), "{:6.3f} ".format(ina219_three.current) , end = '') + error = 1 + + except: +# print("Python Error 3", file=sys.stderr, flush=True) + print("{:6.3f} ".format(0), "{:6.3f} ".format(0), end = '') + + try: + time.sleep(0.01) + print("{:6.3f} ".format(ina219_four.bus_voltage), "{:6.3f} ".format(ina219_four.current) , end = '') + except: + + try: + ina219_four= INA219(i2c_one, addresses[3]) + ina219_four.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) + ina219_four.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) + ina219_four.bus_voltage_range = BusVoltageRange.RANGE_16V + time.sleep(0.01) + print("{:6.3f} ".format(ina219_four.bus_voltage), "{:6.3f} ".format(ina219_four.current) , end = '') + error = 1 + + except: + print("{:6.3f} ".format(0), "{:6.3f} ".format(0), end = '') + + try: + time.sleep(0.01) + print("{:6.3f} ".format(ina219_five.bus_voltage), "{:6.3f} ".format(ina219_five.current) , end = '') + except: + + try: + ina219_five = INA219(i2c_two, addresses[0]) + ina219_five.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) + ina219_five.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) + ina219_five.bus_voltage_range = BusVoltageRange.RANGE_16V + time.sleep(0.01) + print("{:6.3f} ".format(ina219_five.bus_voltage), "{:6.3f} ".format(ina219_five.current) , end = '') + error = 1 + + except: +# print("Python Error 3", file=sys.stderr, flush=True) + print("{:6.3f} ".format(0), "{:6.3f} ".format(0), end = '') + + try: + time.sleep(0.01) + print("{:6.3f} ".format(ina219_six.bus_voltage), "{:6.3f} ".format(ina219_six.current) , end = '') + except: + + try: + ina219_six = INA219(i2c_two, addresses[1]) + ina219_six.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) + ina219_six.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) + ina219_six.bus_voltage_range = BusVoltageRange.RANGE_16V + time.sleep(0.01) + print("{:6.3f} ".format(ina219_six.bus_voltage), "{:6.3f} ".format(ina219_six.current) , end = '') + error = 1 + + except: +# print("Python Error 3", file=sys.stderr, flush=True) + print("{:6.3f} ".format(0), "{:6.3f} ".format(0), end = '') + + try: + time.sleep(0.01) + print("{:6.3f} ".format(ina219_seven.bus_voltage), "{:6.3f} ".format(ina219_seven.current) , end = '') + except: + + try: + ina219_seven = INA219(i2c_two, addresses[2]) + ina219_seven.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) + ina219_seven.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) + ina219_seven.bus_voltage_range = BusVoltageRange.RANGE_16V + time.sleep(0.01) + print("{:6.3f} ".format(ina219_seven.bus_voltage), "{:6.3f} ".format(ina219_seven.current) , end = '') + error = 1 + + except: +# print("Python Error 3", file=sys.stderr, flush=True) + print("{:6.3f} ".format(0), "{:6.3f} ".format(0), end = '') + + try: + time.sleep(0.01) + print("{:6.3f} ".format(ina219_eight.bus_voltage), "{:6.3f} ".format(ina219_eight.current), end = '') except: - print("{:6.3f} ".format(0), "{:6.3f} ".format(0), "{:6.3f} ".format(0), "{:6.3f} ".format(0), "{:6.3f} ".format(0), "{:6.3f} ".format(0), "{:6.3f} ".format(0), "{:6.3f} ".format(0), end = '') -# pass - print(" ") + + try: + ina219_eight = INA219(i2c_two, addresses[3]) + ina219_eight.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) + ina219_eight.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) + ina219_eight.bus_voltage_range = BusVoltageRange.RANGE_16V + time.sleep(0.01) + print("{:6.3f} ".format(ina219_eight.bus_voltage), "{:6.3f} ".format(ina219_eight.current), end = '') + error = 1 + + except: +# print("Python Error 3", file=sys.stderr, flush=True) + print("{:6.3f} ".format(0), "{:6.3f} ".format(0), end = '') + + if (error == 0): + print(" ") + else: + print("Python Error Recovered!") + + inp = input() +# print(inp) diff --git a/rpitx.py b/rpitx.py index 7bfc90d9..bbb87c06 100644 --- a/rpitx.py +++ b/rpitx.py @@ -109,6 +109,7 @@ if __name__ == "__main__": else: print("FSK") system("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.9e3") + else: print("No Band Pass Filter so no telemetry transmit. See http://cubesatsim.org/wiki for instructions on how to build the BPF.") while 1: diff --git a/spacecraft/FoxTelem_11a/CubeSatSim_PSK_maxtelemetry.csv b/spacecraft/FoxTelem_11a/CubeSatSim_PSK_maxtelemetry.csv new file mode 100644 index 00000000..c55ada57 --- /dev/null +++ b/spacecraft/FoxTelem_11a/CubeSatSim_PSK_maxtelemetry.csv @@ -0,0 +1,61 @@ +60,TYPE,FIELD,BITS,UNIT,CONVERSION,MODULE,MODULE_NUM,MODULE_LINE,LINE_TYPE,SHORT_NAME,DESCRIPTION +0,MAX,BATT_A_V,12,V,4,NONE,4,1,3,Cell A,Battery pair A voltage (0-2.5V scale) +1,MAX,BATT_B_V,12,V,4,NONE,4,2,3,Cell A + B,Battery pairs A+B voltage (0-3.3V scale) +2,MAX,BATT_V,12,V,cubesatsim_voltage|FLOAT2,NONE,4,1,3,Cell A+B+C Voltage,Battery A+B+C voltage (0-5.0V scale) +3,MAX,SatelliteXAxisAcceleration,12,g,cubesatsim_acceleration|FLOAT2,NONE,7,4,3,Acceleration,Acceleration around X Axis +4,MAX,SatelliteYAxisAcceleration,12,g,cubesatsim_acceleration|FLOAT2,NONE,8,4,3,Acceleration,Acceleration around Y Axis +5,MAX,SatelliteZAxisAcceleration,12,g,cubesatsim_acceleration|FLOAT2,NONE,9,4,3,Acceleration,Acceleration around Z Axis +6,MAX,battCurr,12,mA,cubesatsim_current,NONE,4,2,3,Current,Total Battery DC current +7,MAX,Temperature,12,C,cubesatsim_temperature,NONE,6,2,3,Temp,STEM Payload Sensor Temperature +8,MAX,posXv,12,V,cubesatsim_voltage|FLOAT2,NONE,7,1,3,Voltage,+X solar Panel voltage +9,MAX,posYv,12,V,cubesatsim_voltage|FLOAT2,NONE,8,1,3,Voltage,+Y solar Panel voltage +10,MAX,posZv,12,V,cubesatsim_voltage|FLOAT2,NONE,9,1,3,Voltage,+Z solar Panel voltage +11,MAX,negXv,12,V,cubesatsim_voltage|FLOAT2,NONE,10,1,3,Voltage,-X solar Panel voltage +12,MAX,negYv,12,V,cubesatsim_voltage|FLOAT2,NONE,11,1,3,Voltage,-Y solar Panel voltage +13,MAX,negZv,12,V,cubesatsim_voltage|FLOAT2,NONE,12,1,3,Voltage,-Z solar Panel voltage +14,MAX,posXi,12,mA,cubesatsim_current,NONE,7,2,3,Current,+X solar Panel current +15,MAX,posYi,12,mA,cubesatsim_current,NONE,8,2,3,Current,+Y solar Panel current +16,MAX,posZi,12,mA,cubesatsim_current,NONE,9,2,3,Current,+Z solar Panel current +17,MAX,negXi,12,mA,cubesatsim_current,NONE,10,2,3,Current,-X solar Panel current +18,MAX,negYi,12,mA,cubesatsim_current,NONE,11,2,3,Current,-Y solar Panel current +19,MAX,negZi,12,mA,cubesatsim_current,NONE,12,2,3,Current,-Z solar Panel current +20,MAX,PSUVoltage,12,V,cubesatsim_voltage|FLOAT2,NONE,5,1,3,Board Voltage,Power Supply Voltage +21,MAX,spin,12,rpm,cubesatsim_rpm,NONE,3,1,3,Spacecraft Spin,Calculated spin rate using solar cells +22,MAX,Pressure,12,hPa,cubesatsim_pressure,NONE,6,3,3,Pressure,STEM Payload Sensor Pressure +23,MAX,Altitude,12,m,cubesatsim_altitude,NONE,6,4,3,Altitude,STEM Payload Sensor Altitude +24,MAX,Resets,12,-,12,NONE,3,2,3,Reset Count, Software Reset Count +25,MAX,rssi,12,dBm,cubesatsim_rssi|INT,NONE,1,1,3,RSSI,Received Signal Strength Indication +26,MAX,IHUcpuTemp,12,C,cubesatsim_temperature,NONE,2,1,3,Temperature,Internal Temperature of IHU +27,MAX,SatelliteXAxisAngularVelocity,12,dps,cubesatsim_rotation,NONE,7,3,3,Rotation,Angular Veolcity around X Axis +28,MAX,SatelliteYAxisAngularVelocity,12,dps,cubesatsim_rotation,NONE,8,3,3,Rotation,Angular Veolcity around Y Axis +29,MAX,SatelliteZAxisAngularVelocity,12,dps,cubesatsim_rotation,NONE,9,3,3,Rotation,Angular Veolcity around Z Axis +30,MAX,Humidity,12,%,cubesatsim_temperature,NONE,6,5,3,Humidity,Humidity +31,MAX,PSUCurrent,12,mA,cubesatsim_current,NONE,5,2,3,Current,Power Supply DC Current +32,MAX,Sensor1,12,signed raw,cubesatsim_sensor2|INT,NONE,6,6,3,Sensor 1,STEM Payload Extra Sensor 1 +33,MAX,Sensor2,12,signed raw,cubesatsim_sensor3|FLOAT2,NONE,6,7,3,Sensor 2,STEM Payload Extra Sensor 2 +34,MAX,ICR3VProt,12,V,43,NONE,7,2,3,3V Prot,ICR 3V Proteted +35,MAX,ICR2dot5V,12,V,43,NONE,7,3,3,2.5V,ICR 2.5V +36,MAX,ICR2dot5VProt,12,V,43,NONE,7,4,3,2.5V Prot,ICR 2.5V Protected +37,MAX,rf6,12,-,0,NONE,0,0,0,None,None +38,MAX,rf7,12,-,0,NONE,0,0,0,None,None +39,MAX,MuxTest,12,V,43,NONE,7,5,3,Sensor Power,Sensor Power Voltage at the ICR +40,MAX,LtVGACtl,12,V,42,NONE,1,4,3,VGA Control,Control Voltage to the Variable Gain Amplifier (VGA) +41,MAX,pad,4,-,34,NONE,0,0,0,None,Unused +42,MAX,IHUdiagData,32,-,18,NONE,3,2,0,Diagnostic Info,Diagnostic Data on IHU Performance +43,MAX,STEMPayloadStatus,1,-,17,NONE,6,1,0,STEM Payload Status, STEM Payload STEM Payload Board Failure Indicator +44,MAX,Nominal Mode,1,-,17,NONE,3,2,0,Nominal Mode, Nominal Mode (Not Safe Mode) +45,MAX,expFailure2,1,-,17,NONE,6,7,0,Exp 2,Experiment 2 Failure Indicator +46,MAX,expFailure3,1,-,17,NONE,6,8,0,Exp 3,Experiment 3 Failure Indicator +47,MAX,I2CfailureBatt,1,-,17,NONE,2,2,0,Battery I2C,Battery I2C Bus failure indicator +48,MAX,I2CfailurePSU1,1,-,17,NONE,2,3,0,PSU1 I2C,PSU2 I2C Bus failure indicator +49,MAX,I2CfailurePSU2,1,-,17,NONE,2,4,0,PSU2 I2C,PSU2 I2C Bus failure indicator +50,MAX,TLMresets,4,-,1,NONE,2,6,0,Ground Resets,Number of times command stations reset stored telemetry +51,MAX,RxAntDeploy,1,-,16,NONE,1,3,0,RX Antenna,2m Antenna status +52,MAX,TxAntDeploy,2,-,16,NONE,1,2,0,TX Antenna,70cm Antenna status +53,MAX,I2CfailureRF,1,-,17,NONE,2,5,0,RF I2C,RF I2C Bus failure indicator +54,MAX,pad1,1,-,0,NONE,0,0,0,NONE,Filler +55,MAX,wodSize,8,000s,36,NONE,3,3,0,WOD Stored,Number of WOD data payloads kept for each of Science and Housekeeping. In hundreds +56,MAX,swCmds,32,-,35,NONE,7,6,0,Diagnostic,ICR Diagnostic information +57,MAX,hwCmdCnt,6,-,1,NONE,7,7,0,HW Command Count,Number of hardware commands since last reset +58,MAX,swCmdCnt,6,-,1,NONE,7,8,0,SW Command Count,Number of software commands since last reset +59,MAX,pad2,28,-,0,NONE,0,0,0,NONE,Filler diff --git a/spacecraft/FoxTelem_11a/CubeSatSim_PSK_mintelemetry.csv b/spacecraft/FoxTelem_11a/CubeSatSim_PSK_mintelemetry.csv new file mode 100644 index 00000000..690b9da2 --- /dev/null +++ b/spacecraft/FoxTelem_11a/CubeSatSim_PSK_mintelemetry.csv @@ -0,0 +1,61 @@ +60,TYPE,FIELD,BITS,UNIT,CONVERSION,MODULE,MODULE_NUM,MODULE_LINE,LINE_TYPE,SHORT_NAME,DESCRIPTION +0,MIN,BATT_A_V,12,V,4,NONE,4,1,3,Cell A,Battery pair A voltage (0-2.5V scale) +1,MIN,BATT_B_V,12,V,4,NONE,4,2,3,Cell A + B,Battery pairs A+B voltage (0-3.3V scale) +2,MIN,BATT_V,12,V,cubesatsim_voltage|FLOAT2,NONE,4,1,3,Cell A+B+C Voltage,Battery A+B+C voltage (0-5.0V scale) +3,MIN,SatelliteXAxisAcceleration,12,g,cubesatsim_acceleration|FLOAT2,NONE,7,4,3,Acceleration,Acceleration around X Axis +4,MIN,SatelliteYAxisAcceleration,12,g,cubesatsim_acceleration|FLOAT2,NONE,8,4,3,Acceleration,Acceleration around Y Axis +5,MIN,SatelliteZAxisAcceleration,12,g,cubesatsim_acceleration|FLOAT2,NONE,9,4,3,Acceleration,Acceleration around Z Axis +6,MIN,battCurr,12,mA,cubesatsim_current,NONE,4,2,3,Current,Total Battery DC current +7,MIN,Temperature,12,C,cubesatsim_temperature,NONE,6,2,3,Temp,STEM Payload Sensor Temperature +8,MIN,posXv,12,V,cubesatsim_voltage|FLOAT2,NONE,7,1,3,Voltage,+X solar Panel voltage +9,MIN,posYv,12,V,cubesatsim_voltage|FLOAT2,NONE,8,1,3,Voltage,+Y solar Panel voltage +10,MIN,posZv,12,V,cubesatsim_voltage|FLOAT2,NONE,9,1,3,Voltage,+Z solar Panel voltage +11,MIN,negXv,12,V,cubesatsim_voltage|FLOAT2,NONE,10,1,3,Voltage,-X solar Panel voltage +12,MIN,negYv,12,V,cubesatsim_voltage|FLOAT2,NONE,11,1,3,Voltage,-Y solar Panel voltage +13,MIN,negZv,12,V,cubesatsim_voltage|FLOAT2,NONE,12,1,3,Voltage,-Z solar Panel voltage +14,MIN,posXi,12,mA,cubesatsim_current,NONE,7,2,3,Current,+X solar Panel current +15,MIN,posYi,12,mA,cubesatsim_current,NONE,8,2,3,Current,+Y solar Panel current +16,MIN,posZi,12,mA,cubesatsim_current,NONE,9,2,3,Current,+Z solar Panel current +17,MIN,negXi,12,mA,cubesatsim_current,NONE,10,2,3,Current,-X solar Panel current +18,MIN,negYi,12,mA,cubesatsim_current,NONE,11,2,3,Current,-Y solar Panel current +19,MIN,negZi,12,mA,cubesatsim_current,NONE,12,2,3,Current,-Z solar Panel current +20,MIN,PSUVoltage,12,V,cubesatsim_voltage|FLOAT2,NONE,5,1,3,Board Voltage,Power Supply Voltage +21,MIN,spin,12,rpm,cubesatsim_rpm,NONE,3,1,3,Spacecraft Spin,Calculated spin rate using solar cells +22,MIN,Pressure,12,hPa,cubesatsim_pressure,NONE,6,3,3,Pressure,STEM Payload Sensor Pressure +23,MIN,Altitude,12,m,cubesatsim_altitude,NONE,6,4,3,Altitude,STEM Payload Sensor Altitude +24,MIN,Resets,12,-,12,NONE,3,2,3,Reset Count, Software Reset Count +25,MIN,rssi,12,dBm,cubesatsim_rssi|INT,NONE,1,1,3,RSSI,Received Signal Strength Indication +26,MIN,IHUcpuTemp,12,C,cubesatsim_temperature,NONE,2,1,3,Temperature,Internal Temperature of IHU +27,MIN,SatelliteXAxisAngularVelocity,12,dps,cubesatsim_rotation,NONE,7,3,3,Rotation,Angular Veolcity around X Axis +28,MIN,SatelliteYAxisAngularVelocity,12,dps,cubesatsim_rotation,NONE,8,3,3,Rotation,Angular Veolcity around Y Axis +29,MIN,SatelliteZAxisAngularVelocity,12,dps,cubesatsim_rotation,NONE,9,3,3,Rotation,Angular Veolcity around Z Axis +30,MIN,Humidity,12,%,cubesatsim_temperature,NONE,6,5,3,Humidity,Humidity +31,MIN,PSUCurrent,12,mA,cubesatsim_current,NONE,5,2,3,Current,Power Supply DC Current +32,MIN,Sensor1,12,signed raw,cubesatsim_sensor2|INT,NONE,6,6,3,Sensor 1,STEM Payload Extra Sensor 1 +33,MIN,Sensor2,12,signed raw,cubesatsim_sensor3|FLOAT2,NONE,6,7,3,Sensor 2,STEM Payload Extra Sensor 2 +34,MIN,ICR3VProt,12,V,43,NONE,7,2,3,3V Prot,ICR 3V Proteted +35,MIN,ICR2dot5V,12,V,43,NONE,7,3,3,2.5V,ICR 2.5V +36,MIN,ICR2dot5VProt,12,V,43,NONE,7,4,3,2.5V Prot,ICR 2.5V Protected +37,MIN,rf6,12,-,0,NONE,0,0,0,None,None +38,MIN,rf7,12,-,0,NONE,0,0,0,None,None +39,MIN,MuxTest,12,V,43,NONE,7,5,3,Sensor Power,Sensor Power Voltage at the ICR +40,MIN,LtVGACtl,12,V,42,NONE,1,4,3,VGA Control,Control Voltage to the Variable Gain Amplifier (VGA) +41,MIN,pad,4,-,34,NONE,0,0,0,None,Unused +42,MIN,IHUdiagData,32,-,18,NONE,3,2,0,Diagnostic Info,Diagnostic Data on IHU Performance +43,MIN,STEMPayloadStatus,1,-,17,NONE,6,1,0,STEM Payload Status, STEM Payload STEM Payload Board Failure Indicator +44,MIN,Nominal Mode,1,-,17,NONE,3,2,0,Nominal Mode, Nominal Mode (Not Safe Mode) +45,MIN,expFailure2,1,-,17,NONE,6,7,0,Exp 2,Experiment 2 Failure Indicator +46,MIN,expFailure3,1,-,17,NONE,6,8,0,Exp 3,Experiment 3 Failure Indicator +47,MIN,I2CfailureBatt,1,-,17,NONE,2,2,0,Battery I2C,Battery I2C Bus failure indicator +48,MIN,I2CfailurePSU1,1,-,17,NONE,2,3,0,PSU1 I2C,PSU2 I2C Bus failure indicator +49,MIN,I2CfailurePSU2,1,-,17,NONE,2,4,0,PSU2 I2C,PSU2 I2C Bus failure indicator +50,MIN,TLMresets,4,-,1,NONE,2,6,0,Ground Resets,Number of times command stations reset stored telemetry +51,MIN,RxAntDeploy,1,-,16,NONE,1,3,0,RX Antenna,2m Antenna status +52,MIN,TxAntDeploy,2,-,16,NONE,1,2,0,TX Antenna,70cm Antenna status +53,MIN,I2CfailureRF,1,-,17,NONE,2,5,0,RF I2C,RF I2C Bus failure indicator +54,MIN,pad1,1,-,0,NONE,0,0,0,NONE,Filler +55,MIN,wodSize,8,000s,36,NONE,3,3,0,WOD Stored,Number of WOD data payloads kept for each of Science and Housekeeping. In hundreds +56,MIN,swCmds,32,-,35,NONE,7,6,0,Diagnostic,ICR Diagnostic information +57,MIN,hwCmdCnt,6,-,1,NONE,7,7,0,HW Command Count,Number of hardware commands since last reset +58,MIN,swCmdCnt,6,-,1,NONE,7,8,0,SW Command Count,Number of software commands since last reset +59,MIN,pad2,28,-,0,NONE,0,0,0,NONE,Filler diff --git a/spacecraft/FoxTelem_11a/CubeSatSim_PSK_rttelemetry.csv b/spacecraft/FoxTelem_11a/CubeSatSim_PSK_rttelemetry.csv new file mode 100644 index 00000000..ec06db4f --- /dev/null +++ b/spacecraft/FoxTelem_11a/CubeSatSim_PSK_rttelemetry.csv @@ -0,0 +1,61 @@ +60,TYPE,FIELD,BITS,UNIT,CONVERSION,MODULE,MODULE_NUM,MODULE_LINE,LINE_TYPE,SHORT_NAME,DESCRIPTION +0,realTime,BATT_A_V,12,V,cubesatsim_voltage|FLOAT2,NONE,4,1,3,Cell A,Battery A voltage (0-2.5V scale) +1,realTime,BATT_B_V,12,V,cubesatsim_voltage|FLOAT2,NONE,4,2,3,Cell A+B,Battery A+B voltage (0-3.3V scale) +2,realTime,BATT_V,12,V,cubesatsim_voltage|FLOAT2,Battery,4,1,3,Cell A+B+C Voltage,Battery A+B+C voltage (0-5.0V scale) +3,realTime,SatelliteXAxisAcceleration,12,g,cubesatsim_acceleration|FLOAT2,+X Panel,7,4,3,Acceleration,Acceleration around X Axis +4,realTime,SatelliteYAxisAcceleration,12,g,cubesatsim_acceleration|FLOAT2,+Y Panel,8,4,3,Acceleration,Acceleration around Y Axis +5,realTime,SatelliteZAxisAcceleration,12,g,cubesatsim_acceleration|FLOAT2,+Z Panel,9,4,3,Acceleration,Acceleration around Z Axis +6,realTime,battCurr,12,mA,cubesatsim_current,Battery,4,2,3,Current,Total Battery DC current +7,realTime,Temperature,12,C,cubesatsim_temperature,Experiments,6,2,3,Temperature,STEM Payload sensor temperature +8,realTime,posXv,12,V,cubesatsim_voltage|FLOAT2,+X Panel,7,1,3,Voltage,+X solar panel voltage +9,realTime,posYv,12,V,cubesatsim_voltage|FLOAT2,+Y Panel,8,1,3,Voltage,+Y solar panel voltage +10,realTime,posZv,12,V,cubesatsim_voltage|FLOAT2,+Z Panel,9,1,3,Voltage,+Z solar panel voltage +11,realTime,negXv,12,V,cubesatsim_voltage|FLOAT2,-X Panel,10,1,3,Voltage,-X solar panel voltage +12,realTime,negYv,12,V,cubesatsim_voltage|FLOAT2,-Y Panel,11,1,3,Voltage,-Y solar panel voltage +13,realTime,negZv,12,V,cubesatsim_voltage|FLOAT2,-Z Panel,12,1,3,Voltage,-Z solar panel voltage +14,realTime,posXi,12,mA,cubesatsim_current,+X Panel,7,2,3,Current,+X solar panel current +15,realTime,posYi,12,mA,cubesatsim_current,+Y Panel,8,2,3,Current,+Y solar panel current +16,realTime,posZi,12,mA,cubesatsim_current,+Z Panel,9,2,3,Current,+Z solar panel current +17,realTime,negXi,12,mA,cubesatsim_current,-X Panel,10,2,3,Current,-X solar panel current +18,realTime,negYi,12,mA,cubesatsim_current,-Y Panel,11,2,3,Current,-Y solar panel current +19,realTime,negZi,12,mA,cubesatsim_current,-Z Panel,12,2,3,Current,-Z solar panel current +20,realTime,PSUVoltage,12,V,cubesatsim_voltage|FLOAT2,PSU,5,1,3,Voltage,Power Supply voltage +21,realTime,spin,12,rpm,cubesatsim_rpm,Computer Software,3,1,3,Spacecraft Spin,Calculated spin rate using solar cells +22,realTime,Pressure,12,hPa,cubesatsim_pressure,Experiments,6,3,3,Pressure,STEM Payload sensor pressure +23,realTime,Altitude,12,m,cubesatsim_altitude,Experiments,6,4,3,Altitude,STEM Payload sensor altitude +24,realTime,Resets,12,-,12,NONE,3,2,3,Reset Count, Software Reset Count +25,realTime,rssi,12,dBm,cubesatsim_rssi|INT,Radio,1,1,3,RSSI,Received Signal Strength Indication +26,realTime,IHUcpuTemp,12,C,cubesatsim_temperature,Computer Hardware,2,1,3,Temperature,Internal temperature of IHU from Pi +27,realTime,SatelliteXAxisAngularVelocity,12,dps,cubesatsim_rotation|INT,+X Panel,7,3,3,Rotation,Angular veolcity around X Axis +28,realTime,SatelliteYAxisAngularVelocity,12,dps,cubesatsim_rotation|INT,+Y Panel,8,3,3,Rotation,Angular veolcity around Y Axis +29,realTime,SatelliteZAxisAngularVelocity,12,dps,cubesatsim_rotation|INT,+Z Panel,9,3,3,Rotation,Angular veolcity around Z Axis +30,realTime,Humidity,12,%,cubesatsim_temperature,Experiments,6,5,3,Humidity,Humidity +31,realTime,PSUCurrent,12,mA,cubesatsim_current,PSU,5,2,3,Current,Power Supply DC Current +32,realTime,Sensor1,12,signed raw,cubesatsim_sensor2|INT,Experiments,6,6,3,Sensor 1,STEM Payload extra Sensor 1 +33,realTime,Sensor2,12,signed scaled,cubesatsim_sensor3|FLOAT2,Experiments,6,7,3,Sensor 2,STEM Payload extra Sensor 2 +34,realTime,STEMPayloadStatus,1,-,17,Experiments,6,1,0,STEM Payload, STEM Payload STEM Payload board failure indicator +35,realTime,Nominal Mode,1,-,17,Computer Software,3,2,0,Nominal Mode, Nominal Mode (Not Safe Mode) +36,realTime,PayloadStatus1,1,-,17,NONE,6,7,0,Exp 2,STEM Payload status 1 failure indicator +37,realTime,PayloadStatus2,1,-,17,NONE,6,8,0,Exp 3,STEM Payload status 2 failure indicator +38,realTime,I2CBus0Failure,1,-,17,Computer Hardware,2,2,0,I2C Bus 0,I2C bus 0 failure indicator +39,realTime,I2CBus1Failure,1,-,17,Computer Hardware,2,3,0,I2C Bus 1,I2C bus 1 failure indicator +40,realTime,I2CBus3Failure,1,-,17,Computer Hardware,2,4,0,I2C Bus 3,I2C bus 3 failure indicator +41,realTime,CameraFailure,1,-,17,Computer Hardware,2,5,0,Camera,Camera failure indicator +42,realTime,GroundCommands,4,-,1,Computer Software,3,3,0,Ground Commands,Number of ground commands received +43,realTime,RxAntenna,1,-,16,Radio,1,3,0,RX Antenna,Receive antenna status +44,realTime,TxAntenna,2,-,16,Radio,1,2,0,TX Antenna,Transmit antenna status +45,realTime,ICR3VProt,12,V,43,NONE,7,2,3,3V Prot,ICR 3V Proteted +46,realTime,ICR2dot5V,12,V,43,NONE,7,3,3,2.5V,ICR 2.5V +47,realTime,ICR2dot5VProt,12,V,43,NONE,7,4,3,2.5V Prot,ICR 2.5V Protected +48,realTime,rf6,12,-,0,NONE,0,0,0,None,None +49,realTime,rf7,12,-,0,NONE,0,0,0,None,None +50,realTime,MuxTest,12,V,43,NONE,7,5,3,Sensor Power,Sensor Power Voltage at the ICR +51,realTime,LtVGACtl,12,V,42,NONE,1,4,3,VGA Control,Control Voltage to the Variable Gain Amplifier (VGA) +52,realTime,pad,4,-,34,NONE,0,0,0,None,Unused +53,realTime,IHUdiagData,32,-,18,NONE,3,2,0,Diagnostic Info,Diagnostic Data on IHU Performance +54,realTime,pad1,1,-,0,NONE,0,0,0,NONE,Filler +55,realTime,wodSize,8,000s,36,NONE,3,3,0,WOD Stored,Number of WOD data payloads kept for each of Science and Housekeeping. In hundreds +56,realTime,swCmds,32,-,35,NONE,7,6,0,Diagnostic,ICR Diagnostic information +57,realTime,hwCmdCnt,6,-,1,NONE,7,7,0,HW Command Count,Number of hardware commands since last reset +58,realTime,swCmdCnt,6,-,1,NONE,7,8,0,SW Command Count,Number of software commands since last reset +59,realTime,pad2,28,-,0,NONE,0,0,0,NONE,Filler diff --git a/spacecraft/FoxTelem_11a/CubeSatSim_conversion_curves.csv b/spacecraft/FoxTelem_11a/CubeSatSim_conversion_curves.csv new file mode 100644 index 00000000..30f05985 --- /dev/null +++ b/spacecraft/FoxTelem_11a/CubeSatSim_conversion_curves.csv @@ -0,0 +1,13 @@ +CurveName,a,bx,cx^2,dx^3,ex^4,fx^5,Description +cubesatsim_voltage,0,0.01,0,0,0,0,Converts voltages read from the INA219 sensors +cubesatsim_current,-2048,1,0,0,0,0,Converts positive and negative currents read from the INA219 sensors +cubesatsim_temperature,0,0.1,0,0,0,0,Converts temperature of Pi +cubesatsim_rotation,-2048,1,0,0,0,0,Converts positive and negative dps rotation +cubesatsim_acceleration,-20.48,0.01,0,0,0,0,Converts positive and negative g acceleration +cubesatsim_altitude,0,0.1,0,0,0,0,Converts altitude +cubesatsim_pressure,0,1,0,0,0,0,Converts pressure +cubesatsim_sensor1,0,1,0,0,0,0,Conversion of Sensor 1 +cubesatsim_sensor2,-2048,1,0,0,0,0,Conversion of Sensor 2 +cubesatsim_sensor3,-20.48,0.01,0,0,0,0,Conversion of Sensor 3 +cubesatsim_rpm,-204.8,0.1,0,0,0,0,Conversion of calculated RPM +cubesatsim_rssi,-2048,1,0,0,0,0,Conversion of Received Signal Strength diff --git a/spacecraft/FoxTelem_11a/CubeSatSim_maxtelemetry.csv b/spacecraft/FoxTelem_11a/CubeSatSim_maxtelemetry.csv new file mode 100644 index 00000000..57fe1706 --- /dev/null +++ b/spacecraft/FoxTelem_11a/CubeSatSim_maxtelemetry.csv @@ -0,0 +1,47 @@ +46,TYPE,FIELD,BITS,UNIT,CONVERSION,MODULE,MODULE_NUM,MODULE_LINE,LINE_TYPE,SHOMAX_NAME,DESCRIPTION +0,MAX,BATT_A_V,12,V,cubesatsim_voltage|FLOAT2,NONE,0,0,3,Cell A,Battery A voltage (0-2.5V scale) +1,MAX,BATT_B_V,12,V,cubesatsim_voltage|FLOAT2,NONE,0,0,3,Cell A+B,Battery A+B voltage (0-3.3V scale) +2,MAX,BATT_V,12,V,cubesatsim_voltage|FLOAT2,NONE,4,1,3,Cell A+B+C Voltage,Battery A+B+C voltage (0-5.0V scale) +3,MAX,SatelliteXAxisAcceleration,12,g,cubesatsim_acceleration|FLOAT2,NONE,7,4,3,Acceleration,Acceleration around X Axis +4,MAX,SatelliteYAxisAcceleration,12,g,cubesatsim_acceleration|FLOAT2,NONE,8,4,3,Acceleration,Acceleration around Y Axis +5,MAX,SatelliteZAxisAcceleration,12,g,cubesatsim_acceleration|FLOAT2,NONE,9,4,3,Acceleration,Acceleration around Z Axis +6,MAX,TOTAL_BATT_I,12,mA,cubesatsim_current,NONE,4,2,3,Current,Total Battery DC current +7,MAX,Temperature,12,C,cubesatsim_temperature,NONE,6,2,3,Temperature,STEM Payload Sensor Temperature +8,MAX,PANEL_PLUS_X_V,12,V,cubesatsim_voltage|FLOAT2,NONE,7,1,3,Voltage,+X Panel +9,MAX,PANEL_MINUS_X_V,12,V,cubesatsim_voltage|FLOAT2,NONE,10,1,3,Voltage,-X Panel +10,MAX,PANEL_PLUS_Y_V,12,V,cubesatsim_voltage|FLOAT2,NONE,8,1,3,Voltage,+Y Panel +11,MAX,PANEL_MINUS_Y_V,12,V,cubesatsim_voltage|FLOAT2,NONE,11,1,3,Voltage,-Y Panel +12,MAX,PANEL_PLUS_Z_V,12,V,cubesatsim_voltage|FLOAT2,NONE,9,1,3,Voltage,+Z Panel +13,MAX,PANEL_MINUS_Z_V,12,V,cubesatsim_voltage|FLOAT2,NONE,12,1,3,Voltage,-Z Panel +14,MAX,PANEL_PLUS_X_I,12,mA,cubesatsim_current,NONE,7,2,3,Current,+X Panel +15,MAX,PANEL_MINUS_X_I,12,mA,cubesatsim_current,NONE,10,2,3,Current,-X Panel +16,MAX,PANEL_PLUS_Y_I,12,mA,cubesatsim_current,NONE,8,2,3,Current,+Y Panel +17,MAX,PANEL_MINUS_Y_I,12,mA,cubesatsim_current,NONE,11,2,3,Current,-Y Panel +18,MAX,PANEL_PLUS_Z_I,12,mA,cubesatsim_current,NONE,9,2,3,Current,+Z Panel +19,MAX,PANEL_MINUS_Z_I,12,mA,cubesatsim_current,NONE,12,2,3,Current,-Z Panel +20,MAX,PSUVoltage,12,V,cubesatsim_voltage|FLOAT2,NONE,5,1,3,Voltage,Power Supply Voltage +21,MAX,SPIN,12,rpm,cubesatsim_rpm,NONE,3,1,3,Spacecraft Spin,Calculated spin rate using solar cells +22,MAX,Pressure,12,bar,cubesatsim_pressure,NONE,6,3,3,Pressure,STEM Payload Sensor Pressure +23,MAX,Altitude,12,m,cubesatsim_altitude,NONE,6,4,3,Altitude,STEM Payload Sensor Altitude +24,MAX,Resets,12,-,12,NONE,3,2,3,Reset Count, Software Reset Count +25,MAX,RSSI,12,dBm,cubesatsim_rssi|INT,NONE,1,1,3,RSSI,Received Signal Strength Indication +26,MAX,IHUTemperature,12,C,cubesatsim_temperature,NONE,2,1,3,Temperature,Internal Temperature of IHU +27,MAX,SatelliteXAxisAngularVelocity,12,dps,cubesatsim_rotation|INT,NONE,7,3,3,Rotation,Angular Veolcity around X Axis +28,MAX,SatelliteYAxisAngularVelocity,12,dps,cubesatsim_rotation|INT,NONE,8,3,3,Rotation,Angular Veolcity around Y Axis +29,MAX,SatelliteZAxisAngularVelocity,12,dps,cubesatsim_rotation|INT,NONE,9,3,3,Rotation,Angular Veolcity around Z Axis +30,MAX,Humidity,12,%,cubesatsim_temperature,NONE,6,5,3,Sensor 1,STEM Payload Sensor Humidity +31,MAX,PSUCurrent,12,mA,cubesatsim_current,NONE,5,2,3,Current,Power Supply DC Current +32,MAX,Sensor1,12,signed raw,cubesatsim_sensor2|INT,NONE,6,6,3,Sensor 1,STEM Payload Extra Sensor 1 +33,MAX,Sensor2,12,signed scaled,cubesatsim_sensor3|FLOAT2,NONE,6,7,3,Sensor 2,STEM Payload Extra Sensor 2 +34,MAX,STEMPayloadStatus,1,-,17,NONE,6,1,0,STEM Payload Status,STEM Payload Board Status +35,MAX,Nominal Mode,1,-,17,NONE,3,2,0,Nominal Mode, Nominal Mode (Not Safe Mode) +36,MAX,PayloadStatus1,1,-,17,NONE,6,7,0,Exp 2,STEM Payload status 1 failure indicator +37,MAX,PayloadStatus2,1,-,17,NONE,6,8,0,Exp 3,STEM Payload status 2 failure indicator +38,MAX,I2CBus0Failure,1,-,17,NONE,2,2,0,I2C Bus 0,I2C bus 0 failure indicator +39,MAX,I2CBus1Failure,1,-,17,NONE,2,3,0,I2C Bus 1,I2C bus 1 failure indicator +40,MAX,I2CBus3Failure,1,-,17,NONE,2,4,0,I2C Bus 3,I2C bus 3 failure indicator +41,MAX,CameraFailure,1,-,17,NONE,2,5,0,Camera,Camera failure indicator +42,MAX,GroundCommands,4,-,1,NONE,3,3,0,Ground Commands,Number of ground commands received +43,MAX,RXAntenna,1,-,16,NONE,1,3,0,RX Antenna,Receive antenna status +44,MAX,TXAntenna,1,-,16,NONE,1,2,0,TX Antenna,Transmit antenna status +45,MAX,Pad,58,-,0,NONE,0,0,0,NONE,NONE diff --git a/spacecraft/FoxTelem_11a/CubeSatSim_mintelemetry.csv b/spacecraft/FoxTelem_11a/CubeSatSim_mintelemetry.csv new file mode 100644 index 00000000..006ab3ef --- /dev/null +++ b/spacecraft/FoxTelem_11a/CubeSatSim_mintelemetry.csv @@ -0,0 +1,47 @@ +46,TYPE,FIELD,BITS,UNIT,CONVERSION,MODULE,MODULE_NUM,MODULE_LINE,LINE_TYPE,SHOMIN_NAME,DESCRIPTION +0,MIN,BATT_A_V,12,V,cubesatsim_voltage|FLOAT2,NONE,0,0,3,Cell A,Battery A voltage (0-2.5V scale) +1,MIN,BATT_B_V,12,V,cubesatsim_voltage|FLOAT2,NONE,0,0,3,Cell A+B,Battery A+B voltage (0-3.3V scale) +2,MIN,BATT_V,12,V,cubesatsim_voltage|FLOAT2,NONE,4,1,3,Cell A+B+C Voltage,Battery A+B+C voltage (0-5.0V scale) +3,MIN,SatelliteXAxisAcceleration,12,g,cubesatsim_acceleration|FLOAT2,NONE,7,4,3,Acceleration,Acceleration around X Axis +4,MIN,SatelliteYAxisAcceleration,12,g,cubesatsim_acceleration|FLOAT2,NONE,8,4,3,Acceleration,Acceleration around Y Axis +5,MIN,SatelliteZAxisAcceleration,12,g,cubesatsim_acceleration|FLOAT2,NONE,9,4,3,Acceleration,Acceleration around Z Axis +6,MIN,TOTAL_BATT_I,12,mA,cubesatsim_current,NONE,4,2,3,Current,Total Battery DC current +7,MIN,Temperature,12,C,cubesatsim_temperature,NONE,6,2,3,Temperature,STEM Payload Sensor Temperature +8,MIN,PANEL_PLUS_X_V,12,V,cubesatsim_voltage|FLOAT2,NONE,7,1,3,Voltage,+X Panel +9,MIN,PANEL_MINUS_X_V,12,V,cubesatsim_voltage|FLOAT2,NONE,10,1,3,Voltage,-X Panel +10,MIN,PANEL_PLUS_Y_V,12,V,cubesatsim_voltage|FLOAT2,NONE,8,1,3,Voltage,+Y Panel +11,MIN,PANEL_MINUS_Y_V,12,V,cubesatsim_voltage|FLOAT2,NONE,11,1,3,Voltage,-Y Panel +12,MIN,PANEL_PLUS_Z_V,12,V,cubesatsim_voltage|FLOAT2,NONE,9,1,3,Voltage,+Z Panel +13,MIN,PANEL_MINUS_Z_V,12,V,cubesatsim_voltage|FLOAT2,NONE,12,1,3,Voltage,-Z Panel +14,MIN,PANEL_PLUS_X_I,12,mA,cubesatsim_current,NONE,7,2,3,Current,+X Panel +15,MIN,PANEL_MINUS_X_I,12,mA,cubesatsim_current,NONE,10,2,3,Current,-X Panel +16,MIN,PANEL_PLUS_Y_I,12,mA,cubesatsim_current,NONE,8,2,3,Current,+Y Panel +17,MIN,PANEL_MINUS_Y_I,12,mA,cubesatsim_current,NONE,11,2,3,Current,-Y Panel +18,MIN,PANEL_PLUS_Z_I,12,mA,cubesatsim_current,NONE,9,2,3,Current,+Z Panel +19,MIN,PANEL_MINUS_Z_I,12,mA,cubesatsim_current,NONE,12,2,3,Current,-Z Panel +20,MIN,PSUVoltage,12,V,cubesatsim_voltage|FLOAT2,NONE,5,1,3,Voltage,Power Supply Voltage +21,MIN,SPIN,12,rpm,cubesatsim_rpm,NONE,3,1,3,Spacecraft Spin,Calculated spin rate using solar cells +22,MIN,Pressure,12,bar,cubesatsim_pressure,NONE,6,3,3,Pressure,STEM Payload Sensor Pressure +23,MIN,Altitude,12,m,cubesatsim_altitude,NONE,6,4,3,Altitude,STEM Payload Sensor Altitude +24,MIN,Resets,12,-,12,NONE,3,2,3,Reset Count, Software Reset Count +25,MIN,RSSI,12,dBm,cubesatsim_rssi|INT,NONE,1,1,3,RSSI,Received Signal Strength Indication +26,MIN,IHUTemperature,12,C,cubesatsim_temperature,NONE,2,1,3,Temperature,Internal Temperature of IHU +27,MIN,SatelliteXAxisAngularVelocity,12,dps,cubesatsim_rotation|INT,NONE,7,3,3,Rotation,Angular Veolcity around X Axis +28,MIN,SatelliteYAxisAngularVelocity,12,dps,cubesatsim_rotation|INT,NONE,8,3,3,Rotation,Angular Veolcity around Y Axis +29,MIN,SatelliteZAxisAngularVelocity,12,dps,cubesatsim_rotation|INT,NONE,9,3,3,Rotation,Angular Veolcity around Z Axis +30,MIN,Humidity,12,%,cubesatsim_temperature,NONE,6,5,3,Humidity,STEM Payload Sensor Humidity +31,MIN,PSUCurrent,12,mA,cubesatsim_current,NONE,5,2,3,Current,Power Supply DC Current +32,MIN,Sensor1,12,signed raw,cubesatsim_sensor2|INT,NONE,6,6,3,Sensor 1,STEM Payload Extra Sensor 1 +33,MIN,Sensor2,12,signed scaled,cubesatsim_sensor3|FLOAT2,NONE,6,7,3,Sensor 2,STEM Payload Extra Sensor 2 +34,MIN,STEMPayloadStatus,1,-,17,NONE,6,1,0,STEM Payload Status,STEM Payload Board Status +35,MIN,Nominal Mode,1,-,17,NONE,3,2,0,Nominal Mode, Nominal Mode (Not Safe Mode) +36,MIN,PayloadStatus1,1,-,17,NONE,6,7,0,Exp 2,STEM Payload status 1 failure indicator +37,MIN,PayloadStatus2,1,-,17,NONE,6,8,0,Exp 3,STEM Payload status 2 failure indicator +38,MIN,I2CBus0Failure,1,-,17,NONE,2,2,0,I2C Bus 0,I2C bus 0 failure indicator +39,MIN,I2CBus1Failure,1,-,17,NONE,2,3,0,I2C Bus 1,I2C bus 1 failure indicator +40,MIN,I2CBus3Failure,1,-,17,NONE,2,4,0,I2C Bus 3,I2C bus 3 failure indicator +41,MIN,CameraFailure,1,-,17,NONE,2,5,0,Camera,Camera failure indicator +42,MIN,GroundCommands,4,-,1,NONE,3,3,0,Ground Commands,Number of ground commands received +43,MIN,RXAntenna,1,-,16,NONE,1,3,0,RX Antenna,Receive antenna status +44,MIN,TXAntenna,1,-,16,NONE,1,2,0,TX Antenna,Transmit antenna status +45,MIN,Pad,58,-,0,NONE,0,0,0,NONE,NONE diff --git a/spacecraft/FoxTelem_11a/CubeSatSim_rttelemetry.csv b/spacecraft/FoxTelem_11a/CubeSatSim_rttelemetry.csv new file mode 100644 index 00000000..4d466a3a --- /dev/null +++ b/spacecraft/FoxTelem_11a/CubeSatSim_rttelemetry.csv @@ -0,0 +1,47 @@ +46,TYPE,FIELD,BITS,UNIT,CONVERSION,MODULE,MODULE_NUM,MODULE_LINE,LINE_TYPE,SHORT_NAME,DESCRIPTION +0,RT,BATT_A_V,12,V,cubesatsim_voltage|FLOAT2,NONE,0,0,3,Cell A,Battery A voltage (0-2.5V scale) +1,RT,BATT_B_V,12,V,cubesatsim_voltage|FLOAT2,NONE,0,0,3,Cell A+B,Battery A+B voltage (0-3.3V scale) +2,RT,BATT_V,12,V,cubesatsim_voltage|FLOAT2,Battery,4,1,3,Cell A+B+C Voltage,Battery A+B+C voltage (0-5.0V scale) +3,RT,SatelliteXAxisAcceleration,12,g,cubesatsim_acceleration|FLOAT2,+X Panel,7,4,3,Acceleration,Acceleration around X Axis +4,RT,SatelliteYAxisAcceleration,12,g,cubesatsim_acceleration|FLOAT2,+Y Panel,8,4,3,Acceleration,Acceleration around Y Axis +5,RT,SatelliteZAxisAcceleration,12,g,cubesatsim_acceleration|FLOAT2,+Z Panel,9,4,3,Acceleration,Acceleration around Z Axis +6,RT,TOTAL_BATT_I,12,mA,cubesatsim_current,Battery,4,2,3,Current,Total Battery DC current +7,RT,Temperature,12,C,cubesatsim_temperature,Experiments,6,2,3,Temperature,STEM Payload Sensor Temperature +8,RT,PANEL_PLUS_X_V,12,V,cubesatsim_voltage|FLOAT2,+X Panel,7,1,3,Voltage,+X Panel +9,RT,PANEL_MINUS_X_V,12,V,cubesatsim_voltage|FLOAT2,-X Panel,10,1,3,Voltage,-X Panel +10,RT,PANEL_PLUS_Y_V,12,V,cubesatsim_voltage|FLOAT2,+Y Panel,8,1,3,Voltage,+Y Panel +11,RT,PANEL_MINUS_Y_V,12,V,cubesatsim_voltage|FLOAT2,-Y Panel,11,1,3,Voltage,-Y Panel +12,RT,PANEL_PLUS_Z_V,12,V,cubesatsim_voltage|FLOAT2,+Z Panel,9,1,3,Voltage,+Z Panel +13,RT,PANEL_MINUS_Z_V,12,V,cubesatsim_voltage|FLOAT2,-Z Panel,12,1,3,Voltage,-Z Panel +14,RT,PANEL_PLUS_X_I,12,mA,cubesatsim_current,+X Panel,7,2,3,Current,+X Panel +15,RT,PANEL_MINUS_X_I,12,mA,cubesatsim_current,-X Panel,10,2,3,Current,-X Panel +16,RT,PANEL_PLUS_Y_I,12,mA,cubesatsim_current,+Y Panel,8,2,3,Current,+Y Panel +17,RT,PANEL_MINUS_Y_I,12,mA,cubesatsim_current,-Y Panel,11,2,3,Current,-Y Panel +18,RT,PANEL_PLUS_Z_I,12,mA,cubesatsim_current,+Z Panel,9,2,3,Current,+Z Panel +19,RT,PANEL_MINUS_Z_I,12,mA,cubesatsim_current,-Z Panel,12,2,3,Current,-Z Panel +20,RT,PSUVoltage,12,V,cubesatsim_voltage|FLOAT2,PSU,5,1,3,Voltage,Power Supply Voltage +21,RT,SPIN,12,rpm,cubesatsim_rpm,Computer Software,3,1,3,Spacecraft Spin,Calculated spin rate using solar cells +22,RT,Pressure,12,bar,cubesatsim_pressure,Experiments,6,3,3,Pressure,STEM Payload Sensor Pressure +23,RT,Altitude,12,m,cubesatsim_altitude,Experiments,6,4,3,Altitude,STEM Payload Sensor Altitude +24,RT,Resets,12,-,12,NONE,3,2,3,Reset Count, Software Reset Count +25,RT,RSSI,12,dBm,cubesatsim_rssi|INT,Radio,1,1,3,RSSI,Received Signal Strength Indication +26,RT,IHUTemperature,12,C,cubesatsim_temperature,Computer Hardware,2,1,3,Temperature,Internal Temperature of IHU +27,RT,SatelliteXAxisAngularVelocity,12,dps,cubesatsim_rotation|INT,+X Panel,7,3,3,Rotation,Angular Veolcity around X Axis +28,RT,SatelliteYAxisAngularVelocity,12,dps,cubesatsim_rotation|INT,+Y Panel,8,3,3,Rotation,Angular Veolcity around Y Axis +29,RT,SatelliteZAxisAngularVelocity,12,dps,cubesatsim_rotation|INT,+Z Panel,9,3,3,Rotation,Angular Veolcity around Z Axis +30,RT,Humidity,12,%,cubesatsim_temperature,Experiments,6,5,3,Humidity,STEM Payload Sensor Humidity +31,RT,PSUCurrent,12,mA,cubesatsim_current,PSU,5,2,3,Current,Power Supply DC Current +32,RT,Sensor1,12,signed raw,cubesatsim_sensor2|INT,Experiments,6,6,3,Sensor 1,STEM Payload Extra Sensor 1 +33,RT,Sensor2,12,signed scaled,cubesatsim_sensor3|FLOAT2,Experiments,6,7,3,Sensor 2,STEM Payload Extra Sensor 2 +34,RT,STEMPayloadStatus,1,-,17,Experiments,6,1,0,STEM Payload,STEM Payload Board Status +35,RT,Nominal Mode,1,-,17,Computer Software,3,2,0,Nominal Mode, Nominal Mode (Not Safe Mode) +36,RT,PayloadStatus1,1,-,17,NONE,6,7,0,Exp 2,STEM Payload status 1 failure indicator +37,RT,PayloadStatus2,1,-,17,NONE,6,8,0,Exp 3,STEM Payload status 2 failure indicator +38,RT,I2CBus0Failure,1,-,17,Computer Hardware,2,2,0,I2C Bus 0,I2C bus 0 failure indicator +39,RT,I2CBus1Failure,1,-,17,Computer Hardware,2,3,0,I2C Bus 1,I2C bus 1 failure indicator +40,RT,I2CBus3Failure,1,-,17,Computer Hardware,2,4,0,I2C Bus 3,I2C bus 3 failure indicator +41,RT,CameraFailure,1,-,17,Computer Hardware,2,5,0,Camera,Camera failure indicator +42,RT,GroundCommands,4,-,1,Computer Software,3,3,0,Ground Commands,Number of ground commands received +43,RT,RXAntenna,1,-,16,Radio,1,3,0,RX Antenna,Receive antenna status +44,RT,TXAntenna,1,-,16,Radio,1,2,0,TX Antenna,Transmit antenna status +45,RT,Pad,58,-,0,NONE,0,0,0,NONE,NONE diff --git a/systemd/cubesatsim.service b/systemd/cubesatsim.service index 633f689d..e704d5b8 100644 --- a/systemd/cubesatsim.service +++ b/systemd/cubesatsim.service @@ -10,6 +10,8 @@ StandardOutput=inherit StandardError=inherit Restart=always User=root +CPUAccounting=true +CPUQuota=5% [Install] WantedBy=default.target