Feature Request: Use WebSerial for any device to add data wtithout the use of the EdgeImpulse CLI
The WebUSB connection to help add data to EdgeImpulse is really useful and easy to use as long as the EdgeImpulse client is installed on the device. Unfortunately in the educational setting installing the Edgeimpulse client can be tricky as computers are often locked down. I have managed to get the client working from the Arduino IDE, but that is also not an efficient method.
What would be a very useful solution would be to have a direct WebSerial connection between an Arduino device and EdgeImpulse Data Acquisition. I think that is possible with the new Chrome WebSerial that also is supported on Android mobile devices using Web Polyfill.
I have an example WebSerial page here with links to the very simple code needed to be installed on the Arduino.
Arduino example code that just outputs to the serial monitor but can be read using webSerial.
/*
* webSerial for testing javascript connection with an arduino
*
* Note: On the Arduino Serial monitor make sure no line-ending or if statements will not work
*
* Android https://hpssjellis.github.io/web-serial-polyfill/index.html
* Laptops Desktops https://hpssjellis.github.io/my-examples-of-arduino-webUSB-webSerial/public/index.html
* IOS not really sure
*
*/
#include <Arduino.h> // Only needed for https://platformio.org/
String readString;
int myDelay = 5000; // non-block delay in milliseconds
unsigned long myStart;
int serialMessage = 1;
int myCount=48; //48 = ascii 0, 58 ascii 9
void setup() {
Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH); // onboard LED, HIGH = off
myStart = millis(); // set delay
randomSeed(analogRead(A0)); // AO pin on XIAO does not have to be connected to anything
}
void loop() {
if ( (millis() - myStart ) >= myDelay) {
myStart = millis(); // reset the delay time
myCount++;
if (myCount >= 58){ // 48 = ascii 0, 58 ascii 9
myCount = 48;
}
//char myChar = (char)myCount;
byte myChar = (byte)myCount;
Serial.write(myChar);
}
while (Serial.available()) {
delay(3);
char c = Serial.read();
readString += c;
}
if (readString.length() > 0) {
Serial.println(readString);
if (readString == "a"){
digitalWrite(LED_BUILTIN, LOW); //onboard LED LOW = on
Serial.println("LED ON");
}
if (readString == "b"){
digitalWrite(LED_BUILTIN, HIGH);
Serial.println("LED OFF");
}
readString="";
}
}
As with all my feature requests, I realize I don’t know the full situation at EdgeImpulse so if this can’t be done, no big deal on my part.
Have a great day.