Github repo with extensions examples

Today I’ve updated the repository on github https://github.com/sker65/tiltaudio-extensions that contains some examples, how TILT!Audio board can be extended by adding addtional hardware / mods for your game.

The principle is always the same:

  • take an arduino mini pro
  • program it with some little sketch
  • connect i2c bus from tiltaudio board to extension
  • write some support library in lua for your convenience

With the examples provided you can control:

  1. Arbitrary GPIO and also PWM
  2. Shaker with motor controller like https://www.aliexpress.com/item/32914093516.html
  3. RGB led lights as speaker lights or rgb gi replacement
  4. Servo for addtional moveable toys on the playfield.

See my youtube channelĀ for some examples.

I was also looking for a printable case for the arduino mini pro. I found one on adafruit website, that fit my needs (with minor modifications): https://www.tinkercad.com/things/0bF8IWiFE6x-arduino-mini-pro-case

So keep modding and send me your achievements.

TILT!Audio controls rgb led rings

With the new lua scripting support you can do “magic things” like control rgb led rings with the sound your machine is playing. Don’t believe it, just watch the video:

How does it work?

There’s 5 pieces you need to plug together:

  1. An arduino mini pro (5V 16Mhz) that controls the leds rings.
  2. Some leds rings (or other 2812 based rgb led strips from alibaba.com)
  3. TILT!Audio board 2.5f or newer that exposes the i2c bus.
  4. init.lua script on the tilt audio sd card for some convinience
  5. Arduino sketch to control the leds.

The sketch and the lua snippet can be found on github: https://github.com/sker65/tiltaudio-extensions

In order to program the arduino mini you need an FTDI usb to serial adapter (best is switchable between 3V3 and 5V). Arduino IDE to compile should be easy to manage, just ask goole there’s a lot of tutorials about that.

Then connect the led rings data pin is pin 4 (but this is configurable in the sketch).

Finally connect the i2c wires SDA, SLC (its a4/a5 on the arduino mini) plus GND and 5V from TILT!Audio board to the Arduino and you ready to play.

Be careful with the power consumption of the leds in my example its already 32 leds with 32*3*20mA = 1,9A when all are bright white. This would of course be already to much for the 5V output on the TILT!Audio board.

So if you add extra light in your pinball game, also add an extra power supply.

New firmware 1.29 with lua scripting

The new version of TILT!Audio firmware features better support for altsound sound packs and lua scripting support.

What is lua scripting?

In previous version there were already some command attached to a sound effect, either to control an attached shaker or the new port extender starting with 1.28 to control up to 16 additional GPIO ports directly with the TILT!Audio board.

Now lua scripting takes this to the next level. A command attached to a sound effect is per default simply passed to a lua script interpreter (see https://www.lua.org/). Lua script is a super easy to learn script language that lets you “program” what should happen when a certain sound effect gets played.

So everything you can do with special commands (control shaker, control GPIO, control serial media server, control various i2c devices e.g. ProMiniExtender) you can now also do with lua functions. Addtionally you can play additional sound effects or change volume all controlled by your lua script.

In order to make this work, TILT!Audio loads a lua script at startup (init.lua) that is located at the root directory of your sound pack, where you define all functions your going to use with your sound effects.

Example

Lets make an example:

Now in the webUI choose the sound effect that should trigger the shaking …

As you can see the shakeOnMultiball checks which background music is playing and activates the shaker only if a certain music is playing. But this is just an example.

From lua you also can control custom sound playback:

Example: use a dummy sound file that actually contains only a second silence, but triggers a lua function:

In this example we use addtional sound effect ids 1000-1004 and 1010 that the game normally don’t use (choose an arbitray high number). We create a matching row in altsound.csv (or directory in classic dir structure) and put the WAV files there.

The we call the lua functions like shown above and we will hear a random sound with the first function while the drain ball counter is increased. If playLooser sound triggers we play a “looser” sound if the was to many drained balls.

Of course this example requires the game to send the right trigger sounds when ball passes e.g. the outlane.

Tutorial video

I recorded a short video to demonstrate, what you can do with lua scripting. This will also be shown with light controller in my MSF later this month.

Tutorial video for lua scripting

Lua reference (all TILT!Audio lua functions and variables) can be found here.