New automation project, will it work?

I'm looking to learn electronics a bit more in depth. I just finished my stepper controlled plasma table so I'm not totally green. This will be my first experience with a arduino. The project will be two parts, the first will be a building block to the second.

First, I need to be able to read an incremental encoder in degrees. I would guess a large(3") 4 digit led read out would work great. Accuracy needs to be 0.1 degrees. I will need a home switch to zero the readout. Also a way to add degrees to the readout via a set of buttons or a pot switch. The speed I will be measure will be less than 1 rpm per minute (so keeping up with calculating position should be no problem) but, it needs to be very accurate.

The second part will be to add a second 4 digit display with a pot switch to input a desired degree. When the encoder reaches the desired degree a analog signal will need to be sent out. The signal will be used to activate a hydraulic solenoid.

I had considered using a PLC but, would like to use an arduino if at all possible due to cost and flexibility.

I would like to add more features at a later point but, this would make life much easier at this point.

Thanks. If any more detail is needed let me know.

First, I need to be able to read an incremental encoder in degrees.

An incremental encoder? I've heard of linear encoders and rotary encoders, but not incremental encoders.

I would guess a large(3") 4 digit led read out would work great.

I don't see how a 4 digit LED read out, of any size, is going to read an incremental encoder.

Accuracy needs to be 0.1 degrees.

The accuracy depends on the encoder, not the device interpreting the output of the encoder.

I will need a home switch to zero the readout.

OK. You can use one.

Also a way to add degrees to the readout via a set of buttons or a pot switch.

Buttons hold shirts closed. What's a pot switch? Changing to a different dealer?

When the encoder reaches the desired degree a analog signal will need to be sent out. The signal will be used to activate a hydraulic solenoid.

Solenoids are usually on or off. What is this hydraulic solenoid doing?

hi, well yes, we need more details on the encoder you are using, it's outputs and resolution etc.

If by incremental you mean it simply gives you quadrature pulses so it tells you number of changes and direction, you just need to count up or down and reset. Google "Arduino quadrature encoder"..

Controlling motors and solenoids can be done OK.

What are you cutting with the CNC Plasma torch?

Yes I will need a rotary encoder. I haven't picked one as of yet, I have a few choices just need to order one. I've been trying searches all day but never tried that combination. Thanks.

I don't see why I couldn't use a led readout. They are used all the time on DRO's for machine tools. I figured a 7 segment 4 digt led would be all I would need. Can you elaborate?

I know that it depends on the encoder. I was more concerned on if it could handle the encoder with out pause or skips. I've read a few post today about that being an issue. Upon looking into it further it seems that the issue was the encoder was spinning at 400rpm and receiving 40,000 counts per minute.

Sorry potentiometer.

The hydraulic solenoid is 3 positions on - off - on. It will control a hydraulic cylinder to feed it in and out. When the desired angle is reached it will bypass the foot operated switch and return the solenoid to center which would be to divert flow back to the reservoir.

I mainly use it for my fabrication shop. I can process a sheet 5' x 10' material 1/2" thick with no problems. I built it from the ground up. It was a heck of project but, it has increased production immensely.
Heres a few pics




Apparently you can't drive the rotation with a motor directly coupled to it. If you use a reduction gear box, you can reduce the rotation speed of the output and then use it to drive your rotation. I suggest a stepper motor and some reduction gear box with the right ratio so the stepper motor's rotation precision is translated into the 0.1 degree you want. Then you put an encoder on the stepper motor to monitor it, although it's unnecessary for stepper motors running within their max torques. Then a limit switch can be as simple as a screw sticking out the side of the rotation stage and a switch that will be depressed when the screw passes above it.

Sorry let me elaborate a bit further. I didn't realize this would be of any importance. The encoder with read movement via center rotating pin. I will put it in the lathe and either turn it down to press a pulley over it or center drill it and bolt it in place It will be coupled to the pin via a multi tooth belt and pulley on the encoder as well.

At this point to read the degree your at there is a pointer attached to an arm that points to a numbered degree wheel.

Here's a picture to give you a better idea of what im adapting it to. This will give me a much more accurate machine that will make it near idiot proof for shop hands. It will also be possible to make repeatable parts.
![](http://i.ebayimg.com/t/Baileigh-RDB-125-Tube-Bender-Pipe-Bending-Tubing-RMD-/08/!BdpUZCQBmk~$(KGrHqMOKjEEq4cFU(MNBK502lsR2Q~~_12.JPG)

I don't see why I couldn't use a led readout. They are used all the time on DRO's for machine tools. I figured a 7 segment 4 digt led would be all I would need. Can you elaborate?

The rotary or linear encoder outputs data, to something that can read it. The LED readout is not such a device. You can use a LED readout, just not in the way you described.

I've read a few post today about that being an issue. Upon looking into it further it seems that the issue was the encoder was spinning at 400rpm and receiving 40,000 counts per minute.

The Arduino is relatively fast. It has two external interrupts that the encoder can be connected to. The will fire every time there is a signal from the encoder.

Where there is a problem is when people want to do complex calculations, serial output, delays, writing to an LCD, etc. in the interrupt service routine.

If all you are doing is cnt++ or cnt--, depending on the direction, then the Arduino is perfectly capable of keeping up. If you want to print the count to the serial monitor at 300 baud, show the value on a LCD, and write to an SD card every time the encoder sends a pulse, well, then you best limit the speed to about 1 rpw (revolution per week).

The hydraulic solenoid is 3 positions on - off - on.

Then, why send it an analog signal? A digital signal has two states - on or off. Hey, look, those match the solenoid states.

Impressive work. Wish I lived closer. Might want to come visit next summer. I hit New Mexico in June, every other year, then head to Virginia. Houston, if that's where you are, is not that far out of the way.

Ah that makes more sense. I will say that I'm not up to par on my electronics terms. Good to know I'm not losing my mind.

Ok that's also good to know. The most that the encoder will ever rotate is 270 degrees. I have no reason to need to record it. Is there away to set a point or degree so when that degree is reached the soilenoid kicks out. Now the big challenge ( atleast in my head)can this be reprogramed each time without hooking it back to the pc?

For example - I need to go to 105 degrees. I input 105.0 on the 1st led readout and then zero out the 2nd readout that references the encoder. The operator activates the machine. The machine reaches 105.0 and a DIGITAL signal is sent to the hydraulic soilenoid to divert flow back to the reservoir which will stop the cylinder and thus the movement of the machine. Maybe the 1st readout could be controled by a potentiometer for the input of the desired degree.

I'm down by Galveston. Let me know when you come down this way.

If this is possible then I will be one happy guy.

Now the big challenge ( atleast in my head)can this be reprogramed each time without hooking it back to the pc?

Re-programmed means loading a different sketch - set of instructions. This requires connecting to the PC.

Changing the value at which the solenoid is fired is not necessarily reprogramming. Think of a clock. You can set a new alarm time without having to send the clock back to the manufacturer.

You want to do something similar. Provide a means for entering a limit value, then do something when that limit value is reached.

Maybe the 1st readout could be controled by a potentiometer for the input of the desired degree.

I'd use something else. Either 4 pots (one for each digit) or some thumbwheel switches and a set of switches to select which digit is being set.

I'm down by Galveston. Let me know when you come down this way.

Will do.

A simple way to build a zero-to-high-number interface with just a couple of pushbutton switches is to base it on the speed in which the button is tapped. Each time the button is pushed record the time; when the interval between presses is small make the value/setting increase faster; longer intervals result in smaller increases.

If you're looking for an encoder you can try one of the newfangled magnetic encoders. The AS5045 is a 12-bit encoder (4096 positions -- slightly better than .1 degree) and outputs an absolute position rather than a forcing you to count encoder pulses. US Digital also sells versions with analog or PWM output ... which is kinda wierd because that kind of interface degrades the accuracy. I suppose you could gear it up to regain that accuracy but then it's only semi-absolute.... but still a lot easier to track than an incremental encoder.

Chagrin:
A simple way to build a zero-to-high-number interface with just a couple of pushbutton switches is to base it on the speed in which the button is tapped. Each time the button is pushed record the time; when the interval between presses is small make the value/setting increase faster; longer intervals result in smaller increases.

If you're looking for an encoder you can try one of the newfangled magnetic encoders. The AS5045 is a 12-bit encoder (4096 positions -- slightly better than .1 degree) and outputs an absolute position rather than a forcing you to count encoder pulses. US Digital also sells versions with analog or PWM output ... which is kinda wierd because that kind of interface degrades the accuracy. I suppose you could gear it up to regain that accuracy but then it's only semi-absolute.... but still a lot easier to track than an incremental encoder.

The 10 and 12 bits needed are what kills it. One could connect it to a Parallel In - Serial Out chip, but that would take some time to read and might screw up the readings and available speed.

I'd go for something like this:

You could create some logic to move this value from a parallel form to serial, but I think that maybe connecting both of the ouputs to interrupts would be enough.

However, if we do some math, it would come out cheaper (for the hobbyist) to get an 8 pin AVR and implement a I2C/SPI encoder counter.

What are you cutting with the CNC Plasma torch?

Wow. Way Cool.... I have the rails and bearings for my big X-Y table, and in a couple of years when I get back to my barn/shop in Vermont I'll build it!

You've got lots of good advice here.

I would start prototyping this with just the electronics parts soon, and get that working the way you want.

How often does the operator need to change that target degree number?? Are those numbers one of a mostly-fixed set, or arbitrary every time?