adiba
Posts: 3
Joined: Mon Apr 21, 2014 12:22 am

Control a drilling machine...

Mon Apr 21, 2014 12:43 am

Hi everyone,

I am trying to develop a drilling robot. I like to automate the robot by measuring the torque and reversing the drill accordingly. I know C, C++, Unix, and Python. Where do I start? What sensors do I need and how to go about it?

I am not starting from scratch. The drill I am working with currently has a board that converts analog signals for turn and torque into digital and I get those read by an app that I have written that displays the information. The Pi program needs to read this data, run an algorithm, then provide control on the direction and start/stop of the motor. Later on (next phase) I want to add heat/temperature control on the drill so that would be another input which impacts the algorithm.

Any help you provide is greatly appreciated.

Adiba

Tarcas
Posts: 741
Joined: Thu Jan 09, 2014 5:38 am
Location: USA

Re: Control a drilling machine...

Mon Apr 21, 2014 2:52 am

I'm a little confused by what you're actually asking. It sounds like you can already read the torque and turn (do you mean turning speed?) so you're already started if I understand correctly.
Where to go from here?
As far as programming languages, C or C++ will be about as fast as possible as far as run speed. However, that probably matters less in this application (truthfully, in most applications) than the time it takes to code it up, so my recommendation is to use whichever language is easiest for you to use. You can even use multiple languages for different parts. (i.e. call a separate program to read the torque, which happens to be written in a different language.) If you happen to find that your bash script (as an example, assuming for the sake of argument that that's what you find most familiar) isn't fast enough, you can translate it to C later, and probably more easily than coding it initially in a language you weren't as familiar with (if you're not very familiar with C.)

The first step in any coding project is to figure out exactly what you want your program to do. i.e. when the torque reaches TORQUE_LIMIT, then reverse direction for 3 seconds, stop the drill for 0.5 seconds, and resume drilling until either TORQUE_LIMIT is reached again, a depth sensor is triggered, or the operator sends a stop signal.
Design is often the hardest part. Once you know the steps your program should take, it's generally fairly simple to convert that into an algorithm, if you're already familiar with the language you're using.
The main idea is to break your project down into little bite-sized micro-projects. It sounds like you've already completed one of those. Now you just need to define what the rest of those entail. Once each of the pieces is working independently, you can put them together much more easily than building it up as one big project. It's also easier to debug a 5-line function that does one thing than your entire 800-line (or even 80-line) project, especially if you're not even sure if the bug is in hardware or software.
Also if you're building it in pieces, you can more easily prepare to add additional things like your temperature sensor, and just not build that piece until you need it. (for example, you can already call a read_temperature() function, but until you have a temperature sensor, that function is just: return (0); It's called a stub function, just acting as a placeholder.)

You said you already have the drill, and that includes the ADC to read the torque and turn. Does it also include a way to control the drill? If not and if it's a DC motor, you'll want to use an H-bridge. L298N is commonly used around here, but your drill may take more current that that will permit. If it's an AC motor... I'm not really sure.

You also didn't mention anything about controlling drill depth; either sensing depth or moving the drill. This is probably just as important as actually turning the bit. If you haven't already planned this out, it's going to be important to consider, and probably a large portion of your design and program.

Hope this helps.

adiba
Posts: 3
Joined: Mon Apr 21, 2014 12:22 am

Re: Control a drilling machine...

Mon Apr 21, 2014 6:32 am

Thank you Tarcas for responding. It is very much appreciated. Let me try to explain more. You are absolutely correct about the depth measurement as well. The parameters in my mind are:

Turns - combined with time can give me the rotation speed
Torque
Depth
Temperature - in the future.

My current setup is readonly. I have no control/feedback implemented yet. In another words, I can read some of the data but I am not controlling the drill. Currently the drill is manually operated and I am able to see the numbers for turns and torque on a display. No depth yet. There is currently no Pi involved at this time. The box I am using to pick up the A2D signal is

http://www.mccdaq.com/usb-data-acquisit ... -7204.aspx

It has a USB interface and is Linux compatible. I have the sensors connected to this box. It costs about $200. Your idea of breaking the problem down is right-on. I do intend to do that as soon as I start with the Pi. My plans are:

Phase 1 - Implement reading all of the input data and displaying it using Pi display
Phase 2 - Implement the control algorithm with text feedback only.
Phase 3 - Connect it to the motor.
Phase 4 - Incorporate Temperature

I am going to post more details about the motor. I can keep the current mccdaq box or replace completely with Pi sensors if that is a better approach. Looking for ideas ...

Thanks again.

Return to “Automation, sensing and robotics”