Show Posts
Pages: [1] 2
1  Community / Bar Sport / A Casio power chord tale on: September 17, 2014, 06:49:51 pm
I have this old Casio piano (CTK-500) which I have taken apart before. Last time, it had to do with one of the switches. This time, it was the AC adapter input jack. It would still work, but it was flaky.

The first time I took it apart, I had an egg carton (which I still have) with numbers on each hole. Whenever I take something apart that I'm actually planning on reassembling, I draw a rough sketch of the chassis including the screw holes. When I take out screws, I write a number next to the hole on the sketch and then put the screw in the corresponding egg carton hole. And, I kept the sketch for future reference if I wanted to take it apart again. This turned out not to be as big a deal with this particular keyboard, because it didn't have a lot of different screws, and they didn't look similar enough to put one in the wrong hole. But, extra information doesn't hurt as long as it's correct.  smiley

I assumed it would be a loose solder connection. However, on closer inspection, the metal contact for the barrel plug's sleeve appeared mildly tarnished or corroded. In principle, I might have been able to reuse the existing connector by using some contact cleaner or a sharp pin to remove the corrosion from the contact. However, the circuit board layout and the cutout in the chassis is such that an exact match isn't critical, so it would probably be easier to just replace it. All I need is to get at the solder side of the board.

Unfortunately, there are no solderless connectors to speak of in this piano! There is a ribbon cable going to the actual keyboard, which is soldered on both ends. The speakers are soldered as well. Considering how long the piano has lasted with no major problems, this isn’t all that frustrating to me. The ribbon cable is long enough for me to flip the board without removing it, which would certainly not be a fun thing to do. So be it, I’ll work in place. The speaker wires, however, won’t let me invert the board. Last time I took it apart, I unscrewed the speakers and got enough access to the other side of the board to work on it. So I did it again.

In retrospect, I probably should have disconnected them instead, to avoid the speakers falling in just the wrong direction and damaging the circuit board. However, I got lucky for the second time in a row.

Out of curiosity, I gently wiggled the jack while looking at the bottom of the board. I don’t see any movement, but it doesn’t really matter, since I’ll be soldering here anyway to replace the corroded jack, which I now further suspect as the source of the problem.

I have a temperature controlled soldering station and one of those rubber bulb type things to suck up old solder. I desolder two of the three pins without hassle. I plan to gently prod the pins with a screwdriver to make sure they are not still partially soldered to the pads, lest I damage the board trying to remove the old part! I get to the third pin and – oops – the pad just came right off! Fudge!

Well, at least the power supply isn’t all that complicated layout-wise, so I can run a wire to the new jack. Following the traces from that hole to another pad takes just a few seconds. New jack installed with no further collateral damage. I looped a small wire around the pin, to an adjacent, appropriate connection, and solder it on.

I do a quick look over for solder bridges. Everything looks fine. But, what if some extra work is needed? It’s a low voltage circuit, so there’s no danger (to me) if I plug it in while it’s taken apart like this. However, the switch contacts, which are attached to the top chassis, mate with contacts on the circuit board. Thus, it is not possible to even power it on until a number of the screws are re-installed into the board. Well, I suppose it wouldn’t be a good idea to play the piano until it is completely assembled ☺

I put some extra hot glue around the new connector as a bit of added insurance, then I put the circuit board back. What do you know? The cutout in the chassis is almost a perfect match! Since this was my keyboard that I don’t imagine would have much resale value to begin with, I would have been prepared to modify the case slightly to use the connector that I had on hand. I screw the circuit board down, and then the speakers. Well, the bottom cover has nothing critical on it, so I’m going to go ahead and apply power. Sure enough, the keyboard’s power is now stable.

I suspect that the solder pad that came off was already partially lifted from the board. If this were the case, it might have been the main problem all along - it wasn't making consistent contact with the trace on the circuit board.

I would like to mention that this keyboard must have been designed pretty well since it has lasted as long as it has with only a few minor repairs (the switch problem I suspect was a result of abuse (not by me) rather than wear) Although it could have been made more serviceable, it would have cost more to do so, and possibly lost it’s competitive price with other similar keyboards as a result.
2  Using Arduino / General Electronics / Re: Where should I connect fuse? on: September 03, 2014, 10:19:24 am
An open ground with multiple voltages, in a nutshell, could cause the 5v to become a new "ground" for the 12v. This could result in current going the wrong way and/or too much current through certain parts, breaking them.

If you are using an off-the-shelf power supply, it may be current limited. If it has a LEGITIMATE "UL listed" and/or "CE approved" label, that means it has been tested under various fault conditions. It doesn't necessarily mean it won't be damaged by an overload or power surge-just that the power supply, itself, won't explode or catch fire.

The fuse should definitely be connected in the positive rail of the power supply you're protecting. If your 5v regulator is running off of the 12v power supply/regulator, you may only need one fuse, rated for the maximum expected current of both the 5v and the 12v parts of your circuit. Otherwise, put one fuse for the 5v and one for the 12v. If the fuse blows without an actual fault, you can try the next "common value" up. This is more likely to be a problem if your circuit has motors and/or a lot of capacitance (either a few big capacitors, or lots of medium sized ones in parallel). Also, logic circuits tend to be more sensitive than motors and their switching devices. In fact, the fuse may not be much help in protecting a logic chip: rather, it'll prevent an overload from causing a meltdown.

Even if the 5v comes from the 12v, a separate 5v fuse would give you more information on where the fault is, should one occur.

If you built your own 5v power supply using a regulator chip, it may have it's own thermal shutdown-check the datasheet. A regulator with a current or temperature limit may be all you need. If the 12v comes from a battery or a power supply who's specs are unavailable, it should be fused separately.

If you want to protect your circuit from overvoltage, that will be a bit more complicated. Fuses and circuit breakers respond strictly to overcurrent. One solution might be what's known as a "crowbar" circuit that is downstream of your regulator and fuse. In a nutshell, a crowbar circuit deliberately shorts the power supply in the event of the voltage going too high. Of course, this would be quite dangerous if you don't have a fuse!
3  Using Arduino / Sensors / Re: Encoder interrupts not working right when I use a shift register... on: August 01, 2014, 08:30:44 pm
Since my project doesn't really NEED an encoder, I decided instead to use Up and Down keys along with "Enter" and "Cancel" buttons. The reason I originally wanted a knob was so that I could move quickly by spinning the knob fast, and get right on the money by turning it slow (in other words, a pseudo-analog type of control). But, I discovered I could do that by having the incrementing of the minutes speed up the longer the button is held.

One solution I contemplated, but never actually tried, was to have an ATtiny84, whose job was basically just reading the encoder and talking back to the ATmega.

In a nutshell, the ATtiny would count pulses from the encoder, hold the "Forward" or "backward" pin HIGH until it gets an ACK from the ATmega, then it would subtract a count and momentarily turn off the direction pin, then turn it back on when the ACK input goes low.

This would prevent timing issues with the ATmega from interfering with the encoder process, as well as negating the need for interrupts (Not that they're necessarily bad, but there's quite a few specific things to keep track of that newcomers might find daunting. As I said, I did get it to work, but it quit when I added on to my program).

However, if you're reading an encoder for feedback purposes rather than a user interface (i.e. some kind of automated machine with precise positioning needs) you'd probably need either a faster processor, more efficient code, or both. One could also have a separate MCU for reading the encoder(s) and controlling the appropriate motor(s), which would simply listen for commands from the main computer.
4  Using Arduino / Sensors / Re: Encoder interrupts not working right when I use a shift register... on: August 01, 2014, 11:34:07 am
Here's a schematic as well.
5  Using Arduino / Sensors / Re: Encoder interrupts not working right when I use a shift register... on: August 01, 2014, 10:51:30 am
Here's the ISR for the encoder.

void encoder()

  if( digitalRead(ENCB) == LOW )
    Pos++; //if B and A are on at the same time, the knob is moving one way
    Pos--; //else it's moving the other way


    if(Pos > 1)
      Pos = 0;
      //increase Count by 1 and reset position to 0
    else if(Pos < -1)
      Pos = 0;
      //decrease Count by 1 and reset position to 0




Here's the code for the shift register:

void ReadSws()
  CSIS = SrIn();

  for(int z = 0; z < 8; z++)
    Sw[z] = bitRead(CSIS, z);
  if(PSIS != CSIS)
    if(millis() - lastDb > DbTime)
      if(debug == true)
        Serial.print("Debounced switch status: ");
      for(int z = 0; z < 8; z++)
        DbSw[z] = Sw[z];
        if(debug == true)
     if(debug == true)
     Serial.println(" ");
      PSIS = CSIS;
      lastDb = millis();
      if(DbSw[Knb] == false) //If active low switch is on
        KnobPressed = true;
        DbSw[Knb] = true; //Reset DB variable to off
    lastDb = millis();


byte SrIn(){
  byte x;
    digitalWrite(CE, HIGH);
  digitalWrite(PL, LOW); //Tells shift register to read inputs
  digitalWrite(PL, HIGH); //Tells shift register to store input status
  digitalWrite(CE, LOW);
  for(int z = 0; z < 8; z++)
  bitWrite(x, z, digitalRead(Din) );
  digitalWrite(ClkIn, HIGH);
  digitalWrite(ClkIn, LOW);
  return x;


PartClockMenu3 is a functional build, which does not include code for the shift register.

Nw_ShiftRegClock is the one that is having the problem with the encoder only reading in one direction. It includes the shift
register code. The shift register must be somehow related because when I comment out the call to the shift register read
function, the knob works fine.

I don't have the actual LCD programmed in yet, but I was planning ahead with the shift register so that I wouldn't have to program multiple things in at once. (The shift register and the LCD) In other words, I was planning on adding the LCD when I was certain that everything else was working as expected. The way I am viewing the results of the program at the moment is via Serial.print()
6  Using Arduino / Sensors / Encoder interrupts not working right when I use a shift register... on: July 31, 2014, 10:37:44 am
I'm trying to use a mechanical 2 channel rotary encoder as a user interface device. I had one of the switches connected to interrupt 0 with the input pullup turned on, and the other one connected to pin 3, which is set up as a regular input pullup (without the interrupt). Pin 3 is read within the interrupt function, using an "if-else" statement to decide whether to increase or decrease the counting variable.

Up until recently, I had it set up with one button to select stuff, but the project in question (an alarm clock using a character LCD) will need more I/O pins than the ATMEGA328P itself has. I figured shift registers would do the trick. So, I set up the "supporting code" for an input shift register in a separate function that is called at the beginning of the main loop. Now, the interrupt service routine still gets triggered, but it never seems to read the second switch on the encoder as it should within the interrupt function. As a result, I can only turn the knob in one direction.

Since I did do quite a bit of rewiring, I checked the wires to the encoder as well as it's ground connections. Then, to rule out the relatively small chance of the ATmega328 itself being broken, I connected the wire for the second switch directly to ground and spun the knob with only the first one connected. Then, it turned only in one direction, but opposite of what it was doing before, so this proved that both the software and the hardware were still able to read pin 3-but maybe not reliably enough to catch a momentary pulse...

I did comment out the shift register function to ensure that the encoder, itself, was still working properly (Hardware and software wise, since I had to mess with both to add the shift register) Without the shift register code, the encoder works as it should, reading rotation in either direction.

Although I have things in my shift register code that I don't have elsewhere (A few For loops and bitRead() and bitWrite() ) I've read the references to those functions and see nothing that suggests that they will interfere with interrupts.

At this point, I'm lost. All I know is that it must be some kind of software issue because commenting out the shift register code makes the encoder work again.  If the encoder didn't use an interrupt, I would suspect that my code was "too long" for the processor to catch the encoder pulses...
7  Using Arduino / Microcontrollers / Re: Arduino Pro 8mhz bootloader problem (ATmega328p) on: March 19, 2014, 12:35:50 pm
Never mind, it turned out to be a PEBKAC error. I didn't hook up AVCC properly (the wire was loose so there was no actual voltage on that pin) and for whatever reason, this caused the chip to work on 5v but NOT on 3.3v. I didn't think to check the power and ground connections simply because it worked fine on 5v  smiley-mr-green

Not sure why AVCC (for the analog to digital converter) would be required ONLY for 3.3v operation. I guess only the AVR engineers would know- or maybe not  smiley-mr-green

Somewhat embarrased, but I figured that I can't be the only one who had this problem and I was hoping to "save" someone from this very situation  smiley-mr-green
8  Using Arduino / Microcontrollers / Arduino Pro 8mhz bootloader problem (ATmega328p) on: March 10, 2014, 11:26:18 am

I'm having an issue with an ATmega328p. I was planning on using it in a project that runs on 3.3v instead of 5v, so I got an 8 MHZ crystal (with capacitors) and an ATmega328p. I was planning on using the Pro 8mhz bootloader on it. The bootloading process seems to go over without a hitch, at which point I do the "upload using programmer" option to upload my "blink" sketch to the chip. (I changed the blinking LED to pin 9 so that it would not be using the SCK pin)

The blink sketch works just fine running off of the 5v from my Arduino Uno. However, when I disconnect the Uno and attempt to power the chip with a 3.3v regulator, it is totally inert. I've checked the voltages everywhere when the 3.3v regulator is on, and it's not a power problem.  It's not the LED/resistor combination either because if I connect them across 3.3v, the LED lights up.

I thought maybe it was a bug in the bootloader program, like it didn't set the "brownout detect" fuse to the correct value or something like that. I can tell that my external crystal is working and the chip is running off of it, because it only works (on 5v) when said crystal is connected. I've already checked and rechecked the "board" and "programmer" options.
9  Using Arduino / General Electronics / Re: Electrical contact lube? on: November 27, 2013, 05:21:06 pm
I think I'm understanding you. The contacts in question are "logic" switches and thus, do not carry a great deal of current. Thus, the "non-conductive-ness" of the grease probably wouldn't have much effect.
10  Using Arduino / General Electronics / Electrical contact lube? on: November 27, 2013, 03:09:38 pm
Hey, all you engineers out there,
I just took apart an electric piano (Casio CTK-500) because one of the switches broke. I figured, if I can't fix it, I'll circuit bend it. I believe I will be able to fix it, so that's not really my question.

Here's how the switches work. There is a plastic block with metal contacts glued to it. The contacts ride on the circuit board below, connecting the right "tracks" together for a given position, but there is a ball bearing on a spring lined up with grooves to provide an artificial "detent" when moving the switch. There is some kind of grease on the contacts and on the circuit board. But, so many sources I've read have warnings saying NOT to lubricate electrical contacts. When I think about it, that does make sense for a number of reasons:
1. If the lube doesn't conduct well, of course the switch won't work well (or at all)
2. If the lube is conductive, it might let current go through paths that it shouldn't (in a multi-position or multi-pole switch) causing erratic or unexpected operation, or worse, the lube could "run" or "creep" into areas where it shouldn't be and connect two things that shouldn't connect, ruining the device. Over-lubricating mechanical components can also have this effect if the lube "runs"
3. A lot of lubricants (oil in particular) are flammable. Flammable liquids probably aren't a good thing to have around a powered circuit.   smiley-grin
4. Many lubricants attract dust and grime over time, and dirty contacts make for poor/intermittent connections.

With all that in mind, I was somewhat surprised to see the contacts greased like they are. At least there's not too much where "creepage" would be a problem, but how does it allow the contacts to work, without shorting the tracks at the same time? Having said that, I am somewhat surprised, based on the mechanism employed (metal contacts sliding on a circuit board) that the switches haven't had more problems, even with lubrication. The piano is around 16 years old.
11  Using Arduino / General Electronics / Re: LM317 regulating voltage but no current! on: February 10, 2013, 05:30:02 pm
Remember the golden rule: If so many things are wrong that you fail to understand how they can be so wrong, check the ground connections smiley-mr-green

Also, make sure the regulator isn't getting hot when it's sitting regulating voltage w/o load (and with load as well) because the LM317 has thermal overload protection to protect fools from themselves. If it is getting hot, use a heat sink, even an alligator clip on the top may do the trick! Remember, the bigger the difference between the input and the output voltage, the more heat is going to be dissipated. So, if you're regulating 30 volts down to, say, 9 volts, you'll be putting out a lot of heat even under a small load.

One more thing, look at *THEIR* example circuits on the data sheet ("they" being the makers of the voltage regulator) and compare them with yours.

If all else fails and you're sure your circuit is correctly wired (or you've corrected any "mistakes") then it's possible that the regulator is broken (age, prolonged overheating, incorrectly wired on power-up, etc.)

Often when I'm shopping for electronic components, if they're cheap enough, I'll get one more than I need in case I break one.  smiley
12  Using Arduino / Motors, Mechanics, and Power / Resistor in series with MOSFET gate? on: August 19, 2012, 11:07:01 am
Hey, this is just a quick question.

On another post, I was having trouble with a mosfet and a motor and I mentioned the fact that I just had the output line hooked directly to the mosfet. Someone recommended having a 100-ohm resistor in series with the gate. What is the purpose of that? Is it just to protect the arduino in case you connect the wire into the wrong hole on the breadboard (e.g. the drain of the mosfet instead of the gate?) I had one of those "inductive spike suppressing" diodes. I thought that the fact that the gate is isolated and controlled by voltage instead of current was the advantage of a mosfet over a regular transistor.
13  General Category / General Discussion / UL listed appliance with no fuse? How can this be? on: July 04, 2012, 11:07:41 am
I recently took apart a fan for someone who wanted me to fix it. It was UL listed according to the label on the back. However, I took it apart and I discovered that the motor is NOT protected against over load in any way, shape or form. A motor that has gummed up lubrication or failing bearings can eventually seize and this causes the motor to be "stalled" i.e. attempting to run but not able to turn. A stalled motor usually draws excessive current (but not enough to blow a 15 amp fuse in the electrical panel!) and this can overheat the windings, which damages the motor, and at higher voltages (such as from the wall socket) this could cause a fire!

Now, I'm fairly certain that since a stalled motor draws more power than a normal one, a properly sized slow-blow fuse would blow before a catastrophic failure occurred, right? Sure, it could blow due to a temporary condition such as a kid sticking something in it, but I'd rather put in a new fuse (or even get a new fan) than have my house burn down because I failed to periodically lubricate a <$20 fan! A thermostat mounted to the (usually metal) case of the motor would also work, though that might be more expensive than a fuse.

The scary thing is that the fan claims to be UL listed! How is that even possible? I thought UL was a SAFETY certification! How can an appliance with an unfused, non-overheat-protected 110v motor possibly meet any kind of safety standard??? Seriously, I'd hate to see an appliance that ISN'T UL listed! Does UL no longer even so much as look inside the appliance before approving it? How bad would it have to be to NOT be listed?

Besides, what bean-counter decided that they would rather face a wrongful death lawsuit due to a fire than raise the cost of the product by a measly 25 cents???
14  Using Arduino / General Electronics / Low battery voltage detector? (9v total battery voltage, 5v regulator) on: June 11, 2012, 12:53:40 pm
I was going to try and make a low battery voltage indicator using an LM339, and after I figured out the circuit itself I would connect it to an Arduino input, and make my program to give a visible indication of a low battery. What I was going to attempt was to have a 5v voltage regulator connected to "input 1 minus", using a voltage divider circuit with a 10-ohm resistor and a 4.7 k, to make the voltage go down by a very small amount. (voltage drop of like 0.1v on the 10 ohm resistor). Then, the 9v is hooked to a 2.2K resistor, then to ground through a 4.7K resistor, with the "input 1 plus" pin connected in between them. I use a 5k potentiometer to simulate voltage changes. The output can only sink current, so I have an LED wired to 5V, through a 470-ohm resistor then to the output.

The circuit does not seem to work as I intended. I wanted to voltage-drop the 9v through resistors to be close to 5v, so that when the battery voltage started to drop, the voltage that the chip would see would be lower than the reference voltage, causing the output to change. My LED just stays on all the time until the voltage is too low to actually light it up. That's not exactly what I'm aiming for. Am I missing something here? This circuit is currently on a bread-board by itself, I just wanted to figure out if my idea worked. So far, it doesn't.

If you use a series resistor voltage divider circuit, could you bring the battery voltage within the range of the analog inputs on the Arduino, and then just use the analog read function to check the battery level?
15  Using Arduino / Motors, Mechanics, and Power / Re: 9v Motor + Mosfet + Arduino = timing errors/crashes? on: June 05, 2012, 05:32:50 pm
Thanks. In an electronics class that I took previously, we were told that putting capacitors in parralel will result in increased total capacitance. I have a number of different values and about 6 of each, so I will add a 470 uf cap between 9v and ground, in addition to changing the batteries. If that doesn't help, I'll hook a few more caps in parralel with the 470 to increase the total capacitance and thus the noise/sag supression capability.
Pages: [1] 2