collapse

Author Topic: Faceting machine head assembly.  (Read 11168 times)

MakkyBrown

  • Administrator
  • ALF'er VIP
  • *****
  • Posts: 1763
    • Andrew Brown Faceting Designs
Re: Faceting machine head assembly.
« Reply #105 on: June 19, 2024, 01:58:41 PM »
Perfect.
US Digital E5-900-250-1E-S-D-D-B
E5 = type
900 = cpr
250 = to suit 1/4inch shaft
IE = has index for calibration
S = Single end low voltage output, what you want to keep it simple.
D = Default case
D = Default cover
B = comes with some tools
You are good to go. Don't have to buy a new encoder yet as you can make a new control box to suit your existing encoder. Once you get that working just change the code slightly when you install the new encoder.

https://www.usdigital.com/media/4g4hyv0p/e5-datasheet.pdf
Maybe what we(between us all) need to do is make up a parts list and code, nothing fancy just displaying the angle and an eprom based calibration function. Maybe a jumper for which side of the machine the encoder is mounted. Then it should be largely fool proof.

Looking forward to seeing a pic of your stone when finished.  :)
« Last Edit: June 19, 2024, 02:01:34 PM by MakkyBrown »

Alaskan

  • ALF'er Silver Member
  • *
  • Posts: 35
  • Will AI have curiosity and a sense of humor?
Re: Faceting machine head assembly.
« Reply #106 on: June 19, 2024, 09:23:16 PM »
Which board do you recommend with Arduino - EBay is piled with choices?

I'm ready to collect the parts and build the box - might as well get it all together - that pale blue lab created Zircon appears to be gone... was hoping to get more - someone beat me to it.

Flying blind here - Been 40 + years since I played with analog/digital components. White cane excited to see this integration.
« Last Edit: June 19, 2024, 09:59:37 PM by Alaskan »

Faceting Frank

  • Global Moderator
  • ALF'er VIP
  • *****
  • Posts: 505
Re: Faceting machine head assembly.
« Reply #107 on: June 20, 2024, 07:16:50 PM »
Did some more research on attachInterrupts, because with Tom’s code it was not reading anything from the encoder. He has attachInterrupts(0,doA,CHANGE); and attachInterrupts(1,doB,CHANGE); for the A and B pins on the encoder, yet he is using pins 2 and 3 on his Arduino board.
Anyway got it working with attachInterrupt(digitalPinToInterrupt(16),doA,CHANGE);
and   attachInterrupt(digitalPinToInterrupt(17),doB,CHANGE); ,pin 16 and 17 being the pins used on my board. Don’t know if that’s the best bit of code, but it works.
Still to fix is the angle going the wrong way from 90deg as I turn the encoder, going higher instead of lower. As well as it still has no memory and will start from the beginning when turned on.
The two pics show the encoder at setting 0 and 5,000, or at least as close as I can get it by hand. That is a 90deg turn, the encoder having 20,000 steps in 360deg.
Ordered a new Arduino esp32s board same as this one for my control box on my machine, want to keep this setup working for my next project. Which is having a fancy screen like RoughCreations.










MakkyBrown

  • Administrator
  • ALF'er VIP
  • *****
  • Posts: 1763
    • Andrew Brown Faceting Designs
Re: Faceting machine head assembly.
« Reply #108 on: June 21, 2024, 12:06:44 AM »
I've been using the NodeMCU ESP32 boards. Frank and RC might be using different one. I might find some time and wire up a new control box, and make a part list.
MB

RoughCreations

  • Administrator
  • ALF'er Platinum
  • *****
  • Posts: 355
    • Rough Creations homepage
Re: Faceting machine head assembly.
« Reply #109 on: June 21, 2024, 11:58:17 AM »
Did some more research on attachInterrupts, because with Tom’s code it was not reading anything from the encoder. He has attachInterrupts(0,doA,CHANGE); and attachInterrupts(1,doB,CHANGE); for the A and B pins on the encoder, yet he is using pins 2 and 3 on his Arduino board.
Anyway got it working with attachInterrupt(digitalPinToInterrupt(16),doA,CHANGE);
and   attachInterrupt(digitalPinToInterrupt(17),doB,CHANGE); ,pin 16 and 17 being the pins used on my board. Don’t know if that’s the best bit of code, but it works.
Still to fix is the angle going the wrong way from 90deg as I turn the encoder, going higher instead of lower. As well as it still has no memory and will start from the beginning when turned on.


Hi Frank, your code for attachInterrupt is the recommended approach. Tom uses a direct interrupt number which works for his board, but not necessarily other boards, and is an earlier way of doing it. Good work!
You will have to save to the EEprom/flash memory to get your state saved between power on/off cycles, or way better: use the preferences library (see my later code) to save as many key-value pairs as you like. The data held in the flash memory persists across resets or power failures.

RC
« Last Edit: June 21, 2024, 11:59:54 AM by RoughCreations »
Rough Creations - Beauty from rough beginnings

Faceting Frank

  • Global Moderator
  • ALF'er VIP
  • *****
  • Posts: 505
Re: Faceting machine head assembly.
« Reply #110 on: June 21, 2024, 01:29:20 PM »
Thanks for the info RC.
That’s the Iveska. FacetronEncoderWithAngleStorageESP_colourTFT_21022024.ino file your talking about? Will have a look through the file later.
Thanks again.

RoughCreations

  • Administrator
  • ALF'er Platinum
  • *****
  • Posts: 355
    • Rough Creations homepage
Re: Faceting machine head assembly.
« Reply #111 on: June 21, 2024, 04:18:19 PM »
Thanks for the info RC.
That’s the Iveska. FacetronEncoderWithAngleStorageESP_colourTFT_21022024.ino file your talking about? Will have a look through the file later.
Thanks again.

That's the one, important lines to setup preferences are:

Code: [Select]
#include <Preferences.h>
.
.
Preferences preferences;
.

Read 3 key-value pairs from preferences:
Code: [Select]
  preferences.begin("encoder", false);
    eenc90 = preferences.getUInt("eenc90", 0);
    eStoredAngle = preferences.getFloat("eStoredAngle", 0.0);
    padTime = preferences.getInt("padTime", 0);
  preferences.end();
Write an unsigned integer key-value pair to preferences:
Code: [Select]
  preferences.begin("encoder", false);
    preferences.putUInt("eenc90", eenc90);
  preferences.end();


RC
Rough Creations - Beauty from rough beginnings

Faceting Frank

  • Global Moderator
  • ALF'er VIP
  • *****
  • Posts: 505
Re: Faceting machine head assembly.
« Reply #112 on: June 22, 2024, 12:35:15 PM »
Thanks for thar RC. Will work out where that best fits in Tom's code.

Alaskan

  • ALF'er Silver Member
  • *
  • Posts: 35
  • Will AI have curiosity and a sense of humor?
Re: Faceting machine head assembly.
« Reply #113 on: June 22, 2024, 10:12:42 PM »
Frank - RC... This ongoing search for a final code sequence looks intimidating - the coding seems hit or miss - MB... how many have working hundredths accuracy in those who are involved - is it the differences in hardware or the coding that are seeming to be having problems? 😳
« Last Edit: June 22, 2024, 10:16:46 PM by Alaskan »

MakkyBrown

  • Administrator
  • ALF'er VIP
  • *****
  • Posts: 1763
    • Andrew Brown Faceting Designs
Re: Faceting machine head assembly.
« Reply #114 on: June 22, 2024, 11:01:02 PM »
It's not too bad Alaskan. I've be using one for years. I want to have a go making a new box with the touch screen. I want to make it fool proof and simple. You can make interface buttons on the touch display. So all that will really be needed is a small 12v powersupply/socket, voltage reg, touch screen, encoder, a few 0.1uf decoupling capacitors, on/off switch, project box, some header pins, and an esp32.Also worth putting a ferrite magnet or two on the lead/cord to the powersupply as faceting machine motors can be noisy.

Faceting Frank

  • Global Moderator
  • ALF'er VIP
  • *****
  • Posts: 505
Re: Faceting machine head assembly.
« Reply #115 on: June 23, 2024, 11:29:22 AM »
Alaskan. It is frustrating at times and I have been working on this off and on for five months with that wired up monster in the pics I’ve posted. To my way of thinking it is much easier to get it working next to my PC and then make a boxed copy with soldered connections to fit on my machine. Apart from the encoder the other parts are dirt cheap. MB and RC have helped me all the way through this and the YouTube tutorials have been invaluable.
My code is copied and pasted into Arduino ide from Tom’s code from his website. The needed changes were for my different encoder and to // out all his depth of cut indicator and buzzer stuff, which I don’t want. // means it will ignore that line of code.
The apparent problems with this code are created by me. The line that Tom has which reads the info from the encoder “attachInterupts(1,doA,CHANGE);”. Was never going to work with my board and pin out, but I didn’t know that and my encoder never moved when turning the dial. So, I searched for a YouTube tutorial on attachInterups and found a 30 minute one that explained all about it. Finally now have it working.
The hardware parts all work ok and the board I’m using is a NodeMCU-32S ESP32s WROOM WiFi+BT 38Pin MCU Development Board for Arduino. That’s their description of it on eBay.

Faceting Frank

  • Global Moderator
  • ALF'er VIP
  • *****
  • Posts: 505
Re: Faceting machine head assembly.
« Reply #116 on: July 06, 2024, 07:13:40 PM »
Progressing a bit more with the encoder setup. Included a bigger screen so I can have more info showing. Reversed the encoder readout in the code so it will show the angle correctly as I move the quill. The encoder readout increases as it is turned clockwise, that is the wrong direction if fitted to the back of the faceting machine.
 Fixed having the angle in the code showing 90deg more than it should be, which is what it does with Toms code, it meant I could not go below 90deg. Now it shows 90deg less than the readout, but that’s ok the number on Toms code line 29 which is used to set the quill at 90deg is 5,000 more. I’m assuming that is what line 29 is for as it works ok for me.
Put a button into the loop to store the target angle. That was simple enough, just copy the current angle and print it on the second row of the screen.
The same person who had the YouTube vid about attachinterupts has one on how to use the millis function. She is really good, takes her time and explains what every line of code does and how to apply it to your project.
 Anyway, I know the numbers on the top line on my screen will be badly affected by any lap flutter. So, I was thinking of using the 20 step encoder I have to create a set of millisecond delays in the millis function. Having the top line print out to suit the dialled in delay the 20 step encoder is set at to suit the lap rotation.
Sounds good, but need to look at more vids on how to make it work.





Alaskan

  • ALF'er Silver Member
  • *
  • Posts: 35
  • Will AI have curiosity and a sense of humor?
Re: Faceting machine head assembly.
« Reply #117 on: July 08, 2024, 03:41:52 AM »
Hi Frank, my shop is getting a new roof which was getting worse wi annoying leaks & buckets and such catching drips so my faceting is taking a backseat. My Supernova is currently stopped at the table just above the meets @#5 Diamond - going to #14 then #50 as soon as roof is done... lots of mistakes but beautiful - patience of pushing on too soon is my biggest shortcoming - this winter when snow and rain going sideways is my time to build the hardware and box then coding Arduino which will be me begging for help. Thank you all!

RoughCreations

  • Administrator
  • ALF'er Platinum
  • *****
  • Posts: 355
    • Rough Creations homepage
Re: Faceting machine head assembly.
« Reply #118 on: July 08, 2024, 10:54:34 AM »

 Anyway, I know the numbers on the top line on my screen will be badly affected by any lap flutter. So, I was thinking of using the 20 step encoder I have to create a set of millisecond delays in the millis function. Having the top line print out to suit the dialled in delay the 20 step encoder is set at to suit the lap rotation.
Sounds good, but need to look at more vids on how to make it work.


My LCD screen code (you should already have a copy) has a section that addresses lap flutter, worth a look for some ideas.
Anywhere the variable padTime appears is relevant, and particularly the snippet below that uses a 7-value moving average (and an array) to reduce or smooth the output by only displaying an averaged value to the screen every padTime milliseconds:

Code: [Select]

 //========================================================================================
  // Display averaged angle info.
  //========================================================================================
                                     
  sumArray = 0;
       
  for (int k = 0; k < 7; k++) {
    sumArray = sumArray + liveAng[k];
    liveAng[k] = liveAng[k+1];                            // shift all array elements to the left one place
  }
  liveAng[6] = theAng;

  u8g2.setCursor(2, 52);
  u8g2.setFont(u8g2_font_helvR08_tr);
  u8g2.print("Averaging mS: ");

  if (millis() - lastTimeRun > padTime) {
lastTimeRun = millis();
    movingA = sumArray / 7;                               // calculate the (moving) average   
}
 
  if ((changeRotVal != padTime) && (millis() - enc_change_time < 1500)) {
    u8g2.print(changeRotVal);
  } else {
    u8g2.print(padTime);
  }


I have a little rotating encoder to dial in the amount of smoothing, then the encoder is pressed (my rotary_onButtonClick() function) to save the desired value to the flash memory.

RC
Rough Creations - Beauty from rough beginnings

Faceting Frank

  • Global Moderator
  • ALF'er VIP
  • *****
  • Posts: 505
Re: Faceting machine head assembly.
« Reply #119 on: July 09, 2024, 07:51:36 PM »
The way I see your code RC, is it taking an average of several loop readings and printing that on the screen, which will take away the flutter and give you an average over the swing across the lap as well. Not that I understand the code but that is what I think it does.
 I can’t test any type of delay function at the moment till I fit the encoder to the machine.

 

Recent Activities

Faceting machine head assembly. by Faceting Frank
[July 12, 2024, 07:43:51 PM]


converting designs by slimey
[July 10, 2024, 11:09:59 AM]


Gemmasta Model GFE 3 by Rusted
[July 08, 2024, 10:50:00 AM]


Prospecting in qld, North Brisbane area. General help for a newb! by Bucket
[July 07, 2024, 12:43:30 PM]


Agate Master Faceting Machine circa 1980s (or earlier) by PCH
[June 29, 2024, 04:40:39 PM]


The Next Big Trip by Bucket
[June 29, 2024, 10:04:56 AM]


Halls Extra quill attachment help please. by Gemlicker
[June 28, 2024, 03:31:24 PM]


Chipping - running in reverse by Ghost
[June 25, 2024, 02:14:12 PM]


Joke of the Day by Conan
[June 23, 2024, 01:15:29 PM]


NSW Dept of PERE campaign against highbankers, they are now illegal in NSW by Conan
[June 23, 2024, 01:12:18 PM]


Hi from Toongabbie, Sydney Australia by PeterAUS
[June 23, 2024, 02:47:27 AM]


Recently cut gems (AB Facet Designs) by Alaskan
[June 18, 2024, 10:14:53 AM]


Dial Gauges by Alaskan
[June 17, 2024, 08:48:58 PM]


Faceting synthetics for profit by RoughCreations
[June 14, 2024, 08:10:44 AM]


Advice needed on the Hall Xtra faceting machine by Gemlicker
[June 13, 2024, 10:26:18 PM]

SimplePortal 2.3.7 © 2008-2024, SimplePortal