Announcement

Collapse
No announcement yet.

Rotary Encoder question...

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

  • neildavis
    replied
    The voltage divider approach for keypads is common. The "standard" 2-line LCD Arduino shield uses a single line to encode the 6 pushbuttons--the schematic is at this link. It's very easy to decode this type of keyboard, as you just need to poll the analog input pin for any voltage, read the voltage and then compare it to values in a table.

    Mechnical rotary encoders are more difficult to deal with, as the keybounce can result in invalid sequences (non-Gray-codes). For that reason, mechanical rotary encoder contacts are usually connected to pins with interrupt capability, and the pulses are debounced and counted in an interrupt service routine. So there is more complexity, although the Arduino library code takes care of that. Also, you can't share CPU pins: each rotary encoder requires two dedicated pins. I don't see any extra pins available on that JL chip for a rotary encoder, so I'm assuming that the volume control encoding, if any, is done as a voltage like the other pushbuttons.

    I ordered one of these boards yesterday, and it will probably take two or three weeks to arrive. I'll look at those pins with a scope and trace some connections to get a better idea of how this board works and how it can be integrated into active speakers.

    Leave a comment:


  • Millstonemike
    replied
    Originally posted by neildavis View Post
    ...

    However, the idea might not work, depending on how the volume encoder interface is implemented. I assume the master volume is encoded as a voltage like the other buttons. But the software might force you to hold and release the button very slowly, and the rotary encoder connected to the Arduino would only be able to spin at the speed of the button pressing logic. So it might be an unsatisfactory solution. The schematic for the buttons on the AC4602 is shown below. I assume the master volume is encoded in a similar way.

    Click image for larger version  Name:	Image2.png Views:	32 Size:	27.5 KB ID:	1427789

    I think it's worth investing time on these boards, because these System-on-a-chip (SOC) devices have become very powerful and very high quality in the last few years. This is how consumer electronics is trending, and coming up with clever ways to take advantage of these devices is a new and interesting frontier for the DIY'er.
    That's a strange implementation. Using 10 buttons and a voltage divider network to control one function. After all, one major purpose of these electronic chips is to reduce costs. And that translates to reducing the number and/or complexity of mechanical devices. 2 SMD switches are cheaper tha a stereo pot for both component cost and assembly cost. And less part proliferation as the same switch is used for other functions on the module).

    I have a BT speaker that uses two separate buttons to control volume; an up & a down button. It doesn't seem to respond to a single push (or it's imperceptible), only to holding the button down. That tells me the chip is reading the contact and adjusting the volume based on time of closure.

    After reading up on the rotary encoders I concluded that: (1) The class of encoders in this application are purely mechanical rotary switches with two separate sets of contacts. The phase relationship between the opening and closing of the two separate rotaries produces two signals in tandem read by the intelligent device; (2) There are several encoding techniques but quadrature seems to the standard for user electronic type encoders; and (3) A main parameter is the number of pulses per revolution. It is important to match that parameter with the device reading the rotary input. You don't want 1/10th of a revolution to change between minimum and maximum volume. Nor do you want 10 revolutions to accomplish the same span of volume.

    "I think it's worth investing time on these boards, because these System-on-a-chip (SOC) devices have become very powerful and very high quality in the last few years. This is how consumer electronics is trending, and coming up with clever ways to take advantage of these devices is a new and interesting frontier for the DIY'er."

    +1

    Leave a comment:


  • neildavis
    replied
    Looks like that is a custom part number. You can buy the AC4602 chip for $0.90 at Aliexpress, but they tell you the "chip does not support retail, because the chip requires software". So once it gets programmed, the vendor puts on a different part number. The JL website lists a number of products, but there are some good reasons for thinking that the chip on your board is a programmed AC4602 (same functionality, same number of pins, etc.)

    The Arduino boards are cheap--you can get a basic "328" board at AliExpress for under $2, and Microcenter has the Adafruit "Trinket" board for $7.

    However, the idea might not work, depending on how the volume encoder interface is implemented. I assume the master volume is encoded as a voltage like the other buttons. But the software might force you to hold and release the button very slowly, and the rotary encoder connected to the Arduino would only be able to spin at the speed of the button pressing logic. So it might be an unsatisfactory solution. The schematic for the buttons on the AC4602 is shown below. I assume the master volume is encoded in a similar way.

    Click image for larger version

Name:	Image2.png
Views:	1309
Size:	27.5 KB
ID:	1427789

    I think it's worth investing time on these boards, because these System-on-a-chip (SOC) devices have become very powerful and very high quality in the last few years. This is how consumer electronics is trending, and coming up with clever ways to take advantage of these devices is a new and interesting frontier for the DIY'er.

    Leave a comment:


  • tomzarbo
    replied
    Finally got a decent close-up pic of the chip... it's a JL Chip... text for easy copy/pasting... AC19AP1R339-1A8

    Here is the pic:

    Click image for larger version

Name:	Chip Closeup.jpg
Views:	646
Size:	132.5 KB
ID:	1427783

    I'm planning to order a few encoders of various types later today after I wake up a bit. Even if they can't be used on this project, for future stuff.

    Found a few different 'diagrams' of the back from a few different sellers:

    Click image for larger version

Name:	Diagram of back.JPG
Views:	582
Size:	142.1 KB
ID:	1427781 Click image for larger version

Name:	Diagram of back2.JPG
Views:	579
Size:	92.6 KB
ID:	1427782


    Not sure if I trust any of this though; I hate to waste peoples time if this thing isn't what's advertised.

    Again, thanks for the great info everyone, I'll keep pluggin' with it as long as it seems worth it for folks to invest time and thought.

    Neil, I paid around $10 ea. for these. How much would the Audrino setup add to the cost of this do you estimate?

    TomZ

    Leave a comment:


  • neildavis
    replied
    Something that would help is knowing the part number on that 48-pin chip. The chip is made by Zhuhai Jieli technology company, with that stylize J-L logo (http://www.zh-jieli.com/), but I can't read the part number from the low-rez photos. They make a number of different MP3/Bluetooth/FM decoder chips. The only chip that I could information for is the AC6901, which is also a 48-pin chip. If you look at the pin definition, you can see that the chip has a lot of dedicated ports for the LCD display, analog I/O, USB, SD card, etc.

    Click image for larger version  Name:	AC6901.png Views:	0 Size:	555.4 KB ID:	1427757


    The "keyboard" functions appear to be handled by a single pin, where the keys create a voltage divider. In fact, one of the questions for this device at one site listed the resistors used for the voltage divider: "Add keys circuit key and GND through resistor: next-24k, pre-36k, play-22R, mode-51k, eq-16k, rep-4k7, rec-200k, mic-2k2". These instructions were for using the "key" pin for creating an external keypad. I suspect the "master volume encoder interface" would be similar--it would use a resistor network to create a voltage that the micro would read and interpret as Vol+ or Vol-.

    As I noted in a previous post, the voltages Tom provided don't make sense for this interface being for a rotary encoder. And this chip doesn't appear to provide the ports needed to process a mechanical rotary encoder. Maybe the chip used on Tom's board is different, but I think it is unlikely that there are dedicated pins for a rotary encoder on a relatively small 48-pin chip. Also. it looks like the traces from that empty connector go straight to the other pushbuttons, so it looks like that interface is used to create a specific voltage for Vol+ and Vol-.

    So, I think there is close to zero chance that this interface is for a rotary encoder. However, it would be possible to add a rotary encoder by using an Arduino CPU that would read the rotary encoder and then provide the right voltages to either the "Key" pin or else to that "master volume encoder interface", assuming you could figure out what voltages are required.
    So someone needs to volunteer to write some Arduino code if there is interest in making this device respond to a rotary encoder. The Arduino IDE has library functions to process the pulses from a rotary encoder. I've written my own code to read rotary encoders for several different CPU's, but I'm guessing that with the Arduino library this would be fairly easy. And then the rotary encoder movement would need to be converted to a voltage, so there would be some additional circuitry involved. Any takers? Is this worth doing?


    Leave a comment:


  • Millstonemike
    replied
    Originally posted by tomzarbo View Post
    ... BTW I can't see any of the pics in post #31 for some reason on my phone, iPad or computer.

    TomZ
    Reposting pics from post 31.



    Leave a comment:


  • devnull
    replied
    Originally posted by Millstonemike View Post

    BTW: The rotary encoders with the 3-pin plus 2 pin interface have two pins opposite the main pins (pic below) for an on/off function. One big dial for volume and on/off - "right up your design alley." so to speak. But the switch function seems to be a momentary push on. I presume it's looking for an always-on electronic interface to sense that momentary connection and power up the device. But I don't see a power button on your main module. It might have been possible to parallel​
    There are some volume control ICs that can use the momentary push button function to toggle between different modes. i.e. volume/balance, mute/un-mute If I remember correctly MAXIM makes a few like this.

    Leave a comment:


  • tomzarbo
    replied
    Thanks for all the input guys.

    Neil, Nate is right, the three tabs are for the IR receiver, it's more visible on the flipside of the board.

    Here are a few pics of that...

    Click image for larger version

Name:	Ground Not Soldered.jpg
Views:	593
Size:	423.6 KB
ID:	1427708
    Click image for larger version

Name:	Ground Soldered.jpg
Views:	585
Size:	282.9 KB
ID:	1427707

    Well, after taking the board off of the case I saw something funny...

    When I looked at the back side of the board, it appears that the soldering I did only affected the one side of the circuit board, the hidden side doesn't seem to be making contact with the solder on the inside pad. Not sure if I should have done this or not, but I flowed a little solder on to the inside portion as well since I had it open.

    The square tab, the ground one was troublesome to solder, it just didn't want to seem to take any solder and I couldn't get the solder to 'flow' like it normally does. I hit it with flux which helped, but it was still a bugger. The other two were a lot less fussy getting solder to flow.

    After doing that, I had no voltage between the ground, and either of the other two pins. ??? I double checked it with the multimeter and confirmed...

    Then I started connecting the other two pins to the ground quickly to simulate turning an encoder, and after that, the voltage (3.3) is fluctuating as before. It's possible I fixed, then goofed up the board?

    Anyway, the second preamp had been untouched until this morning, I soldered three lines to that and it is acting exactly the same way as the first one with the fluctuating voltage between the ground and second pin. I didn't take that one apart to 'fix' the inside solder joint yet. I wanted to make sure both of them were acting the same though before wasting everyone's time in case I was fiddling with a 'faulty' unit.

    I appreciate the input, I'll order up a few encoders later today (today's our 15th anniversary and I'm taking the wife out on a date in a few minutes!) based on your recommendations and see what we can figure out with it.

    Mike, the push button momentary on some encoders would be great for a 'turn-on' function right? But, like you said, this board doesn't have an 'on-off' button on it to hack into. Mode change maybe? BTW I can't see any of the pics in post #31 for some reason on my phone, iPad or computer.

    Also, looking at the circuit board, I really can't see where anything is going. The screen covers up pretty much most of the board and it's bonded to the board and won't really come off that I can see.

    Thanks again for all the great ideas. Man, it really takes a village to 'raise' me doesn't it?

    TomZ

    Leave a comment:


  • Millstonemike
    replied
    Here's an interesting selection

    Leave a comment:


  • Millstonemike
    replied
    Originally posted by Billet View Post
    I think the square pad usually indicates pin 1. If I remember correctly, the center pin of a three line mechanical encoder is the common.
    Billet nailed it. See below.Beware these "Half Axis" encoders don't spin ad infinitum. That half axis means 180o stop-to-stop.

    Tom Zarbo ; "Black lead on the square pad and the red lead on the other lead furthest from the square pad showed basically no voltage."

    That's becuase you measured the voltage between the A and the B signal - both inputs to the module. The encoder is all physical contacts. When turned, the contacts open and close to generate a specific sequence of contacts for both the A & B signal to C. Both are inputs to the module's circuitry.The middle pin "C" is +3.3 V. The succession of on/off states - individual contact between A & C and A &C - pull the A and the B signal positive using the voltage from C. The logic reads that sequence and translates it into CW or CCW rotation. Both the A and B inputs on the module should be pulled low with a light resistor. Going high only when pulled up to 3.3 V from C.

    So I'm at a loss for the fluctuating voltage between A and C. It should be a steady 3.3 all the time. And the effect of pressing Pause is, uh, entertaining

    Perhaps it's a function of not receiving any input, the module's logic pulsing a wake up / restart signal for some type of active electronic encoder.

    Click image for larger version  Name:	Encoder Spec..png Views:	0 Size:	376.2 KB ID:	1427698


    Leave a comment:


  • Millstonemike
    replied
    EDIT: Half Axis encoders only spin 180o stop-to-stop. Look for 360o encoders (5th down on the list).

    Tom, suggesting a course of action you've got down pat ...

    I never used a rotary encoder, but a quick search showed 3-pin plus 2-pin and 5-pin configurations. I would think the interface is a well defined standard for those. And if the module implemented a standard design, it's ready to accept a 3-pin encoder. So, I suggest you buy one on the cheap (see below). If it works but usage is imperfect, at least you'll know buying a better encoder or one with different parameters should work as well. If you look to Digikey's encoders, and peruse the filter categories you can see several encoder variables - like pulses per revolution. I would think that's an important parameter for a useful volume control

    In the mean time, if you feel compelled to experiment, you can do Neil's resistor test and/or try the trace the three encoder contacts to their corresponding connections on the module.

    BTW: The rotary encoders with the 3-pin plus 2 pin interface have two pins opposite the main pins (pic below) for an on/off function. One big dial for volume and on/off - "right up your design alley." so to speak. But the switch function seems to be a momentary push on. I presume it's looking for an always-on electronic interface to sense that momentary connection and power up the device. But I don't see a power button on your main module. It might have been possible to parallel the encoder push button contacts with the module's power-on push button.



    Last edited by Millstonemike; 12-27-2019, 12:15 AM.

    Leave a comment:


  • silverD
    replied
    Found this site with more info, but not exactly what we need. https://alexnld.com/product/bluetoot...decoder-board/

    Leave a comment:


  • silverD
    replied
    The three soldered connections below are for the IR receiver on the other side.

    Leave a comment:


  • neildavis
    replied
    Also, if you could provide some more info on those three soldered connections just below the unused pads...

    Leave a comment:


  • tomzarbo
    replied
    Originally posted by devnull View Post
    It would help to know what those pads are hooked up to. Are there any markings on the ICs on the board? Can you trace the pads back to specific pins on the ICs?
    I think it will be easy enough to remove the board from the frame. I'll give that a try later today to see what I can see.
    Thanks for the input and for helping. I appreciate everyone's help.

    TomZ

    Leave a comment:

Working...
X