Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    RMT, receiving is working fine however transmitting seems to fail

    Scheduled Pinned Locked Moved WiPy 2&3
    wipy 2.0rmtinfrared
    1 Posts 1 Posters 252 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B Offline
      bnjroos
      last edited by

      Hello,

      I have been playing around with an IR receiver and an IR transmitter, I have no issue recording the signal from my AC remote (Panasonic) however when I try to transmit I seems to be erratic and not transmitting everything.
      I am using two WiPy, one to receive and one to transmit.

      To receive/record:

      import machine
      import time
      # create a RMT object
      rmt = machine.RMT(channel=4)
      # Configure RTM for receiving
      rmt.init(gpio="P21", rx_idle_threshold=12000)     
      # wait for any number of pulses until one longer than rx_idle_threshold
      while True:        
          data = rmt.pulses_get()
          print('length:%s' % (len(data)))
          print(data)
      

      From the remote the output is as followed:

      length:128
      ((0, 3458), (1, 1769), (0, 397), (1, 500), (0, 366), (1, 1340), (0, 419), (1, 475), (0, 394), (1, 472), (0, 393), (1, 475), (0, 367), (1, 498), (0, 367), (1, 500), (0, 367), (1, 501), (0, 367), (1, 500), (0, 394), (1, 472), (0, 397), (1, 472), (0, 392), (1, 500), (0, 368), (1, 499), (0, 398), (1, 1307), (0, 397), (1, 498), (0, 367), (1, 476), (0, 391), (1, 500), (0, 368), (1, 499), (0, 396), (1, 448), (0, 415), (1, 475), (0, 367), (1, 499), (0, 366), (1, 1340), (0, 420), (1, 1316), (0, 420), (1, 1313), (0, 392), (1, 501), (0, 422), (1, 472), (0, 392), (1, 1315), (0, 394), (1, 500), (0, 366), (1, 500), (0, 368), (1, 499), (0, 368),
      (1, 499), (0, 395), (1, 449), (0, 391), (1, 499), (0, 367), (1, 500), (0, 367), (1, 476), (0, 391), (1, 500), (0, 392), (1, 475), (0, 391), (1, 475), (0, 367), (1, 499), (0, 368), (1, 499), (0, 424), (1, 470), (0, 368), (1, 499), (0, 368), (1, 499), (0, 368), (1, 499), (0, 366), (1, 501), (0, 367), (1, 500), (0, 395), (1, 472), (0, 368), (1, 498), (0, 368), (1, 499), (0, 368), (1, 499), (0, 390), (1, 478), (0, 392), (1, 474), (0, 395), (1, 472), (0, 393), (1, 473), (0, 396), (1, 472), (0, 419), (1, 475), (0, 396), (1, 470), (0, 394), (1, 1312), (0, 396), (1, 1338), (0, 422), (1, 472), (0, 390), (1, 478), (0, 392), (1, 474), (0, 394), (1, 472))
      

      If i try to send this code using an IR led from another WiPy with the following code:

      from machine import RMT
      import time
      
      record = ((0, 3458), (1, 1769), (0, 397), (1, 500), (0, 366), (1, 1340), (0, 419), (1, 475), (0, 394), (1, 472), (0, 393), (1, 475), (0, 367), (1, 498), (0, 367), (1, 500), (0, 367), (1, 501), (0, 367), (1, 500), (0, 394), (1, 472), (0, 397), (1, 472), (0, 392), (1, 500), (0, 368), (1, 499), (0, 398), (1, 1307), (0, 397), (1, 498), (0, 367), (1, 476), (0, 391), (1, 500), (0, 368), (1, 499), (0, 396), (1, 448), (0, 415), (1, 475), (0, 367), (1, 499), (0, 366), (1, 1340), (0, 420), (1, 1316), (0, 420), (1, 1313), (0, 392), (1, 501), (0, 422), (1, 472), (0, 392), (1, 1315), (0, 394), (1, 500), (0, 366), (1, 500), (0, 368), (1, 499), (0, 368),
      (1, 499), (0, 395), (1, 449), (0, 391), (1, 499), (0, 367), (1, 500), (0, 367), (1, 476), (0, 391), (1, 500), (0, 392), (1, 475), (0, 391), (1, 475), (0, 367), (1, 499), (0, 368), (1, 499), (0, 424), (1, 470), (0, 368), (1, 499), (0, 368), (1, 499), (0, 368), (1, 499), (0, 366), (1, 501), (0, 367), (1, 500), (0, 395), (1, 472), (0, 368), (1, 498), (0, 368), (1, 499), (0, 368), (1, 499), (0, 390), (1, 478), (0, 392), (1, 474), (0, 395), (1, 472), (0, 393), (1, 473), (0, 396), (1, 472), (0, 419), (1, 475), (0, 396), (1, 470), (0, 394), (1, 1312), (0, 396), (1, 1338), (0, 422), (1, 472), (0, 390), (1, 478), (0, 392), (1, 474), (0, 394), (1, 472))
      data = ()
      duration = ()
      for x in record:
          data = data + (x[0],)
          duration = duration + (x[1],)
      
      rmt = RMT(channel=4, gpio="P21", tx_idle_level=RMT.LOW)
      while 1:
          print('sending...')
          rmt.pulses_send(duration, data)
          print('done')
          time.sleep(2)
      

      I get random transmissions:

      length:25
      ((0, 564), (1, 330), (0, 208), (1, 818), (0, 559), (1, 370), (0, 654), (1, 263), (0, 850), (1, 187), (0, 436), (1, 288), (0, 558), (1, 571), (0, 695), (1, 11801), (0, 1012), (1, 312), (0, 374), (1, 274), (0, 207), (1, 573), (0, 1796), (1, 647), (0, 1194))
      length:7
      ((0, 265), (1, 156), (0, 284), (1, 183), (0, 202), (1, 174), (0, 205))
      

      Any idea what am I doing wrong ?

      Thank you in advance.

      1 Reply Last reply Reply Quote 0

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      • 1 / 1
      • First post
        Last post

      Pycom on Twitter

      Pycom