As it stands now, my dosing pump project works perfectly, and the functionality is just right “all” thanks to Blynk! However, if this project is copied by someone with even less code/circuit skills than myself, I would want them to have an easier to understand project in the end.
THIS youtube video depicts the functionality of my project while also showing my app being interacted with. I refer specifically to the first Step widget titled PUMP#. This widget allows me to select from 1 of 8 pumps. I as the creator will know what I put on pump 1, 2, 3 etc in terms of nutrient solutions, but other users, especially those that use this as a bartender would likely be consuming the cocktails made and likely forget which liquor is assigned to pump 1, 2, 3 etc. All of that said, and as the title states, I would like expanded functionality of the Step widget to include a variable name display, or even a new display app that can piggy back onto existing widgets to display the names in the array. As of this morning, I updated my sketch to print these names out onto the terminal monitor when the code is being executed on a respective pin and array position, but this is an ‘after the fact’ result. I seek the ability to step from name to name instead of number to number.
/*
Nutrient Dosing or Alcohol Dosing
*/
#include <SPI.h> //Used by Blynk
#include <Ethernet.h> //Used by Blynk
#include <BlynkSimpleEthernet.h> //Used by Blynk
#include <SimpleTimer.h>
char auth[] = "PasteAuthKeyBetweenQuotes"; //Paste code that app emailed you between "quotes"
SimpleTimer timer;
WidgetTerminal terminal(V3);
int pumpPin[8] = { 2, 3, 4, 5, 6, 7, 8, 9 }; //Digital pins used
uint32_t multiplier[8] = { 858, 827, 872, 865, 887, 895, 913, 843 }; //ms per ml
uint32_t startPump = 0;
uint32_t runCount;
float DOSEml; //V1 Step Widget (0.25 per step, send step/NO, loop values ON)
int button = 0; //V2 Button Widget set to Switch
bool pumpRunning = false;
int x;
const char *y[8] = { "armorSi", "floraBlend", "caliMagic", "koolBloom",
"floraGro", "floraMicro", "floraBloom", "phDown" };
BLYNK_WRITE(V0) { // Choose Pump
x = param.asInt() - 1;
}
BLYNK_WRITE(V1) { // Adjust Dosage
DOSEml = param.asFloat();
}
BLYNK_WRITE(V2) { // Activate Chosen Pump
button = param.asInt();
}
void checkPump()
{
if (button == 1 && pumpRunning == false)
{
Blynk.virtualWrite(V0, 0);
Blynk.virtualWrite(V1, 0);
Blynk.virtualWrite(V2, 0);
pumpRunning = true;
digitalWrite(pumpPin[x], HIGH);
startPump = millis();
runCount = DOSEml * multiplier[x];
terminal.print("Dosing in: ");
terminal.print(DOSEml);
terminal.print(" milliliters of ");
terminal.println(y[x]);
terminal.flush();
}
if (millis() - startPump > runCount)
{
digitalWrite(pumpPin[x], LOW);
pumpRunning = false;
button = 0;
}
}
void setup()
{
Serial.begin(9600);
Blynk.begin(auth);
while (Blynk.connect() == false) {}
timer.setInterval(100L, checkPump);
for (int p = 0; p <= 7; p++)
{
pinMode(pumpPin[p], OUTPUT);
}
Blynk.virtualWrite(V0, 0);
Blynk.virtualWrite(V1, 0);
Blynk.virtualWrite(V2, 0);
}
void loop()
{
Blynk.run();
timer.run();
}