Meta Cellular Automata is a simulation application for the ESP32 that implements a customized version of a cellular automata. The project generates composite video output using the ESP_8_BIT_composite library while transmitting and receiving data using ESP-NOW.
- Cellular Automata Simulation:
Evolves a grid (board) of cells using customizable born and survival rules similar to Conway's Game of Life. - Composite Video Output:
Uses the ESP_8_BIT_composite library to display evolving patterns on composite video hardware. - ESP-NOW Communication:
Sends and receives neighborhood data over ESP-NOW for potential multi-device interactions. - Analog Input Controls:
Utilizes four potentiometers (inputs on pins 34, 35, 32, and 33) for controlling simulation parameters such as the center line force and rule configurations.
- Development Board: ESP32DevKit (e.g., esp32doit-devkit-v1).
- Video Output: Hardware compatible with composite video.
- Controls: Four potentiometers connected to the corresponding ADC pins (34, 35, 32, and 33).
- PlatformIO for project management and build.
- Arduino framework for ESP32.
- Relevant libraries:
- ESP_8_BIT_composite
- WiFi and ESP-NOW libraries (included with the Arduino core).
- src/
Contains the main source code:main.cpp: Main application code handling setup, simulation loop, rendering, and ESP-NOW communication.general.hpp: Contains constants, global variables, and helper function declarations.config.hpp: Device-specific configuration, such as MAC addresses for ESP-NOW.neighborhood.hpp: Defines theNeighborhoodclass for managing cell neighborhood data.
- lib/
(Optional) Additional custom libraries. - test/
Unit tests for simulation logic (if applicable).
-
Clone the Repository:
git clone <repository-url> cd meta-ca
-
Configure PlatformIO:
Ensure yourplatformio.iniis configured correctly for your ESP32 board. -
Build the Project:
pio run
-
Upload the Firmware:
pio run --target upload
-
Monitor Serial Output:
Use the PlatformIO Serial Monitor:pio device monitor
-
main.cpp:
Initializes the video output, configures ESP-NOW communication, registers the receive callback (OnDataSideRecv), and handles the simulation loop (rendering, evolving, and center line generation). -
general.hpp:
Contains simulation constants (grid size, cell lifetime, etc.), analog input pin mappings, and global grids used for storing simulation states. -
config.hpp:
Defines the MAC addresses for ESP-NOW communication (currently set for EAST_MAC by default). -
neighborhood.hpp:
Defines theNeighborhoodclass to package and handle neighborhood data dynamically.
- Rules:
Modifyborn_ruleandsurvive_ruleingeneral.hppto experiment with different cellular automata behaviors. - Hardware Pins:
Change analog input pins and cell or pixel dimensions by editinggeneral.hpp. - ESP-NOW Peers:
Uncomment or update additional MAC defines inconfig.hppto enable multi-device networking.
- Compilation Errors:
Ensure your header files use include guards (seegeneral.hppandconfig.hpp) to avoid redefinition errors. - ESP-NOW Issues:
Verify that your ESP32 devices are configured correctly and that the proper MAC addresses are in use.
[Insert your license information here.]
- Thanks to the maintainers of PlatformIO, Arduino-ESP32, and the contributors of the ESP_8_BIT_composite library.