Hello,
I'm newbie to micropython not to python.
I have ir remote that runs on nodemcu and is written in default c++ type language. However i am confused while translating it to run in micropython..
My question is which library to import for IR remote 8266 ? Im specifically trying to transmit ir.sendRC6( code,24) command.
Any idea?
Library to import for IR remote ESP8266
-
- Posts: 4
- Joined: Wed Feb 05, 2020 7:31 pm
- Location: India
Re: Library to import for IR remote ESP8266
hi,
Sorry I'm not aware of a good option for this right now, hopefully someone else knows more though. It would be really nice to make this work though.
The problem is that there isn't a way to drive a pin at precisely 38kHz from MicroPython. It's not impossible, but it will require some support from the firmware (which hasn't been implemented). Have a look at this thread for more information -- viewtopic.php?f=14&t=2823 There was a note from Peter in a thread I saw here about perhaps using the PWM to generate the 38kHz carrier and a mosfet to modulate it from the TX pin of a UART (assuming the UART supports the correct baud rate).
It might be possible to use the MOSI line of the SPI peripheral (possibly at some multiple of 38kHz) to do this. You'll need a way to generate the encoded RC6 data, but that should be fairly straightforward.
Can you describe which components you're using? I assume it's just a straightforward IR LED (which needs the modulation to be done by the MCU) rather than a module with its own 38kHz carrier generator?
Sorry I'm not aware of a good option for this right now, hopefully someone else knows more though. It would be really nice to make this work though.
The problem is that there isn't a way to drive a pin at precisely 38kHz from MicroPython. It's not impossible, but it will require some support from the firmware (which hasn't been implemented). Have a look at this thread for more information -- viewtopic.php?f=14&t=2823 There was a note from Peter in a thread I saw here about perhaps using the PWM to generate the 38kHz carrier and a mosfet to modulate it from the TX pin of a UART (assuming the UART supports the correct baud rate).
It might be possible to use the MOSI line of the SPI peripheral (possibly at some multiple of 38kHz) to do this. You'll need a way to generate the encoded RC6 data, but that should be fairly straightforward.
Can you describe which components you're using? I assume it's just a straightforward IR LED (which needs the modulation to be done by the MCU) rather than a module with its own 38kHz carrier generator?
-
- Posts: 4
- Joined: Wed Feb 05, 2020 7:31 pm
- Location: India
Re: Library to import for IR remote ESP8266
Hello Jimmo,
Thanks for your response.
Thanks again
Thanks for your response.
I am simply using a esp8266 based nodemcu and digital ir module..and just to explain what i mean here is my c++ implementation poc https://youtu.be/k4pKGrE4Z5o
Thanks again
Re: Library to import for IR remote ESP8266
Can you provide a link to the module?
-
- Posts: 4
- Joined: Wed Feb 05, 2020 7:31 pm
- Location: India
Re: Library to import for IR remote ESP8266
This is the c++ library that i took reffered
https://github.com/crankyoldgit/IRremoteESP8266
Please note i am not the creator of this scripts.
https://github.com/crankyoldgit/IRremoteESP8266
Please note i am not the creator of this scripts.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
IR transmitters
Most IR transmitter modules are just an IR LED. I did find this one on Ebay but there only seems to be a single source in Germany of a Chinese made unit. It looks easy to interface (via a UART) but the single source puts me off supporting it.
I did somewhere suggest using PWM on a Pyboard as a source of stable 38KHz. I don't think a UART could be used to modulate it because of the start and stop bits. My original idea was to generate the pulse train on a pin, which would be easy as it's relatively slow. A simple external gate would drive the IR LED.
On reflection this is surely silly because the PWM duty cycle could be set to 0 or 50% in code. I can feel an experiment coming on.
[EDIT]
See these results.
I did somewhere suggest using PWM on a Pyboard as a source of stable 38KHz. I don't think a UART could be used to modulate it because of the start and stop bits. My original idea was to generate the pulse train on a pin, which would be easy as it's relatively slow. A simple external gate would drive the IR LED.
On reflection this is surely silly because the PWM duty cycle could be set to 0 or 50% in code. I can feel an experiment coming on.
[EDIT]
See these results.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.