User Tools

Site Tools


arduino:sansui-repair

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
arduino:sansui-repair [2019/04/16 17:05]
Ilias Iliopoulos Add link to software
arduino:sansui-repair [2024/02/02 21:46] (current)
Ilias Iliopoulos Added DISQUS
Line 1: Line 1:
 ====== Repair and bring back to life a 27-year old Sansui AU-X517R audio amplifier with Arduino ====== ====== Repair and bring back to life a 27-year old Sansui AU-X517R audio amplifier with Arduino ======
 +
 +{{htmlmetatags>​metatag-keywords=(arduino,​ sansui, repair, audio, amplifier, au-x517R, au-517) ​
 +metatag-description=(Repair an old Sansui audio amplifier with Arduino)
 +}}
  
 ===== Introduction ===== ===== Introduction =====
Line 41: Line 45:
 The signals from the controller are applied to an ''​LB1641''​ bidirectional motor driver, which subsequently provides voltage with the appropriate polarity to the motor to force it rotate to the desired direction. ​ The signals from the controller are applied to an ''​LB1641''​ bidirectional motor driver, which subsequently provides voltage with the appropriate polarity to the motor to force it rotate to the desired direction. ​
  
-The motor itself ​is an ''​ALPS (Japan)''​ module which is composed of a motor and three 12-pin rotary switches. The two switches are connected to the Left and Right channel of the audio sources, respectively . The third rotary switch provides an indication of the current position of the switch. This is achieved using another resistor ladder, having the same resistor values as the "INPUT SELECTOR CONTROL"​. The output of the resistor ladder is connected to another A-to-D channel of the micro-controller,​ on pin 4.  ​+The motor assembly ​is an ''​ALPS (Japan)''​ module which is composed of a motor and three 12-pin rotary switches. The two switches are connected to the Left and Right channel of the audio sources, respectively . The third rotary switch provides an indication of the current position of the switch. This is achieved using another resistor ladder, having the same resistor values as the "INPUT SELECTOR CONTROL"​. The output of the resistor ladder is connected to another A-to-D channel of the micro-controller,​ on pin 4.  ​
  
  
Line 85: Line 89:
  
 Another option would be to search for a used component. But such an old mechanical switch may also suffer from corrosion problems, which could appear as audio "​scratches"​ when moving to another audio source, in some positions one or both the two audio channels could not play. Regarding the position control switch, an oxidized contact would cause the controller to be blind to the switch current position etc. Another option would be to search for a used component. But such an old mechanical switch may also suffer from corrosion problems, which could appear as audio "​scratches"​ when moving to another audio source, in some positions one or both the two audio channels could not play. Regarding the position control switch, an oxidized contact would cause the controller to be blind to the switch current position etc.
 +
 +Another option would be to build a gear with a 3D printer or order a gear online. Unfortunately,​ I do not have access to a 3D printer and the online order will take a lot of time and money. If anyone wants to go this way, the broken gear had 40 teeth, outside diameter 16 mm, hole diameter 4 mm and width 1.5mm.
  
 All the above, along with the desire to replace electromechanical components with digital components, led me to design the complete replacement of the ALPS assembly with a set of relays controlled by an Arduino Nano. The new module would be controlled by the original TMP47C440AN micro-controller,​ mimicking as precisely as possible the ALPS assembly. Replacing entirely the TMP47C440AN micro-controller was not even considered, because this controller performs several other duties which I could not invest so much time to reverse-engineer.  ​ All the above, along with the desire to replace electromechanical components with digital components, led me to design the complete replacement of the ALPS assembly with a set of relays controlled by an Arduino Nano. The new module would be controlled by the original TMP47C440AN micro-controller,​ mimicking as precisely as possible the ALPS assembly. Replacing entirely the TMP47C440AN micro-controller was not even considered, because this controller performs several other duties which I could not invest so much time to reverse-engineer.  ​
Line 126: Line 132:
 Header pins J1 are used to power the Arduino board. Pin 2 is connected to the 7.8V power supply. A set of four diodes drop the voltage to make it more suitable for the the operation of the 5V relays. Pin 3 is wired to pin 2, but could be used in the future to power the Nano independently of the relays. A 1N4007 diode is placed between pin 3 and Vin, to block current going back to the amplifier circuits, when the Arduino is programmed and subsequently powered via the USB port. Header pins J1 are used to power the Arduino board. Pin 2 is connected to the 7.8V power supply. A set of four diodes drop the voltage to make it more suitable for the the operation of the 5V relays. Pin 3 is wired to pin 2, but could be used in the future to power the Nano independently of the relays. A 1N4007 diode is placed between pin 3 and Vin, to block current going back to the amplifier circuits, when the Arduino is programmed and subsequently powered via the USB port.
  
-Header pins J3 are used to receive the motor control orders from pins 13 and 14 of the TMP47C440AN. Two 1N4148 diodes are fixing the voltage mismatch.+Header pins J3 are used to receive the motor control orders from pins 13 and 14 of the TMP47C440AN. Two **1N4148** diodes are fixing the voltage mismatch ​and provide the proper TTL voltages to pins ''​D10''​ and ''​D11''​.
  
 Header pins J4 and J5 are the Left and Right audio channels. Each source signal comes into pins 2 to 7 and when one of the six relays RL1 to RL6 is activated, the signal is connected to the common which is wired to pin 1 of the header of the respective channel. The normally-closed pin of the relays is left unconnected. All common relay pins of each audio channel are wired together and are connected to pin 1 of J4 and J5. Header pins J4 and J5 are the Left and Right audio channels. Each source signal comes into pins 2 to 7 and when one of the six relays RL1 to RL6 is activated, the signal is connected to the common which is wired to pin 1 of the header of the respective channel. The normally-closed pin of the relays is left unconnected. All common relay pins of each audio channel are wired together and are connected to pin 1 of J4 and J5.
Line 135: Line 141:
  
 ===== Construction ===== ===== Construction =====
-I placed all components in a perforated all-purpose 7x9cm board, from which I cut a few cm to make it fit into the space available in the amplifier rack. The new board dimensions were a bit larger than the ALPS module, but I managed to squeeze it.+I placed all components in a perforated all-purpose 7x9cm board, from which I cut a few cm to make it fit into the space available in the amplifier rack. The new board dimensions were a bit larger than the ALPS module, but I managed to squeeze it in.
  
 {{arduino:​sansui_arduino.jpg?​400}} {{arduino:​sansui_arduino.jpg?​400}}
Line 153: Line 159:
  
 Please note that the motor position control rotary switch is the one which is more close to the motor. The traces on the amplifier board are really easy to follow and identify the purpose of each pad.    Please note that the motor position control rotary switch is the one which is more close to the motor. The traces on the amplifier board are really easy to follow and identify the purpose of each pad.   
 +
 +The board along with the soldered cable strips is shown below:
 +
 +{{arduino:​sansui_arduino_wired.jpg?​600}}
  
 Finally I placed the Arduino board on top of the amplifier PCB and used plastic spacers to maintain the distance between the two boards. To avoid drilling holes on the amplifier board, I kept everything in place with a few drops of hot glue, using a glue gun. If, in the future, we need to move the Nano board, the glue material can be removed easily. I also made sure that the Arduino Nano USB socket is easily accessible from the top side, so that I can re-program if necessary by only removing the top cover of the amplifier. ​   ​ Finally I placed the Arduino board on top of the amplifier PCB and used plastic spacers to maintain the distance between the two boards. To avoid drilling holes on the amplifier board, I kept everything in place with a few drops of hot glue, using a glue gun. If, in the future, we need to move the Nano board, the glue material can be removed easily. I also made sure that the Arduino Nano USB socket is easily accessible from the top side, so that I can re-program if necessary by only removing the top cover of the amplifier. ​   ​
Line 158: Line 168:
 ===== Software ===== ===== Software =====
  
-Writing the code was an experience. Since I do not know the exact code programmed in the TMP47C440AN,​ I have found sometimes that this code was competing to the Arduino code. My first version was a very elegant masterpiece which rotated the motor very well in the back and forth direction. Unfortunately,​ it worked only when the audio source selection knob was moved one position at a time. If the user moved the knob two or more positions in one blow, several rotations ​were required ​to reach the proper positions+Writing the code was an experience. Since I did not know the exact code programmed in the TMP47C440AN,​ I have found sometimes that this code was competing to the Arduino code. My first version was a very elegant masterpiece which rotated the motor very well in the back and forth direction. Unfortunately,​ it worked only when the audio source selection knob was moved one position at a time. If the user moved the knob two or more positions in one blow, the internal Sansui code tried to locate the shortest path to the new location in a way that I could not replicate, resulting in several ​"rotations" around the full perimeter before reaching stability ​to the final position
  
-**I finally realized that in order to mimic a "​stupid"​ behaviour, you need to be smart enough to copy every single detail of "​stupidity",​ in every single time interval!** To cut a long story short, the position control switch **cannot** be modelled as something that only provides six distinct connections. To achieve the functionality duplication that the software designers of the nineties had to cope with, the rotary switch must be modelled as something that "​makes"​ connection at several points in time and "​breaks"​ at other points in time, rolling smoothly from each state to the other. Probably the Sansui engineers utilized the transient from one condition to the other as a synchronization signal. **Kudos to the Sansui designers who managed to squeeze a highly effective code into this 4-bit micro-controller.**+**I finally realized that in order to mimic a "​stupid"​ behaviour, you need to be smart enough to copy every single detail of "​stupidity",​ in every single time interval!** To cut a long story short, the position control switch **cannot** be modelled as something that only provides six distinct connections. To achieve the functionality duplication that the software designers of the nineties had to cope with, the rotary switch must be modelled as something that "​makes"​ connection at several points in time and "​breaks"​ at other points in time, rolling smoothly ​and in a predicted manner ​from each state to the other. Probably the Sansui engineers ​have utilized the transient from one condition to the other as a synchronization signal. **Kudos to the Sansui designers who managed to squeeze a highly effective code into this 4-bit micro-controller.**
  
-There are cases when the switch does not link any contacts. At those times, the resistor ladder provides the highest voltage. Therefore, when moving from 0.7V to 1.4V, there is some time while the output continues to remain at 0.7V, then, when the connection is broken, the ladder output raises to 3.5V, then we have a new contact and the voltage goes to 1.4V, and finally, the motor continues to move in order to reach the middle of the new contact.+There are cases when the switch does not link any contacts. At those times, the resistor ladder provides the highest voltage. Therefore, when moving from 0.7V to 1.4V, there is some time while the output continues to remain at 0.7V, then, when the connection is broken, the ladder output raises to 3.5V, then we have a new contact and the voltage goes to 1.4V, and finally, the motor continues to move in order to reach the middle of the new contact ​keeping the voltage to 1.4V.
  
-To simulate this behaviour, I wrote the code as going through each of the 360 degrees of the circle. Our six audio sources are modelled as 6 segments of 60 degrees each. In each of those areas and considering that our switch has 12 pins from which only 6 are connected and the other six are left floating, our model behaves like this:+To simulate this behaviour, I wrote the code as a contact ​going through each of the 360 degrees of the circle. Our six audio sources are modelled as 6 segments of 60 degrees each. In each of those areas and considering that our switch has 12 pins from which only 6 are connected and the other six are left floating, our model behaves like this:
  
   - The circle is divided in 6 segments, each of 60 degrees, from 0 to 59   - The circle is divided in 6 segments, each of 60 degrees, from 0 to 59
Line 176: Line 186:
  
 Actually, our 12-pin switch has one common and 11 contacts, so we would have to divide the circle in 11 parts of 32.7 degrees each and the position where the physical contacts start and end, as represented by integers, would not be easy to replicate in each of the 6 segments. In addition, the physical construction of the rotary switch is not known in detail because the contacts are not visible and I have noticed (just a feeling, with no proof) that the rotation from an active pin 12 to an active pin 2, takes more time than rotating from pin 2 to 4. Yet, the model above with the six 60-degree segments is within the error limits allowed by the TMP74C440AN and works perfectly. Actually, our 12-pin switch has one common and 11 contacts, so we would have to divide the circle in 11 parts of 32.7 degrees each and the position where the physical contacts start and end, as represented by integers, would not be easy to replicate in each of the 6 segments. In addition, the physical construction of the rotary switch is not known in detail because the contacts are not visible and I have noticed (just a feeling, with no proof) that the rotation from an active pin 12 to an active pin 2, takes more time than rotating from pin 2 to 4. Yet, the model above with the six 60-degree segments is within the error limits allowed by the TMP74C440AN and works perfectly.
 +
 +**UPDATE**: I found some time to place the ALPS module on the surgical bed to have a deeper look on the contacts. After removing the axle, I was able to remove the rotating part of each switch and see what happens inside. The two pictures below show the stator and rotor of the switch.
 +
 +{{arduino:​sansui_alps_stator.jpg?​200}}
 +{{arduino:​sansui_alps_rotor.jpg?​200}}
 +
 +In the stator, the common pin is wired to a metal ring near the center. Twelve contacts are placed around the perimeter. One contact is a bit wider than the others and is electrically connected to the internal ring. The rotor has two contacts, which are wired together. One maintains contact to the ring and the second rotates around the stator contacts, connecting with each one of them while rotating. This means that my conceptual 12-contact model was mostly accurate, including the "​feeling"​ that the rotation from an active pin 12 to an active pin 2 takes a bit more time. This happens because the common contact is connected to itself during part of the rotation. In addition, the stator part of the common contact is a bit wider than the other contacts. **Although the code works well at its current version, in order to be absolutely precise, I must set the output voltage of the resistor ladder to 0V instead of high-Z, when the rotor passes through the common contact, i.e from circle position 352 to 7 which is the last half of the last segment and the first half of the first segment. In addition, I could set the width of the "​gap"​ sections a bit larger than the width of the contacts, as shown in the stator photo.** ​
 +
 +**END OF UPDATE**
 +
 +
     ​     ​
-The model moves though ​each of the 360 positions, one at a time. The delay between each step can be programmed so that a full rotation is achieved in about two seconds, as the physical motion of the original motor allowed. The ROTATION_SPEED constant is set to 5 milliseconds,​ leading to a full rotation in 5*360=1.8 seconds. ​+The software ​model moves through ​each of the 360 positions, one step at a time. The delay between each step can be programmed so that a full rotation is achieved in approximately ​two seconds, as the physical motion of the original motor allowed. The ROTATION_SPEED constant is set to 5 milliseconds,​ leading to a full rotation in 5*360=1.8 seconds. ​
  
 The code is documented well enough to present what happens in every step [[arduino:​sansui-repair-code|and can be found and downloaded here]]. The code is documented well enough to present what happens in every step [[arduino:​sansui-repair-code|and can be found and downloaded here]].
Line 202: Line 223:
 The problem was that the ''​setControlIndex(currentSourceIndex);''​ failed to activate the digital output. The code was running properly and activated another audio source at the knob movement, but it seemed that the first ''​digitalWrite(audioControlPins[index],​ AUDIO_ACTIVE);''​ was ignored by the ATMega328P processor!!! After adding a delay of more than 15 milli-seconds between the second and third command, the problem was solved. ​ The problem was that the ''​setControlIndex(currentSourceIndex);''​ failed to activate the digital output. The code was running properly and activated another audio source at the knob movement, but it seemed that the first ''​digitalWrite(audioControlPins[index],​ AUDIO_ACTIVE);''​ was ignored by the ATMega328P processor!!! After adding a delay of more than 15 milli-seconds between the second and third command, the problem was solved. ​
  
-Although the code now behaves perfectly at this point, the incident is rather suspicious and requires further investigation by anyone who likes to dig deeply. ​ +Although the code now behaves perfectly at this point, the incident is rather suspicious and requires further investigation by anyone who likes to dig deeply. ​Unfortunately,​ I was not able to reproduce it outside the circuit which was installed inside the amplifier. ​
  
  
Line 213: Line 234:
 Again, this improvement has not much of practical significance (unless we powered the amplifier from a UPS) and can be implemented simply as an exercise from anyone who feels conscious in power consumption matters, but requires electronics to remain on standby. Again, this improvement has not much of practical significance (unless we powered the amplifier from a UPS) and can be implemented simply as an exercise from anyone who feels conscious in power consumption matters, but requires electronics to remain on standby.
  
 +==== Inherent design flaw ====
  
 +All design decisions, in spite of having been taken to resolve a problem, they have a tendency to create another problem or to be subject to a condition that may be a disaster waiting to happen. Remember that one problem with the rotary switch was that when switching audio sources, you needed to pass through them and you heard them at the speakers momentarily. A solution with buttons which would select an audio source (or in our case with individual relays) would not present this problematic behaviour. Unfortunately,​ buttons may be subject to another problem. What happens if you press two or more buttons at once? A proper design should handle such a problem in two modes:
 +
 +  - Try to avoid having multiple switches (or relays) pressed at the same time. Old systems provided a mechanical release when pressing a button, but this did not stop us from pressing multiple switches at a time
 +  - If for any reason, multiple switches are pressed, no failure will occur both to the amplifier as well as the sources.
 +
 +In our circuit, the software disables all relays before switching to an audio source. In addition, during the start-up of the Arduino, we should make sure that the ports which control the relays do not provide enough current when they are in the start-up phase or when they are in the high-Z state since the ports are configured by default as Inputs. So, the first mode is covered. Yet, any software modification should always take proper care to avoid having two relays on at the same time. Actually, it should provide sufficient time after the de-activation of one relay before activating another.
 +
 +Regarding the second mode, the amplifier itself will not complain if its input receives a composite signal from several sources, provided that the aggregate voltage of the sources is within the specifications. In contrast, connecting the output of several sources means that the output stage of each source is somehow short-circuited to the output stage of another source. The lower the output impedance of each source, the bigger the problem. A solution would be to place a resistor in series with each source. In case two relays were active at the same time, the current from one source to the other would be limited by the sum of the two resistors. Actually the AU-X517R has made a provision for such resistors on the PCB, but unfortunately,​ wire bridges are installed at the place of the resistors. We could replace the bridges with the resistors if we like. The input impedance of the amplifier is specified as 47K, so a resistor of maximum 4.7K would not modify the specs considerably,​ yet it could provide the additional protection that we need.  ​
 +
 +    ​
 ====== Conclusion ====== ====== Conclusion ======
  
 This project gave additional life to an audio amplifier that in normal circumstances would have been recycled several years ago because of an inexpensive plastic gear. Sometimes, it is not the cost of the repaired equipment that is the driving force behind such an endevour. Imagine the case when your enclosed washing machine stops functioning because a simple plastic element in the mechanical timing sequencer has failed. There is no replacement part, so you need to buy a new washing machine. The new machine is a bit larger than the previous one, so you need to replace the entire enclosure, including the washing bin and the entire plumbing. The new bin does not match aesthetically with the old bathroom elements, including the tiles. Perhaps a renovation of the bathroom and subsequently the entire home is in order!!!! This project gave additional life to an audio amplifier that in normal circumstances would have been recycled several years ago because of an inexpensive plastic gear. Sometimes, it is not the cost of the repaired equipment that is the driving force behind such an endevour. Imagine the case when your enclosed washing machine stops functioning because a simple plastic element in the mechanical timing sequencer has failed. There is no replacement part, so you need to buy a new washing machine. The new machine is a bit larger than the previous one, so you need to replace the entire enclosure, including the washing bin and the entire plumbing. The new bin does not match aesthetically with the old bathroom elements, including the tiles. Perhaps a renovation of the bathroom and subsequently the entire home is in order!!!!
  
-Well, the above example, is not so far from reality and at some extent it has happened to real people I know. Imagine now that such an incident happens in an industrial line, where the chain of replacements that is activated by a simple inexpensive component may cost millions. Ingenious engineers should possess in their toolbox the knowledge to design and implement effective solutions.+Well, the above example, is not so far from reality and at some extent it has happened to real people I know. Imagine now that such an incident happens in an industrial line, where the chain of replacements that is activated by a simple inexpensive component may cost millions. Ingenious engineers should possess in their toolbox the knowledge to design and implement effective solutions ​to cope with such problems. 
 + 
 +If not persuaded about the practical usage of such an application,​ simply consider that we do it, first because we can, and second because we have fun doing it!    
 + 
 +If you have any feedback, please contact me via [[https://​www.fryktoria.com/​wiki-contact.html|this contact form]]  ​
  
-If not persuaded about the practical usage of such an application,​ simply consider that we do it, first because we can, and second because it's fun!     +~~DISQUS~~
arduino/sansui-repair.1555423535.txt.gz · Last modified: 2019/04/16 17:05 by Ilias Iliopoulos