/SerialHex2FlipperZeroInfrared

Convert infrared serial interface commands for Flipper Zero 🐬 🧱🤖

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

README

The Python script convert.py can be used to convert infrared serial interface commands (in hexadecimal representation) into a Flipper Zero[1] compatible infrared[2] .ir file.

The script supports sending multiple multibyte messages at once and adds wait times for message replies by default.

Use case: It can be used to convert LEGO MINDSTORMS RCX[3] (the "yellow programmable brick") infrared commands[4] (see LEGO_RCX.json input file).

⚠️ If LEGO MINDSTORMS RCX is a use case for you: the example does not take care of the toggle bit. So sending the IR commands may not always work. You'll need to dive deeper into the internals of the RCX communication protocol. Pull requests are very welcome!

References

[1] Flipper Zero — Portable Multi-tool Device for Geeks

[2] Flipper Zero Blog — Taking over TVs with Flipper Zero Infrared Port

[3] Disclaimer: LEGO and MINDSTORMS are trademarks and copyrights of the LEGO Group of companies which does not sponsor, authorize or endorse this site.

[4] RCX 2.0 Firmware Command Overview / LASM bytecode specification

Dependencies

A Python 3 environment is required.

The script only imports sys and json and therefore shouldn't require any additional packages.

Converter usage

Run converter and print output on stdout:

$ python convert.py LEGO_RCX.json

Run converter and pipe output to IR output file:

$ python convert.py LEGO_RCX.json > LEGO_RCX.ir

Run converter and pipe output to both an IR output file and stdout:

$ python convert.py LEGO_RCX.json | tee LEGO_RCX.ir

For the format of the .json file, inspect LEGO_RCX.json example.

Plot usage

The IR signal plot script additionally requires the Python module matplotlib.

Usage: python3 plot_signal.py <IR_file_name> <IR_signal_name>

Example:

python plot_signal.py LEGO_RCX.ir ABC_STOP
Trying to open file 'LEGO_RCX.ir' and then to plot signal 'ABC_STOP'
Found signal:
  Raw signal name: ABC_STOP
  Raw signal data: 833 417 417 417 417 ...

IR signal plot