A collection of code used to control the UVic Rocketry's Filament Winding Machine.
A short montage showcasing the machine, filament winds produced, and some trial runs with various winding patterns.
Prior to winding:
- A suitable microcontroller must be chosen
- The filament winders low and high voltage systems must be wired correctly
- The software must be uploaded to the microcontroller
Any board which Arduino complies for and meets the following requirements can be used:
- At least 8MHz clock speed
- At least 13 digital I/O pins
An Arudino Mega 2560 has worked previously.
The filament winder contains both high and low voltage systems. Please refer to the electrical architecture diagram for the following discussion. Below the procedure for ensuring both system are correctly wired is illustrated.
The high voltage system consists of the power supply, stepper motors, and high voltage end-points on the stepper drivers. These are the devices connected by red lines in the architecture diagram. Consult the stepper driver wiring diagram for wiring connections. The high voltage system should be enabled/disabled via a breaker switch between the power supply and the AC wall outlet.
The low voltage system consists of the microcontroller, switch debounce circuits (SDC), switches, and low voltage end-points on the stepper drivers. These are the devices connected by black lines in the architecture diagram. It is worth mentioning here that SDCs must be used with all switches to provide physical debouncing. This solution was chosen over software debouncing to simplify the software. Each SDC must be wired according to the diagram here.
To wire the low voltage system, all of the switches and drivers must be connected to the Arduino as shown in the architecture diagram. It is important that the devices are wired into the correct GPIO pin of the Arduino as defined in main/include/Config.h
under I/O PINS.
For troubleshooting electrical connections, it is recommended to check the stepper driver and power supply terminals first, as these can come lose over time.
This software has been designed to run with Arduino.
- Install Arduino
- Clone this repo
git clone https://github.com/isaaccormack/fw_controls.git
- Open
fw_controls/main/main.ino
in the Arduino IDE - Plug the Arduino into the computer
- Select the board being used under
Tools/Board: {$board}
- Select the port connecting to the board under
Tools/Port: {$port}
- Upload the code!
Between winds, calibratible parameters such as the wrap angle and mandrel radius can be changed in main/include/Config.h
. Once the changes are saved, they can be uploaded to the board.
Although the Arduino IDE is sufficient for building and uploading, using VS Code with Microsoft's Arduino Extension is recommended for developing.
To do this:
- Install VS Code
- Install the Microsoft VS Code Arduino Extension ^v0.3.0
- Configure the extension in VS Code. This Medium article is really helpful to get your feet on the ground. You may also need to configure:
a.Arduino: Path
An error which states "Cannot find Arduino IDE" may arise. In this case, under VS Code settings, navigate toExtensions/Arduino configurations
and enter the path where Arduino has been downloaded underArduino: Path
, on Mac this was/Users/{$username}/Downloads
- Select the board and port being used by clicking the
<Board Type>
and<Serial Port>
buttons in the blue control bar at the bottom of the editor - Navigate to
main/main.ino
and click on the button labeledArduino: Upload
in the top-right corner
To perform a 2 axis filament wind, upload main/main.ino
to the controller. Common calibratible parameters changed on a wind-by-wind basis such as wrap angle and mandrel radius can be modified in config.h
. Constants such as I/O pins and phsyical parameters can also be changed there.
Various unit and system tests are provided as regression tests to validate changes made to the software over time. These tests also serve to validate the configuration of the physical machine after any modifications have been made. The tests found in tests/
must be run manually due to the physical nature of the testing. For each test these is a write up giving backgound information, expected results and last executed results along with the accompanying test code. These tests cover basic functionality such as positional and velocity control of motors, basic switch sanity and more. System tests can be found in tests/system_tests/
. Theses tests validate main.ino
by successively testing functionality with greater dependencies until all major components of the system are covered by tests.