Skip to content

Provide an emulated Tasmota environment for Berry development outside of ESP devices

License

Notifications You must be signed in to change notification settings

s-hadinger/Tasmota-Berry-emulator

Repository files navigation

Berry Animation Simulator

A browser-based simulator for the Berry Animation Framework, enabling LED strip animation development and testing directly in your web browser without hardware.

🌐 Try It Now

Tasmota_Berry_LED_emulator

Launch the Emulator

No installation required - runs entirely in your browser.

About

This project is part of Tasmota, an open-source firmware for ESP32/ESP8266 devices. Tasmota provides extensive home automation capabilities, including addressable LED strip control through the Berry scripting language.

The Berry Animation Framework introduces a simplified Domain-Specific Language (DSL) for creating LED animations. This simulator compiles the Berry interpreter to WebAssembly, allowing you to develop and test animations in your browser before deploying to hardware.

✨ Features

  • Browser-Based - No hardware required, runs entirely in WebAssembly
  • Real-Time Preview - See your animations on a virtual LED strip
  • DSL Support - Write animations using the simplified animation DSL
  • Berry Support - Full Berry language support for advanced animations
  • Example Library - Browse and run example animations instantly
  • APNG Export - Export animations as animated PNG files for sharing
  • Tasmota UI - Familiar interface matching Tasmota's web UI style

🎬 Animation Examples

Rainbow Wave Fire Effect
Color Pattern Cycling color pattern
Cylon red eye Cylon red eye

πŸš€ Quick Start

Using the Online Simulator

  1. Open the simulator
  2. Select an example from the Animation Library panel
  3. Click "Compile & Run" to see the animation
  4. Modify the code and experiment!

Running Locally

# Clone the repository
git clone https://github.com/s-hadinger/Tasmota-Berry-emulator.git
cd Tasmota-Berry-emulator

# Open in browser (no server required)
open dist/index.html

πŸ“ Writing Animations

The simulator includes a library of example animations - just select one from the Animation Library panel and click "Compile & Run". Here's a sample of what the DSL looks like:

# @desc Smooth color transitions using rich_palette_color with sine interpolation

# define a palette of rainbow colors including white with constant brightness
palette rainbow_with_white = [
  0xFC0000        # Red
  0xFF8000        # Orange
  0xFFFF00        # Yellow
  0x00FF00        # Green
  0x00FFFF        # Cyan
  0x0080FF        # Blue
  0x8000FF        # Violet
  0xCCCCCC        # White
  0xFC0000        # Red - need to add the first color at last position to ensure roll-over
]

# define a color attribute that cycles over time, cycle is 10 seconds
color rainbow_rich_color = rich_palette_color(colors=rainbow_with_white, period=10s, transition_type=SINE)

animation back = solid(color=rainbow_rich_color)

run back

πŸ“š Documentation

Animation Framework

Simulator

External Resources

πŸ› οΈ Building from Source

Prerequisites

  • Emscripten SDK for WebAssembly compilation
  • Make and Clang (recommended) or GCC

Build Commands

# Full build (native + WebAssembly)
./build.sh

# Or build separately:

# Native Berry interpreter
make -C berry-lang clean
make -C berry-lang

# WebAssembly build
source emsdk/emsdk_env.sh
make -C berry-lang clean BUILD_MODE=emsdk
make -C berry-lang BUILD_MODE=emsdk

Running Tests

# Run all tests
./run_all_tests.sh

# Compile all DSL examples
./compile_all_dsl_examples.sh

πŸ“ Project Structure

β”œβ”€β”€ dist/                    # Browser simulator files
β”‚   β”œβ”€β”€ index.html          # Main simulator page
β”‚   β”œβ”€β”€ berry.js            # Berry WASM module
β”‚   └── *.js                # JavaScript modules
β”œβ”€β”€ lib/libesp32/berry_animation/
β”‚   β”œβ”€β”€ src/                # Animation framework source
β”‚   β”œβ”€β”€ anim_examples/      # Example animations
β”‚   β”œβ”€β”€ anim_tutorials/     # Tutorial animations
β”‚   └── docs/               # Framework documentation
β”œβ”€β”€ berry-lang/             # Berry interpreter source
β”œβ”€β”€ tasmota_env/            # Tasmota emulator for local dev
β”œβ”€β”€ docs/                   # Simulator documentation
└── emsdk/                  # Emscripten SDK

🀝 Contributing

Contributions are welcome! This project is part of the Tasmota ecosystem.

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test with the simulator
  5. Submit a pull request

πŸ“„ License

This project is licensed under the GPL-3.0 License - see the LICENSE file for details.

Part of the Tasmota project.

πŸ”— Links


Happy Animating! 🎨✨

About

Provide an emulated Tasmota environment for Berry development outside of ESP devices

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published