Thursday 21 June 2007

The day the music died

Although I am fortunate enough to have a project room which is nearly 3m by 4m, as you can see it almost completely full of junk.



The large glass fronted MDF box on the far left next to HydraRaptor is a 400 CD jukebox that I designed and made in 1990. I used it for about 10 years until the CD player's laser wore out. At that point I ripped all the discs and stored them on my PC as mp3s. I haven't used it since but I could never bring myself to dismantle it as it is probably the best thing I have ever made. However, this week I got fed up of not having enough work space so I decided it had to go.

This is what it looked like. It had a sealed glass door on the front which is hard to photograph.



Here it is with the door open.



The discs were stacked 10 high on wooden pegs arranged in semi circles of six on seven shelves, i.e. 42 sites. The bottom shelf had a hole in it above the open CD player drawer and an empty peg used to store the next disc to be played.



That left 40 pegs of ten discs giving a maximum capacity of 400 discs. Worst case, to play a disc at the bottom of a peg, involved moving the nine discs above it to three nearest neighbours. This took about 40 seconds but as long as the playlist was not empty it would get the next disc ready and place it on the peg next to the player. It would then move the discs it had moved out of the way back onto their home pegs. Then it would hover above the player waiting for the disc being played to finish. When it did it would lift it out of the drawer and stash it on an the adjacent peg. It would then insert the new disc and while that was playing it would return the previous disc to the top of its home peg. That way the most popular discs tended to be at the top of their pegs for fast access.

The discs were moved by a robotic arm with a rubber suction cup on the end made out of a toy dart.



This was moved radially by a stepper motor with a gear box. It was attached to a trolley on steel rails which was moved vertically by a toothed timing belt driven by a large 12V DC motor with a gear box. As you can see the end of the arm has three micro switches. The left hand one was used during initialisation to find the home position of the arm. The other two were just for safety. The vertical motor is so powerful it could easily snap the arm off so I wired the limit switches in series with the motor so if the software crashed and left the motor running it would do no damage.

The arm is actually made of two pieces of perspex clamped together at the hub. When the arm descends onto a disc the top piece bends way from the bottom piece and a pair of switch contacts between them part. Again this was in series with motor for safety.

Here is a view of the electronics shelf after I removed the top :-



On the far left is a mains modem which allowed my PC upstairs to communicate with it when it was in its original home in an under stairs cupboard.



Next to that is a small switch mode PSU which powered everything.

In the middle is an aquarium pump which I used to generate the vacuum to lift the discs. I converted it from blowing to sucking by sealing the case and connecting a pipe to the air inlet underneath.

On the right is the controller :-



This is a Motorola MC6809 microprocessor with 32K battery backed RAM, 32K EPROM, a timer, a UART and two PIAs. Nowadays this would be a single chip. Here are the circuits, no free ECAD programs in those days :-



Here is a view with the electronics removed :-



Here is a close up of the mechanics :-



The vacuum pump took a while to build up pressure and release it again so I made a solenoid operated 3 way valve to turn the suction on and off quickly.

The top circuit board is an opto detector which looked at tabs on the right hand rail to know where the shelves were. The board below it is a vacuum pressure sensor to enable it to know if it had failed to pick up or dropped a disc. That only happened during development really but it was vital to detect it otherwise it would lose track of which discs were on which pegs. Originally there was just one vacuum sensor but about twice a year I had to recalibrate it. Eventually I realised this was because the change in atmospheric pressure, due to weather, was greater than the vacuum level. I fixed it by adding a second sensor and measuring the difference between the vacuum pipe and atmospheric pressure. Not a very cost effective solution as the sensors were about £13 each.



Here is a video of it moving some discs. I had to drive it manually from the test routine as it would not run without a working CD player.


You probably will have noticed that each time it picks up a disc it pauses over the peg for a while. This was because the discs tended to stick together by suction after being pressed by the weight of the ones above. This was mainly cured by putting a small circular spot label near the centre of the disc to break the seal. The delay gave time for the second disc to drop back onto the peg if it did initially lift.

So now it is no more, but perhaps I might reuse the vacuum system and the metre long axis for some sort of pick and place machine.

Monday 18 June 2007

Disaster, frustration, success, disaster

Not posted for a while because I couldn't get the I²C link between my main controller and the spindle controller working. Before that I had a minor disaster when I crashed the drill chuck into a block of plastic. It appears to have bent the shaft out of true as the tool runs a little eccentrically now. The drill was made by Minicraft but they seem to have gone out of business. This made me realise how precarious it is to make something out of surplus components and things you have to hand rather than readily available parts. If I break anything then it might be impossible to get a drop-in replacement. Something like the $4000 XY table I got for $400 would be virtually irreplaceable.

Fortunately the drills seem to crop up on eBay fairly often. I got one almost identical except that it has a collet chuck rather than a three jaw one. It seems to have a bit of end play but this appears to be due to the bearing being loose in the housing rather than having play itself. I should be able to fix it with glue or shim it with a washer.

The I²C problem was a nightmare. I could get it to work if I stepped through the code at either end but not if I ran it. I was fairly sure the software was right because I had used the MSP430F2013 code before on a very similar device and it was based on an app note. The code at the MC9S12NE64 end was a translation of some code I used recently on a Coldfire which seems to have an almost identical I²C module. Not surprising as they are both Freescale devices.

Obviously it was a timing issue but all the timing should be done by the hardware. I am only running it at 100K baud and with 1K pullup resistors over 4 inches of cable I should have no problems. Looking round the Web I found an errata for the MSP430 which seemed to have lots of I²C bugs in the B revision of the chip with no workarounds. Mosts of these are fixed by revision C but my chip seems to have an X where the die revision should be.

Because the problem manifested itself as a lockup it wasn't possible to get a repetitive signal to look at on my analogue scope. I decided I should really have a digital storage scope for these types of problem so I ordered a cheap USB scope front end made in China from a company in the US. $360 plus shipping for 100MHz bandwidth, two channels, 250 MSps. Not bad if it works and the software is half decent. Most software to support hardware seems to be complete rubbish these days. I have had four PC TV cards so far each with decent hardware but software that is utter crap.

While waiting for it to arrive I decided in desperation to try reducing the clock speed of the MSP430. To my amazement dropping it from 16MHz to 8 MHz appeared to fix the problem. So definitely hardware not software then.

Flushed with success I added a Python function to control the drill speed by sending a command via Ethernet to the main controller which forwards it by I²C to the head controller. This worked fine but as soon as the drill made contact with the tool height sensor for the first time the sensor stopped working. I thought the shaft of the drill was ground but actually it was +12V. Now that the power supplies are linked by the comms cable it stuffed 12V into two of the 3.3V inputs of the MC9S12NE64 and not surprisingly they don't work anymore! In fact I am surprised any of it still works but most of it does.

So, major disaster. It will be very difficult to replace the chip as it is fine pitch surface mount. I do have some spare inputs I could use providing the rest of the chip holds out. I can probably still buy another demo board but its starting to get expensive repairing my mistakes.

Curiously the replacement drill seems to have an isolated shaft. I knew the first one wasn't but I assumed it was ground not +12V. However, it wouldn't have made any difference because foolishly I switched it with a low side driver so when it is off both wires are at 12V!

So now I have to rewire the tool sensor inputs, add some protection and cobble the two drills together to make one good one, preferably using the motor with the isolated shaft. The I²C comms need beefing up a bit with a CRC, packet sequence flag and an acknowledgment / retry mechanism. I also want to add drill stall detection and employ the shaft encoders on the XY table to detect that stalling as well. Hopefully then I will avoid any more costly tool crashes and move on to making the RepRap extruder.

Monday 11 June 2007

Rewire

Well I got dissed at work today for my two line post over the weekend so I thought I had better post something more substantial even though I don't have much news. I spent most of the weekend rewiring HydraRaptor when I wasn't watching the Formula One Grand Prix.

I got a solid state relay from eBay for £16 to control the vacuum cleaner. I have had reliability problems with SSRs in the past so I went for something with plenty of headroom.



It's rated at 660V 25A with 250A 1200V surge capability. It's completely over the top and I know I could have got something a lot cheaper but it looks impressive.

The vacuum cleaner is rated at 1300W so it can theoretically draw 5.4A although it measures a bit less. This plus the rest of HydraRaptor exceeded the rating of my mains inlet which was 5A. If it was a plain socket I might have chanced it with a small overload but it was a cheap filtered inlet from an old PC PSU so I didn't want to risk it. I had to upgrade to a 10A inlet socket and upgrade the mains lead . I installed a 3 pin outlet socket on the back of the machine for the vacuum and I then had to fuse back down to 3A for the rest of the internal wiring.



I also installed the spindle motor speed controller and a 12V 3A power supply. While it may seem wasteful to have two separate power supplies it does have one big advantage. The main controller and the stepper motors are powered from a 24V 100W PSU. All the heads will be powered from the 12V supply and linked to the main controller with an I²C bus. Both PSUs have floating 0V rails so there will be no motor current flowing down the comms ground between the two controllers. This will allow me to use only single ended 3.3V signals rather than differential or RS232 signals which would normally be needed to combat ground bounce. Here is a block diagram. As you can see there are no signal grounds shared with power grounds and there are only four wires from the main machine to the heads. Once I am able to make PCBs I will shrink the motor controller using surface mount components and mount it on the Z axis together with a similarly shrunk extruder controller.



Here is the current state of the machine, getting ever more complicated :-



Just software now to complete the milling machine and then on to extruder.