NodeMcu Lua wifi(esp8266), how to send a signal through an ir diode? #6339
Replies: 1 comment
-
Posted at 2019-12-23 by user107037 It will be good to get a diagram for connecting an IR diode to a NodeMcu Lua wifi module, as well as an example code for sending a signal. Posted at 2019-12-23 by @allObjects @user107037, I'm not sure if you are at the right spot here. But may be you are. Espruino is not LUA... The example you refer to is for an Espruino PICO: get yourself an https://shop.espruino.com/espruino-pico-unpinned and - of course - an IR diode - and I can tell you it will run within less than 5 minutes following the instructions in the example. Trying to do it with your LUA modules is a bit more work: re-flash it with Espruino Firmware and then adapt the code in the example, and it will most likely work as well. For starters, take a look at http://forum.espruino.com/conversations/311849/ . Other spots on the forum and even on the Espruoino site have more details: https://www.espruino.com/EspruinoESP8266 Posted at 2019-12-23 by user107037 My module is already flashed with espruino firmware. I also connected the ir receiver and read the codes from the TV remote control. The only thing I need is to understand how to connect the IR diode and send a signal to the TV. Posted at 2019-12-23 by user107037 I don’t understand how to adapt the code https://www.espruino.com/Pico+Infrared from the section "Software - Transmitting" to send an infrared signal to TV Posted at 2019-12-23 by user107037 screenshot of code Attachments: Posted at 2019-12-24 by Robin Mon 2019.12.23 I am violating my own choice to only provide assistance with official authentic supported boards @user107037, but as the issue is with an existing code example, and with the spirit of X-Mas upon us, I'll have Santa send through a few observations. It would be cleaner to wrap the L40 points to an invalid pin name, maybe a habit left over from Arduino development? L45 and L55 I believe it is setTimeout rather than setInterval that is required. > 'The only thing I need is to understand how to connect the IR diode' From the image within the link provided in #5 post, the IR transmit diode is across Pins A5 and A6. See the third bulleted point that indicates to connect the shortest leg, the cathode to pin A5 It's current limiter resistor makes use of the internal pullup. > 'I don’t understand how to adapt the code' The separate second Good luck! Have fun and have a Happy Holiday Season!! Posted at 2019-12-24 by user107037 Guys, I am very grateful to you for your help and for the work you have done. I still have problems that I have not found answers from your posts ((.
My module does not have contacts A5, A6. I attach the screenshot with the pinout of my module. Can you tell what pins in my module should I connect an IR diode? Maybe such a connection scheme is suitable? Attachments: Posted at 2019-12-24 by user107037
My module also does not have LED1, BTN(please see the screenshot in post 8). Therefore, I asked the question how to adapt this piece of code to my NodeMcu Lua wifi module (https://aliexpress.ru/item/32408097207.html?spm=a2g0s.9042311.0.0.1ad333ed1mlnaz). Most likely, if possible, then using only this piece of code:
This can only be dealt with after it is clear how to connect the IR diode (post 8) Posted at 2019-12-24 by Robin Tue 2019.12.24
Bravo, it appears success has be achieved with the flash process. Your post is in the correct thread under the correct heading. Maybe others are willing, but for me however; As I pointed out in #7 post @user107037, my choice is to provide assistance gratis to those that support the Espruino community with their purchse of official authentic supported boards. Still, in the spirit of the Holiday season . . . > 'I still have problems that I have not found answers from your posts ((' That statement as indicated, from #5 post, the third bulleted item beneath heading 'Wiring Up' is clear and succinct.
It most likely wouldn't as; The examples and tutorials were written with the intent to further the Espruino community with fair compensation returned with the offical authentic board purchase. @allObjects had the best suggestion in his #3 post above to obtain rapid results.
The link provided there with images has many useable suggestions. I'd pick one with the least amount of supporting components. Also, there is a hardware use case example clearly detailed in the the board purchase link #1 post, although the supporting code snippet appears to be Arduino 'C'. > 'This can only be dealt with after it is clear how to connect the IR diode' My suggestion would be to use a visible LED (color of your choice - and with a current limiter to protect the LED of around 220 ohms until the internal pullup concept is mastered) in place of the IR diode, and use a simple command to illuminate that LED. When satisfied with that task, replace with the IR one. If the circuit still doesn't work, then maybe the IR diode is in backwards, or at worst damamged. The easiest command to toggle a GPIO pin is: along with many in use examples. To assist the others; @user107037 is the struggle with the connectivity and placement of the parts, the understanding of the electrical characteristics of IR diodes and current flow, how to re-write code in 'C' for Arduino using Javascript with Espruino, mastering the commands of the Javascript language or deciphering the datasheet of the microcontroller? Posted at 2019-12-24 by user107037 It is very sad that I spent so much time studying the documentation and writing other espruino libraries for my personal project (smart home system), and now I have to abandon the use of espruino at all because I see no reason to continue without this part ((. Your modules are very expensive, that is, almost comparable in price to raspberry pi which has much wider possibilities.I understand that you do not want to support other modules for free, and I do not blame you, but it is advisable to immediately inform people about this fact so as not to waste not your time on me or other people. I thank you anyway for your help. Thank you. Posted at 2019-12-24 by Robin
and what is the justification for the above statement @user107037? You have successfully flashed a non-supported device, and there hasn't been an indication that Espruino is not running on that, so I'm bewildered by the #11 post. As none of the questions to assist others in helping out here were answered last pp in #10 post, I can only surmise there is a mis-understanding of how the device you have actually works. To confirm, Espruino is running on that device correct? . . . and all the suggestions from #10 post were exhaustively tested to view usage visibly? (doubt it) IMO it is also the Holiday season, and most are spending time with their families. I reached out as I was checking on a post of my own, when this thread showed up. I feel I've gone out of my way assisting with a non supported board, there just hasn't been a response from others that might chose to support an 8266. As the indication is that 'so much time has been spent' then I'm sure you realize the advantages of Espruino Javascript speed to development success and debug ease, in comparrison with other micros. Be a shame to abandon all that effort as the successful use of the current device hasn't been discovered yet. > 'and writing other espruino libraries for my personal project (smart home system)' Again, as code for libraries has been developed, this means full immersion into the workings of the speed and efficiency of Espruino development has been acquired. It seems the issue is with the understanding of how IR tansmissions using modulation is where the understanding effort should be made. Nothing to do with Espruino or the Javascript language as I see it. > ' but it is advisable to immediately inform people about this fact' Done in detail on the web site in several places, here is the first I uncovered: First sentence
Bullet #7
This is the opportunity cost of 'Open Source'. In this case the entire work of others was acquired for free, put in use for a project with unrelated hardware that benefits yourself, and now the expectation is that support should be provided when no contribution is made to the Espruino community? That is akin to test driving a car, not purchasing it, then demanding transportation of that owner somewhere because the vehicle you have invested time and money in, isn't working as needed. ***There ain't no free lunch!*** Posted at 2019-12-24 by @allObjects In the spirit of the season, let's take a look at the issue at hand:
Re 1: Take a look at GPIO Pin BTN LED naming conventions specific to ESP8266. The code is done so smart that when you put the right pins in line 43 and 44 (in your screenshot), you are good to go. Re2: I/O pins of the ESP8266 ESP-12E are the pins of the ESP8266EX chip. According to data sheet - for example, from https://cdn-shop.adafruit.com/product-files/2471/0A-ESP8266__Datasheet__EN_v4.3.pdf under Re3: Described in many places, including the conversation referred to in my first link of this post, ESP8266 Wifi stack has hard requirements of getting control of the CPU every so much ms for number of ms. If someone else - the soft PWM / Espruino / JavaScript execution task is not done within the remaining time (window), ESP8266 panics and does a restart. For that reason, it is always good to have a processor for less time critical high/application level control and a separate processor for time low level - HW oriented things - that have their time critical requirements met in regard of available resources - interrupts, interrupt service times, etc. Try with various pins in that you have available on your ESP8266 ESP12E. This https://randomnerdtutorials.com/esp8266-pinout-reference-gpios/ may help you. I searched for free pins... because many pins require to be at a certain state on power-on and some others are reserved for the operation mode / life cycle control. If you ran out of power, you may add FET transistors to increase transmission power of the IR LED. A quick look at the code runs the IR LED between two pins, one it emits a continuous PWM signal, and with the other it turns it on and off. PS:
ooops... Espruino consists of two parts: The targeted hardware - Espruino boards - and the firmware - Espruino binary... and Espruino (firmware) makes life so ease in the application realm - and that was exactly the motivation why it was created (the major point; others were more computing power - 32 vs 8 bit as Arduino - and with less current power - interrupt driven with sleep and deep sleep vs continuous run as Arduino's main loop. Going bare metal hardware and C - even with nice support, such as Arduino - life is quite different... It is your choice: usually a nut and a bolt have to match and go and together to do what is expected from the concept they implement. Choosing one part and avoiding the other one and then complaining seems to me unfair - or to say the least - unbalanced. It is the community - and the the smart choice of @gfwilliams regarding software/firmware architecture, implementation, and choice of processor - ARM3/4 - that brought it so far that Espruino is available on other than Espruino financing - lit.: @gfwilliams salary paying - hardware...
@user107037, you mentioned all the libraries and other things you developed and that you now have to abandon if ESP8266 does not make it: may be you pay forward in the spirit of open software and hardware as Espruino lives - in sharing in the Espruino forum - so others can enjoy as well as you can enjoy Espruino and the attention you get - for free. Posted at 2019-12-24 by @MaBecker Hi @user107037 take a look at this ESP8266 analog write Posted at 2019-12-24 by @MaBecker @user197937 the chosen title is very confusing, it might be helpful if you change it :) Posted at 2019-12-24 by @allObjects ...is there something like ESP8266 butter?-@MaBecker : German Butter ...with some Espruino Jam on a 'Zopf' - that would be something new and for sure of great taste...! @gfwilliams, sorry, had my fun, like a while ago when I mistyped and it became a meaning of its own... (too bad that cannot remember). PS: Zopf = https://www.youtube.com/watch?v=AOMrlBe-u3U - a perfect language mix... for sure not the origin one... https://www.goodfoodstories.com/swiss-bread/ |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2019-12-23 by user107037
Hello. I have a NodeMcu Lua wifi module(https://aliexpress.ru/item/32408097207.html?spm=a2g0s.9042311.0.0.1ad333ed1mlnaz) + ir diode(https://aliexpress.ru/item/32491780864.html?spm=a2g0s.9042311.0.0.264d33edJE2Wsr). I have successfully read the codes and the TV remote control(http://www.espruino.com/Pico+Infrared). How can I control the IR diode to send a signal to the TV?
Beta Was this translation helpful? Give feedback.
All reactions