Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch
10 changes: 10 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
],
"unwantedRecommendations": [
"ms-vscode.cpptools-extension-pack"
]
}
10 changes: 10 additions & 0 deletions BREAD-Local-Software.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"folders": [
{
"path": "."
}
],
"settings": {
"liveServer.settings.multiRootWorkspaceName": "BREAD-Local-Software"
}
}
22 changes: 14 additions & 8 deletions DCMT_R1/DCMT_R1.ino
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ void loop() {
}
else if(DCMT.turbPump1 || DCMT.turbPump2){ // run as turbidity pump
measureTurbidity();
calculateTurbidity();
}else{ // run as continuous motor/pump
actuateMotors();
}
Expand Down Expand Up @@ -292,15 +293,20 @@ void measureTurbidity()
}
}

//Maybe needs to change to: Output Voltage (V)= -0.0008× (Turbidity of Water (NTU)) + 3.9994
//Needs testing and calibration with known NTU values
// need to change once biomass is calibrated
void calculateTurbidity(){
float x;
if(DCMT.turbVoltage[1] >= 2.5){
x = DCMT.turbVoltage[1];
}else{
x = 2.5;
for(int i = 0; i < 2; i++){
float x;
if(DCMT.turbVoltage[i] >= 2.5){
x = DCMT.turbVoltage[i];
}else{
x = 2.5;
}
DCMT.currentTurbidity[i] = (5742.3 - 1120.4*x) * x - 4352.9 - TURBIDITY_OFFSET;
//DCMT.currentTurbidity[i] = (x-3.9994)/(-0.0008); //Potential equation replacement
}
DCMT.currentTurbidity[1] = (5742.3 - 1120.4*x) * x - 4352.9 - TURBIDITY_OFFSET;
}

void setPIDTunings()
Expand Down Expand Up @@ -415,12 +421,12 @@ void requestEvent() {
if(isnan(DCMT.turbVoltage[0]) || !(DCMT.turbPump1))
turb1.number = 0;
else
turb1.number = DCMT.turbVoltage[0];
turb1.number = DCMT.currentTurbidity[0];

if(isnan(DCMT.turbVoltage[1]) || !(DCMT.turbPump2))
turb2.number = 0;
else
turb2.number = DCMT.turbVoltage[1];
turb2.number = DCMT.currentTurbidity[1];

for (int i = 0; i < 4; i++) Wire.write(turb1.bytes[i]);
for (int i = 0; i < 4; i++) Wire.write(turb2.bytes[i]);
Expand Down
21 changes: 18 additions & 3 deletions RLHT_R2/RLHT_R2.ino
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
long lastThermoRead = 0;
long lastSerialPrint = 0;

//Edit these offsets to calibrate thermocouples as needed
double thermo1_offset = -4.0;
double thermo2_offset = -4.0;

bool E_STOP = false;

CRGB led;
Expand Down Expand Up @@ -224,8 +228,8 @@ void measureThermocouples()
{
if(millis() - lastThermoRead >= THERMO_UPDATE_TIME_MS)
{
RLHT.thermo1 = CH1.readCelsius();
RLHT.thermo2 = CH2.readCelsius();
RLHT.thermo1 = CH1.readCelsius() + thermo1_offset;
RLHT.thermo2 = CH2.readCelsius() + thermo2_offset;
lastThermoRead = millis();
}
}
Expand Down Expand Up @@ -356,5 +360,16 @@ void setParametersRLHT(char *in_data)
RLHT.Kd_2 = (double)float3.number;
}
break;
case 'O':
for(int i=0; i<4; i++) float1.bytes[i] = in_data[i+2];
if(in_data[1] == 1)
{
thermo1_offset = (double)float1.number;
}
if(in_data[1] == 2)
{
thermo2_offset = (double)float1.number;
}
break;
}
}
}
72 changes: 72 additions & 0 deletions Website Code on SD Card/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/* Set height of body and the document to 100% to enable "full page tabs" */
body, html {
/* height: 100%; */
margin: 0;
font-family: Arial;
}

/* Style tab links */
.tablink {
background-color: #555;
color: white;
float: left;
border: none;
outline: none;
cursor: pointer;
padding: 14px 16px;
font-size: 17px;
width: 25%;
}
.tabnav {
width: 100%;
background-color: #777;
display: flex;
}

.tablink:hover {
background-color: #777;
}

/* Style the tab content (and add height:100% for full page content) */
.tabcontent {
color: black;
display: grid;
padding: 100px 20px;
height: 100%;
}

/* Ensure grid containers have explicit sizes */
.grid-container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 10px;
width: 100%;
max-width: 1200px;
margin: 0 auto;
}

/* Set heights to prevent overlap */
.graph-container, .gauge-container {
height: 350px;
position: relative;
}

/* Prevent graph overlap */
.graph-container {
z-index: 1;
}

/* Ensure gauges are on top */
.gauge-container {
z-index: 2;
}

/* Tab content visibility */
.tabcontent {
display: none;
padding: 20px;
}

.tabcontent.active {
display: block;
}
Binary file added Website Code on SD Card/favicon.ico
Binary file not shown.
Loading