collapse

Author Topic: Faceting machine encoder  (Read 3946 times)

Faceting Frank

  • Global Moderator
  • ALF'er VIP
  • *****
  • Posts: 609
Re: Faceting machine encoder
« Reply #15 on: February 24, 2025, 12:06:21 PM »
It wasn’t the screen that was the problem RC but the info the encoder was putting out.
Got rid of Tom’s millis() info and replaced it with this.

unsigned long screendisplay = 100;      // update time for display
unsigned long previousetime_1 = 0;     // Last sample time in milliseconds

void loop()
unsigned long currentime = millis(); // current millis() time
.
Rest of loop info including lights
.
 if (currentime-previousetime_1 >= screendisplay){
Screen info
previousetime_1 = currentime;
  }
Rest of loop info.

What this is doing is running the loop without any delay and I confirmed it was working by having the millis() count displayed at the bottom of the screen (not in the display 100ms delay). Which as you know counts at 1’000 times per second and continue to do so.
The rest of the screen display is inside {} and displays every 100ms. The red stop light activates when the target angle is reached and the green light now comes on 0.02deg before that.  I was cutting an 8 sided centre point at 30deg on a 1200 lap at 300 rpm to test this using the lights as stops.
It should cut a near perfect centre point, but the facets were all over the place, confirmed by the dial gauge. Moving the quill up and down a bit and putting the facet on a stationary lap would show the correct angle, either short or overcut slightly.
My thoughts on this is the 1,000 times per second refresh rate is to fast for Tom’s code regarding checking the encoder position.

Faceting Frank

  • Global Moderator
  • ALF'er VIP
  • *****
  • Posts: 609
Re: Faceting machine encoder
« Reply #16 on: February 24, 2025, 01:31:03 PM »
Just checked the same test stone with the stop light. 0.01 movement on the encoder is equal to 0.02 movement on the dial gauge. Using the light as a stop for each facet and checking with the dial gauge after cutting. The dial gauge showed readings of 0.42 0.41 0.41 0.41 0.40 0.41 0.41 0.41, that's with no side to side swing with the quill after the green light comes on. Thats with Tom's 100ms delay loop.

MakkyBrown

  • Administrator
  • ALF'er VIP
  • *****
  • Posts: 1824
    • Andrew Brown Faceting Designs
Re: Faceting machine encoder
« Reply #17 on: February 24, 2025, 03:17:58 PM »
Hello Frank, I am unable to put much time into this atm.

The code doesn't check the encoder position, it checks if there has been an interrupt then it moves outside the main loop to increment or de increment the encoder position. The code shouldn't be too fast for the encoder interrupts.

My box I am using only has a Arduino nano in it so it is not that fast and I haven't tested the ESP32 and TFT with an encoder yet. 

MB


Faceting Frank

  • Global Moderator
  • ALF'er VIP
  • *****
  • Posts: 609
Re: Faceting machine encoder
« Reply #18 on: February 24, 2025, 05:16:07 PM »
That makes sense MB, will leave it with the 100ms delay.

 

Recent Activities

Magnetic Encoders by Faceting Frank
[Today at 08:40:46 AM]


Cutting the table by Faceting Frank
[April 19, 2025, 09:34:39 AM]


Mt Strzelecki on Flinders Island by Bucket
[April 12, 2025, 09:59:34 AM]


Fossicking trip by Barry Simiana
[April 09, 2025, 03:51:18 PM]


Butterfly cut by MakkyBrown
[March 29, 2025, 03:42:54 PM]


Pendant findings by Faceting Frank
[March 18, 2025, 12:38:24 PM]


Topaz scratches (aka should've known better) by RoughCreations
[March 15, 2025, 07:00:56 AM]


Resin-bonded 60K diamond lap by RoughCreations
[March 13, 2025, 08:22:58 AM]


Has anyone modified a gemmasta to take a dial gauge on the hard stop? by Rusted
[March 05, 2025, 11:01:12 AM]


Faceting machine encoder by Faceting Frank
[February 24, 2025, 05:16:07 PM]


The Art of Moissanite Cutting: Transforming Rough Stones into Brilliance by MakkyBrown
[February 24, 2025, 02:59:58 PM]


AgateMaster Faceting Machine Bearing Replacement by Bucket
[February 16, 2025, 09:11:49 AM]


Anyone Faceted Synthetic Rutile Gem rough? Any Advice. by RoughCreations
[February 14, 2025, 10:46:42 AM]


Recently cut gems (AB Facet Designs) by mehoose
[February 11, 2025, 03:40:59 PM]


rock or stone by Jimnyjerry
[February 08, 2025, 02:07:53 PM]

SimplePortal 2.3.7 © 2008-2025, SimplePortal