danielweidman / pixmob-ir-reverse-engineering

Hacking the PixMob infrared (and now also RF!) protocol to enable control of PixMob wristbands at home.
MIT License
594 stars 42 forks source link

RPi IR sending #38

Closed settwi closed 4 months ago

settwi commented 1 year ago

Heya,

I'm trying to get some transmitting code up and running using the hardware PWM on an RPi Zero W for these Pixmob bracelets.

I've seen some stuff online for IR control using the lirc library, but the issue with this library is it requires you to press buttons to register the corresponding "remote."

I think an easier and more customizable way to do this would be to just use the bcm2835 PWM API directly. You can set a 38 kHz frequency and then "bit-bang" the delays corresponding to 1's and 0's specified in the Pixmob communication protocol that you all have been decoding.

I'm imagining I can just take the binary codes that you send to the Arduino serial port and send em off using the PWM idea once the delays are properly incorporated. I'll try to make a simple C program that you could call from subprocess in Python, or maybe just make a Python/C bridge so you don't need to use subprocess.

This is in its infancy but I wanted to just put some info up here and get y'alls thoughts on this.

Thanks! best William

settwi commented 1 year ago

~~One thing I'm trying to figure out is the "clock divider" that we need to set in order to get a 38 kHz square wave for PWM. I think we can interpolate a function based on the given divisors to figure that out.~~

edit: the equation is simple: d = 19200 / f(kHz). so to get a 38 kHz signal, d = 19200 / 38 = 505.

settwi commented 12 months ago

@sean1983 or @danielweidman could you try out this repo i've been working on (using a Raspberry Pi) and see if you can get some bracelets working? i think the ones i have from a Taylor Swift concert are programmed to deactivate.

https://github.com/settwi/infrared-kernel-blaster

The repo is only compatible with the BCM2835 chip...

You have to make the kernel module and then do make test to insert it into the kernel. Then you can echo aabfccedff12345 > /dev/blaster where that string after echo is the hex code of the command to send.

Connect the LED driver circuit to GPIO pin 12.

You might have to install the RPi kernel headers for this to work... I will update the readme soon.

Best WS

danielweidman commented 11 months ago

Hello! Sorry for the very late response. I'm travelling for a couple weeks, but could totally try this once I'm back!

avolk201 commented 4 months ago

@settwi I know it's been a while since you posted this, but what did you mean by "i think the ones i have from a Taylor Swift concert are programmed to deactivate." Do they not flash after the fact? Or are they just uncontrollable? I'm thinking about attempting this once some components arrive tomorrow but I only have the ones from the Eras Tour.

settwi commented 4 months ago

It was user error on my part. Code works!