Mysterious things while hacking a Makita BLDC motor trigger - Page 1
Forum section: electronics / beginners

author: steveinfrance
author_rank: Newbie
timestamp: September 05, 2018, 05:13:55 pm
content: Firstly 'Hello to All'I've been tinkering with electronics for 50 years and am still alive to tell the tale although, in my youth, I did have some unfortunate contacts with anode voltages of Military wireless sets.I will try to explain the problem - please tell me if I'm not making things clear.I would like to use a Makita BLDC cordless drill motor and gearbox for some equipment we're making.It offers a compact and reliable motor and gearbox which will require a housing made but that's not a problem.The plan is to throw away everything else and drive the controller from a PLC and use an external power source.The battery supply has a small third terminal which, I think, goes to a temperature sensor in the battery.Connecting a 220resistor to +ve makes the drill happy to run off a bench PSU (it is an 18 V drill).Next, and this is where the fun starts, the trigger.It is marked as an Omron C3JW-4B but (apart from buying replacements at 1/3 the price of the whole drill) there's nothing about it on the Internet - trust me !Contacting Omron they tell me Makita bought out their division that makes similar switches and regard its workings as a proprietary secret so no datasheet.The trigger has two components - a set of beefy contacts to supply +V to the controller and a 5 pin miniature connector.There's a first pressure which switches power and a second pressure which starts the motor and makes it spin faster the more it's pressed.There's also a forward/reverse (F/R) switch.Nothing too difficult so far.Disconnecting +ve in and +ve out from the switch and jumpering them together lets the motor start on second pressure and run as expected.So, a 5 pin 'black box' to sort out.I cut the wires and took them to a breadboard - the drill still worked !With the controller connected there were three easy ones - GND which was common with I/P GNDOne which sat at 18 V until second pressure then fell to 0 V no matter what so it was there to detect 'second pressure'One which sat at 3.5 V with the F/R switch in 'Forward' and 0V with the switch in reverse.Disconnecting these from the trigger and jumpering them to GND as required gave the expected results - motor starts on 'second pressure' in the direction set by the F/R switch.This left 3 connections to the trigger - GND, grey and white (colour of wires).With the controller connected to the trigger white sat at 2.5V no matter what and grey went from 2.2 to 0V as the trigger was pulled.Easy !White is the excitation voltage for the speed pot and grey is the 'wiper' O/P.So, disconnect the trigger completely and look at resistance values with my trusty Fluke DVM.I should say for all resistance measurements I took them with the DVM leads both ways round in case of a diode type junction somewhere.The 'second pressure' detect went from O/C to 'closed' as expected, as did the F/R switch.White to GND read a constant 15while grey to GND went from 15 to 0so that seemed to fit in with white supplying 2.5 V across the pot which was passed back to the controller by grey on the slider to give speed.15seems a bit low but anyway let's connect two 10resistors between white (2.5 V) and GND so we should get 1.25 V at the junction and connecting that to grey should give half speed (or thereabouts).Now this is where the mystery starts (hope you weren't holding your breath).With the two resistors between white and GND white fell to 0V so it wasn't happy feeding 20let alone 15.I completely disconnected the trigger from the controller.I put a 220resistor in series with whiteand the DVM read 15between the free end of the resistor and GND.I put a 220resistor in series with greyand the DVM read 15 to 0between the free end of the resistor and GND.In other words the DVM couldn't see the 220resistor.How is this possible ? The 220resistor measured correctly.I checked white to GND and grey to GND for volts (in case of a capacitor or backup battery) and diode (both ways) but nothing.I repeat there was no voltage supply of any sort (apart from the DVM) to the trigger - it was literally in my hand.HELP (Please).

author: xavier60
author_rank: Super Contributor
timestamp: September 05, 2018, 10:47:02 pm
content: I can't make much sense of that. This is what I traced out on my DHP481 a few years ago.

author: steveinfrance
author_rank: Newbie
timestamp: September 06, 2018, 08:51:56 am
content: ThanksYour schematic is exactly what I expected and partially what I found.My problem is that yellow (gnd) to white on your diagram should give the resistance of the speed pot which measures with a DVM as 15.The exciting voltage applied to white by the controller is 2.5V.I tried to explain that if I put 20 (2x10) between gnd and white the voltage fell to near zero so the pot can't really be 15- which seems far too low anyway.I didn't believe the value so, among other things, I put a 220resistor with one end connected to the white lead and the other to the DVM.If the pot was really 15one would expect to see a reading of 235but it still read 15- as if the resistance wasn't there - which seems impossible to me.I can't work out what could possibly be inside the trigger to 'confuse' the DVM.Sorry about the glare on the DVM, I was allowing 5for the DVM leads so I said 15while the DVM reads 20

author: capt bullshot
author_rank: Super Contributor
timestamp: September 06, 2018, 09:23:42 am
content: Just a wild guess:There's no stinkin' pot inside the trigger, but a linear magnetic sensor (Hall element) with some signal processing. These are available as single chip solutions today and have three pins: GND, supply and output voltage proportional to magnetic field.This would (Edit: not) explain your DVM measurements as far as I could follow your description.Does the controller work if you just apply a variable voltage to the speed control (wiper?) input?

author: xavier60
author_rank: Super Contributor
timestamp: September 06, 2018, 09:27:19 am
content: I think that there is something wrong with your meter. Seems it is trying to tell you that the pot is 20300 ohms.Try measuring the 220 ohm resistor and some other values.Edit: I see where you said earlier that the 220 ohm resistor measured correctly. But look at the 2 readings in the 2 photos, the 22 difference.

author: steveinfrance
author_rank: Newbie
timestamp: September 06, 2018, 09:45:51 am
content: Xavier,You're absolutely right.I put 10K in series with the pot and measured the voltage drop.The pot is 20K and my meter has lost its decimal point sanity.I do apologise,Will go away and grovel but at least, thanks to you, I've sorted it.

author: Fred27
author_rank: Unknown
timestamp: September 06, 2018, 09:54:49 am
content: I may have missed something but it sounds like the "5 pin black box" is the brushless motor driver.If you want to simply drive the motor from DC then you'd be best to look at an earlier model that used a brushed motor.

author: steveinfrance
author_rank: Newbie
timestamp: September 06, 2018, 10:14:04 am
content: No, it was the trigger.My fault in trusting the DVM, and also paranoia that there was some sneaky Makita smoke in there.Sorted now, thanks.

author: steveinfrance
author_rank: Newbie
timestamp: September 06, 2018, 11:30:19 am
content: Last words !Xavier's diagram is correct (except there's no switch in the trigger on the grey lead).The pot is 20 K.The motor is running happily on an external DAC giving 0 - 2.5 V between grey and yellow (GND).White doesn't need to be connected to anything so it isn't current sensed.Red (trigger sense) must be O/C when power is first connected or the motor won't arm. It can be connected to GND a few ms later and then used as a start/stop signal to the motor.The motor will restart at any speed set by the volts on grey. Just remember that 2.5 V is 0 rpm and 0 V maximum.There's an irritating ~5 minute timeout built into the controller which stops the motor. This is reset by a quick O/C on red.Hacking BLDCs like this is quite attractive to robotic and other communities.Is there anywhere on the website we could put this thread or this post so it can easily be found with Google for lost souls like me ?Edit - I see it's already on Google. Worth changing the thread subject to just 'hacking a Makita BLDC motor trigger' ??Very useful to be able to talk a problem over - helps concentrate the old mind.Thanks again to all - I'll be back......

author: xavier60
author_rank: Super Contributor
timestamp: September 06, 2018, 11:56:22 am
content: I traced out the trigger in my drill for the opposite reason, to keep the trigger and build a replacement for the old burnt out motor controller. So I didn't get a chance to take any voltage measurements at the trigger.Looks like I have used it upside down with my replacement motor controller, using the White as negative ground.Although I didn't have to, I made my controller take notice of the 3rd battery contact. In my case I noticed it was the 3rd battery contact that times out every few minutes,goes high Z. A brief 5v pulse applied to the 3rd contact via a 100K resistor is enough to make it output battery voltage again. A MOSFET switches battery voltage via a 4 amp fuse.

author: xavier60
author_rank: Super Contributor
timestamp: September 06, 2018, 12:11:10 pm
content: I think I have figured it out. It is a simple handshake between the battery and controller.The controller expects the 3rd contact to switch off every few minutes. The controller then responds by pulsing the 3rd contact, causing the battery to turn it on again.I guess that if the battery feels stressed, it will hold the 3rd contact in the off state.

author: xavier60
author_rank: Super Contributor
timestamp: September 06, 2018, 12:39:50 pm
content: There is actually a 4th contact on the battery that is in line with the 3rd contact. the 4th contact has permanent 18v on it.When the battery is slid into the tool's battery holder, a blade momentarily connects the 3rd and 4th contacts together.This seems to be needed to initially wake up the battery.

author: steveinfrance
author_rank: Newbie
timestamp: September 06, 2018, 12:56:28 pm
content: How very devious.All I wanted was to make the controller think it was connected to a genuine Makita battery.I'd assumed the controller took a look at the third contact once and, if OK, forgot about it.I suppose it makes sense (literally) for the controller to check if the battery's getting red hot but-assuming it's a thermistor in there- I would have expected it to shut things down if the third contact went high or O/C rather than giving it a tickle (technical term) from time to time.I know there's a lot of processor in the battery pack hence a lot of complaints about it 'bricking' the battery on deep discharge so perhaps, as you suggest, the third contact is via the battery processor rather than directly connected to the sensor.Maybe I've got to spoof the third wire input to the controller along the lines you suggest.That would be good because it would be better, in my application, to keep the motor running for as long as I want rather than as long as the controller decides.This will keep me quiet for a while !Was your controller for a brushed motor ?If you managed to build a BLDC controller I'd be mighty impressed.Just out of interest it costs about £500 for a commercial BLDC motor and controller with less performance than the Makita which I can buy for £75 without battery, also programming these controllers is a right old game, so it's worth spending some time on a one-off hack for a potentially quite large production run.

author: xavier60
author_rank: Super Contributor
timestamp: September 06, 2018, 01:12:33 pm
content: I made the controller for a BLDC model, DHP481. It was a very challenging project and not really worth the time I spent on it.When I did actually need to use a drill to drive a chemical applicator, I used a brushed model.Much simpler to control the power directly to the brushes with a buck converter.https://www.eevblog.com/forum/projects/cordless-drill-hacking/msg1579870/#msg1579870

author: steveinfrance
author_rank: Newbie
timestamp: September 06, 2018, 02:20:01 pm
content: I'm impressed.The reason for a BLDC is that the equipment will have to work in some possibly difficult atmospheres.The drill itself is, of course, not ATEX approved nor could be because of the power switching contacts in the trigger.There's an electrolytic in the controller which produces a nice fat spark on power-on.I can't just put the whole thing in a sealed box because of air cooling for the motor so I can't use a brushed motor.If you're right about the handshake to the third contact I'd have to detect that and send something comforting back to the controller.I'll probably start by interrupting the red lead for a few ms every couple of minutes which seems to reset the controller timer and won't have much effect on performance.I'll have an optoisolator or reed in there anyway driven by the PLC so less programming to do and I/O to handle.As you say, it's still easier than building a bespoke controller.