Jeremy W. Langston

Personal Website

Month: November 2010

Sawbot Update 3 – Rough, RUFF Drawings

Here’s a quick mock-up of what I’m planning for Sawbot.

The general idea is a 4WD independent differential-drive with a central pivot between the left and right sides providing suspension.  Each wheel is individually driven using its own motor and ESC.  Doing this allows for more functionality in turning, and slip monitoring when coupled with an ammeter or an encoder.  The central pivot point will be a passage for wiring, etc.  You can see the arduino for scale, as the tire OD is 6″.  Large.  Not sure what will change or will stay the same.  With my Sketchup track record, I’ll likely never see this platform…

Sawbot Update 2

So, I wrote a bit of code to control brushed DC motors from a Logitech USB Gamepad -> Custom VC++ Software -> Custom Arduino Software -> Motor Driver -> Brushed DC motor.  This is mostly just temporary code to test things.  Ultimately there will be three modes of operation:   remote via RC transmitter, remote via PC, and autonomous.  Depending on how I decide to control this thing, the RC transmitter/receiver will be pretty much plug-n-play.  Autonomous control will come much later.  This is something I’ve done before and know how much work goes into it.  Remote via PC is fairly straight-forward, as I mentioned.

Here’s my code, including the Arduino sketch and the code for VC++:

DCMotor

The DCMotor class talks with the Arduino via the USB using RS232 communications.  I had to make my own protocol for passing commands to the Arduino to control the motors.  Right now each message is composed of the following:

<STX> <Forward> <Speed[7-0]> <Speed[15-8]><Speed[23-16]><Speed[31-24]> <ETX>

Each are bytes, where:

STX = start of text = 0x02

Forward = 1-forward, 0-back

Speed[#-#] = individual bytes of the unsigned int speed

ETX = end of text = 0x03

Inside the DCMotor zip are the DCMotorTestDlg .cpp/.h files I’ve used.  They can’t be directly built because there are several other files needed.  Really all you need to know are how to use the DCMotor class and how to talk to gamepads.  In the OnInitDialog() method of DCMotorTestDlg I make the following three calls:

m_DCMotor.Create(“DC Motor”, WS_CHILD|SS_NOTIFY, CRect(0,0,0,0), this, 6666);

m_DCMotor.Open(“COM13”);

SetTimer(m_pTimer, 20, NULL);

Create() is used for making a window.  The window is used for sending messages internally and externally. Internal messages go to/from the internal thread which does the communications to the Arduino.  External messages aren’t really used for much right now, but I’ll eventually rewrite all of this to be a Sawbot controller which will give status updates.  Open() does exactly what you think.  For now, I’m running at 9600, 8, n, 1.  SetTimer() is used for polling the gamepad for button presses.  I won’t get into the details of why I do polling instead of interrupts, except to say that polling allows for more use of the gamepad.  Feel free to let me know I’m wrong.

As you will see in OnTimer() method of DCMotorTestDlg, I issue move commands to the DCMotor class based on the analog X position of the gamepad.  Sorry about the massive lack of commenting.  I wrote it fast, but what isn’t obvious can be Google’d.  Just in case, here’s a quick explanation of what I’m doing.
if (bJoyPresent){
if ((joyInfoEx.dwXpos < 28672) || (joyInfoEx.dwXpos > 36864)){
if (joyInfoEx.dwXpos > 32767)
m_DCMotor.IssueCommand(true, (joyInfoEx.dwXpos – 32768)/128);
else
m_DCMotor.IssueCommand(false, (32767 – joyInfoEx.dwXpos)/128);
}
else {
m_nLastXpos = 32768;
m_DCMotor.IssueCommand(false, 0);
}
}

First, I’ve retrieved the gamepad/joystick info (refer to lines 104-109 of DCMotorTestDlg.cpp, not shown here).  If a gamepad is connected, then I check to see if I should command the motor to move.  I’ve put a dead-zone of 8192 (between 28672 and 36864).  This is to prevent the motor from always wanting to turn unless the value is exactly 32767.  Then I noticed a mistake.

The Arduino is an 8-bit microcontroller, and the pseudo-analog (read:  PWM) output I use to control the DC motor is 8-bit.  That’s a range of 0-255.  Much less than 0-32767.  So I divide by 128 to get in the appropriate range.  Not a big deal though as I doubt I will ever need to do anything more refined.

If you don’t quite follow my mental defection logic, feel free to leave a comment and I’ll explain.  Also, this code is very very basic and unfinished.  The Arduino code is easy to follow and uses the same protocol I stated above.  I’ll post up a demo when I get a chance.

Sawbot Update 1

I spent some time the other day modeling the HF 18V Circular Saw motor and bracket.  Since I don’t have the money for pro CAD programs, I use Google Sketchup.  Great product for free, and it’s very simple to use.  The most time I spend modeling is just using the calipers, rechecking, and then checking again.  I’ve posted the sketch to the Sketchup Warehouse.

HF 18V Circular Saw Motor

While modeling it, I’ve been thinking about how to mount it.  There aren’t any easy flat faces and the cast aluminum is only about 0.1″ thick.  Several options are available.  I could mill the front face flush and machine an aluminum mounting plate for it to mount to.  This isn’t my preferred choice because it could easily break and I’d be hosed.  Another option is to make a similar mounting plate without milling the current bracket.  That’s the easiest way out, and I haven’t completely decided against it.  The four deep holes on the corners could be threaded or just put a bolt and nut to it.  Since there isn’t a lot of material there, helicoils wouldn’t be an option, but there’s a full inch to bite onto so…I don’t know yet.

Another option is to make a custom bracket that would mate directly with the black plastic gear casing.  The longer I look at it, the easier it looks to do.  Here’s a closer look at what is actually inside.

As you can see, the current bracket houses a 6000RS series ball bearing.  I’m sure it’s there to stay, so I’d have to buy another if I remade it.  Over the next few days I will update my model to show these parts.  If you were wondering what the oddly shaped part was that rides on the shaft, it’s a locking mechanism for holding the shaft when you are changing blades on the saw.  Here’s the product manual showing an exploded parts list.

Edit:

I’ve redrawn the motor, bracket, and other inside goodness, and posted it to the Sketchup Warehouse.  The planetary gears aren’t drawn because I’m lazy.  Here’s an exploded view:

HF 18V Circular Saw Motor - Modeled Exploded View

SAWBOT? QUE?!

Having no money after buying tools and tooling, I’ve had plenty of time to plan out a robot platform.  There are several ideas rolling around in my head.  They range from independently-driven, independently-suspension-ed (?) 4WD drivetrains, to Ackerman-steering platforms with front, rear, and center differentials.  Yeah, overly complex, at least for now.  I’m instead going for a simple skid-steer drivetrain with no suspension other than the tires.  The left-side two wheels will be driven by one motor, as is the right side.  The difference in speeds causes the platform to turn.  I also want to be able to get this thing up to a pretty good speed so I can run around with it like an RC car:  ~20mph.  I can already see it busted on a wall.  It’s going to be great.

Now the question is where can I find motors?  Ideally the shaft speed of the motor would be the same as the wheel speed.  I found that to be impossible within a reasonable budget (<$50 ea).  Typically the motors you find on RC trucks run at about 4,000 kv.  For those that don’t know, a 4,000 kv motor runs at 4,000 rpm PER VOLT.  Don’t get me wrong.  A robot rolling down the road at 476mph would be cool.  Maybe later.  So, I’ll need to go with a gear reduction.  It turns out that it can get expensive.  Making a custom gearbox is an option.  However it takes some careful design work to ensure proper meshing.  I don’t think my master metalworking skills are quite up to that just yet.

I came across several people repurposing a cordless drill motor.  Now there’s an idea!  At Harbor Freight, you can get cheap Chinese junk like cordless drills.  The batteries are horrible and the clutch be worn out fast.  However, the motor and gearbox are pretty decent – and the output shaft speed is around 500 RPM, unloaded.  Not bad for $20.  I picked up a couple.

IMAG0178 IMAG0145 IMAG0183

Bringing back the drills, I torn one apart and looked to see how I would mount it.  The plastic housing and extended shaft would take up too much space in my robot. The plastic housing is part of the clutch assembly, as it allows the ring gear to spin if the clutch isn’t tightened all the way (the drill setting).  Also, proper mounting is non-trivial.  I came across another site showing a custom gearbox enclosure for a drill.  This is definitely the way to go as it gives you a better fit and mounting options.

Then I came across this:

It’s the Harbor Freight 18V 5-1/2″ Cordless Circular Saw, part # 67026, and was on sale for $25.  The no-load speed is 3800 RPM, uses a larger 750-sized motor, and has a mounting bracket already!  As far as I know, no one else has tried this.  That’s usually a bad sign, but it’s worth a shot.

Here are some pictures from the break-down process.

Random Youtube video of the motor?  Sure, here you go: http://www.youtube.com/watch?v=3KQaba3A2qI

© 2024 Jeremy W. Langston

Theme by Anders NorenUp ↑