back
ProffieOS
Got Pike?
Open-source lightsaber software


What you will need:

Download version 2.6 here

ChangeLog (since 1.312)
  • Initial Proffieboard V2 support
  • Thermal Detonator support
  • lightsaber.ino renamed to ProffieOS.ino
  • New versioning scheme
  • audio fixes
  • accent swings (thanks to sa22c)
  • bgnlock/endlock support (thanks to adays1234)
  • trigger<> function
  • double off bugfix
  • support for NAME/NNNN.WAV filename pattern
  • BatteryLevel function
  • Mix<>
  • better support for RGBW LED stars
  • CH1LED, CH2LED, CH3LED added to leds.h
  • ColorSequence<>
  • Bump<>
  • save program memory by making POV data smaller
  • blade ID bugfix
  • 30-second off bug
  • stripes glitch bugfix
  • negative speed stripes bugfix
  • TeensySaber audio freeze bugfix
  • NULL POINTER bugfix

Features

  • 100% open-source, you may add any feature you like. (GPLv3)
  • Support for WebUSB for configuration through a browser.
  • Thermal Detonator support
  • Support for remote control via bluetooth (with external addon)
  • Speedy 32-bit processor makes advanced features like sound filters, synthesizing and mp3 playback possible.
  • 16-bit digital output (12-bit for TeensySaber V1 and V2)
  • Default sample rate is 44kHz
  • 22kHz and 11kHz samples are supported and upsampled to 44kHz automatically.
  • Gapless playback, with 2.5ms cross-fade when you interrupt one sample to go to another.
  • Polyphonic playback, currently configured for up to 5 simultaneous samples.
  • Support for PL9823 or neopixel strings. (including RGBW)
  • Support for arbitrary 1/2/3/4/5/6-color stars/strings.
  • Supports segmented string blades. (with flash string)
  • Multi-blade support for dual and crossguard setups.
  • Crystal chamber support.
  • Power-level indicator with neopixel blade.
  • OLED PLI display
  • MTP support (drag-n-drop files from windows through USB connection)
  • POV (persistance of vision) mode.
  • Multiple blades. (at the same time)
  • Accent LEDs. (also implemented as additional "blades".)
  • Spoken error messages.
  • Easy software updates.

If you want any other features, contact me on The Rebel Armory or the fx-sabers forum and I'll see what I can do.

Preparations for Proffieboard

  1. Install latest arduino software.
  2. Install the Proffieboard Arduino Plugin
  3. Select Tools->Boards->Proffieboard-STM32L433
  4. Select Tools->DOSFS->SD(SPI)

Preparations for TeensySaber

  1. Install latest arduino software.
  2. Install latest teensyduino software (in same directory)
  3. Go to the Tools menu, select Board: Teensy 3.1/3.2
  4. (optional) Also in the Tools menu, select: USB Type: "MTP Disk (Experimental)"

Note that it's totally ok to install support for both Proffieboard and TeensySabers.

Installing ProffieOS on your board

  1. Download and unzip the teensysaber software from above.
  2. Open up the arduino software, go to file->open and select ProffieOS.ino (Note, that on Windows, ProffieOS.ino might just be called "ProffieOS", as windows will hide the ".ino" part by default.)
  3. Make a config file. Usually, this will be tweaked and re-uploaded many times, but the best way to get started is to go to the V4 or V3 page and use the configuration generator. Go to the config/ directory, make a copy of one of the .h files, then rename the copy to "mysaber_config.h" (or whatever you like), then open up the file in an editor (like notepad) and remove all the lines, then cut-n-paste the stuff from the config generator instead and save it.
  4. In ProffieOS.ino, go to line ~24, and change it to: #define CONFIG_FILE "config/mysaber_config.h" (make sure the other config files are commented out, there should only be one CONFIG_FILE without //)
  5. Hook up the board to your computer with an USB cable
  6. If you have a teensysaber, Power the board with a battery. (You did cut the VIN/VUSB, right?)
  7. Press the arrow button near the top left in the arduino interface, and it will compile and upload the program.
  8. Done, now tweak your config file and re-upload as many times as you like.
If you have a problem, you can contact me on The Rebel Armory or the fx-sabers forum, but there is also lots of online informtation about arduinos and teensys, so some googling probably won't hurt.

How to use it
See the Wiki page.

Configuration
While you can obviously change *anything* in the source, the parts you may need to change depending on how you wired your electronics should all be in the config file. I recommend starting by having the configuration generator on the board page generate a config file for you, but you will probably need to tweak it as you go. Full documentation for all the configuration file options can be found here.

LED configuration
ProffieOS already contains definitions for some popular Cree LEDs, so most of the time, all you need to do is to use the right template and specify the right number of milliohms in the < > after the template. If you use a led that doesn't exist in leds.h different LED, copy one of the led structs into your config file and modify it. You can find more information on the
Wiki page.

LED Color configuration
Most of the time, TeensySaber simply uses RGB colors to run everything, however, if you're using an LED star, things can get a bit more complicated. For instance if you have a Blue-Blue-White LED star, you have two choices for how to configure the driver class. The first choice is something like: SimpleBladePtr<CreeXPE2Blue, CreeXPE2Blue, CreeXPE2White, NoLED>(). This means that when the Style classes tells the blade to be blue, the channel one and two turns on, and when the style class say to make it white, all three channels turn on. This is usually what you want to make the blade flash on impact. With this setup, the style setup becomes simple as well, you just do something like: StyleNormalPtr<BLUE, WHITE, 300, 800>(). However, there is one drawback; if you want to actually use the white LED by itself, there no way to do it. The only way to activate the white LED is for the Style to specify a white color, and that will also activate the blue LEDs. You can find more information on the Wiki page.

Sound Fonts
Once you have the firmware installed, you'll need at least one sound font. Sound fonts are stored on the SD card, just create a subdirectory and put the files from the font in there, and it should work. Most fonts are monophonic, meaning that only one sound is played at a time, but some are polyphonic, meaning that sound effects are played over the basic humm sound of the saber. The teensy saber os supports both types and should be able to figure out what kind it is based on the file names. Here are a few places where you can obtain sound fonts:

Button configuration
By default, TeensySaber is configured to use a touch button for power, while the other buttons use regular momentary switches. There is currently no support for latching switches. If you want to use a momentary switch for the power button, you'll need to change two things.

  1. Find the line that says TouchButton power_; and replace it with Button power_;.
  2. Find the line that says power_(powerButtonPin, 1700, "pow"); and replace it with power_(powerButtonPin, "pow");. (The 1700 is the sensetivity of the touch button, at some point I might calculate the sensetivity automatically, and then this step won't be required anymore.)
Note that you can do the opposite of these two steps to the other buttons if you want to make them into touch buttons.

Sound Effect File Names
A sound font is made up of many sound files, the filename of these files should look something like this:

font1/clash001.wav
The file name is made up of four parts:
  1. The directory - This can be anything you like. All the files belonging to the same font should be in the same directory though. You can put fonts in sub-directories if you like, so it could be something like: fonts/dark/1/hum.wav if you like. The first entry in the preset[] array specifies the directory.
  2. The name - One of a set of pre-defined names specified below.
  3. The number - When playing a sound, TeensySaber will generally pick one of them randomly. The numbers can either be on the form 1,2,3,4,5,6,7,8,9,10,11, etc. or 01, 02, 03, etc. or 001, 002, 003, etc. The number sequence must be consistent and without any gaps. It's also possible to omit the number completely. For looping sounds, TeensySaber will randomly pick one of the numbered files each time it starts over, so it's possible to create a more interesting hum by having "hum.wav", "hum1.waw", "hum2.wav" etc. Note that since we're using an ancient file system, the length of the name and number must not total more than 8 characters. (So you can only have 11 poweron sounds: poweron.wav, poweron0.wav, poweron1.wav....poweron9.wav)
  4. The extension - I recommend using .wav files, 11, 22 and 44khz mono/stero wav files are supported. .raw and .usl files are also supported, but must be 44khz mono.

Sound Effect Names
The name part of the filename needs to be one that TeensySaber can recognize. Sound fonts can either be monophonic (Plecter) or polyphonic (Naigon Electronics) style. In monophonic mode, the following names are recognized:

  • boot - Played when TeensySaber boots up.
  • swing - Played when you move the saber around.
  • hum - Played when you don't move the saber around. (looped)
  • poweron - Played when you turn the saber on.
  • poweroff / pwroff - Played when you turn the saber off.
  • clash - Played when you hit something with the saber.
  • force - Force use sound.
  • stab - Played when you make a stabbing motion. (Not yet implemented)
  • blaster - Played when you press the AUX button.
  • lockup - Lockup, activate by hoding power then trigger a clash. (looped)
  • bgnlock - played when lockup starts
  • endlock - played when lockup ends (if not present, clash is used)
  • poweronf - Force power on (not yet implemented)
  • font - Played when you switch to this font / preset.
Note that in monophinic mode, the end of all sounds (except poweroff) smoothly join up with the beginning of the "hum" sound(s).

In polyphonic mode, the following names are recognized:

  • boot - Played when TeensySaber boots up.
  • swng - Played when you move the saber around.
  • hum - Played when you don't move the saber around. (looped)
  • out - Played when you turn the saber on.
  • in - Played when you turn the saber off.
  • clsh - Played when you hit something with the saber.
  • force - Force use sound.
  • stab - Played when you make a stabbing motion. (Not yet implemented)
  • blst - Played when you press the AUX button.
  • lock - Lockup, activate by hoding power then trigger a clash.
  • bgnlock - played when lockup starts
  • endlock - played when lockup ends (if not present, just fades out)
  • font - Played when you switch to this font / preset.
TeensySaber will automatically decide if a directory contains a monophonic or polyphonic font based on the filenames.

In addition, if the sounds "swingl" and "swingh" are present, the SmoothSwing algorithm will be used to generate swing sounds from these files instead of using "swing" or "swng" files. See below for more details on SmoothSwing algorithms.

Also, if the "drag" sounds are present, they will replace the "lock" / "lockup" sound if you drag the saber tip across the ground.

For thermonal detonator, these effects are used:

  • bgnarm - when the td is arming
  • armhum - when the td is armed (looped)
  • endarm - when the td is disarmed
  • boom - when the td blows up

SmoothSwing V1/V2 configuration
When one or more set of swingl/swingh files are present, TeensySaber will activate the SmoothSwing V1 or V2 algorithms. To decide which one to use, it will read a file called "smoothsw.ini". The full list of variables that can be used in smoothsw.ini can be found on the wiki page.

SmoothSwing V1 - Demo, Thexter's description
Demo, Algorithm explanation, details of how to use it below. Many thanks to Thexter for his excellent work on this algorithm. Smoothswing V1 doesn't actually use any of the variables from the configuration file. The swingl and swingh files are played in a loop. The software will then place a rotating plane through the blade of your saber, and if the saber swings in one direction across the plane, we'll play more of swingl and less of the background hum. If we swing in the other direction, we'll play more of swingh and less of the hum. The fade will never blend swingl and swingh directly, it will essentially cross-fade between the regular hum and one of swingl/swingh based on direction and strength of the swing.

SmoothSwing V2 - Demo, Thexter's description
Smoothswing V2 has some similarties to V1, but is much better at producing natural swing- and spin-like sounds, and also produces more variety than the V1 algorithm. To do this, the swinglNN.wav and swinghNN.wav files are paired up. Whenever a swing is not going on (swing speed < SwingStrengthThreshold) a new pair if selected randomly. As we start swinging, we keep track of how many degrees the saber has swung so far, and at a randomly selected threshold, we start a cross-fade to go from swingl to swingh. The transition lasts for Transition1Degrees, and if the swing continues, we will eventually cross-fade back from swingh to swingl 180 degrees after the first threshold. The second transition is generally wider and is controlled by Transition2Degrees. The combined swing sound is then cross-faded with the regular hum based on the swing strength.

Serial Monitor Commands
You can use the serial monitor to debug and control the software once uploaded, here is an incomplete list of commands:

  • help - prints a list of known commands
  • on - turns the saber on
  • off - turns the saber off
  • blade on - turns the blade on (but leaves the sound off)
  • blade off - turns the blade off
  • clash - trigger a clash effect
  • dir [directory] - list files on sd card
  • cd [directory] - change directory, and sound font
  • play [file] - play wav file
Note that there is a drop-down at the bottom of the serial monitor that defaults to "No Line Feed", you must change it to "Newline" to use the serial monitor with TeensySaber.

Download Older versions

  • 1.8 - pre-alpha version
  • 1.10 - alpha version
  • 1.11 - beta version
  • 1.14 - first recommended version
  • 1.18 - preliminary teensy 3.5/3.6 and TeensySaber V2 support
  • 1.19 - Fixed BUILTIN_SDCARD
  • 1.20 - Fixed hang when reading directories ending in /
  • 1.40 - new LED configuration system, PWM over volt protection, audio bugfixes, improved audio buffering, better help system, multiple touch buttons, code cleanup
  • 1.43 - looped swing sound support
  • 1.45 - MTP, power+clash=previous preset, RAW/USL support
  • 1.60 - POV, V2 motion, APA102/Dotstar (Experimental)
  • 1.86 - multi-blade support
  • 1.89 - blade template system
  • 1.93 - fixed short activation
  • 1.110 - louder, lockup, flicker
  • 1.119 - bugfixes
  • 1.144 - GPLv3, speech, separate configuration files, zero-button sabers, mtp support for serialflash
  • 1.153 - Display/PLI, crossguard
  • 1.157 - TeensySaber V3 support, latching button support
  • 1.164 - blast effect, pulsing blade, drag effect, 16-bit color
  • 1.167 - Support for bluetooth addon.
  • 1.175 - SubBlade, IgnitionDelay, ColorCycle, Makefile, more blades
  • 1.191 - Smoothswing V2, better wav reader, Cylon, reduces clash sensetivity when swinging
  • 1.224 - loop optimizations, split into many files, blade style functions, bugfixes
  • 1.246 - split out more classes, better spoken error messages, serialflash config files
  • 1.247 - bugfixes, INVERT_ORIENTATION
  • 1.264 - initial proffieboard support, StyleFire<>, any orientation, motion disable, WS2811 fixes
  • 1.264 - fixed proffieboard support, bugfixes
  • 1.269 - force command, neopixel fix for profffieboard
  • 1.284 - N-gradient, new Blast, LocalizedClash, Sparkle, BlastFadeout, InOutHelperX, OriginalBlast, separate color for drag, double-click to mute, bugfixes
  • 1.286 - Blinking style, faster motion code, lots of bugfixes
  • 1.291 - SD card access, interchangeable clash/blast/force effects, bugfixes and optimizations
  • 1.305 - motion fixes, hybrid fonts, blade movies, button clash suppression, RandomBlink, Stripes, i2c reset fix, allowDisable fix, hum keeps playing fix
  • 1.312 - WebUSB, presets.ini, RGBW pixels, teensy serial pixels, bugfixes, lower standby power, Sequence<>

Troubleshooting
If you're having problems, check out the troubleshooting page.

Problems? Questions? Suggestions? Check out the The Rebel Armory or fx-sabers online forum.
This page has been accessed 23,092 times since July 29th, 2018.
Last modified: September 8th, 2019 - Design by Monica & Fredrik Hübinette