Skip to content

Activity

Light-up fishing nets

Beginner | MakeCode, Python | LED display, Light sensor, Sound | 14 Life below water, Input/output, Selection

Step 1: Make it

What is it?

Use your micro:bit to create a prototype of LED lights that can stop unwanted fish, turtles and birds from getting trapped in fishing nets.

This project is part of a series created to offer problem-solving and prototyping activities designed to explore technology as a solution to the challenges of the Global Goals for Sustainable Development.

Introduction

Coding guide

What you'll learn

  • How to make a prototype for a larger project
  • How computers take readings from inputs, process the data to make different outputs depending on the value of sensor readings

How it works

  • A prototype is a working model used to test ideas. Remember to keep your micro:bit away from real water!
  • This program uses the micro:bit's LEDs as a light sensor. It tells the micro:bit to turn on the LEDs when the light is less than a certain level (50).
  • Cover your micro:bit's LED display, to simulate being deep in the sea, and it should light up.
  • You may need to change the number 50 depending on the lighting conditions where you are. If it's lighting up too easily, use a smaller number.
  • If you have a speaker attached, or you're using the new micro:bit with sound, it also gives out a high frequency pulsed sound to help to keep other creatures away from the nets.

What you need

  • micro:bit (or MakeCode simulator)
  • MakeCode or Python editor
  • battery pack (optional)
  • speaker accessory or new micro:bit with sound (optional)

Step 2: Code it

1from microbit import *
2import music
3
4while True:
5    if display.read_light_level() < 50:
6        display.show(Image(
7        "99999:"
8        "99999:"
9        "99999:"
10        "99999:"
11        "99999"))
12        music.play("A5")
13    else:
14        display.clear()
15    sleep(1000)

Step 3: Improve it

  • Change the LED pattern into an animation of a pulsing light
  • Create your own sounds to scare away creatures you don't want to catch
  • Add radio to control the lights and sound remotely