Avatar for CrashingDutchman


Member since Apr 2015 • Last active Oct 2018
  • 8 conversations

Gadget freak

Most recent activity

  • in ESP8266
    Avatar for CrashingDutchman

    Thank you @Gordon!

    Hmmm, maybe this way is over my head then...

    I have an Espruino, so I might try to go that way first but the idea was to build this into an iTead S20 smartswitch so I think that the other options (555 timer or an array with 40khz pulses) would better suit me.

    Any pointers on how to generate such an array or do you have a link to the page where you found the above image @Gordon?

    Much appreciated!

  • in ESP8266
    Avatar for CrashingDutchman

    Thank you for your suggestions @MaBe and @Wilberforce.

    First I tried to fix the pulse times from the receiver to 1 decimal, but that didn't work.

    Next I wanted went the Pronto-way. I found codes for my TV, but run into a problem with the Pronto module:

    >var p=require("pronto")
    WARNING: Module "pronto" not found

    I found the pronto module on the Espruino site and took the function to decode the hex-string and used it to send to to my TV with digitalPulse... To no avail.

    Has anyone ever got this to work with a NodeMCU?

  • in ESP8266
    Avatar for CrashingDutchman

    I have a TSOP31236 connected to a NodeMCU:

    • Ground to NodeMCU Gnd pin
    • VCC to NodeMCU 3.3V pin
    • Data to NodeMCU D1 pin

    I am using the following code to record IR codes from the remote from my TV:

    // https://www.espruino.com/Pico+Infrared
    // Keep somewhere to put the signal times
    var times = [];
    // now watch the input
    setWatch(function(e) {
      // work out how long the pulse was, in milliseconds
      var pulseLen = 1000 * (e.time - e.lastTime);
      // then save it, if it was less than 1 second
      if (pulseLen < 1000)
        times = [];
    }, NodeMCU.D1, {repeat:true});

    I press the Standbye-key on the remote and when I type console.log(times) I see the contents of the times-array:

    [ 2.69600000001, 0.853, 0.48300000003, 0.84700000002, 0.47899999992, 0.40800000010, 0.47899999992, 0.40800000010, 1.36699999995, 1.29399999991, 0.48100000003, 0.406, 0.48100000003, 0.406, 0.48200000003, 0.405, 0.48199999991, 0.40500000011, 0.48300000003, 0.40499999988, 0.48200000003, 0.40499999988, 0.48300000003, 0.40400000011, 0.48299999991, 0.40400000011, 0.48299999991, 0.404, 0.48399999991, 0.404, 0.48300000003, 0.40400000011, 0.92199999983, 0.41000000010, 0.48800000001, 0.84199999992, 0.48400000002, 0.404, 0.48400000002, 83.35299999998, 2.703, 0.84700000002, 0.51, 0.82, 0.48499999991, 0.402, 0.48599999990, 0.40100000012, 1.37300000005, 1.28699999993, 0.48799999990, 0.4, 0.48800000001, 0.39900000001, 0.48800000001, 0.39899999990, 0.47800000004, 0.40900000010, 0.48899999990, 0.39900000001, 0.48800000001, 0.39900000001, 0.48900000001, 0.39799999990, 0.47900000004, 0.40800000010, 0.47899999992, 0.408, 0.48, 0.408, 0.47900000004, 0.40799999987, 0.92900000004, 0.403, 0.48400000002, 0.84700000002, 0.47900000004, 0.40699999988, 0.48 ]

    So, the receiving part seems to work.

    Now from this page I found that you can send the times-array to an IR transmitter led. I have connected an IR led to pin NodeMCU.D2 and NodeMCU ground and use the following command to submit the times-array to my TV:

    pinMode(NodeMCU.D2, "output")

    Nothing seems to happen, at least the TV doesn't switch off or on. When I exchange the IR led with a normal led I see that there are pulses sent out. Any idea what could be wrong or does anyone have working code with Espruino on an ESP8266?

  • in ESP8266
    Avatar for CrashingDutchman

    Ah, you are on a Mac. Not sure how it would work there. I am on Windows.

  • in ESP8266
    Avatar for CrashingDutchman

    After flashing Espruino firmware to my Sonoff you have to disconnect it from power (USB). Then connect again and make a connection to it with Putty (Serial / 115200 bd).

    Re-connect again and now use Espruino.

  • in ESP8266
    Avatar for CrashingDutchman

    I solved it by disconnecting and reconnecting the Sonoff and make a connection with Putty first. Then disconnect and connect again with the Espruino IDE. Make sure your FTDI USB programmer can provide enough current at 3V.

  • in ESP8266
    Avatar for CrashingDutchman

    Are you 100% sure that your connection details (see your 1st code share in your first post) are correct? I understand that what you posted here is mocked up, but check in your actual code.

    I would suggest to try this code (a bit simpler than yours):

    var wifi = require("Wifi");
    wifi.connect("ssid", {password:"password"}, function(){ console.log("connected"); });

    Then wait for "connected" message.

    Also, make sure you do a wifi.save() to make sure that wifi settings are saved for after a power cycle.

  • in ESP8266
    Avatar for CrashingDutchman

    @Wilberforce, he said he could connect with esp-open-rtos, so it would be weird if he would need an antenna now.

    @citizen12123 How are you powering the board? Maybe your power source isn't able to supply enough current?