Hello Guest it is April 20, 2024, 01:28:52 AM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - stevesy

Pages: 1 2 »
1
Here's the Arduino Sketch for the encoder. Maybe someone might find it useful.
Code: [Select]

#include <digitalWriteFast.h>  // library for high performance reads and writes by jrraines
                               // see http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1267553811/0
                               // and http://code.google.com/p/digitalwritefast/
 

// Quadrature encoder
#define c_EncoderPinA 8
#define c_EncoderPinB 7
volatile bool _EncoderASet;
volatile bool _EncoderBSet;
volatile long _EncoderTicks = 0;
volatile bool _lastATick;
volatile bool _lastBTick;

void setup()
{
  Serial.begin(115200);
 
  pinMode(c_EncoderPinA, INPUT);      // sets pin A as input
  digitalWrite(c_EncoderPinA, LOW);  // turn on pullup resistors
  pinMode(c_EncoderPinB, INPUT);      // sets pin B as input
  digitalWrite(c_EncoderPinB, LOW);  // turn on pullup resistors
 
}
 
void loop()
{
  _EncoderASet = digitalReadFast(c_EncoderPinA);   // read the input pin
  _EncoderBSet = digitalReadFast(c_EncoderPinB);   // read the input pin

 
   // If the previous and the current state of the outputA are different, that means a Pulse has occured
   if (_EncoderASet != _lastATick)
   {     
     // If the outputB state is different to the outputA state, that means the encoder is rotating clockwise
     if (_EncoderBSet != _EncoderASet) {
       _EncoderTicks ++;
     }
     else
     {
       _EncoderTicks --;
     }
     _lastATick = _EncoderASet;
     _lastBTick = _EncoderBSet;
     Serial.print(_EncoderTicks);
     Serial.print("\n");
   } 
}

2
An update from this weekend.

I had originally ordered this rotary encoder https://www.robotshop.com/en/6mm-rotary-encoder-1024-p-r.html
For some reason the order failed to go through so I ended up ordering this one from Amazon. It's half the resolution but I just needed it for testing.
https://www.amazon.com/Signswise-Incremental-Encoder-Dc5-24v-Voltage/dp/B00UTIFCVA/ref=sr_1_1?s=hi&ie=UTF8&qid=1535373946&sr=8-1&keywords=Signswise+600&dpID=41%252BwuyVZcKL&preST=_SX300_QL70_&dpSrc=srch

I tried to use this IO board assuming it would work with the encoder
https://numato.com/product/8-channel-usb-gpio-module-with-analog-inputs

The Numato GPIO isn't nearly fast enough to keep up with the encoder and it was skipping ticks (readings or whatever).

I had a Arduino Uno that I ordered for another project but never used. I've never used Arduino and just assumed it would be super slow. I mean how fast can a $11 microcontroller be? Well, a heck of a lot faster than the Numato GPIO it turns out.
I used a couple of 10k resistors used the digitalWriteFast library found at https://code.google.com/archive/p/digitalwritefast/downloads and I was able to read every tick of the encoder without issue no matter how fast I turned it. I should have started off using the Arduino to begin with.[/img][/img]

My next problem was trying to get a gear that matched my rack (20 pitch, 20 pressure angle) with a 6mm bore. I know nothing about gears and assumed this would be easy, it wasn't. Even finding a gear that fit the rack was ridiculously hard. There's way more options to how a gear fits to another gear or rack than I imagined.  The only one I could find was on Amazon and it was out of stock. So I tried to order a gear from Grainger with a 20 pitch but a 14.5 pressure angle with an 8mm bore and hoped I could rig it up. Well, they sent the right box but the gear was wrong. I guess someone switch them or something so I was stuck.  

I thought I have a CNC why not just make one? Well, this turned out to be REALLY hard because its not straight forward. I ended up finding the site https://geargenerator.com/#200,200,100,6,1,0,0,4,1,8,2,4,27,-90,0,0,16,4,4,27,-60,1,1,12,1,12,20,-60,2,0,60,5,12,20,0,0,0,2,-563

I paid the $2, downloaded the svg. Converted it to EPS and imported it into ArtCam and cut it out of 1/2" polycarbonate. This turned out perfect, I get 0.005" resolution with it. I should have done this begin with. It would have saved me $25 from Grainger and numerous hours of research. Hind-sight is 20/20 though.

So that's all I was able to do this weekend. I'm going to try and find time next weekend. I'm pretty busy at work these days.


Encoder Gear:
https://drive.google.com/open?id=1FmpiZ8SHy31yYGcKkz6RTFFB5bpI9Ock
https://drive.google.com/open?id=1hm1z2rrhRfzgw8T3IWZb5HrzzyN9TS00

3
Warp9
Quote
The ESS reads each input at about 30 MHz. It can easily read encoder signals of up to 4 MHz (however this greatly depends on the Break Out Board's input pins, since too much capacitance or resistance will limit the maximum signal rate).

The ESS reports this data back to Mach3 10 times every second (which is the hard coded plugin update rate in Mach3).

The ESS reports this data back to Mach4 40 times every second (which is the default plugin update rate in the Mach4 ESS config, but it can be changed).
So getting anything through ESS isn't going to work for my project in Mach3. Possibly Mach4 though.

4
Hi,
re-reading the spec sheet on the encoder and there are both incremental (quadrature) models AND absolute (Grey code) models.
The ESS /Mach can read quadrature encoders but would require a decoder to read Grey code.

Rather depends on the model of encoder that you get.

Craig
The one I bought is the CWZ3E it's 1200P/R
But doesn't the ESS only report at 10HZ to Mach3? I read that somewhere. If that's the case I will still only get a reading every 10th of an inch at 60IPM.

5

IMHO i would "walk the street" with an ARDUINO.
I would have to disconnect everything to use my new "feature". I'm trying to make this an on demand kind of thing.

The other thing main point of the project is to do this as a pass..meaning I don't stop moving. Otherwise it will take forever to scan something. The goal is 60IPM with 0.5mm resolution..

Quote
btw i have written a wizard for the Point by Point digitizing, just let me know if you want to try it.
Let me give it a try first..the funnest part of this is doing it. You know what I mean?

6

Just an ordinary A,B,Z differential encoder would hook to three inputs of the ESS and Mach can read the encoder directly and process it and display it in a DRO.

Craig

This encoder has the same outputs. I don't see why I couldn't use it with the ESS. I'm writing the remote control in C# so even if I had to capture the data myself through usb it shouldn't matter. Also, wouldn't I be limited to the 10hz output of the ESS. It seems I would be in the same boat I'm in now of not getting the data fast enough.

7
Yes I could use a microcontroller but I'm not familiar with sending commands to the CNC controller with anything other than Mach3. If you have a suggestion of where I could get a C# example of moving an axis with the smoothstepper that would be awesome. However, my understanding is the smoothestepper is running at 10hz, still too slow for the effort I would need to put into it I think.

Yes, you are correct. I'm basically going to do a raster running across X given a length and then stepping Y by say 0.5mm then scanning across X again getting Z with this laser displacement sensor that I can get readings from at 50hz (every 20ms).

I will use OpenGL to plot the data on the screen in a point cloud and build triangles for a mesh, then allow the user (Me) to save to an stl file. All that part is complete. Well, the prototype is complete. I can take a 2.5d point cloud and plot and save a mesh to a stl file. It's just getting the data accurately at the X/Y position where I'm a little stuck. I ordered a rotary encoder to hook up to the gantry so that should produce an accurate X position.
https://www.sparkfun.com/products/11102
IO https://numato.com/product/8-channel-usb-gpio-module-with-analog-inputs







8
Just a quick update....

I'm getting reports back about every 0.2" at 60 IPM in simulation mode. So basically 5 per second. Not good at all for what I'm trying to do.
I guess I'll go get an encoder and work with that.

9
I guess joeaverage's idea of an encoder would work then. It's rack and pinion so maybe I can use a rotary encoder with arduino or something.

I can read the laser sensor at 50hz so even if I could get readings every 10th of a inch running at 60 IPM I could still get pretty accurate measurements.  I could just divide 1/10 of an inch into the 5 readings I get from the sensor. I would imagine it would be within 0.5mm accuracy on the position of X as it traveled that distance which is plenty for something like wood.

I guess the only real way to tell is do it. I'll report back just for fun after this weekend. I have the sensor and the means to measure it now. I'll write the code for the remote control over the next week and post my results from the test.

-Steve


10
Hi,

Quote
So no way to match up Mach's position with this sensor then
Yes that can be done, but t is not as straightforward as you assume. I assume from
your reply that you cannot attach a linear scale? That would be the most direct and accurate solution.

Note G90 is a positioning mode, not a motion code. If you want to travel at max axis speed you use G0 or if you wish to travel at the current feedspeed,F,
then use G1.

You could issue a series of commands moving 0.01 say each time and measure/record the Z distance between each move. The speed at which that would happen
is dependent on the acceleration capability of the axis.

Craig

I could attach a linear scale but I'm trying to keep cost down. Laser displacement sensors aren't cheap, so I already have a bit of investment in this project :)
Unfortunately I didn't think that Mach3 was not showing accurate position as it travels. In hindsight I guess I should have.

I'm more worried that the smoothstepper would be my bottleneck, if its just the acceleration of the axis then I think I would be fine. Unless of course I'm not seeing something I should again :)

Pages: 1 2 »