cameronbunce
Published © Apache-2.0

Sparrows for Beehives, and ML too!

A Beekeeper's helper, for keeping a sense of hive growth in the winter, with ML, LoRa, and Cellular connections.

AdvancedWork in progress8 hours220
Sparrows for Beehives, and ML too!

Things used in this project

Story

Read more

Code

sparrow-application/CMakeLists.txt

Makefile
Adding our folder to the CMake Lists gets them to be compiled
# Copyright 2022 Blues Inc.  All rights reserved.
# Use of this source code is governed by licenses granted by the
# copyright holder including that found in the LICENSE file.

# Target name `sparrow-application` is required for import
#     ${CMAKE_CURRENT_LIST_DIR}/serial-sensor.c
add_library(sparrow-application STATIC
    ${CMAKE_CURRENT_LIST_DIR}/bme/bme.c
    ${CMAKE_CURRENT_LIST_DIR}/bme/bme280/bme280.c
    ${CMAKE_CURRENT_LIST_DIR}/button/button.c
    ${CMAKE_CURRENT_LIST_DIR}/contact-switch/contact-switch.c
    ${CMAKE_CURRENT_LIST_DIR}/diag/diag.c
    ${CMAKE_CURRENT_LIST_DIR}/hcsr04q/hcsr04q.c
    ${CMAKE_CURRENT_LIST_DIR}/ping/ping.c
    ${CMAKE_CURRENT_LIST_DIR}/pir/pir.c
    ${CMAKE_CURRENT_LIST_DIR}/serial-sensor.c
)
#    PUBLIC ${CMAKE_CURRENT_LIST_DIR}/serial-sensor
target_include_directories(sparrow-application
    PUBLIC ${CMAKE_CURRENT_LIST_DIR}/bme
    PUBLIC ${CMAKE_CURRENT_LIST_DIR}/button
    PUBLIC ${CMAKE_CURRENT_LIST_DIR}/contact-switch
    PUBLIC ${CMAKE_CURRENT_LIST_DIR}/diag
    PUBLIC ${CMAKE_CURRENT_LIST_DIR}/hcsr04q
    PUBLIC ${CMAKE_CURRENT_LIST_DIR}/ping
    PUBLIC ${CMAKE_CURRENT_LIST_DIR}/pir
    PUBLIC ${CMAKE_CURRENT_LIST_DIR}/serial-sensor
)

add_dependencies(sparrow-application
    sparrow-runtime
)

target_link_libraries(sparrow-application
    PRIVATE sparrow-runtime
)

target_compile_options(sparrow-application
    PRIVATE -Wunused-parameter
)

sparrow-application/init.c

C/C++
adding serial-sensor/serial-sensor.h at line 12 rolls our sensor into the Sparrow firmware
// Copyright 2022 Blues Inc.  All rights reserved.
// Use of this source code is governed by licenses granted by the
// copyright holder including that found in the LICENSE file.

// Sparrow Header(s)
#include <framework.h>

// Scheduled App Header(s)
#include "bme/bme.h"
#include "button/button.h"
#include "pir/pir.h"
#include "serial-sensor/serial-sensor.h"

void schedAppInit (void) {
    // Will not initialize if BME280 is not detected
    bmeInit();

    // Will not initialize if not a Sparrow Reference Sensor Board
    pirInit();

    // Reports node identifier and signal health information on button click
    if (!buttonInit()) {
        APP_PRINTF("ERROR: Failed to initialize button application!\r\n");
    }
}

Cameron's Sparrow Firmware

The Blues Reference Sparrow Firmware with my bodges

Sparrow EdgeImpulse Helper

ESP32 code for running inferences and passing them to the Sparrow

Credits

cameronbunce

cameronbunce

2 projects • 3 followers

Comments