Devices & Components
SmartElex Bharat AI Innovators Kit Powered by Arduino
Software & Tools
Arduino IDE
Edge Impulse Studio
Project description
Code
Cricket Shot Recognition using Arduino UNO एक R4 Wi-Fi, ADXL345 and Edge Impulse.
cpp
include file downloaded from Edge impulse
1#include <Wire.h> 2#include <Adafruit_ADXL345_Unified.h> 3#include <your_project_inference.h> // Replace with Edge Impulse 4header 5Adafruit_ADXL345_Unified accel = 6Adafruit_ADXL345_Unified(12345); 7static bool debug_nn = false; 8void setup() { 9Serial.begin(115200); 10while (!Serial) {} 11if (!accel.begin()) { 12Serial.println("ERROR: ADXL345 not detected"); 13while (1); 14} 15accel.setRange(ADXL345_RANGE_4_G); 16} 17void loop() { 18float buffer[EI_CLASSIFIER_DSP_INPUT_FRAME_SIZE] = {0}; 19for (size_t ix = 0; ix < EI_CLASSIFIER_DSP_INPUT_FRAME_SIZE; ix += 203) { 21uint64_t next_tick = micros() + (EI_CLASSIFIER_INTERVAL_MS * 221000); 23sensors_event_t e; 24accel.getEvent(&e); 25buffer[ix + 0] = e.acceleration.x; 26buffer[ix + 1] = e.acceleration.y; 27buffer[ix + 2] = e.acceleration.z; 28int32_t wait = (int32_t)(next_tick - micros()); 29if (wait > 0) delayMicroseconds(wait); 30} 31signal_t signal; 32int err = numpy::signal_from_buffer(buffer, 33EI_CLASSIFIER_DSP_INPUT_FRAME_SIZE, &signal); 34if (err != 0) return; 35ei_impulse_result_t result = {0}; 36EI_IMPULSE_ERROR res = run_classifier(&signal, &result, 37debug_nn); 38if (res != EI_IMPULSE_OK) return; 39for (size_t ix = 0; ix < EI_CLASSIFIER_LABEL_COUNT; ix++) { 40ei_printf("%s: %.3f ", result.classification[ix].label, 41result.classification[ix].value); 42} 43#if EI_CLASSIFIER_HAS_ANOMALY == 1 44ei_printf("anomaly: %.3f", result.anomaly); 45#endif 46ei_printf("\n"); 47}
Downloadable files
Cricket Shot Recognition using Arduino UNO एक R4 Wi-Fi, ADXL345 and Edge Impulse.
Circuit Diagram
Screenshot (82).png

Documentation
Cricket Shot Recognition using Arduino UNO एक R4 Wi-Fi, ADXL345 and Edge Impulse.
Follow the steps given in manual
Cricket_Shot_Recognition_Complete (4).pdf
Comments
Only logged in users can leave comments