Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/maehw/SerialHex2FlipperZeroInfrared

Convert infrared serial interface commands for Flipper Zero 🐬 🧱🤖
https://github.com/maehw/SerialHex2FlipperZeroInfrared

flipper-zero flipperzero infrared infrared-encoder lego lego-mindstorms mindstorms mindstorms-rcx rcx serial-communication

Last synced: about 1 month ago
JSON representation

Convert infrared serial interface commands for Flipper Zero 🐬 🧱🤖

Awesome Lists containing this project

README

        

# 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).

> :warning: 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](https://flipperzero.one/)

[2] [Flipper Zero Blog — Taking over TVs with Flipper Zero Infrared Port](https://blog.flipperzero.one/infrared/)

[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](https://www.inf.ed.ac.uk/teaching/courses/sdp/lego/LASM_Bytecodes.pdf)

## 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
```

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](./IR_signal_plot.png)