-
• #2
I'd try specifying a massive Float32Array of bit times to digitalPulse, which includes all 38kHz pulses - it seems like it could work for you? Either that or use an external 38kHz oscillator
-
• #3
hi !
yup, I think it may work ( although I'd have to workout the resulting Float32Array from the signals[] array + 38kHz pulses ) ;)
For the second option, maybe connecting a 555 'd work ? ( but I'd truly prefer the 1st option .. )
As said above, I'll investigate more as I get back home ( where all my uCs are .. )
Nevertheless, thanks for the quick answer ;) -
• #4
Hi there ! :)
Now back, I was glad to receive 2 Espruino WiFI boards :D ( @Gordon #keepUpTheGoodWork #supportingEspruino ;P )
While I didn't have time yet to test my code on the Espruino Wifi or try the external oscillator way, I did a quick visual recap of the idea ( feel free to correct me if I'm wrong - I really may be so :/ .. ) - the attached .pdf file.
On that a question: when setting a pin to oscillate, it jump-starts HIGH, right ?
( since the logic - if I'm not false - is: "when oscillating pin goes LOW & signal pin is HIGH, IR LED is lit", I try that guess using "visual cues" ;) ( .. ) )If so, then I'll only have to write code that actually mixes some signal[] to some passed freq of oscillation & return the "mixed" signal ( I guess it'd be better to pre-process the existing one instead of doing so "on the fly" ( .. ) ), then test it out :)
I plan to test out the aboves in few days & really hope the esp8266-emitted signals 'll do the trick, but now that I have the said Espruino WiFi, I'd really consider pushing the project further, adding*:
- accel/gyro/mag detection ( LSM9DS0 9-DOF )
- ble support ( HC-05 )
- rgb LED ==> to be added anyway ;)
& maybe opening up the actual tv support to directly interface with its motors ? => 'de be GREAT ( to learn stuff as well as to bypass some limitations of the "available range of positions" to which the tv can be set to ( .. ) )
Last but not least, if the signals can be sent correctly for the esp8266 while its also handling changing the rgb led colors & the WiFi stuff, I still have to figure out where the troubles came from in my "quick svg ui" for the tv support ( I'll post that as well as an updated version soon ;) ), but I guess this should be the least of the troubles ..
This being said, whishing any reader a very nice day :)
*I guess now I'll also have to try interfacing these with the WeMos D1 as well as do so on the Espruino WiFi ( .. ) ;p
2 Attachments
- accel/gyro/mag detection ( LSM9DS0 9-DOF )
-
• #5
little update:
as an cheap alternative to transmitting the actual IR signals, it seems I can use the learn mode to learn other IR signals ( if those are both supported & long enough - like holding a btn on an actual remote until hearing a buzzing sound as confirmation that some IR signal was learned successfully ): after some quick tries, it doesn't seem to be working all the time ( more like 33% ), even using a code that used to work ( one sniffed from the device, not one learned )
since the IR signals can be learned, I suppose it'd be a good idea to look for custom IR signals that could be easily transmitted from whatever board ( I plan to test on original Espruino, Pico, EspruinoWiFi, & esp8266 esp-01, esp-12 & Wemos D1 Mini Pro ), although it 'd be awesome to easily support the actual signals of some device :)
I gotta digg the following link to experiment with the signals I already have & custom ones - any hint welcome ;) https://internetofhomethings.com/homethings/?p=899
on a related subject, it seems someone has ported /is porting Ken Shirriff's IR remote lib for the esp8266 https://github.com/markszabo/IRremoteESP8266
Aside from this, it seems I have troubles with an EspruinoWiFi: "NetworkJS" & 'http' modules not found ? ( though, it seems it can connect but I can't for ex call 'wifi.getIP()' for some reason :/ ).
The WeMos is ok ( wifi & hosting the UI ) but doesn't yet support sending IR signals, so pretty much useless for now .. ( .I didn't try again using the original Espruino board + esp8266 esp-01 for WiFi, I'll do & hope it works on 1st try ;p )Last but not least, I also have to check if the IR signals learnt can be / are reset when plugging off the tv support power supply ( .. )
On the html/UI side, the code used 'll be published on the github repo later tonight, & I also plan to try using some jsonp to get an html page bigger than can be hosted as is on the Espruino ( nb: my 1st try on the WeMos ran out of memory :/ .. ) - I'll be posting the logic here as well
"onto the next update " ..
-
• #6
back
Nb: other point, but I think my above drawing is completely wrong ( .. )
'this being said",From what I could read, 38kHz is a far reach for the esp8266, if its said max is actually 100Hz ( & I'm not talking about code taking too much time to exec & disrupting the WiFi part .. )
From the post linked above, it seems using 'gpio_write(pin, 1)' & 'os_delay_us(13)' for HIGH & then for LOW could do the trick on the esp8266 platform - maybe as a tiny module or tweak to the build ?I'm also wondering which of the following could best suit the need ( & work as intended, if working at all, on most of the platforms .. ):
// way A var arr38kHz = [0.013,0.013,0.013,0.013, ..]; // huuge array ? function sendSig(sigArr){ digitalPulse(irLed_anodePin, 1, arr38kHz); // start 38kHz digitalPulse(irLed_cathodePin, 1, sigArr); // send signal digitalPulse(irLed_cathodePin, 1, 0); // wait until signal finished before further code execution digitalRead(irLed_anodePin); // stop 38kHz // or digitalWrite(irLed_anodePin, 0); // if I'm not wrong ;) // or digitalPulse(irLed_anodePin, 0, 0); // as well as above ;) } // way B var interval function sendSig(sigArr){ interval = setInterval(function(){ digitalPulse(irLed_anodePin, 1, 0.013); digitalPulse(irLed_anodePin, 0, 0.013); }, 0.026); // start 38kHz digitalPulse(irLed_cathodePin, 1, sigArr); // send signal digitalPulse(irLed_cathodePin, 1, 0); // wait until signal finished before further code execution clearInterval(interval); // stop 38kHz digitalRead(irLed_anodePin); // make sure it's off } // way C var signal = [.., ..]; for(var i=0; i< signal.length; i++){ if( i.isEven() ){ // we need a HIGH digitalWrite(irLed_cathodePin, 1); for(var j=0; j < signal[i]/2; j++){ digitalPulse(irLed_anodePin, 1, 0.013); digitalPulse(irLed_anodePin, 0, 0.013); } } else { // we need a LOW digitalPulse(irLed_cathodePin, 0, signal[i]); // stay Low for a while /* or, but not mandatory since we're LOW anyway ? digitalWrite(irLed_cathodePin, 0); for(var j=0; j < signal[i]/2; j++){ digitalPulse(irLed_anodePin, 1, 0.013); digitalPulse(irLed_anodePin, 0, 0.013); } */ } } // way D - using only one leg of the IR LED & the other to Gnd ? var signal = [.., ..]; for(var i=0; i< signal.length; i++){ if( i.isEven() ){ // we need a HIGH for(var j=0; j < signal[i]/2; j++){ digitalPulse(irLed_cathodePin, 1, 0.013); digitalPulse(irLed_cathodePin, 0, 0.013); } } else { // we need a LOW digitalPulse(irLed_cathodePin, 0, signal[i]); // stay Low for a while } }
I'll test as soon as I can, but sadly I'm surely not as confident in tweaking the esp build or writing a quick module for it for now :/ ..
-
• #7
Hi, What is test result? I'm also trying to do IR transmit on ESP8266 recently.
-
• #8
Hi stephaneAG and Gordon!
I've became very interested in both of your approaches. I've studied a little about IR Transmission and found those great resources:
http://www.ece.ucsb.edu/Faculty/rodwell/Classes/ece2c/labs/Lab4_2C_2009.pdf
http://www.ti.com/lit/an/slaa644b/slaa644b.pdf
http://www.remotecentral.com/features/irdisp3.htm
http://forum.espruino.com/conversations/297428/
I don't know how, yet, but I've managed to output 38kHz wave using
analogWrite(D13, 1, {freq: 38000});
on my Wemos D1 Mini.
Using the IRReceiver module, I could even see the binary data printed on the console terminal.
I was wondering if it's possible to implement only one port to create an IR transmitter. I've already soldered a prototype PCB with a TIP 122 and 4 IR LEDs in parallel (nothing serious, that I can't add another transistor later), but for the sake of the high optimization (I intend to get better each day with Javascript), I will continue with the quest of only using one uC port.
By reading those resources above, I found that the IR Transmission protocol that I'm implementing (or trying to do reverse engineering...) uses ASK Modulation, by the variation of the "on" pulse width to differentiate between zeros and ones.
So, a "ON" signal must have 48x 38kHz pulses and 24x off pulses (which I can just extend the 48º time length to cover that area, saving array space) and an "OFF" signal must have 24x 38kHz pulses and another 24x off pulses (which again I can extend the time duration of the 24º pulse, so I can save space on the array)
I've tried to do this, but got "Out of memory" limitations. I'll try to use your examples here to try to create an array "on the go" or iterate through lots of "digitalPulse" calls, in a for loop, so I don't need to use arrays.
Thanks a lot for your colaboration!
EDIT: Finished paragraph.
EDIT2: Changed the mistyped "380000" to "38000" in code snippet.
-
• #9
See here
-
• #10
Hi Wilberforce! Thanks for the reply!
I've saw this tutorial, and I have the setup for using 2 pins, but I ask if it's possible to do the IR Transmission by using just one pin (discarding the carrier part of 38kHz, and just outputting the signal, in the 38kHz frequency, but for the time required to represent the 0's and 1's).
If it's impossible (due to the event loop and timing approach), I'll switch to the approach on the link that you shared, using two GPIOs and two transistors.
-
• #11
Hi there !
If it helps on this topic & while what I'm about ot say is a little aside, I had success on another project sniffing what was received on the IR receiver pin & then controlling that pin using a NPN or PNP transistor ( can't remember if the IR receiver rested HIGH & the signal was inverted or not ).
I did the above helped with lirc on a rpi & after learning how to configure its mess ( ^^ ), I had something wroking nicely ( actually controlling an LCD board .. )I plan on trying to do so in the coming weeks & as usual 'll post back updates on thee :)
Hi
I plan to control my tv support using WiFi, and was hoping to make it work on a WeMos D1 Mini Pro ESP8266 board.
Tests were initially done using the original Espruino board, which was capable of receiving & transmitting IR codes from & to the tv support.
The wip esp8266 code used for transmitting is available at the following URL:
https://github.com/stephaneAG/Espruino_tests/blob/master/tvSupportRemote/WemosD1MiniPro_tvSupportRemote.js
Now, after digging stuff ( and while I'm still digging .. ), it seems IR transmitting is not as quick as I hoped on the ESP8266 (my code currently uses 'analogWrite()' & 'digitalPulse', as in the official IR receive & send tutorials ) ..
Currently not at home ( :( .. ), I can't quite improve/test stuff out, but I'm posting here anyway, hoping it may help others in finding a way to bypass the involved limitations :)
Regarding this, the following post(s) may be of interest:
http://forum.espruino.com/conversations/291741/#comment13494747
This being said, wishing yall a very nice day :)
( I'll come back as soon as I can try stuff out ;p )
+