Announcement

Collapse
No announcement yet.

Rotary Encoder question...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #61
    Excellent work and suggestion Neil.
    My Builds - Overnight Sensations w/ Voxel - Speedsters in surplus boxes - Zaph B3N's in bamboo - Classix II in BR-1 cabinets - Dual TPA3116 D2 amp in an old music box - Mariposas

    Comment


    • #62
      Originally posted by neildavis View Post
      The IR pin would allow you to control the volume "directly", without the long hold But the IR pin is more difficult, as it uses a 32-bit PPM stream to encode the key value.

      I used the IR_protocol_analyzer software available here to look at the stream. It looks like there is a 15-bit header followed by 8-bit data and then the same 8-bit data "inverted", at a bit rate of 900Hz. It shouldn't be too hard to create the same stream with an Arduino micro. I've actually got all of the key codes figured out, but it would take some time to test the code and hook up a rotary encoder. But I still need to do an A/B test to make sure the audio quality is good enough to make the programming effort worthwhile.
      Hi Neil,
      I downloaded the IR protocol analyzer you suggested and confirmed that it uses the NEC 32-bit protocol. I connected an encoder to an arduino nano and wrote a quick sketch to read the encoder and then send the IR pulse sequence (IRremote library) for volume up and down via arduino pin 3 (pwm) to the IR pin on the audio board. I'm not getting a volume change on the board, so I need to verify that I have the correct hex code/raw data as well as make sure I have it connected correctly. Any suggestions?
      My Builds - Overnight Sensations w/ Voxel - Speedsters in surplus boxes - Zaph B3N's in bamboo - Classix II in BR-1 cabinets - Dual TPA3116 D2 amp in an old music box - Mariposas

      Comment


      • #63
        Very good!. I just connected the "IR" pin to the input of my sound card and it read the data OK, but the program didn't convert it to digital data, and didn't recognize the format. But that makes sense because the IR pin is on the input side of the IR receiver, which demodulates the data from the carrier (usually 38KHz). Apparently the program works best with the modulated IR signal.

        I converted all the timing values to bits myself, but I haven't gotten any further than that. The raw captured data for each key is in this zip file: http://www.audiodevelopers.com/temp/.../BMP_files.zip My preliminary conversion is in this Excel file: http://www.audiodevelopers.com/temp/...ma_remote.xlsx. Hope that helps...

        Here is a tutorial on remote controls that I wrote many years ago. Maybe it will help: http://www.audiodevelopers.com/temp/Remote_Controls.ppt . This was from about 12 years ago, when I was decoding remote controls using 6801 assembly code .
        Free Passive Speaker Designer Lite (PSD-Lite) -- http://www.audiodevelopers.com/Softw...Lite/setup.exe

        Comment


        • #64
          BTW, I put an order in for a couple of 4-pin cables with 2mm pitch JST connectors. That way you can get power and ground for the Arduino CPU from that same connector. Digikey part number is 455-3155-ND. They are 12" long with female connectors on each end, so you can get two 6" single-ended cables from that part number.

          Also: I just threw that speadsheet together rather quickly, and after looking at the NEC format again, I will be making changes (I only accounted for 31-bits, so that is one change...). But the information that you will need is there--just needs some minor corrections. What I labelled "Header" is actually the address field, and it needs to have both the 8-bit address and it's 2's complement. The data field should be correct, and I added up the data and its inversion for each key to make sure they added up to 255.

          Free Passive Speaker Designer Lite (PSD-Lite) -- http://www.audiodevelopers.com/Softw...Lite/setup.exe

          Comment


          • #65
            So, you guys are going about this by 'creatively piggybacking' where the input for the IR signal usually would go into the chip... so you can give it volume up/down prompts as though it were coming directly from the IR input... that's really creative.

            Just trying to unravel the plot a bit so I understand... the thought is to write code somehow that will take a rotary encoders output to be converted so it will speak "IR volume up/down" language to the chip? Where is that code stored? Does it need a whole Arduino setup piggybacked with this, or can it be stored somehow on the existing chip? I thought that these little chips on these boards were pretty much ROM types... but then again, they remember where the volume is upon restart after shutdown, so that takes some type of RAM or whatever it would be called to 'store' the last state of the volume at least.

            It is interesting watching this play out.

            Many thanks for all the effort!
            TomZ
            *Veneering curves, seams, using heat-lock iron on method *Trimming veneer & tips *Curved Sides glue-up video
            *Part 2 *Gluing multiple curved laminations of HDF *Cello's Speaker Project Page

            *Building the "Micro-B 2.1 Plate Amplifier -- Part 1 * Part 2 * Part 3 * Part 4 * * Part 5 'Review' * -- Assembly Instructions PDF

            Comment


            • #66
              Originally posted by neildavis View Post
              .... This was from about 12 years ago, when I was decoding remote controls using 6801 assembly code .
              Wow. I was programming Motorola 6800 series assember code in 1984.

              Tom, you might find this interesting. For the amp filter equations, I had to re-learn mathematics I forgot from college in the late '70s. And to do that, I had to re-learn the precursor mathematics I forgot from high school in the mid '70s.

              I gave up engineering 20 years ago. So Neil and SilverD will have to carry the torch on this ...

              Comment


              • #67
                Originally posted by tomzarbo View Post
                So, you guys are going about this by 'creatively piggybacking' where the input for the IR signal usually would go into the chip... so you can give it volume up/down prompts as though it were coming directly from the IR input... that's really creative.
                Not really "creative", as that is the point of having those two pins on J9: you can provide your own keypad or your own remote control signals. The remote control is more flexible because of the way they doubled-up on keypad functions by using short and long key presses.

                Just trying to unravel the plot a bit so I understand... the thought is to write code somehow that will take a rotary encoders output to be converted so it will speak "IR volume up/down" language to the chip? Where is that code stored?
                It's just a simple translator...to convert a rotary encoder to IR volume control data. But it could also allow using a cell phone app to provide all of the remote controls functions. The cell phone app would convert the touches on the phone to a Bluetooth or WiFi stream that the Arduino CPU would then translate to IR remote control data. You can get an Arduino CPU with both Bluetooth and WiFi for around $10 (ESP32).

                Does it need a whole Arduino setup piggybacked with this, or can it be stored somehow on the existing chip? I thought that these little chips on these boards were pretty much ROM types... but then again, they remember where the volume is upon restart after shutdown, so that takes some type of RAM or whatever it would be called to 'store' the last state of the volume at least.
                Yes, you would need a small Arduino board, but it could be very small since the processing requirements are so light. You could use one of those "trinket" boards that people use for wearables, but even the ESP32 with WiFi and Bluetooth is only 1" by 2". Most modern CPU's like what is on this encoder board or that use the Arduino IDE have lots of flash memory for storing the code plus additional EEPROM memory for storing data such as volume settings. You just download the code using the USB connection on the Arduino board. If you want to change the program, erase the flash and load different code. There may be small amounts of ROM for certain functions, but for the most part everyone has switched to flash.

                Update: That USB port on the decoder board can be used to reprogram the device. The development kit has the programming tools and all of software, so that would be the really creative way to add more functionality. But that effort would be formidable, because the older code that I have looked at is not easy to follow, and there are a lot of missing pieces of information about the chip that might make code changes difficult. Also, there are almost no comments in the code about how it works. It's modular and is done by a skilled coder, but very hard to understand.
                Last edited by neildavis; 01-22-2020, 09:47 AM.
                Free Passive Speaker Designer Lite (PSD-Lite) -- http://www.audiodevelopers.com/Softw...Lite/setup.exe

                Comment


                • #68
                  Okay, I understand a little better how the process works. Thanks for filling in the details for me.

                  I'm no master of mathematics. I did take some college math for my Master's degree, but my wife had to help me understand how to do lots of it. That was 5-6 years ago, and I wouldn't like to try and reintroduce myself with that stuff, let alone stuff from high school. Me and math are like oil and water.

                  I just think you guys have been doing this higher-level stuff so long that maybe you don't realize how impressive it is to 'normal' non-engineer people that a 'person' can even figure this stuff out. I enjoyed programming in BASIC a little bit when I was a youth, but just for fun and nothing too crazy... Like I made little chickens walk back and forth on the screen of my little pocket-sized Tandy computer and later my TI994A, that kind of stuff.

                  TomZ


                  *Veneering curves, seams, using heat-lock iron on method *Trimming veneer & tips *Curved Sides glue-up video
                  *Part 2 *Gluing multiple curved laminations of HDF *Cello's Speaker Project Page

                  *Building the "Micro-B 2.1 Plate Amplifier -- Part 1 * Part 2 * Part 3 * Part 4 * * Part 5 'Review' * -- Assembly Instructions PDF

                  Comment


                  • #69
                    [QUOTE=tomzarbo;n1429998]Okay, I understand a little better how the process works. Thanks for filling in the details for me.

                    I'm no master of mathematics. I did take some college math for my Master's degree, but my wife had to help me understand how to do lots of it. That was 5-6 years ago, and I wouldn't like to try and reintroduce myself with that stuff, let alone stuff from high school. Me and math are like oil and water.

                    I just think you guys have been doing this higher-level stuff so long that maybe you don't realize how impressive it is to 'normal' non-engineer people that a 'person' can even figure this stuff out. I enjoyed programming in BASIC a little bit when I was a youth, but just for fun and nothing too crazy... Like I made little chickens walk back and forth on the screen of my little pocket-sized Tandy computer and later my TI994A, that kind of stuff.

                    TomZ

                    Closest I ever came to that, Tom, was to play a video game! And my math was prior to 1966!

                    Comment


                    • #70
                      Two updates to this thread.

                      First, I wired up a switch to allow comparing a high quality signal directly versus going through the encoder's line in A/D and output D/A. You can tell a difference, and the switch position that bypasses the encoder sounds more "alive", or clearer, or better...pick your adjective. But it wasn't an overwhelming difference, and there wasn't that much fidelity lost for a table radio or PC speaker application. I wouldn't pass the signal through the encoder for high-end applications, but if you are happy with SBC Bluetooth, it's an acceptable solution. I think that most people would find the losses through the decoder board to be OK.

                      Second, I got the remote control code working. I used a teensy 3.5 board that I had laying around to connect to a hex keypad (remember those?). I used the Arduino keypad library to scan the switches and return the remote control data that I needed to send to the decoder board through the IR pin. I could have used a rotary encoder or even a Bluetooth connection to read codes from a cell phone app, but I'll leave that fun for somebody else--I just wanted to make sure the IR pin was a viable way to control the board. And, it is working fine--I've got all of the main functions from the remote mapped to my keypad (my keypad only has 19 switches and the remote has 24, so a couple of the keys aren't mapped). The remote control codes and Arduino code to send the data to the decoder board are at this link.
                      Free Passive Speaker Designer Lite (PSD-Lite) -- http://www.audiodevelopers.com/Softw...Lite/setup.exe

                      Comment

                      Working...
                      X