Firmware for the DWE OS Sync Board, an Arduino Uno–based board that outputs a PWM signal with a floating-point frequency. You set the frequency and duty cycle over USB serial.
The sketch is in dweos_arduino/. This repository is also the PWM library the sketch uses. For the original library documentation and credits, see README-PWM-library.md.
Everything below runs from a terminal using arduino-cli. The Arduino IDE isn't needed.
- A USBtiny ISP programmer with a TC2030-IDC (Tag-Connect) cable. You only need this to burn the bootloader.
- A USB cable for the Sync Board (it connects through an FTDI USB-serial chip).
git
git clone https://github.com/DeepWaterExploration/ArduinoPWM.gitcd ArduinoPWMRun all the commands below from inside this folder.
If you are on Ubuntu, automated scripts handle setup, bootloader burning, and flashing with automatic hardware detection:
# 1. Install dependencies, udev rules, and AVR core
./setup.sh
# Option A: One-step full flash (burns bootloader + flashes sketch)
# Connect both USBtiny and Sync Board USB; fails immediately if either is missing:
./flash-all.sh
# Option B: Individual step-by-step scripts
./flash-bootloader.sh # Autodetects USBtiny / 1781:0c9f and burns bootloader
./flash-program.sh # Autodetects Sync Board FTDI / 0403:6001 and flashes sketch
# Open serial monitor (autodetects port, no flashing):
./flash-program.sh -monitor
# or:
./monitor.shThe sections below explain the manual process and instructions for other platforms (macOS, Windows).
brew install arduino-clicurl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=$HOME/.local/bin shMake sure ~/.local/bin is on your PATH.
Give your user access to serial ports, then log out and back in:
sudo usermod -aG dialout $USERLet your user access the USBtiny without sudo:
echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="1781", ATTR{idProduct}=="0c9f", MODE="0666"' | sudo tee /etc/udev/rules.d/99-usbtiny.rulessudo udevadm control --reload-rules && sudo udevadm triggerwinget install ArduinoSA.CLIThen close and reopen PowerShell so arduino-cli is on your PATH.
The USBtiny needs a USB driver on Windows. Plug it in, run Zadig, select the USBtiny, and install the libusb-win32 driver. The Sync Board's FTDI driver normally installs automatically through Windows Update.
arduino-cli core update-indexarduino-cli core install arduino:avrYou only need to do this on a new board, or if the bootloader has been erased. It also erases any sketch on the board.
The USBtiny is found over USB automatically, so you don't need a port for it. If you want to confirm the computer sees it:
| Platform | Command |
|---|---|
| macOS | system_profiler SPUSBDataType | grep -i -A3 usbtiny |
| Linux | lsusb | grep 1781:0c9f |
| Windows | Get-PnpDevice -PresentOnly | Where-Object InstanceId -match 'VID_1781' |
- Plug the TC2030-IDC cable into the USBtiny.
- Press the pogo head onto the Sync Board's TC2030 pads, with the red stripe on pin 1.
- If the Sync Board is also powered over its own USB, remove the USBtiny's power jumper.
- Hold the pogo head steady and run:
arduino-cli burn-bootloader -b arduino:avr:uno -P usbtinyispIt prints nothing if it succeeds. If it fails with initialization failed or a signature error, re-seat the pogo head and run it again.
Unplug the USBtiny, then connect the Sync Board over USB.
arduino-cli board listThe Sync Board is listed as Serial Port (USB) with board name Unknown. Its port looks like this:
| Platform | Port |
|---|---|
| macOS | /dev/cu.usbserial-XXXXXXXX |
| Linux | /dev/ttyUSB0 |
| Windows | COM3 (any COM number) |
Replace <PORT> with the Sync Board's port:
arduino-cli compile --upload -b arduino:avr:uno -p <PORT> --library . dweos_arduinoIt prints the sketch size and nothing else if it succeeds.
Don't flash the sketch through the USBtiny (
-P usbtinyispon an upload, or "Upload Using Programmer" in the IDE). That erases the bootloader, and you'd have to burn it again.
arduino-cli monitor -p <PORT> -c baudrate=9600You should see PWM frequency and initial duty cycle set. (it may print twice when the monitor connects). The board starts at 60 Hz and about 50% duty cycle.
Send frequency,duty and press Enter. For example, 60,50:
Set frequency to: 60.00 Hz, duty cycle to: 50%
Frequency is in Hz, between 1 and 2,000,000, and can have decimals. Duty cycle is a whole-number percentage from 0 to 100. Press Ctrl+C to exit the monitor.