element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Save The Bees Design Challenge
  • Challenges & Projects
  • Design Challenges
  • Save The Bees Design Challenge
  • More
  • Cancel
Save The Bees Design Challenge
Blog Save the Bees - IoT Bee Hive Monitor - blog 2
  • Blog
  • Forum
  • Documents
  • Leaderboard
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Save The Bees Design Challenge to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: rahulkhanna
  • Date Created: 7 Mar 2023 7:44 PM Date Created
  • Views 921 views
  • Likes 9 likes
  • Comments 1 comment
  • save the bees
  • savethebeesch
  • nicla vision
  • arduino pro
  • mkr wan 1310
  • arduino
Related
Recommended

Save the Bees - IoT Bee Hive Monitor - blog 2

rahulkhanna
rahulkhanna
7 Mar 2023
Save the Bees - IoT Bee Hive Monitor - blog 2

Welcome to the #blog2 of IoT Bee Hive monitor. We will be using the Arduino Pro Nicla Vision board to capture images and video of the bees inside the hive, and the MKR WAN 1310 board to transmit this data to the Arduino IoT cloud.

                                  image

Using the Arduino Pro Nicla Vision & OpenMV, the bee count is updated periodically. The Edge impulse classifier is used to classify bees on the frame. In addition, we will be collecting the temperature, pressure and humidity data of the bee hive from the Pro Nicla Vision.  Using the collected data, the bee behaviour data will give me insights into the health and productivity of my hive, while the temperature data will help me ensure that the bees are living in optimal conditions. These data are logged to the Arduino IoT cloud which will be used later. 

Setting up the Arduino MKR WAN1310  

To begin, let's ensure that we have the necessary drivers installed. If we are utilizing the Web Editor, there is no need to install any drivers manually. However, if we are using an offline editor, we will need to install the drivers manually. We can do this by navigating to Tools > Board > Board Manager... and searching for the Arduino SAMD boards (32-bits ARM Cortex M0+), then proceed to install it.

image    image

On running the LoRa transmitter & receiver example, 

Transmitter code:

#include <SPI.h>
#include <LoRa.h>

int counter = 0;

void setup() {
  Serial.begin(9600);
  while (!Serial);

  Serial.println("LoRa Sender");

  if (!LoRa.begin(868E6)) {
    Serial.println("Starting LoRa failed!");
    while (1);
  }
}

void loop() {
  Serial.print("Sending packet: ");
  Serial.println(counter);

  // send packet
  LoRa.beginPacket();
  LoRa.print("hello ");
  LoRa.print(counter);
  LoRa.endPacket();

  counter++;

  delay(5000);
}
  

 Receiver code:

#include <SPI.h>
#include <LoRa.h>

void setup() {
  Serial.begin(9600);
  while (!Serial);

  Serial.println("LoRa Receiver");

  if (!LoRa.begin(868E6)) {
    Serial.println("Starting LoRa failed!");
    while (1);
  }
}

void loop() {
  // try to parse packet
  int packetSize = LoRa.parsePacket();
  if (packetSize) {
    // received a packet
    Serial.print("Received packet '");

    // read packet
    while (LoRa.available()) {
      Serial.print((char)LoRa.read());
    }

    // print RSSI of packet
    Serial.print("' with RSSI ");
    Serial.println(LoRa.packetRssi());
  }
}

image

Setting up the Pro Nicla Vision - OpenMV 

To begin with, you'll need the following materials:

  • Arduino Pro Nicla Vision Board
  • OpenMV IDE (Integrated Development Environment)
  • USB cable

Install OpenMV IDE from the official website: https://openmv.io/pages/download. Once the download is complete, install it on your computer. Connect the Arduino Pro Nicla Vision board to your computer using the USB cable. Open the OpenMV IDE on your computer. Click on the "New Script" button to create a new script.

image    image

Now it's time to write the code. Here's a sample code that you can use to detect an object:

# Untitled - By: Rahul - Tue Mar 7 2023

import pyb # Import module for board related functions
import sensor # Import the module for sensor related functions
import image # Import module containing machine vision algorithms

redLED = pyb.LED(1) # built-in red LED
blueLED = pyb.LED(3) # built-in blue LED

sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # Sets the sensor to RGB
sensor.set_framesize(sensor.QVGA) # Sets the resolution to 320x240 px
sensor.set_vflip(True) # Flips the image vertically
sensor.set_hmirror(True) # Mirrors the image horizontally

redLED.on()
sensor.skip_frames(time = 5000) # Skip some frames to let the image stabilize

redLED.off()
blueLED.on()

print("You're on camera!")
sensor.snapshot().save("example.jpg")

blueLED.off()
print("Done! Reset the camera to see the saved image.")

When you run this script in OpenMV, you will see the image currently captured by the camera in the top right corner within the frame buffer. Initially, the onboard red LED will be turned on for a few seconds, followed by the blue LED, indicating that the picture is about to be taken. As soon as the picture is taken, a message will be printed on the serial terminal. 

Once the image is captured, it can be saved in either "example.jpg" or ".bmp" format in the board's directory. In case you press the reset button to restart the camera, the image file will be available in the same directory.

image

Upload the code to the Arduino Pro Nicla Vision Board

Click on the "Connect" button in the OpenMV IDE to connect to the Arduino Pro Nicla Vision board. Then click on the "Run" button to upload the code to the board.

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

We've successfully interfaced with the Arduino Pro Nicla Vision board using OpenMV and Arduino MKR WAN 1310.

In the next blog, We will be discussing the Arduino Pro Nicla Vision & OpenMV and exploring its potential. Thanks for reading and keep following. 

  • Sign in to reply
  • DAB
    DAB over 2 years ago

    I looks simple enough, maybe I might give it a try.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube