Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IR transmit and receive #160

Open
mehrdadfeller opened this issue Aug 16, 2024 · 1 comment
Open

IR transmit and receive #160

mehrdadfeller opened this issue Aug 16, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@mehrdadfeller
Copy link
Collaborator

Ubo Pod comes with hardware support for sending and receiving Infra Red commands. Pod has 4 IR LEDs that blast IR light at 4 different directions. It also comes with one front IR receiver.

The receiver and transmitters are connected directly to RPi GPIO pins. You need to make sure confix.txt includes the following pin assignments:

# Uncomment this to enable infrared communication.
dtoverlay=gpio-ir,gpio_pin=24
dtoverlay=gpio-ir-tx,gpio_pin=23

The code below is from hardware acceptance test which uses ir-ctl system utility to transmit IR codes and and ir-keytable to receive and decode IR signal:

To transmit:

sudo ir-ctl -S sony12:0x10015

To receive:

sudo stdbuf -i0 -o0 -e0 ir-keytable -c -p all -t -s ' + dev + ' > test_ir_codes.txt
where stdbuf is used to limit the size of buffer and ensure the received signal always gets written to output file. dev is the device ID.

https://github.com/ubopod/ubo-hw-acceptance/blob/main/tests/hw_acceptance/test_ir.py

UX

For starters, I propose the following UX:

A menu item with name Infra Red under settings (maybe we can move it somewhere else later).

When entering the menu item, we present user with two options:

  • Record
  • Replay

When user select Record, we present him with instructions to press a button on the remote control. We wait on that screen for incoming remote codes. We can ask the user press the button a few times and increment a counter on that page. Once user presses button for example 5 times, we show a success message and return back to previous page where show record/replay options. This is usually done to ensure the received code is not corrupted by noise.

Now if the user enter replay option, he is presented with a list of pre-recorded options (we can for now just name them record 1, 2, 3). Once he selects one of them, we replay the code.

Things to improve:

  1. giving each code a name
  2. allowing user to play the remote code by dispatching a action to the bus

We can do a quick demo of this with LED strips that have IR remote.

@mehrdadfeller mehrdadfeller added the enhancement New feature or request label Aug 16, 2024
@mehrdadfeller
Copy link
Collaborator Author

@nubcore did cool some cool stuff with PIIR but it turned out that there's a conflict with audio. Can recall the exact root cause but it had something to do with PWM pin-outs being limited and there was a conflict there with audio.

https://github.com/ubopod/ubo-hal/blob/main/ir/keytable/receive_wd.py
https://github.com/ubopod/ubo-hal/tree/main/ir/PiIR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: No status
Development

No branches or pull requests

2 participants