2015. február 21., szombat

CNC Motor Driver 1.

A long time ago I started to work on my CNC spindle drive. After many experiments I rendered the whole unit to useless. Today I've a dead 230W motor, a dead 600W switching power supply as a result. The box of the power supplies are taken apart. So the thing not looks great.
A few month ago I started a project to reanimate the thing.
Now I've a new power supply and a new 400W motor on hand. The only thing is missing the electronics between this two.
When I started not even considered to use the original electronics. It is a useless crap.
I have had some goals:
  1. Switching on/off from software
  2. Control the rotational speed from software (g-codes)
  3. Creating a closed loop control with measuring just the motor current and voltage. Not using optical encoder, hall sensor or any similar thing
  4. Adding some kind of digital RPM display
Unfortunately I not documented this project as deeply than I did it with the previous ones, but I write some notes about it now when I reached some of my milestones.
So:
Milestone 1 - Measure the motor rotational speed
If I put a diode in series of the motor, the diode will close briefly every time the motor brush step from one commutator segment to the next. This happening because of the sudden change in the magnetic field of the motor. When this change happens the the motor's windings are try to work against the power source, creating a negative current pulse (sorry for my phrasing, I'm not a native English speaker, and my study of physics happened long ago). This can be measured:


Ok, we can measure the frequency of the above pulse, but I thought, not to feed this signal directly into an MCU, so I did some shaping before.
First of all the signal decoupled with a 1uF capacitor, to keep just the AC part. After this I filtered out the frequencies above the the maximum I can get.
BTW what is the maximum here? The motor has 15000 rpm maximum rotational speed. This ok, but to keep some room, we can start to calculate from 30000 rpm. It should be devided by 60 to get the revolutions per second, and multiply by 12 what is the number of the segments in the commutator. This gives to us 6kHz. Everything above this can be eliminated. The filter in the current circuit has ~7.5kHz:


The filtering is needed because of the switching noise coming from the controller (In the further development this noise will be reduced as much as I can)
The filtered signal is fed into an MCP6002 opamp after transposed to the half supply voltage (2.5V in this case). The opamp is acting as a Schmitt trigger. The hysteresis is set to ~35mV. This is high enough to eliminate the remaining noise but low enough to be able to catch the signal what is around 200mV. At the output of the opamp is a stable square wave what is proportional to the rotational speed of the motor.
Milestone 2 - MOSFET driver
I needed a switching MOSFET driver for the motor. From the first look it looked simple, but finally it came out that I need DC to drive the circuit above, with the least possible amount of noise and clearly high side switching. The circuit come out is closer to a buck regulator then a simple MOSFET switch.
I chosen a P-Chanel MOSFET for switching, because the required maximum current (~8.5A) can be easily handled with a relatively low cost MOSFET and eliminate the rather tricky circuit or specialized driver IC needed for driving an N-Chanel MOSFET on the high side.
Theory of operation:
When the incoming PWM signal get high, the Q2 start to conduct and pull down the gate of the MOSFET 10V below the 48V rail (restricted by the D3 zener) and the FET start to conduct. The 50mA what can flow here is enough to fill the gate capacitor of the FET. At the same time Q1 transistor's base pulled down keeping the Q1 in nonconducting state (the D2 is used to protect Q1 base to not go bellow the BE diode rated voltage). When the PWM signal goes low, the Q2 stop conducting allowing the FET gate to go high, but because of the high gate capacitance the FET would not switch off fast enough. Here come the role of the Q2. When the Q1 stop conducting the Q2's base is pulled up to the rail through R1-D2. The Q2 start to conduct and the FET's gate capacitor gets discharged through Q2.
The high energy square wave generated by the MOSFET is fed to the L4-C8-D4 buck network creating a DC signal proportional to the PWM signal.

There is still lot of work to go, but here is the first working model:

 
 
And here is the schematic design:


2015. január 29., csütörtök

My newest "project"

My older daughter asked me to create some lighting to her into her paper lamp.
I had twenty minutes to achieve (together with the parts collection).


And yes, if you switch it on, it lights up. Purple! Awesome! :-)

2014. október 25., szombat

Display "harvesting" 1. - Power Up

As I have nothing more to do with the logic analyzer now (there is national holiday here in Hungary and I'll have other things to do on the next week, I've no chance to get a new quieter fan and work with it till 2nd November), I picked something waiting to me from the drawer.


I've around fifty of this. I've no PBX for this anymore, so it is useless except for some parts "harvesting".
First of all I disassembled one, and realized, that the only part can be useful is the display unit. I need to reverse engineer a little bit to find out, how can I drive it.
I was looking around but nothing found on the internet. No information, no service manual, no schematic design. In addition the display driver chip is the regular silicon mounted on the board type:



(how I hate these)
So, the first thing, to power it up somehow, because without the PBX, I not even know what kind of power source is needed. It was obvious for the first look that the main board contains a switching regulator:


I looked to the regulator IC, it wasn't familiar to me:


But I assumed that -5 mark means 5V. If I connect a little bit more than 5V to the +- pins of the rectifier bridge:


It will bring the unit alive. And around 8V:



The unit started.
To be continued...



2014. október 22., szerda

Logic analyzer project 2. - first "repair"

After thinking a lot (2 sec) and reading thoroughly the service manual (5 min) with a long hard work (30 sec) I repaired the bigger fault of the Logic Analyzer. The soft key button error:


And the high tech advanced tool used for the repair:






You see correctly it is a cosmetic cotton pad (a dirty one).
Explanation:
The unit has touch screen. This called "soft keys". Because of the age of the unit it is not a capacitive or resistive touch screen but an optical grid created with infrared LEDs and phototransistors.

  1. When I first seen the error I think that one of the LEDs may failed (2 sec)
  2. Then I read the manual what the error code is about (5 min)
  3. When it proved that my theory is close to the possible cause, first cleared the frame of the display (30 sec)

Logic Analyzer project

I was crawling on eBay, and found an old Tektronix 1240 logic analyzer for a few bucks. The seller stated, it is defective because the picture intensity is weak on the screen (and it has defective soft buttons as it can be seen on the pictures).


I was thinking a little bit. This logic analyzer may not the best for today's digital electronics projects, but a good looking something what may deserve a restoration.
What if I replace the monitor with a same size LCD panel. So I took a bid on and bought it. Afterwards I found the service manual online. At a quick look in it found out that it produces an NTSC like TTL level signal for the display. I'm quite sure it is convertible to the current LCD screens.
After the bidding I was looking around the 7" LCD displays. Now I think it will be not so easy to do the conversion. Today's plan is the following:
Pick a low end FPGA (or a CPLD) attach some RAM to it. Read the signal into the RAM from the logic analyzer, and drive the LCD with the FPGA using the RAM as a frame buffer. (I can't do this in an MCU because the LCD panel needs 40MHz signaling)
To be honest, I've not even touched FPGA before ever, but this project could be a good one for learning. :-)
So I ordered an LCD and the necessary connectors and evaluating FPGA development boards.
After this introduction the Logic Analyzer arrived today.
I switched it on. And my colleague immediately found the contrast knob at the back side of the unit. So you can see here how week the display in reality:



As we see the todo changed:
- Repair the soft button problem
- Change the extremely noisy fan
I don't want to cancel my display change idea. I found that this series of logic analyzers has one bigger model: 1241. It has color display. What if I can "upgrade" mine to color one. If it is possible based on the Service Manual, I'll try. :-)

2014. október 18., szombat

Multimeterless 4. - Uni-T, Philips

I've some more information about my Multimeter business. The problems with the Uni-T shipment finally got a resolution. I was waiting endlessly to the seller to resend them. A day before the resolution deadline from ebay, I sent one last message without answer, so I escalated the case to the ebay. The money arrived back, but no multimeters.
Because finally I've plenty of them on hand, I highly thinking about this Uni-T ones. I'm not sure if I still need them. The only problem that not all of them was ordered to me, so I should discuss with my friend what to do.
After a long journey my Philips PM2525 also arrived. It was a some mistake by the shipping company. It went to the Czech Republic instead of Hungary, and afterwords back to Germany. The seller seen some strange information in the online tracking, so asked me if it arrived. I told him, that I haven't received it. He called up the shipping company and after some rerouting the multimeter arrived.
As it here, As usual, I made some measurements with it:
DC Voltage:


It looks on spot
Resistance.
When I first tried it was a mess. I finally find out that the test lead I'm using is a crap. And the result:


It looks like it is on spot. Great meter.
Finally I tried to look inside. It is a definite failure:


I just have a bit type Torx screwdriver what doesn't fit into the hole deep in the stands of the meter and I don't want to destroy the screwheads - go shopping! :-)

2014. október 14., kedd

POM #1 - Voltage inverter for breadboards 3.

The PCBs are arrived. I got 11 boards altogether what makes me possible to produce 44 inverters. The board quality is not worst than the ones created by seeedstudio's fusion service, and I got some nice stickers with the boards.


Thanks Ian!
I think this is not the last time I ordered from DirtyPCBs.