Announcement

Collapse
No announcement yet.

Rotary Encoder question...

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

  • neildavis
    replied
    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.

    Leave a comment:


  • skatz
    replied
    [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!

    Leave a comment:


  • tomzarbo
    replied
    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


    Leave a comment:


  • neildavis
    replied
    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, 08:47 AM.

    Leave a comment:


  • Millstonemike
    replied
    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 ...

    Leave a comment:


  • tomzarbo
    replied
    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

    Leave a comment:


  • neildavis
    replied
    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.

    Leave a comment:


  • neildavis
    replied
    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 .

    Leave a comment:


  • silverD
    replied
    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?

    Leave a comment:


  • silverD
    replied
    Excellent work and suggestion Neil.

    Leave a comment:


  • neildavis
    replied
    Originally posted by Millstonemike View Post

    I can guess at that connector, J9,...it seems to be an interface for a remote module.
    Of course, and it's easy to figure out what voltages are needed on the "Key" pin to provide a remote version of the keypad. But the keyboard is clumsy, as in order to increase volume you need to hold the >> button until it changes function to Vol+. Not good. 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.

    Leave a comment:


  • Millstonemike
    replied
    Originally posted by tomzarbo View Post
    Looking at the rear of the board again, I'm wondering if there isn't another possible connection to tap into.

    Here is another pic of the 'operating function keys' if that can be believed. Could any of these connections do anything volume wise?

    I think you guys are pretty much past these 'labels' and connections and are looking at the chip itself to determine what's 'possible' but I just wanted to bring it up in case we overlooked it. Could just be another bad translation issue though. I'm kind of assuming it's a remote IR receiver and support for alternate face panel buttons or something. Just didn't know if it was another 'hook-up' option to consider.

    Click image for larger version

Name:	Operating function.JPG
Views:	115
Size:	20.2 KB
ID:	1429643

    Also, Neil/Nate/Mike or anyone looking into this, did anyone see any issues with the underside of the board (the side that faces the front) regarding soldering the three terminals that we soldered connections to.
    I wasn't sure that the backside of the board was soldered up correctly without taking off the board and soldering one of those leads on the back side which may not be making good connection.

    This post farther up shows what I'm saying: http://techtalk.parts-express.com/fo...06#post1427706

    Just trying to avoid any 'poor connections' becoming a problem in figuring things out. I had different voltages once I soldered up the back side of the board.

    Thanks Neil, I don't feel so bad if you guys don't think it's a waste. I like it's compact form factor, it's not deep and it will fit in a lot of places, plus it's pretty quiet too. I have my music collection ripped as 128k MP3's for the most part... I find the quality okay for car stereo playing and for these little players as "radios" but nothing really 'hi-fi' in any way. It's nice to see that it has the ability to play high quality files too.

    I'm just literally amazed at how much these little players can do with the 1/4" by 1/4" chips that are the brains that make them think and work.

    Anyway, thanks to all.

    TomZ

    P.S. I have three new 'untouched' boards to mess with if anyone has any ideas.
    "Nothing Ventured, nothing gained." - Benjamin Franklin

    I can guess at that connector, J9, given the schematic and Neil's "education" on the key pad functionality (I didn't know the chip could read analog voltage levels).

    It seems to be an interface for a remote module. There's Gnd and +3.3 V out. The "Key" input is for yet another unique push button signal into the chip. I have no idea what the S/W may do with that function. Lastly, there's a tie-in with the IR interface. That might feed the IR signal to the remote module. A lot of the potential functionality is a guess without knowing how the PCB is / was intended to be used in other products.


    Leave a comment:


  • tomzarbo
    replied
    Looking at the rear of the board again, I'm wondering if there isn't another possible connection to tap into.

    Here is another pic of the 'operating function keys' if that can be believed. Could any of these connections do anything volume wise?

    I think you guys are pretty much past these 'labels' and connections and are looking at the chip itself to determine what's 'possible' but I just wanted to bring it up in case we overlooked it. Could just be another bad translation issue though. I'm kind of assuming it's a remote IR receiver and support for alternate face panel buttons or something. Just didn't know if it was another 'hook-up' option to consider.

    Click image for larger version

Name:	Operating function.JPG
Views:	115
Size:	20.2 KB
ID:	1429643

    Also, Neil/Nate/Mike or anyone looking into this, did anyone see any issues with the underside of the board (the side that faces the front) regarding soldering the three terminals that we soldered connections to.
    I wasn't sure that the backside of the board was soldered up correctly without taking off the board and soldering one of those leads on the back side which may not be making good connection.

    This post farther up shows what I'm saying: http://techtalk.parts-express.com/fo...06#post1427706

    Just trying to avoid any 'poor connections' becoming a problem in figuring things out. I had different voltages once I soldered up the back side of the board.

    Thanks Neil, I don't feel so bad if you guys don't think it's a waste. I like it's compact form factor, it's not deep and it will fit in a lot of places, plus it's pretty quiet too. I have my music collection ripped as 128k MP3's for the most part... I find the quality okay for car stereo playing and for these little players as "radios" but nothing really 'hi-fi' in any way. It's nice to see that it has the ability to play high quality files too.

    I'm just literally amazed at how much these little players can do with the 1/4" by 1/4" chips that are the brains that make them think and work.

    Anyway, thanks to all.

    TomZ

    P.S. I have three new 'untouched' boards to mess with if anyone has any ideas.

    Leave a comment:


  • neildavis
    replied
    That board is pretty amazing for the $15 or so that it costs. It's certainly worth putting in the time to understand it better. It still might pan out as a great find. But even if we can't have it do everything we want, it's a very good bargain radio/Bluetooth/music player/preamp. You didn't lead anyone on a goose chase--you just pointed out a very promising product, and we are grateful for that.

    As I said, if the audio quality is good enough I might buy the developer toolkit. That would allow a lot of customization. The specs for the JL chip are fairly good -- 92db SNR for both the DAC and ADC, but sometimes the specs are misleading. A/B testing will tell...

    Update: I tried using different CODECs for the Bluetooth connection from my Android phone, but the phone only reported SBC, which is the default Bluetooth CODEC that isn't very good. I looked through the AC6901 code again for other CODECs like AptX and AAC and LDAC, but I only found AAC. That's the default for the iPhone, so maybe AAC is supported. I tried using my wife's iPhone but couldn't figure out how to see which CODEC is being used. Maybe the iPhone uses AAC, but I'm pretty sure Android phones are limited to SBC with this device. So the Bluetooth controls work great, but the audio quality isn't as good as it could be. *sigh*.

    On the other hand, it has no trouble with FLAC or variable bit rate MP3's from the USB input. FLAC is a lossless encoding method, so the audio quality is good. It took a while (almost a minute) to read a 128M USB stick that was full (about 1200 files), but once it figured out the directory it seemed to work well.

    Leave a comment:


  • tomzarbo
    replied
    Thank you Neil, for spending your time trying to figure this out. I had hopes for it... but I really don't have much of an understanding of the time and effort it takes to really dig into it. Sorry that I lead everyone on a wild goose chase.

    As an excuse, I think that the product information laid out clearly suggested a volume adjusting device of some type. I really thought it was going to pan out.

    But thanks everyone for the effort.
    TomZ

    Leave a comment:

Working...
X