* Team Number: 9
* Team Name: Shorts & Sparks
* Team Members: James Steeman and Tim Zhang
* Github Repository URL: https://github.com/ese5160/a14g-final-submission-s25-t09-shorts-sparks
* Description of test hardware: Detkin Desktop (Windows 10), MacBook Pro M2 (Mac OS), Our PCBAs, LSM6DSO IMU, Servo Motor, DC motor, our mechanical assembly
(development boards, sensors, actuators, laptop + OS, etc)
Brief Project Description.
What inspired you to do the project? What problem is your device solving?
How do you use the Internet to augment your device functionality?
The entire system revolves(get it? haha) around the flywheel. Using the principle of gyroscopic precession, this allows us to tilt the flywheel back and forth (pitch), and produce a rolling tourque to counteract waves rocking a boat (usually boats are longer than they are wide so the largest tilt is in this axis). Our large DC motor (original CNC spindle), will spin up a laser cut disk with slots for 16 large bolts along the circomference (DIY flywheel with max rotational inertia). This inertia combined with a very high RPM (~5000 with 25% full power) gives us a large amount of stored angular momentum to use and counteract the boat rocking side to side. A servo motor is used to act as the gimbal actuator to tilt the flywheel assembly back and forth as it is very simple and provides decent torque. An IMU is used which allows us to measure current tilt and correct for it inside of a PID loop (originally also planend for a kalman filter with sensor fusion bt once again time was extreemly limited). All of the processing is handled by the SAMW25 which runs Free RTOS to simultaneously perform active stability compensation and other tasks such as CLI, and WIFI communication with Node-Red Dashboard.

Where did you face difficulties? This could be in firmware, hardware, software, integration, etc.
Our major challenge was hardware (and as a result a lack of time), due to unforseen factors from the manufactures that caused several unfixable PCB issues (possibly due to wrong reflow temperature that killed the ICs). This quite literally killed our original project, leaving us only 3 days to try to implement and demo a new project from scratch. Again, this document provides specific information on board issues: Board Issues Google Document
The new project suffered from lack of development/debugging time, with potential further hardware issues that we did not have time to pinpoint (unable to move our gimbal actuator as we could not get a second PWM instance on a different tcc unit to output from other pins. Tried 8 total pins, only the one used for the flywheel motor worked). This meant that we were unable to demonstrate the full integrated active roll compensation (which was the main selling point).
How did you overcome these challenges?
What lessons did you learn by building and testing this prototype?
What would you do differently if you had to build this device again?
What steps are needed to finish or improve this project?
What did you learn in ESE5160 through the lectures, assignments, and this course-long prototyping project?
Note: Since we had a late project change, we have created new HRS and SRS for the new project (post-facto) based on our goals when this project was created. We will attempt to evaluate our final output relative to these goals that reflect the ideal new project expectations. We recognize that some of these requirements are very basic and could be developed much further to frame a project, but since they were made post facto and again very limited time (we focused more on actual implementation for as long as possible) we hope this is sufficient to have some picutre of the intentions. The review is also more brief, in accordance with the nature of the requirements.
| Req ID | Requirement | Review |
|---|---|---|
| HRS-01 | We shall repurpose the PCBA from the CNC project using as much hardware as possible | Success: we used the PCBA. Used everything besides SAMD21 and stepper motor driver (timeline constraint) |
| HRS-02 | We shall reporpose as much of mechanical hardware as possible | Success: Used the Spindle motor as flywheel motor, bearing blocks, linear rods, aluminum extrusion, … See pictures/video to see structure |
| HRS-03 | The DC flywheel shall be driven with a mosfet driver to allow for PWM speed control | Success: See video demos for control |
| HRS-04 | The system shall have external non-voilatile memory (microSD) of no less than 512MB for storing G-code and current progress (in any pause scenario) | N/A |
| HRS-05 | An IMU shall sample acceleartion and gyro in necessary axes (gz, ax, ay) at at least 200 Hz (for Kalman filter input) | Success: The refresh rate of IMU is 417 Hz, and we sample in an RTOS task running at 200 Hz ?Testing video? |
| HRS-06 | The system shall use a stepper motor to change the angle of the flywheel and provide a torque to the boat | Fail: We switched to a servo motor using PWM from SAMW (unsuccessful also), as simpler than SAMD21 interfacing to use the Stepper driver (connected to SAMD21 on pcba) |
| Req ID | Requirement | Review |
|---|---|---|
| SRS-01 | System shall use IMU data as input to Kalman filter of optimally 200Hz and at least 100Hz | Fail: timeline and implementation issues prevented this from being persued and implemented |
| SRS-02 | A pid control loop shall execute at optimally 100Hz and at least 50Hz | Fail: servo was not functional, so PID was not necessary or implemented |
| SRS-03 | The MCU in the SAMW25 module shall run an RTOS | Success: See codebase, all videos run applicaiton code in FreeRTOS |
| SRS-04 | The user shall be able to remotely set flywheel speed | Success: See demo video |
| SRS-05 | The system shall be able to send IMU data to the web portal for remote user access | Success: See demo video |
| SRS-06 | The SAMW25 and SAMD21 mcus on the board should communicate over UART to transimit PWM or data for distributed processing as possible or best feasable as found in development | Fail: UART developed on both indpendantly successfully (on pins already connected on the PCBA). Logic analyzer captures were used to assess this on SAMD21 and moving the CLI uart to different pins on SAMW25. Creating a separate simultaneous (with cli) uart implementation on the samw led to integration issues, and this was dropped in favor of a simpler, time sensitive approach |
| SRS-07 | The system shall generate 10kHz PWM at various duty cycles in a ramping manner for safe DC motor control (flywheel) | Success: see codebase DcMotor.c and Demo video for example |
| SRS-08 | User shall be able to remotely activate and disable tilt compensation | Partial Success: Node red/wifi setting successful, but servo/feedback actuation unsucessful |
| SRS-09 | OTAFU shall be able to be initiated remotely through web portal (node-red) | Success: See demo video |
| SRS-10 | An OTAFU shall be implemented | Success: See demo video |
| Original | Current |
|---|---|
| Foam cyllinders 3d model prototypes | Copper clad FR4 for milling PCB prototypes |
| r(z), y, theta (cyllinder) cnc | x, y, z cnc |
| Battery backup power in wall power outage case | Approved removal of battery as PCB milling times are faster so it is less expected and a less significant issue to lose power in the middle of a job |
Included for reference, not for review as the project could not be completed in this form.
| Req ID | Requirement | Review |
|---|---|---|
| HRS-01 | The CNC router shall use 3 stepper motors to control X, Y, Z axis | N/A |
| HRS-02 | The CNC router shall use 1 DC motor for spindle | N/A |
| HRS-03 | The DC spindle shall be driven with a mosfet driver to allow for PWM speed control | N/A |
| HRS-04 | The system shall have external non-voilatile memory (microSD) of no less than 512MB for storing G-code and current progress (in any pause scenario) | N/A |
| HRS-05 | The CNC router shall be able to engrave FR4 copper boards | N/A |
| HRS-06 | The CNC shall have a milling area of at least 100 by 70mm (most common FR4 board size) | N/A |
| HRS-07 | The CNC should have a milling area of at least 150 by 100mm (some larger boards have this dimention) | N/A |
| HRS-08 | The CNC shall have a veritcal Z axis travel of at least 30mm (length of an engraving bit) | N/A |
| HRS-09 | The CNC shall run off a wall outlet during operation | N/A |
| HRS-10 | The CNC shall operate on 24V DC and draw no more than 10 A | N/A |
| HRS-11 | The system shall use the SAMW25 as the main microcontroller and Wi-Fi communication IC | N/A |
| HRS-12 | The stepper motors shall use encoders for closed loop feedback | N/A |
| HRS-13 | A SAMD21 for each axis shall handle the closed loop control | N/A |
| HRS-14 | Each axis shall have limit switches | N/A |
| HRS-15 | Each axis shall use a leadscrew drive with linear rods for accuracy and rigidity | N/A |
| HRS-16 | The system shall have user buttons on the PCB | N/A |
| HRS-17 | The system shall have status indicator LEDs on the PCB | N/A |
| HRS-18 | The system shall have a power (on/off) switch | N/A |
Included for reference, not for review as the project could not be completed in this form.
| Req ID | Requirement | Review |
|---|---|---|
| SRS-01 | The system shall be able to control all 3 stepper motors in its cyllindrical coordinates | N/A |
| SRS-02 | The MCU in the SAMW25 module shall run an RTOS | N/A |
| SRS-03 | The user shall be able to remotely operate the machine, setting presets, start/pause etc | N/A |
| SRS-04 | The system shall be able to send status updates and job progress to the web portal for the user | N/A |
| SRS-05 | The system shall be able to read and interoperate encoder values as positions | N/A |
| SRS-06 | The system shall be able to automatically pause the job when hitting limit switch | N/A |
| SRS-07 | The system shall be able to perform X/Y zeroing (calibration) with limit switches | N/A |
| SRS-08 | The system shall be able to automatically perform bed level calibration using the contuctive nature of the endmill and copper FR4 board | N/A |
| SRS-09 | The webpage portal shall handle remote uploading of jobs | N/A |
| SRS-10 | The webpage portal shall handle GCode generation from PCB gerber files leveraging existing software (e.g. FlatCAM) | N/A |
| SRS-11 | The webpage portal shall handle GCode to motor instruction conversion | N/A |
| SRS-12 | An OTAFU shall be implemented | N/A |
| SRS-13 | A CLI shall be implemented | N/A |
| SRS-14 | The communication between MCUs shall use I2C (and some gpio) | N/A |
| SRS-15 | The communication between MUC and SD card shall use SPI | N/A |









This is the early diagram that remained mostly ture for throughout the PCB implementation and until the weekend before demo day, when enough critial issues with the PCBA manufacturing was found and isolate to issues outside our control and reworking capability that wee moved to the boat stabilization project.
Bootloader Folder in course repo
Application Folder in course repo
N/A