AppleRemote & AppleDock modules

Posted on
  • Hi there :)

    I have a nearly finished "Apple Remote" module ( currently only for the old IR remote ) & an ongoing "AppleDock" module hosted at the following repo: https://github.com/stephaneAG/iDeviceRem­ote.

    While the remote module just needs some polish, the dock one has currently just the codes added, and as I'm not that confident in translating the original code all on my own ( & pretty sure it's bread & butter for some fellas ;p ), any help/contribution is hugely welcome :D

    I'm still waiting for the "pod breakouts" ordered, and 'll be posting updates as soon as I get those & corresponding code working :)

    Well, 5:35 -> "Now goin' to sleep mode" ;p

    cheers +

  • I've used the same remote using the IRreciever module - posted here..

    http://forum.espruino.com/conversations/­287385/#comment13013007

  • hello :)

    Nicely done !
    ( special mention to the "keys" used to link a code to text to be displayed on the LCD ;) )

    Also, it makes me realize really gotta try Espruino on the ESP8266 NodeMCU board ^^
    ( I'll see if I can do so later today , & try your code as well ;) )

    This being said, do you have any experience with the Apple Dock connector ?

    Thinking about the way you handled the "keys", we could print the received IR code key first, and then the answer from the Dock Tx/Rx stuff

    Also, thinking about some older code for keypad matrices, It could be nice to map "long button presses" on the IR remote to different codes to be sent from the dock connector ( allowing to control most of the dock's available stuff with our std remotes :p )

    +

  • Thanks. Sorry - I don't have the apple dock, only the remote that came with an Apple TV gen 1.
    Not sure I understand what you mean by Apple dock?

  • hi

    By Apple Dock, I meant the 30 pins connector that has been recently replaced by the "lightning" one ( the one the aclosely ressembles ).
    ps: I must have some LCD somewhere, and I'll try your code / the stuff from my previous post as soon as I get to it ;p

  • Sorry, still confused!

    How does the 30 pin connector relate to IR?

    Oh - and the lcd I used had a i2c converter on the back.

  • ^^
    understood, I'll explain another way:

    IR receiver --> Espruino ( or tinier IC ? ) --> 30pin connector --> iDevice

    The Espruino/uC in between "translates" the stuff from the IR remote to control the iDevice through the dock connector

    Thx for the info on the LCD used ( that's what I guessed when looking at the beginning of your code ;p )

    So, my turn:

    For the 30pin dock connector breakout, I ordered one like this ( "PodBreakout Nano Style 1" ):
    http://www.makertronic.com/podbreakout-i­pod-iphone-ipad-breakout-nano-board

    For the LCD screen I have, it's this one ( so I was planning to use http://www.espruino.com/HD44780, same as you ;p ):


    https://www.adafruit.com/products/398

  • Ah - see what you mean now!

    Instead of connecting to the rs/rw/d0-d3 pins in the lcd, I'm using this type of guy:

    http://www.dx.com/p/lcd1602-adapter-boar­d-w-iic-i2c-interface-black-works-with-o­fficial-arduino-boards-216865#.V1Fh86aeq­rU

    So you only need to supply vss,Gnd,sda and sla lines - saving pins.

  • -> haha, 'glad to hear that ;)

    -> you mean RS, EN, D4..D9 || D0..D9 ? ( I have the RW Gnd-ed fine currently - nb: never used the 'read' mode yet .. )
    => big thanks for the "guy": I'll try picking one/some up & try out having more pins left & greater speed than with the 4 wires configuration:D

    Also, I have some ( ugly :/ .. ) code that auto fades the backlight RGB between few colors ( 'd need improvements to be maybe a 'grb color fade' module ? ( .. ) ) available here:
    https://github.com/stephaneAG/Espruino_t­ests/blob/master/characterLcdRgbBackligh­tAndMike/characterLcdRgbBacklightAndMike­.js

    Little question, though: using eith 8 wires or I2C is mandatory to have quicker response between lcd.clear() & the next lcd.print call ? ( I wanted to display bar graph of 16 chars max on the lcd depending on the analog value from the mike ( to be "mapped" from one "-" to 16 of them ) as a quick try ;) )

    the test code for the above quick try:

    // lcd update/ clear 
    var lcdUpdateCntr = 0;
    
    
    // listen to mike & output bar graph
    var w = new Waveform(128,{doubleBuffer:true});
    w.on("buffer", function(buf) { 
      var l = buf.length;
      var v = E.variance(buf,E.sum(buf)/l)/l;
      console.log("---------------------------­---------------------------------".subst­r(0,v));
      
      // map/adapt the result to the LCD width ( 16 chars )
      var lcdOutput = "----------------".substr(0,v);
      //lcd.clear();
      //lcd.print(lcdOutput);
      
      if ( lcdUpdateCntr < 1 ) {
        lcd.print(lcdOutput);
        lcdUpdateCntr++;
      } else if ( lcdUpdateCntr === 1 ) {
        lcdUpdateCntr++;
      }
      else if ( lcdUpdateCntr == 5 ) {
        lcdUpdateCntr = 0;
        lcd.clear();
      } else {
        lcdUpdateCntr++;
      }
      console.log('lcd update counter: ' + lcdUpdateCntr );
      console.log('variance: ' + v);
      
    });
    w.startInput(mike,2000,{repeat:true});
    

    ps: still didn't receive the pod breakout :/ ..

    +


    1 Attachment

    • IMG_0181.JPG
  • Little question, though: using eith 8 wires or I2C is mandatory to have quicker response between lcd.clear() & the next lcd.print call ?

    I believe the module is just as quick in 4 or 8 bit mode...

    I think from what you are asking - you are getting a flicker on the display?
    Instead of using clear just set the cursor location and over type the characters use ' ' to clear a single char.... Then you won't get any flickering

  • back :)

    -> actually, I was getting more than a flickering ( I couldn't even see the text being displayed before calling lcd.clear() -> so, very fast flickering ? ^^ )

    -> for the advised solution, I bet it'd work ( I was digging the HD44780 module js), but here's the thing: noticing the logs about B2 not able to PWM output, I changed it to B7 .. and ~now I can't connect back over USB~ ( even if I didn't 'save()' ) ..

    UPDATE ==> BACK IN BUISNESS :D

    -> I guess I'll have to unwire nearly all the pins connected to the lcd, since I can't get the conn. back with just a few ( or just the incriminated pin .. ) & test after that ..

    .. this being said, thanks for the hint ( I'm pretty sure that's also what I ended up doing with some Arduino code a while ago, keeping string buffers for each lines of the lcd screen ( one being displayed, and one that may be longer than 16 chars to be used as source for the stuff to be displayed ( .. ) ) )

  • back ! :D

    All right, I now have a working audio bar graph ( but it seems the chars I'm writing are no more "blocks of different height" afer a reset ? -> I gotta digg the stuff to write from the char map, but it seems weird some chars work and some don't ( or have a different charcode: ex: 0100 or 00000100 gives me an @, but it seems not consistant ? I surely use it the wrong way .. ) )

    The char map/set I'm talking about is from the datasheet, "Table 4"
    https://www.sparkfun.com/datasheets/LCD/­HD44780.pdf

    pics of bar graph before ( "blocks of different height") added
    Anyway, the "blocks" are gotten using lcd.write(0..7) ( increase the num for taller block )
    ( 'd be nice to know if we can have those flipped up without using special chars - to represent some audio stuff ;p )

    +


    2 Attachments

    • IMG_0188.JPG
    • IMG_0187.JPG
  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

AppleRemote & AppleDock modules

Posted by Avatar for stephaneAG @stephaneAG

Actions