Everything started when i replaced the brushed motor of my mini lathe with a new higher torque (from far East) brushless dc motor. It was for sale as a replacement part for sewing machines but did a great job for the mini lathe. There was no cutting force that could stop this motor.

On a rebuilt that i did on my mini lathe and as i had everything teared down i thought it would be a great idea to add some extra features to my brushless dc controller. Features like the option to stop/lock the motor in a specific position or turn it a specific number of degrees or even get the servo position encoder readout and use it to control a step motor for driving the leadscrew which thereinafter will automatically cut threads without the need of manually gears changing in the gearbox. (This is another ongoing project for automatic thread cutting which included an extra rotary encoder for the spindle positioning). “Kill two birds with one stone”.

So i start looking the controller PCB ( OD-P05-001-54 F2H0794-A0 UIDO or ODIN depending on which orientation you read it ) trying to understand how it operates.

It looked to have an onboard SMPS, some drivers and fets for the H-bridge, some logic gates and schmitt triggers and a central microcontroller to control everything onboard. The mcu has a label of 8132Z008 0C022 with no available information online. At least all my searches didn’t return any useful information. Nearby the mcu there was a pinhead 3×2 and measuring the voltages across the pins it gave a good chance to be an AVR ISP. I thought it would be a good idea to connect the AVR ISP and try to read this MCU and check if there is a known AVR under this package or at least a copy of. Since the voltage and ground pins where aligned there was no chance of short circuiting something that will make the magic smoke. So everything was straight forward.

I connected the AVR ISP between my (charging) laptop and the PCB and…. i plugged the PCB to the mains power.

……

……

Everything went black! I was wondering what did go wrong? I unplugged it from the mains and i walked down to the electrical panel. The Earth-leakage circuit breaker (ELCB) and the circuit breaker of the mains plug interrupted the mains! WoW! It looked to be something serious! I reset the ELCB as well as the circuit breaker and i started looking for the cause. I realised that the laptop was shut down! That was a really bad omen. Fortunately pressing the power on button boot the laptop normally. It seemed to have minor losses and of course lessons learned! Never again an electrical device mains powered connected to my tools without an isolation transformer. This was also the reason i built an isolation box with 1:1 transformer, a fuse box and a seperate ground banana plug to connect it only when needed.

On the PCB nothing seemed to get blown so i tried to power it on with nothing connected on it and yes it did power up but it didn’t function any more. The shock was big enough to blow the mcu.

Still, it wasn’t clear to me what happened. It looked to me for a short circuit from the PCB to the earth’s ground but what was that? And the adventure just began. There was no choice anymore from reverse engineering the controller and understanding how it did work and then try to build a safer and more robust controller implementing all of my extra requirements/features.

Step by step using my multimeter and supplying the PCB with 5Volt on VCC pins when required i started reverse engineering it. After two weekends of work here you have all the outcome of my spent hours in schematics.

We start with the power supply

The power comes from the mains passed through a huge safety fuse of 10A ! i don’t know what is going to get blown first here. Then there is an X2 capacitor and the Rectifier. Following the rectifier a 500 Ohm 1watt resistor is used to slow charge the two in series electrolyte capacitors of 680uF/250WV during startup. As i can imagine they are used in series to increase the voltage rating. Just a few milliseconds after startup Relay1 arms from the 15Volts produced by the SMPS (not yet discussed) and the RT1 is by passed. This is it. The output is a ~ 330V not isolated DC power. This is the BLDC (brushless DC) motor High Voltage used in the H-bridge. Believe it or not. The – (minus) of the mains full wave rectifier is directly connected to the PCB digital ground! Is something coming to your mind? I don’t know about you but i already make some imaginations… When i connected my AVR ISP onboard actually i did connect the – (minus) of the rectifier to the earths ground through my laptops usb. It doesn’t sound that safe does it? By connecting the minus of the rectifier to the earths ground, means that the mains is shorted to ground on each negative cycle of the AC. About 50 times per second for a 50Hz mains. This is the first design i see with no mains isolation. Attention! The same could have happened if i was trying to probe the circuit with my oscilloscope hooking the scopes ground on the digital circuit GND for reference.

Following the 330V DC we meet the SMPS that i did recognize on my first look but unfortunately i wasn’t so suspicious to take a closer look and see that there was also a second not isolated power. I imagined that everything was powered from the output of the SMPS.

On this smps there are two secondary windings producing 5Volt and almost 15Volt (14.7 measured). The 5Volts are further regulated by the TL431K linear regulator . I think there is no need for any further analysis here.

Close to the SMPS there was an optocoupler with a transistor and a higher wattage resistor that caught my eye.

It looked to be something separate from the SMPS but neither a piece of the digital circuit. After some continuity measurements i found that this was a circuit that grabs the mains frequency and supplies it in TTL Voltage levels to the digital circuit and specifically to the MCU directly.

Could this be a clock for some operations? Or maybe a way to identify if the board is powered by 110V/60Hz or 220V/50Hz mains power and adjust the duty cycle of the H-bridge? I don’t know but make guesswork as the mcu has gone and i can’t take real measurements on the PCB while running.

Turning to the Digital side i started by reversing the side of the Servo Encoder received signal path.

The encoder consisted of 3 pin outputs. The signals once on board are pulled up by resistors and decoupled by capacitors. Then they are passed through a schmitt trigger/inverter (74HC140A) twice to clear and invert twice the signals. The output of the schmitt trigger feeds directly the MCU where the MCU can identify the position of the motor’s rotor. These signals also feed two XOR gates (74HC86). My guess is that these gates are used to create a pulse output corresponding to the motors rpms. Then it could be used a dedicated hardware MCU interrupt just to count the motor rpms and the 3 encoder signals when there is the need to know the position of the rotor. Maybe on the startup sequence?

On the side of the H-bridge circuit there was an IC standing out from the others with some resistors around it.

A closer look showed me that U6 is an LM393 with two Op-Amps inside. My first guess was that this comparator is used to adjust the supplied voltage to the motor but after drawing the circuit on paper i realised that this should be an over current protection. A cheat to this was the R31 R015/3Watt resistor nearby which drove me to the conclusion of the overcurrent protection even before finishing the circuit drawing.

The R31 is used as shunt resistor. One side is connected to Ground and the other side is connected on low sides of the H-bridge so it can sense the current draw of each motor phase. The first op-amp is used to compare and sense the current and the second/followed one is used to convert the output of the first one to the logic level of 0-5V (open collector output). Something like analog to Logic converter. Running this circuit on spice it results that overcurrent protection is active High when current load is more than ~ 2 Amperes across the shunt resistor. The mcu pin on the other side could be there as an analog input to also read the current sense voltage drop but i’m not sure for this.

And now the real thing.

The H-bridge and it’s driving circuit.

Starting from the MCU side, the signals are first pulled up. Then depending if they drive the High side of the H-bridge or the Low side they are feed to a NOR (74HC02D) or OR (74HC32D) accordingly. These gates are used in combination with the overcurrent protection to directly cut off the driving of the H-bridge in an overcurrent detection. HIN, is active high but LIN is active low. Using a NOR gate on High sides when the overcurrent is on the one side of the NOR input is going to be High resulting always an output of logic 0 which means the H-bridge High side to be deactivated. Respectively using an OR gate on the Low sides when the overcurrent is on the one side of the OR gate input is going to be High resulting always an output of logic 1 which deactivates H-bridge low side which is active Low. For driving the H-bridge transistors the ID5S606 have been used which seems to be also far East ICs. The transistors on the bridge are the XNF15N60T described as Trench-FS IGBT with the characteristics of 15Amper, 600V and VGE=5V2.

The motor itself needs some reverse engineering as there are no available characteristics of it.

Out of curiosity i disassembled it to see the encoder implementation and measure the wire thickness used for the windings to determine what is the maximum amperage it can handle.

Here we see the 3 hall effect sensors used for the rotor position detection
I also soldered this extra Red wire at the center point of the Star for any possible future use. Just in case.

The encoder consists of 3 hall effect sensors positioned internally between the windings (as seen above) making it clear that all three are used for the positioning of the rotor and there is no index signal.

The output of the encoder is:

Blueu000111000
Yellowv110001110
Whitew011100011

Which corresponds to 6 steps of 60 Degrees.

The rotor consists of 6 neodymium magnets as seen above.

The winding wire thickness is measured to 0.51mm so it is a AWG24 which means a maximum load of 3.5Amper. The resistance between two phases is 5.2 Ohm (59 meters of wire?) and the inductance is 19mH. These in comparison to the 2 Ampere overcurrent control reverse engineered above will guide the design of the new servo controller.

Stay tuned!

This is my first fully homemade device i ever built and i built it before having enough knowledges on electronics. I found the circuit on the internet here. It is a very stable power supply with current limiting 0-30V adjustable and 0-3A adjustable which is enough for most of the electronic circuits. I also made a modification and added an Operational Amplifier for inverting the output Voltage in order to have symmetric voltages for powering Op Amps. The only disadvantage is that the negative voltage is 1 Voltage less than the positive (eg. if you have  a +6V positive output then the negative output will be -5V) and starts working after +1V of positive voltage.

The front panel is a printed cardboard.

PSU 0-30V 0-3A

PSU 0-30V 0-3A

Here you see the backside with the 2N3055 screwed on a heat sink

PSU 0-30V 0-3A

PSU 0-30V 0-3A

PSU 0-30V 0-3A

PSU 0-30V 0-3A

Most of digital circuits needs a fixed stable voltage for powering ICs like a microcontroller. So a very good solution for these voltages can be a computer power supply which gives you the fixed voltages of +/-12V +/-5V and +3.5V. By the option of symmetric voltages you can also supply operational amplifiers. Here you can see a modification i made to a PC PSU putting it into a metal/aluminium box making it look more professional and safe.

The front panel is a printed cardboard.

PC PSU

 

PC PSU

The cooler hole was cut by my Jigsaw Base

PC PSU

 

PC PSU

 

Inside

The IV-12/11 vfd tubes need 1.2Volt for the filament about 100mA each. In my clock project i'm going to use 6 tubes so the total draw current will be about 600mA which is to much for a linear regulator like LM317. The LM317 can be used, but it will be need a big heat sink to keep it cool. So i designed a step-down converter based on MC34063A, a pulsed regulator, which is also power efficient.

I could have been used a resistor in series with the filament but if any tube filament get burned then the other 5 will draw more current and get burned too. Also i could have been used the AVR to regulate this voltage than using the MC34063A but there wasn't more free space on the chip.

MC34063A Step Down Converter design.

The design is based on the MC34063A's datasheet. In this design i regulate the voltage to 2.5Volt because the tubes want to have a negative voltage about -1volt to get fully powered off. So i have put two diodes in series (with ones kathode connecting to others anode) connecting the negative filament pin to GND. By this, each diode works as a supply voltage providing 0.6V x 2 = 1.2Volt.   2.4V-1.2V =  1.2Volt which is the supply voltage needed for powering the filament.

 

Protoboard testing

MC34063A ProtoBoard