Does anyone have examples for how to integrate the ingestion APIs with the Espressif boards (e.g. ESP32WROOM or ESP8266EX)?
@pgrepps, I haven’t tried it myself, but should be trivial if you know how to make an HTTP request on these boards.
- Wrap your data in the Data Acquisition format. Either construct a JSON or CBOR object yourself, or:
- Add the ingestion-sdk-c folder to your project.
- Write your data (example: https://docs.edgeimpulse.com/reference#c-sdk-usage-guide) .
- Send HTTP request to https://ingestion.edgeimpulse.com/api/training/data .
@pgrepps, I followed @janjongboom instructions and I was able to do it. I did the data acquisition and ingestion, but I still have to POST the data to the Ingestion API, which should not be a problem. I can let you know when I am done here, but meanwhile I have my example on GitHub if you are looking for a starting point.
I tested it on an ESP32-CAM, but should work with other ESP32 boards as well. My next step is probably to try sending an image from the ESP32 to the Ingestion API and try to proceed to the inference part.
Hi @rafaelbidese great work done on the ESP32 on your GitHub repo. I have your basic HTTP example working that sends the static (hard coded) accelerometer values from the array to my EI project. But I’m struggling to get the real accelerometer values to update in the array. Specifically this section of code is what I need to update.
float values[][3] = {
{ -9.81, 0.03, 1.21 },
{ -9.83, 0.04, 1.28 },
{ -9.12, 0.03, 1.23 },
{ -9.14, 0.01, 1.25 }
};
I’m using M5Stack’s M5StickC hardware (which is great by the way) and I can get the array to update with a single accX, accY, accZ array. I just can’t seem to get it to capture the accelerometer values over 10 seconds using a 10ms sampling period. The way I call the accelerometer to grab the accX, accY, and accZ values from the hardware is like this…
M5.IMU.getAccelData(&accX,&accY,&accZ);
Do you have any sample code that would help me get the float values[][3]
multi-dimensional array to update over 10 seconds? I’m such a noob when it comes to Arduino/C++ programming.
Hi @bstein2379, I’d do something like:
float values[1000][3] = { 0 }; // 100Hz * 10seconds
size_t values_ix = 0;
while (values_ix < 1000) {
// not sure what this function would be for your platform, but some way to read the current microsecond timer
int64_t next_tick = read_timer_us() + 10000; // 10000 us. between samples
float x, y, z;
M5.IMU.getAccelData(&x, &y, &z);
values[values_ix][0] = x;
values[values_ix][1] = y;
values[values_ix][2] = z;
values_ix++;
while (read_timer_us() < next_tick) {
/* busy loop */
}
}
// upload your values array
Hey @bstein2379 I am glad that was helpful for somebody.
I agree with @janjongboom’s solution. There are some minor drawbacks as the blocking loop depending on your application, but should get you up and running. Ideally, I would think of a timer to trigger the acquisition function every 10 ms without blocking the execution. I have implemented a compiling solution using a dummy accelerometer reading function getAccelData with the same signature.
You can find that example at ei-mbed-qcbor-http-acc. Also, I could not find my ESP32-CAM to test it on the hardware, let me know if you find any issues.
Many thanks @janjongboom and @rafaelbidese. I’ll give the code a try and report back if I have any issues.