My Cordless Drill - Death of nickel-cadmium (NiCd), arrival of lithium-ion (Li-Ion)

by Ivan Hamilton 7/10/2008 11:48:00 AM

A few years ago low-cost rechargeable drills/drivers hit the market. I purchased a nice GMC 18V driver with two batteries.

It's given good service over the years, but:

  • the batteries don't hold as much charge as they used to
  • the batteries don't hold their charge as long as they used to
  • recently, the "charger" (timer & battery clip) died
  • recently, the plug-pack transformer died

The drill itself is perfectly fine, and I've worked around the charger & plug-pack issues, but the time had come... the batteries died completely.

Professional cordless tools often have replacement parts available, but my drill was only a consumer level item and years later, is completely superseded. A number of people have had success rejuvenating cordless tools by "repacking" the batteries. Often, the battery packs for these tools consist of a number of series wired "Sub-C" cells (18V = 15 x 1.2V Nickel-cadmium cells). At $3-$5 per Sub-C, that's $90-$150 for both packs. After making such an investment, a much smarter (and safer) charger would be justified. If the charger is not "smart" (i.e. it cannot detect when the battery is fully charged), then overcharging is likely, which will damage the battery.

With a new 18V drill + two batteries available for AU$99, repacking didn't make economic sense. Armed with the experience from my first, my wish-list was:

  • 18V - I like the power from the 18V driver, and want to keep that. 
  • Geared - My ungeared driver wasn't fast enough for drilling wood or plastic, but I still need power for driving screws.
  • Low self discharge - Sometimes I won't use it for weeks, I want it ready to go.
  • Smart charger - If I need to charge a half used battery for use tomorrow, I want to not think about it (and not  damage the batteries).
  • No hammer action - Even with the hammer action disabled, hammer drills have an amount of axial play that interferes with accurate bit placement.

Any geek worth his salt knows a little about batteries (phones, laptops, etc): Nickel-cadmium (NiCd) then nickel metal hydride (NiMH) then lithium-ion (Li-Ion) then lithium ion polymer (Li-Poly) cells. The latest professional cordless power tools have started to use lithium-ion (Li-Ion), and in my scouting around I found the Bosch PSR 18 LI-2.

What do I like?

  • At AU$250, it's much cheaper than other Li-Ion drills on the market at the moment.
  • The lithium-ion battery is only about half the size & weight of comparable NiCd batteries.
  • 18V power
  • 2 speed gearbox
  • 85 percent of the charge is retained, even if it has not been used for four months.
  • Charging station is automatically switched off when the battery is fully charged (with no memory effect, these batteries can be recharged at any time without reducing their charge capacity.
  • Interrupting the charging procedure does not damage the battery.
  • Not a hammer drill (no axial play)

With all the smarts included to prolong the life of the battery, I figure it should give twice the value of a $99 Nickel-cadmium (NiCd). Time will tell...

Currently rated 1.7 by 66 people

  • Currently 1.666666/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Mechanics | Pragmatism

DIY Servo Controller - The Plan

by Ivan Hamilton 6/24/2008 2:57:00 PM

Accurately controlling the position of rotating elements is the heart of a motion controlled system. Often stepper motors are called upon to complete this task. Although cheap and plentiful at lower power levels, more powerful versions are expensive and difficult to source.

Stepper motors have limitations:

  • Constant-power device (power = angular velocity x torque). As motor speed increases, torque decreases. 
  • More vibration than other motor types, as the discrete step tends to snap the rotor from one position to another.
  • Generally must be over engineered, so that there is no possibility that the motor will lose steps.

Another device is the servo motor. This combines a standard electric motor and position feedback sensor with a controlling circuit. The electric motor can be DC (brushed) or AC (brush-less).

At the hobby level Gecko (US$114) drives appear to be the norm. The Gecko appears to be a analogue unit with gain & dampening trim-pots. A test-point reflecting the error (as voltage) is available to assist in tuning with an oscilloscope.

There are a couple of fundamental components to these servo drives:

  • Actual position conditioning & decoding
  • Desired position conditioning & decoding
  • Error calculation (from actual-desired)
  • Error filtering (PID calculation)
  • PWM generation
  • H-Bridge

Actual position conditioning & decoding
This is the feedback sensor to determine the current position. They are built in to industrial servo motors, and industrial external sensors cost many $100s.
Hobby Option: A low cost optical encoder can be had for US$20, and with a little effort these can be fitted to a standard permanent magnet DC motor. The output from these incremental rotary encoders, is "quadrature" encoded (two output wave forms 90 degrees out of phase). Decode quadrature input with a microcontroller.

Desired position conditioning & decoding
The servo controller must be instructed of the desired position.
Hobby Option: Derived from stepper motors, the defacto standard is STEP & DIRECTION signals. A "step" line is pulsed, and each pulse represents an increment or decrement depending on the state of the "direction" line. Software such as EMC2 & Mach3 can generate these signals.  Decode quadrature input with a microcontroller.

Error calculation (from actual-desired)
Function: From the actual and desired position, an error level must be derived. This can be done via analogue, or digital means.
Hobby Option: Calculate with a microcontroller.

Error filtering (PID calculation)
From the error calculate an output level.
Hobby Option: Calculate with a microcontroller.

PWM generation
From processed error calculate an output level.
Hobby Option: Generate with a microcontroller. This is a logic level PWM signal (or signals) that control the H-bridge.

Produce a high power PWM DC signal.
Hobby Option: The H-bridge needs to match the motor. A simple 100mA unit can be constructed with BC548 NPN and BC558 PNP transistors. At 160A the 16 MOSFET Open Source Motor Controller project is the other extreme. Most setups will lie somewhere in between.

Converts electric power to motion.
Hobby Option: DC Brush motors provide the best performance/price. Genuine high power, low inertia, industrial servo motors cost many $100s. Existing automotive, electric scooter, & general purpose motors can be used quite effectively.

The most variable component is the motor. Different uses will require different motors, and different motors have different drive requirements. A number of DIY controllers, Elm Chan Servo, UHU Servo, Dspic-Servo, were all designed for the specific purposes of their creator, and integrate the H-bridge into the controller PCB. A modular approach, with a separate controller & H-bridge would be much more flexible.

I've created a prototype controller (PCB & firmware), and I'm using an off-the-shelf H-bridge.

This is my plan.

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


CNC | Electronics

BlogEngine.NET r11405 on Mono Patch

by Ivan Hamilton 5/22/2008 5:45:00 PM

I've just put my latest patch for BlogEngine on Mono up.

You'll find it on the newly created BlogEngine.NET Mono Patches page.

From your BlogEngine directory:

host:/opt/BlogEngine# patch -i /tmp/blogengine-11405.patch -p1
patching file BlogEngine.NET/App_Code/Controls/Blogroll.cs
patching file BlogEngine.NET/App_Code/Controls/MonthList.cs
patching file DotNetSlave.BusinessLogic/BlogEngine.Core.csproj
patching file DotNetSlave.BusinessLogic/Web/HttpHandlers/FileHandler.cs
patching file DotNetSlave.BusinessLogic/Web/HttpHandlers/ImageHandler.cs

Currently rated 1.5 by 104 people

  • Currently 1.519231/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


.NET | BlogEngine.NET

DIY Servo Controller - Four Axis Tangential Test

by Ivan Hamilton 5/19/2008 2:57:00 PM

I've setup Mach3 to drive the 4th axis tangential to the XY plane. This feature is used by vinyl cutters and such where the tool's orientation must follow the direction of travel. This includes lifting the tool before large changes (>45°), and lowering it before continuing.

This setup allows me to test my 4 axis servo controller in a "real world" situation. The motion appears a little jerky, but this appears to be Mach3 coming to a full stop before changing the 4th axis' direction (The RoadRunner test is not good for this since it's composed of lines and not arcs).

I've started making the mounts for the motors, but there is more tuning and testing to be done before final mounting of these motors on the mill.

When I'd picked up the motors, they had some heft. So out of interest, I put those motors on the scales... a total of 3kW (4HP) and 16.5kg (more than airline carry-on allowance).

Currently rated 5.0 by 2 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


CNC | Electronics | Mechanics

Trace Aces the slalom

by Ivan Hamilton 5/18/2008 5:12:00 PM

Went out with Tracey for a bit of motorcycle practise.


She's really come along way in a very short time. This time last week, she hadn't ridden for months, and had forgotten pretty much everything.

Now? Well... she's picking up skills quicker than a flash flood. If she keeps this up, she'll surely ace her "P"s test.

Currently rated 1.5 by 45 people

  • Currently 1.488889/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5



The Blackbird's broken radiator

by Ivan Hamilton 5/14/2008 10:12:00 PM

I took a quick trip out to the post office yesterday afternoon, and when I got back the CBR1100XX Blackbird was steaming.

Most people know steaming from a vehicle is not a good thing (unless it's steam powered). After the steaming, came the dripping... green blood (coolant).

I had coolant leaking. Leaking on to something hot (probably the exhaust). Busted radiator? Split coolant hose? Cracked head? I was hoping for something simple (and inexpensive).

After taking the covers off, it wasn't obvious where the source of the leak was... but the radiator was wet. Wet from one point down. It was most probably a leak in the radiator.

I removed the radiator, which on the Blackbird has the thermo fan mounted to it. Removing the fan revealed the problem... the fan had been rubbing on the radiator, and had worn through. The bike's never been dropped or abused, so I assume it's always rubbed and has just taken 30,000kms to wear through.

A call to a local radiator repair shop was answered with "If it's aluminum we can't repair it, it'll need a new core". That' didn't sound right to me. I'm a silent member of the Two Wheels web forums, and thought I'd check if anyone had any recommendations. A recommendation had been made for "Better Radiators Pty Ltd" at Lidcombe. That's 10 minutes away, so I dropped in with the radiator.

I arrived around 12:00pm. "Would you like it today?" I explained was hoping to go on a ride tomorrow. "Come back at 3:30pm". A number of repairs had been done (the fan had worn a large arc), and even the fan brackets adjusted for consistent clearance. All that for ~$50.

I put the repaired radiator back in, topped up the coolant, and let it idle until it warmed up enough that the thermo fan kicked in. There was some steam (water still on the radiator from pressure testing), but that quickly subsided and I went for a short test ride. A quick post-ride inspection show no leaks (everthing dry and no steam), and I'm back on the road 24 hours after the incident.

If you need any sort of radiator repair, I can highly recommend the guys at Better Radiators Pty Ltd at Lidcombe - friendly, efficient & economic.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5



Tuning my PID controller 2

by Ivan Hamilton 5/10/2008 10:44:00 PM

I've mentioned previously that I think it's beyond me to visually judge the performance of the PID tuning values in use in my servo controller.

I had created a simple program to test the response, but wasn't happy with the point to point style test it was carrying out. It's more important for a CNC machine to follow curves closely, than have outright movement speed.

To fix this, I've added a feature to the microcontroller, a sine wave test. The test was added to the controller, because for a good test, a position update needs to be present every time the PID loop recalculates. By placing the sine wave path generation in the controller, a new movement value is present every single PID update. I couldn't achieve this sort of high performance timing by sending updates down a serial line.

Also, the standard point to point test produces massive errors when the set-point jumps, masking the fine detail of an "error" plot. I've added it now (on it's own axis), and it's very helpful in seeing exact levels of error (the large scale of the movement would otherwise hide this relatively small error). 

Rotate 1 revolution forward and back in 1 second

Rotate 1 revolution forward and back in 5 seconds

In the above images you can see the reduction in error during a slower test (from +/-10 to +/-3). On the slower test, that's within 0.9 degrees.

I've also included a "steady state" option. This doesn't instruct the controller to make any movement, but it does record and display it. This lets you see the response to an external disturbance on the servo (the handy shifter!).

Armed with this new information... I still haven't gone back and re-tuned the PID values.

Currently rated 3.0 by 2 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


.NET | CNC | Electronics

Tuning my PID controller

by Ivan Hamilton 5/9/2008 4:21:00 PM

The nice thing about making your own PID controller, is that it's easily modified to add extra features. The nice thing about having PC software development skills, is that it's easy to whip up a small program for a particular task.

I've mentioned on a number of occasions, that I hadn't yet tuned the PID settings in my controller. I didn't want to do this because I could spend all day tinkering with values without being able to accurately judge the exact effect. What I needed was a way to monitor the servo response.

It took less than a dozen extra lines of microcontroller code, and a couple of dozen lines of C# (WinForms) to make a GUI application to test and monitor the servo. Once I had this, I could change values and with a mouse-click see the results. This made it very quick to tune by trial and error.

Step response before tuning

Step response after tuning

The best "simple" explanation I've heard for these values are:

  • P - Proportional - Spring - The greater the error, the more correction applied
  • I - Integral - Accuracy - The longer the error, the more correction applied
  • D - Derivative - Dampening - The more the error changes, the more correction applied

The best "simple" tuning method I've heard is:

  1. Set P, I & D gain values to 0.
  2. Increase P until it becomes unstable (post-step oscillations don't fade).
  3. Halve P.
  4. Increase D until overshoot is removed.
  5. Increase I until it settles quickly enough when disturbed

I used this method and it appears to work well, but this was a simple test on an unloaded motor. It will be interesting to try this once fitted to a more complicated system.

There is an issue with the current test... this a step-response scenario. That's great for a system which needs to move from A to point B as quick as possible. But in a CNC machine, it doesn't just move from one point to another. The motion controller (e.g. Mach3 or EMC2) will produce "smooth" motion with a constant stream of position updates. What is more important, is that the servo accurately follows this acceleration, than achieve high outright point to point speed.

In the future, I think I'll need to add a "Curve Follower" tuning option. Instead of jumping from point to point, this will drive the servo as if it was tracing a circle (a sine wave pattern).

Currently rated 2.0 by 24 people

  • Currently 2.041667/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


.NET | CNC | Electronics

Servo Controller - Four Motors

by Ivan Hamilton 5/8/2008 1:35:00 PM

After a bit of a late night, I've connect four motors to my servo controller. I wanted to clean up the layout a little, and I think for a prototype, it's pretty neat.

I had recently finished fitting encoders to my other motors, and thought it was time to test the limits of the controller.

I had always designed my controller to handle four servos, but didn't have the hardware to test it. Armed with the extra hardware, I had the opportunity to see how well my theory would work in practise. Once again, I was very happy with myself.

There's a couple of things the keen-eyed will notice.

  • The motors don't always turn at the same speed - The test here is limited by the power delivered to the motors. It's set to output 33% max. Different motors will have slightly different performance, especially when moving in different directions. The motors I'm using slightly prefer one direction to the other.
  • The motors overshoot - the PID parameters aren't tuned yet.
  • The motors sometimes hunt - it's the cogging of the unloaded motor & the PID parameters aren't tuned yet.

This test was just sending serial set-point commands. The controller can also be able to decode STEP+DIR input from Mach3 and such (I haven't fully wired up the break out board yet).

I've put it off long enough, I think I'll have to work on the PID tuning...

Currently rated 1.8 by 37 people

  • Currently 1.81081/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


CNC | Electronics

More Mono & BlogEngine issues

by Ivan Hamilton 5/8/2008 2:34:00 AM

I've recently submitted to the Mono team (and had accepted) a few patches to fix the issues I've found running BlogEngine.Net under Mono on Linux.

At this point, you will need the very latest Mono release (r102737) from SVN to get the fixes. These fixes are for Windows/Linux interoperability, cross directory master page & user controls, and Forms authentication.

With these fixes now applied, I now know of no problems with Mono running BlogEngine.Net on Linux. (I say "know of" because I haven't tested everything yet).

No problems with Mono, but there are problems with BlogEngine.Net.

The BlogEngine.NET code makes a number of assumptions (like a Dictionary will retain the order of items that are inserted) that aren't part of the .Net runtime's specification. I have 3 issued logged in BlogEngine.Net's Issue Tracker on CodePlex. All of the issues I've reported include the code changes required to fix them. Three weeks later, and they still sit there. There are three weeks worth of issues between mine and the latest one resolved. I expect we'll see them applied in about three weeks.

But on my system... all problems appear fixed.

Currently rated 3.0 by 1 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


.NET | BlogEngine.NET

Powered by BlogEngine.NET
Original theme by Mads Kristensen

About the author

Name of author Ivan Hamilton
"My inner nerd can beat up your inner nerd."

E-mail me Send mail



<<  August 2020  >>

View posts in large calendar

Recent comments





    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2020

    Sign in