You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
New to openLog SD. I am building a payload that has three generators each hooked up to a current and voltage sensor. Everything displays perfect on the serial monitor but when I take my 16 GB micro SD card out of the OpenLog it has nothing on it. The LEDs on the openlog work so I'm thinking something is wrong with my code. PLEASE HELP!
/* This program is Designed for High-Atmosphere Bolloon. This program reads data from three generators(motors) and Gyroscope store it temparaley before saving the data to a .txt
on a SD card.
1st PROGRAMMER: CASIMIRO M DEFIGUEIREDO || 2nd PROGRAMMER: MEGAN ROBARDS
DATE: 03/28/2023
VERSION 1.0
NOTICE_______
AMPMETERS have a small variance from 0mA to 185mA (Assume all Read values below 200mA is 0)
*HARDWARE____
3x Ampmeter
3x Voltmeter
1x Gryoscope
1x Arduino Nano
1x Arduino Nano Breakout board
1x Arduino Uno Balloon sheild.
*CONNECTION__
Each Ampmeter requires 5v to Vcc and GND connection
Each Voltmeter requires GND connection
*------------------------ PINOUTS -----------------------------------------------------
PIN | CONNECTION
*-------|---------------------
A0 | Ampmeter(1) Sig
A1 | Voltmeter(1) Sig
*-------|---------------------
A2 | Ampmeter(2) Sig
A3 | Voltmeter(2) Sig
*-------|---------------------
A4 | Gyroscope X-axis sig
A5 | Gyroscope Z-axis sig
*-------|---------------------
New to openLog SD. I am building a payload that has three generators each hooked up to a current and voltage sensor. Everything displays perfect on the serial monitor but when I take my 16 GB micro SD card out of the OpenLog it has nothing on it. The LEDs on the openlog work so I'm thinking something is wrong with my code. PLEASE HELP!
/* This program is Designed for High-Atmosphere Bolloon. This program reads data from three generators(motors) and Gyroscope store it temparaley before saving the data to a .txt
*HARDWARE____
*CONNECTION__
*------------------------ PINOUTS -----------------------------------------------------
*-------|---------------------
*-------|---------------------
*-------|---------------------
*-------|---------------------
*/
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// INCLUDES_&_DEFINE
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//Ampmeters pins
#define Amp1 A0
#define Amp2 A2
#define Amp3 A6
//Voltmeter pins
#define Volt1 A1
#define Volt2 A3
#define Volt3 A7
//Gyroscope pins
#define Gyro_X A4
#define Gyro_Z A5
//SENSOR VALUES
#define mVperAmp 0.180
#define ACSoffset 2.500
#define ACSerror 0.150
#define Resistor_1 30000.000
#define Resistor_2 7500.000
//Change Values
#define NumGens 3
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// CLASS & STRUCT
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
class mData {
protected:
float amp;
float volt;
public:
mData(){
amp = 0.000;
volt = 0.000;
}
float AMP(){
return amp;
}
void AMP(float a){
amp = a;
}
float VOLT(){
return volt;
}
void VOLT(float v){
volt = v;
}
float Watt(){
return amp * volt;
}
};
class Time {
private:
int Hours;
int Min;
int Sec;
int mill;
public:
Time() {
Hours = 0;
Min = 0;
Sec = 0;
mill = 0;
}
int HOUR() {
return Hours;
}
int MINUTES() {
return Min;
}
int SECOUNDS() {
return Sec;
}
int MILLISECONDS() {
return mill;
}
void ReadTime(){
long temp = millis();
Sec = temp / 1000;
Min = temp / 60000;
Hours = temp/ 3600000;
while(temp >= 1000) {
temp -= 1000;
}
mill = temp;
while(Sec >= 60) {
Sec -= 60;
}
while(Min >= 60) {
Min -= 60;
}
}
};
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// GLOBAL_VARIABLE_&_FUNCTIONS
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//FUNCTIONS
float AmpSensor(byte); //
float VoltSensor(byte);
//GLOBALS
//Data handling
mData Data[NumGens];
mData High = mData();
Time time = Time();
// Accelerometer X
int accelX;
float accelXVolt;
float accelXG;
// Accelerometer Z
int accelZ;
float accelZVolt;
float accelZG;
//ports
byte Ammeters[] = {Amp1, Amp2, Amp3};
byte Voltmeters[] = {Volt1, Volt2, Volt3};
//
unsigned int SampleSet = 1;
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// MAIN_PROGRAM
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
void setup() {
Serial.begin(9600);
for(byte i = 0; i < 1; i++)
Data[i] = mData();
}
void loop() {
Serial.print(" ** Sample Set: "); Serial.print(SampleSet); Serial.println(" **");
for (byte s = 0; s < 10; s++) {
}
Serial.println();
SampleSet++;
delay(14000);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// FUNCTIONS
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/* Function NAME | AmpSensor
*/
float AmpSensor(byte pin){
//Variables
float Voltage = 0.000;
float Amperage = 0.000;
float RawValue = analogRead(pin);
//MATH
//Serial.print("READ VALUE: "); Serial.println(RawValue, 3);
Voltage = ((RawValue * 5.000) / 1024.000);
//Serial.print("Voltage: "); Serial.println(Voltage, 3);
Amperage = abs((Voltage - ACSoffset) / mVperAmp) - ACSerror;
if(Amperage < 0)
Amperage = 0;
//return
return Amperage;
}
/* Function NAME | VoltSensor
*/
float VoltSensor(byte pin){
//Variables
float Voltage_out = 0.000;
float Voltage_in = 0.000;
int RawValue = analogRead(pin);
//MATH
Voltage_in = (RawValue * 5.000) / 1024.000;
Voltage_out = Voltage_in / (Resistor_2 / (Resistor_1 + Resistor_2));
//return
return Voltage_out;
}
The text was updated successfully, but these errors were encountered: