Canal Water Level Warning
Picture a canal edge on your Learning Group's city tile. An ultrasonic stands in for water level. When the level crosses thresholds, the city needs clear states — normal, warning, alarm — with RGB + buzzer, an OLED level readout, and optionally a servo gate/indicator. Two measuring points give enough depth for two sprints. That is embedded logic: continuous sensing drives coordinated alerts and actuators.
In this challenge you design and build a canal water level warning for your Learning Group city tile: measure water level, show it, and alert on thresholds with normal / warning / alarm behaviour. Because this challenge spans two sprints, the delivered result is a multi-point or multi-output system — not a single distance print to Serial. You integrate into the city’s shared firmware, make sensor data and controls available to full-stack classmates, and work through research, advice, design, and realisation for your Sprint 1-2 Learning Goal. Follow the city Requirements.
Your Learning Goal title in Portflow
Use: Sprint 1-2 - Learning Goal - Canal Water Level Warning (adjust the sprint number if needed). See the Learning Goal page for the Portflow template.
Illustration
The animation below shows the idea in simplified form (water rising, status colour, alert). Your delivered system should cover threshold states plus display/alerts, and prefer two measuring points or an equivalent multi-output depth for two sprints.
Challenge
Your Learning Group city needs a canal water level warning on a city tile. An ultrasonic measures level; OLED shows the value; RGB/LEDs and buzzer signal normal / warning / alarm; an optional servo acts as gate/indicator. Prefer two measuring points for multi-side scope. Your work is part of one shared embedded firmware for the city — not a separate personal project.
You will deliver a working prototype and the documents that justify and explain it. Work in this order:
- Understand the problem. One or two measuring points? What distances map to normal / warning / alarm? When does the buzzer sound? What does the servo do in each state? Write clear rules. Agree which tile template you use and how this challenge fits the city plan.
- Research. Compare realistic ways to measure level, filter noisy readings, and drive multi-state alerts, plus how to handle two points if you build them. Include how you will expose level data and controls to the full-stack side. Use datasheets and cite resources for decisions.
- Advise. Recommend one architecture: microcontroller role in the shared city firmware, sensors per point, alert outputs, optional servo, and the data/control interface for full-stack. State what you are not building in this period.
- Design. Specify hardware (wiring, pin map, BOM) and software (state machine for normal / warning / alarm, thresholds, hysteresis, interface messages) so someone else could rebuild your system and integrate it into the shared firmware.
- Realise. Build and test in small steps. Prefer separate Arduino sketches for parts (ultrasonic, OLED, RGB states, buzzer, servo, then second point) before you merge working pieces into the shared city firmware on GitLab
main. Keep each test sketch tiny. Then demonstrate: rising level walks through normal → warning → alarm with clear outputs. Use simulation or stubs if full-stack or other tiles are not ready yet — do not wait on classmates to progress.
Minimum scope (Sprint 1–2)
Your contribution must include:
- Ownership of one city tile based on a LightBurn template, with the canal warning placed on that tile (or a clear bench stand-in while the tile is cut). Prefer a tile with canal/infra space if available.
- Integration into the city’s one shared embedded firmware (follow the city’s code conventions; do not ship a parallel personal firmware stack).
- A microcontroller (e.g. ESP32-class board) that runs that shared firmware with your water-level warning behaviour included.
- A system that includes:
- At least one ultrasonic (HC-SR04) as water-level stand-in (aim at a movable surface or water tray carefully in the lab),
- Three states: normal, warning, alarm — with documented thresholds and preferably hysteresis,
- RGB or discrete LEDs for state colour,
- An OLED showing level (cm/%) and state name,
- A buzzer active in alarm (and optionally warning),
- Optionally a servo gate/indicator that moves with state.
- Prefer two measuring points for full two-sprint depth. If you start with one point in Sprint 1, Sprint 2 must add a second point or the servo indicator plus richer dual-threshold logic so the result is clearly multi-output / multi-point.
- Firmware that maps distance to states and drives alerts. Example pattern:
- Normal: green, quiet, OLED shows level,
- Warning: yellow, optional soft beep,
- Alarm: red, buzzer pattern, servo indicator to alarm position if used.
- A documented threshold table and alert behaviour. Keep it simple and explain your choice.
- Filtering on ultrasonic readings and timeouts/patterns so the buzzer cannot chatter on a noisy edge.
- A documented data and control interface for full-stack developers: level and state per measuring point, plus commands that can acknowledge alarm or force a state for demo (message names, payload fields, and an example). Full-stack may connect later — you still define and demo the interface (Serial, MQTT, or another city-agreed protocol), with simulation if needed.
- Updates to the city’s shared BOM and wiring diagram for your hardware.
Recommended scope
If you have time, add one or more of:
- A clear second measuring point upstream/downstream with combined city alarm if either is critical.
- Serial debug output showing raw distance and filtered level.
- A simple canal model (tray + foam “water surface”) so demos are obvious.
- A potentiometer demo stand-in to force level during presentations.
- A stub or simulator feed that full-stack can use before your hardware is on the desk.
Out of scope for this challenge
These are not part of this challenge:
- Real flood modelling, municipal pump control, or certified warning systems.
- Computer vision / ML water detection.
- Submerging electronics in water — use stand-ins and keep the lab dry and safe.
- Building the city back-end, front-end, or Raspberry Pi stack yourself — that is full-stack work. You do define and expose the embedded interface they connect to.
- A separate personal firmware repo that never merges into the city’s shared embedded application.
Demo and safety context
Treat the prototype as lab equipment, not a flood-control system:
- Keep electronics dry. Use trays, foam, or cardboard stand-ins; never dunk the MCU or sensors beyond their rating.
- Default alerts should be documented: what happens if the sensor returns nonsense (hold last good state or go to warning — pick one and explain).
- Clear demo script. Anyone in your Learning Group can show at least: normal → warning → alarm as level rises; OLED and RGB match; buzzer on alarm; second point or servo if included.
- Independent progress. You can demo your tile and interface with simulation or stubs while classmates finish their parts.
Starting points
Use these concrete first steps early in Sprint 1:
- Read the city Requirements and agree your challenge with the Learning Group (no duplicate challenges).
- Pick your tile template and sketch sensor point(s), OLED, RGB, buzzer, optional servo.
- Agree on threshold rules. Distances for normal / warning / alarm (with hysteresis). Write rules in plain language.
- Inventory hardware. List what your studio kit provides (ESP32, HC-SR04, OLED, RGB/LEDs, buzzer, optional SG90, breadboard). Note gaps early and ask your coach. Start the city’s shared BOM. Optional KY modules from coach stock are fine if documented.
- Test in small sketches first. Create short Arduino sketches for one concern at a time (e.g. ultrasonic, OLED, RGB states, buzzer pattern, servo, then second point). Do not develop everything only inside the city’s main shared firmware.
- Blink one LED to confirm toolchain: IDE, upload,
Serial.begin, one GPIO. See First ESP32 project. - Draft the full-stack interface with your city (per-point level/state messages and acknowledge/force example). Agree a simulation path so neither side waits. Prove the messages in a small sketch before wiring them into shared firmware.
- Draft your research question. Example: Which level sensing, filtering, and multi-state alert approach best fit a canal warning tile given noise, hysteresis, and full-stack integration?
- Create your Learning Goal in Portflow. Link the product deliverables you plan to submit. Follow Learning Goal.
- Integrate only what works. Prove one measuring point + states in sketches, then alerts, then second point or servo; move proven behaviour into the shared firmware in small merges.
Suggested sprint timeline
The Learning Group does not use Scrum, but you still follow the sprint rhythm of the Group Project: two sprints for this challenge (Sprint 1-2).
In the first sprint you focus on research and advice (including multi-point if planned) and prove one measuring path in small sketches. In the second sprint you focus on design and realisation of the full warning system: remaining outputs, second point/depth, shared-firmware integration, and the full-stack interface.
| Sprint | Focus | Outcome |
|---|---|---|
| 1 | Research & advise (+ first measuring path in sketches) | Research report; advisory report; tile and thresholds chosen; state rules; hardware choice; draft data/control interface; one measuring path proven in a small test sketch |
| 2 | Design & realisation (full warning system) | Wiring diagram + pin map + state diagram; shared BOM updated; normal/warning/alarm with OLED + RGB + buzzer (and preferably two points or servo) in shared firmware on city GitLab main; demo (with simulation if needed); Portflow evidence linked; reflection |
Tools, frameworks, and hardware
| Area | Suggestions |
|---|---|
| City tile | One of the five LightBurn templates |
| Microcontroller | ESP32 / ESP32-S3 / ESP32-C3 (align with city hardware choices) |
| Actuators | RGB/LEDs; buzzer; optional SG90 servo gate/indicator |
| Display | OLED for level and state |
| Sensors | Ultrasonic HC-SR04 per measuring point; optional potentiometer demo stand-in |
| IDE | Arduino IDE or PlatformIO |
| Version control | City GitLab project, shared firmware on main |
| Documentation | Markdown on the city MkDocs site and in the repo (English); cite sources for decisions |
| Full-stack link | Documented messages (Serial, MQTT, or city-agreed protocol); stubs/simulation so you do not block each other |
Profile knowledge worth revisiting:
- Arduino overview
- Sensors and actuators together
- Sketch structure and timing
- LED component
- Microcontrollers
Products
Your challenge evidence is a set of products: studio deliverables tied to learning outcomes. Submit them in Portflow and link them from your Learning Goal.
Analyse & Advise
| Product | What you deliver | Template |
|---|---|---|
| Research | Analysis of water-level sensing, filtering/hysteresis, and multi-state alerts; comparison with criteria; recommendation for design | Research product |
| Advice | Decision document: chosen MCU role in shared firmware, sensor(s), thresholds, alert outputs, optional servo, full-stack data/control interface, and implementation order (one point → alerts → second point) | Advisory report |
Suggested titles for Portflow
- Research: Level sensing and thresholds for canal water warning
- Advice: Multi-state canal water level warning architecture
The advice report should build on the research report. Do not repeat the full comparison tables.
Design & Realise
Product pages for design and realisation are still being added to the studio catalogue. For this challenge, deliver the following and attach them as evidence (repository links, PDFs, or videos as your coach specifies).
| Product | Learning outcome | What you deliver |
|---|---|---|
| System design | Design & Realise | Self-contained design document: context, city requirements link-in, block diagram for measuring point(s), circuit/wiring diagram, pin assignment table, warning state machine (diagram + description), timing parameters, software module overview for the shared firmware, per-point data/control interface for full-stack, contribution to the city BOM, and test plan |
| Prototype realisation | Design & Realise | Working prototype on your city tile (or documented bench stand-in), code integrated in the city’s shared firmware on GitLab main, README with build/upload steps, interface demo (live or simulated), and validation evidence showing normal / warning / alarm behaviour |
Suggested titles for Portflow
- Design: Canal Water Level Warning — hardware and firmware specification
- Realisation: Canal Water Level Warning — prototype and validation
System design — minimum contents
Your design document should let a peer rebuild and integrate the system without guessing:
- Requirements. Rules for normal / warning / alarm, hysteresis, and (if used) per-point behaviour; how this fits the city Requirements.
- Architecture diagram. MCU, ultrasonic(s), OLED, RGB, buzzer, optional servo, power, and the path to full-stack (protocol boundary).
- State machine. States that cover normal, warning, alarm, acknowledge, and optional force-demo modes.
- Timing table. Sample rate; buzzer pattern; hysteresis margins.
- Pin map and wiring diagram. GPIO ↔ component for every point; include resistor values for LEDs.
- BOM. Parts list aligned with the city’s shared BOM.
- Sensor handling. Filter/average, threshold, and invalid-reading policy per point.
- Full-stack interface. Messages for level and state per point, plus controls; example payloads; how to test with a stub or simulator.
- Shared firmware. Where your modules live in the city codebase and which code conventions you follow.
- Test plan. e.g. “normal”, “cross into warning”, “cross into alarm”, “drop back with hysteresis”, “second point if present”, “acknowledge”.
Realisation — minimum evidence
- Small test sketches (or a short test log) showing you verified parts separately: ultrasonic, OLED, RGB, buzzer, optional servo — before integration.
- Work on the city GitLab project: proven behaviour merged (or ready to merge) into
mainas part of the shared firmware — not a dump of unfinished experiments into main. - Photo or diagram of the physical build on the tile (or bench stand-in with a clear path to the tile), with measuring points labelled.
- Demo script (numbered steps) matching your video or live assessment, covering all three states and the data/control interface.
- Proof you can progress without waiting on full-stack (simulation, Serial demo, or stub consumer).
- Honest known limitations (e.g. ultrasonic noise, dry stand-in only, interface not yet wired to the Pi).
Quality indicators
When assessing this challenge as a whole, the following indicators are used. Use them as a self-check before you submit.
Problem fit
- The measuring points and normal / warning / alarm rules are described in plain language.
- Scope is explicit: this challenge delivers a water-level warning with display and alerts (preferably multi-point) on your city tile, integrated into shared firmware — not a Serial-only distance demo or a solo firmware fork.
- The work respects the city Requirements (tile, shared firmware, BOM/wiring, full-stack interface, no waiting on classmates).
Analyse & Advise products
- Research and advice reports meet the research and advisory report quality indicators.
- The advice report references the research report and states one clear recommended architecture, including how level data and controls reach full-stack.
- Component and approach choices are supported by datasheets or comparable evidence, not only opinion. Decisions cite resources.
Design
- The design document is self-contained and includes a three-state machine plus thresholds/hysteresis that match the intended firmware behaviour.
- Pin map, wiring diagram, and BOM cover sensors and outputs and match the realised prototype (or differences are documented with reason).
- Fail-safe behaviour is designed explicitly (invalid reading policy, buzzer pattern/silence path).
- The data/control interface for full-stack is specified with example messages per measuring point.
Realisation
- The prototype demonstrates level sensing, OLED readout, RGB state colours, and buzzer on alarm (plus second point or servo if in scope).
- Behaviour lives in the city’s shared firmware on GitLab
main(or is clearly opened as an integration MR), following city code conventions. - Firmware is readable: meaningful names, constants for thresholds/timings, no unexplained magic numbers.
- Ultrasonic input is filtered; state changes are observable via Serial log or demo script.
- The full-stack interface is demonstrable (live or with simulation/stubs) without depending on a finished back-end.
- Validation evidence covers normal, warning, alarm, and at least one edge case (e.g. noisy edge with hysteresis, acknowledge).
- Repository README explains how to build, flash, and run the demo as part of the city project.
Professional practice
- Learning Goal in Portflow uses the correct naming format and links to all product evidence.
- End-of-sprint reflection connects results to your learning question and to embedded practice (timing, I/O, thresholds, city integration).
- Documentation is in English Markdown and usable by other city students on their tiles.
- You did not block on classmates: simulation, stubs, or a local demo kept you moving.
Focus points
Watch out for these common issues while you work:
- Stopping at raw cm. Two sprints mean states + OLED + RGB + buzzer (and preferably two points).
- Threshold chatter. Use hysteresis; test the boundary on purpose.
- Everything in main firmware. Develop and test parts in small Arduino sketches first; only integrate working pieces into the shared city firmware.
- Solo firmware forever. Test sketches are fine for learning; the assessed integration still joins the shared city firmware per the Requirements.
- Waiting on full-stack. Define the interface early and demo with Serial/stubs; do not pause realisation until the Pi dashboard exists.
- Blocking
delay()everywhere. Longdelay()calls miss level changes. Prefermillis()-based state machines or timers. - Wet lab risk. Keep water away from electronics; use stand-ins.
- Advice without analysis. Coaches will send back an advice report that invents new comparisons not present in research.
- Design–code drift. Update the design document when you change pins, thresholds, timings, or interface messages during realisation.
Key points
- Core task: measure canal level → show it and alert on normal / warning / alarm on your city tile.
- Because this is Sprint 1-2, prefer two measuring points (or equivalent multi-output depth), not a Serial-only sketch.
- Test small parts in separate Arduino sketches; integrate only what works into one shared firmware.
- Expose per-point data and controls for full-stack; keep a shared BOM and wiring diagram.
- Deliver four products: research, advice, system design, and prototype realisation.
- Work research → advice → design → realise; Sprint 1 emphasises research & advice (and proving one measuring path); Sprint 2 emphasises full warning design & realisation.
- Real flood systems / wet electronics are out of scope; building the city back-end/front-end is out of scope for you.
- Link everything to your Learning Goal in Portflow and reflect at the end of Sprint 1-2.