The Forestry Forum

General Forestry => Sawmills and Milling => Topic started by: hackberry jake on September 26, 2013, 08:41:04 PM

Title: Arduino Setworks (with video!)
Post by: hackberry jake on September 26, 2013, 08:41:04 PM
I am in my last semester at the community college to get an associates degree. I have a class called "programing logic" which is handy and all but the people in it are extremely smart electronics students. I have been telling them about sawmilling and they have been helping me through understanding logic. They enlightened me to a thing called an "Arduino". Its a $30 board you can buy online that can be programed to do all kinds of functions. It's exactly like a mini computer without a screen, but you can buy a screen and have it display certain variables. I am pretty sure I can build a highly accurate setwork system for under $400. Program the Arduino and have it send info to a stepper driver, the driver controls the stepper motor and your head moves up and down in precise incriments.
At the moment I am thinking about having a button for 4", a button for 1", a button for 1/4", and a button for 1/16". There would also be an "up" button and a "down" button that would finalize the command. I may change the set-up a bit as I learn more about all thats involved. to lower the head 5 1/2 inches you would hit the 4, then the 1, then hit the 1/4 button twice and once you hit the down button it would "send" the command and the sawhead would lower. What you guys think?
Title: Re: Arduino Setworks
Post by: drobertson on September 26, 2013, 09:05:40 PM
sounds like C++ programming, very doable,   david
Title: Re: Arduino Setworks
Post by: beenthere on September 26, 2013, 09:08:14 PM
Anxious to see it put to work.
When do you start? 

Where will you pick up the needed parts.. board, stepper motor, and the stepper driver? 

Does the stepper driver start out with 'slow' steps and ramp up to a cruise speed and then ramp down slowing to the final step?

Will you drive it through a timing belt or a roller chain, or other means?

http://en.wikipedia.org/wiki/Arduino               
Title: Re: Arduino Setworks
Post by: hackberry jake on September 26, 2013, 09:13:31 PM
Quote from: drobertson on September 26, 2013, 09:05:40 PM
sounds like C++ programming, very doable,   david
Exactly 
Board comes from spark, driver from gecko, and stepper from keling cnc.
As far as ramping speed that is very doable, but I imagine I will save some money on steppers and use a pretty high reduction so I can get away with one medium sized stepper instead of two big ones. I would likley just leave the speed pretty high since it is hooked up to reduction.
I will likley use acme threaded rod for travel up and down and they will be tied together with chain and sprockets.
This is assuming I actually do it. I was mainly throwing it out for people that may need it more than me and for general discussion.
Title: Re: Arduino Setworks
Post by: wildbill on September 26, 2013, 09:23:53 PM
if you can think it you can program an arduino to do it.

you will want a motor driver shield to pair with the arduino.  the arduino alone cannot output enough voltage or amps to drive much of anything.  for the motor required to move a saw head you may end up making your own motor driver to pair with the arduino. 

the ones i have are a few years old and use the ATMega328 chip.  it gives me 12 digital I/O's and 5 analog I/O's.  while the arduino may cost 30-50 depending on the model you choose it is the ATMega chip that is actually doing everything.  everything else on the board is there to make it easier to program and connect to.  the last time i bought some chips alone they were about $5 each.  after the programming is done you pull the chip and put it in its own circuit board as a stand alone unit.  cutting your costs way down.  just be sure to buy the chips that have the bootloader already burned in the chip.

the possibilities are limitless with these little PLCs.  if you can dream it and build it mechanically you can program an arduino to control it
Title: Re: Arduino Setworks
Post by: POSTON WIDEHEAD on September 26, 2013, 09:28:06 PM
I have no idea what y'all are talking about but boy am I a reading.  :D
Title: Re: Arduino Setworks
Post by: beenthere on September 26, 2013, 09:33:23 PM
Quote. I was mainly throwing it out for people that may need it more than me and for general discussion.

We can't let ya off that easy.....   ;D

Well.... today being "HuuMP" day, maybe 'til next week.
Title: Re: Arduino Setworks
Post by: pineywoods on September 26, 2013, 09:39:29 PM
Member Shaworth did a lot of work on such a project. He and I corresponded a bit viaPM and there are a few posts on here. There are a bunch of hidden gotcha's. A stepper motor and driver big enough to drive a sawhead up and down will cost some serious money. Another solution is use a hefty DC motor driven by a mosfet H bridge. (ask your electronics buddies) Most head lift mechanisms use some type of rotary motion. Attach a small magnet and use a hall effect pickup feeding the micro processor to count revolutions. Then there is the problem of stopping the head right where you want it. A sawhead is heavy and it will continue to coast downward after drive power is removed. How much ? Depends, fuel tank full or empty, water tank full or empty. lube on the posts , sawdust in the mechanics. There are solutions, but it ain't as simple as it looks.
Jake, if you pursue such a project, I would certainly like to be involved. Ill se if I can find Shannon's posts..


Found it. click here
https://forestryforum.com/board/index.php/topic,40770.msg586731.html#msg586731
Title: Re: Arduino Setworks
Post by: wildbill on September 26, 2013, 09:41:21 PM
another option for setting level of movement is using a potentiometer.  if resistance = 0 dont move.  if resistance = 1ohm move 1/4" down

4ohm would be 1", 8ohm 2" and so on.  wouldnt have to be that much resistance either could be in the milliohms just as long as the arduino knows what each level means to you.  once the level is set say at 8ohms press the "lock button" and with each pass the head moves down 2" no matter the position of the dial.  a small LCD would show you the level you are set at, if you are locked in or not and anything else you wanted to hook up to the unit to know about (blade RPM?, oil pressure?, temperature?)

with the extra I/O's you lube water could be turned on and off automatically.  possibly a sensor telling how much force is needed to push through the wood (telling if your blade is getting dull or if your speed isnt right?)  im at my limits of what i think i know about a sawmill
Title: Re: Arduino Setworks
Post by: pat smith on September 26, 2013, 09:49:40 PM
I think i'm on the wrong page lol!!!not for sure!!!confused a little!! ??? ???
Title: Re: Arduino Setworks
Post by: hackberry jake on September 26, 2013, 09:55:21 PM
The arduino wont drive the stepper, a stepper driver will. The arduino just generates the step and direction and the driver does the heavy lifting. With a spring or counterweight you will get plenty of power out of a stepper. I have some 906 oz stepper on my cnc and I am almost sure it could break my arm.
Title: Re: Arduino Setworks
Post by: hackberry jake on September 26, 2013, 10:14:11 PM
I dont know what kind of driver is needed but ill bet one of these would be plenty powerful enough
http://www.surpluscenter.com/130-VAC-185-IN-LB-STEPPER-MOTOR-6-5A/edp_no=45120/shop.axd/ProductDetails
I have only dealt with dc steppers. Ill have to research ac steppers.
Title: Re: Arduino Setworks
Post by: wildbill on September 26, 2013, 10:19:59 PM
https://www.sparkfun.com/products/9107

a quick search gave me this.  15A-21A(with heatsink)

its not made for a stepper motor and is for a DC motor but its a step in the right direction
Title: Re: Arduino Setworks
Post by: pri0ritize on September 26, 2013, 10:37:34 PM
It looks like you're going down the right path Jake. Everyone has given you good advice. Would suggest you price things at Digikey and I would also suggest you use a 32 or 64 character display and a few buttons to set the amount of movement. The display can be had for a couple dollars and will make the setworks much more usable. You could have two momentary buttons for increase and decrease increment and two buttons for move up and down.

I write embedded code for a living. Which language will you be using?
Title: Re: Arduino Setworks
Post by: pri0ritize on September 26, 2013, 10:41:51 PM
Also, pay attention when you pick an Arduino. Most of the newer ones use 3.3V logic and the gecko driver needs 5V steps.
Title: Re: Arduino Setworks
Post by: hackberry jake on September 26, 2013, 11:37:31 PM
Quote from: wildbill on September 26, 2013, 10:19:59 PM
https://www.sparkfun.com/products/9107

a quick search gave me this.  15A-21A(with heatsink)

its not made for a stepper motor and is for a DC motor but its a step in the right direction
If I went this way, I would also need an encoder... which adds a lot of complexity... I think  ???
The class I am taking is c++. But im sure it uses a different language. I should be able to figure out enough to do simple functions like setworks I hope. Maybe ill pm you and you could write my code if I go through with it? ;D
Title: Re: Arduino Setworks
Post by: 47sawdust on September 27, 2013, 05:57:19 AM
 Ah,yes,Pineywoods and the hidden gotcha's.They show up here more than I'd like.I think the next gizmo for Jake to be build is a Gotcha Alarm.It would be a best seller,especially if it was set to anticipate the said gotcha.
I too have no idea what your talking about,but that seems to happen more these days.
Title: Re: Arduino Setworks
Post by: bandmiller2 on September 27, 2013, 07:33:54 AM
Old curmudgeon here,what are you guys trying to do turn milling into a video game,replacing sawyer skill with micro chips.Milling is a simple mechanical function best handled in a simple dependable way.Look through past problem posts on this forum almost always its electronics.I'am not saying don't do it but just have a manual backup when you just have to get an order out.Flak jacket on, have at me guys. Frank C.
Title: Re: Arduino Setworks
Post by: drobertson on September 27, 2013, 08:28:46 AM
A big ten four on the manual back up! Just in case,       david
Title: Re: Arduino Setworks
Post by: Leigh Family Farm on September 27, 2013, 09:26:31 AM
Contact Make Magazine. They would love to hear about your Adruino project. As for the coding, search the web. There are a lot of resources out there that have the coding for many applicaitons already completed and are completly free.

Another application that the Adruino can do is link together with other Adruino units and create a huge sensory mechanism that will give you not only the ability to set your cut depth, but the number of cuts made, the width of each board removed from the mill, bdft yeild, catalog the bdft total for a customer, bdft per day rate, average bdft per day over a given time period, engine temp, average blade life, and on and on and on...

Bandmiller2, certain skills do need to be learned and there are no shortcuts to learning them. I am all for learning new skills and crafts, and I hope to teach my son one day the same skills. Some things are just done because we can, not neccissarily because we need to or the old crumugeon way  ;) is broken.

P.S. We don't use flak guns anymore.  ;) ;D
Title: Re: Arduino Setworks
Post by: downsouth on September 27, 2013, 10:31:54 AM
Wow, Jake that boardwalk jr will sure be worth some money when you get finished with it.
  I too am lost but, seems pretty cool. I'm still trying to put together some hydraulics on mine.
Title: Re: Arduino Setworks
Post by: pri0ritize on September 27, 2013, 05:30:51 PM
I'd be more than happy to help you with your code. I've been working on a accuset type setworks using servos in my spare time, which has been very limited lately due to me building a house, getting married and spending 5 weeks on travel for work. Getting to see a bit of the East coast though! Let me know any questions you come up with. Most aTMega programming is done in C...or assembly.
Title: Re: Arduino Setworks
Post by: hackberry jake on September 28, 2013, 10:15:49 AM
Well... an  "arduino uno" should be here by Tuesday or Wednesday. The way I look at it, I have a spare break out board, and power supply from the cnc router build. And the rest of the parts I can borrow from the cnc router to get the setworks going. If it works good then I will order replacement parts for the router. If it doesnt cooperate and I pull half my hair out trying to get it going, im out $30.
Title: Re: Arduino Setworks
Post by: MSSawmill on September 29, 2013, 08:41:54 AM
Very cool idea, Jake! I haven't had a good excuse to play with an Arduino, but I've been looking at them for quite a while. They are extremely cool little devices.

It's been a while since I did any C++ programming, but I still do a lot of scripting so maybe I can help with the logic part of the code. I'll definitely be watching the thread. Good luck!
Title: Re: Arduino Setworks
Post by: scsmith42 on September 29, 2013, 02:37:22 PM
Jake, great idea and I think that you should definitely go for it.  If nothing else, the knowledge that you gain from this project will be a great asset in the future.

Keep us posted.

Scott
Title: Re: Arduino Setworks
Post by: hackberry jake on September 29, 2013, 06:30:59 PM
You guys saying "go for it" is taking the wind out of my sails. Usually when people say "you won't be able to do that" or "that'll never happen"... thats what gets me goin! Just kidding. Thanks guys!  Im committed now!
Title: Re: Arduino Setworks
Post by: drobertson on September 29, 2013, 08:10:00 PM
Jake, this is a good hobby for you, and fun as well, there are systems in place to make lumber quickly and reasonably cost effective.  It boils down to what your time is worth, and how much pay back will be coming with the addition.  All said and done, what you enjoy is the most important.    david
Title: Re: Arduino Setworks
Post by: hackberry jake on September 29, 2013, 09:33:16 PM
Quote from: drobertson on September 29, 2013, 08:10:00 PM
Jake, this is a good hobby for you, and fun as well, there are systems in place to make lumber quickly and reasonably cost effective.  It boils down to what your time is worth, and how much pay back will be coming with the addition.  All said and done, what you enjoy is the most important.    david
It may not benefit me all that much when its done. Kind of like the wright brothers didnt really need a plane when they built one. But once I get most of the kinks worked out it will be easier for the next guy to it without spending thousands on setworks. I really enjoy "open source" projects. Sharing for the common good.
Title: Re: Arduino Setworks
Post by: beenthere on September 29, 2013, 10:46:30 PM
And the project could also show some of the basic code used (assembly language or C++) to accomplish some simple movement showing feedback and output so members could get a better feel for what is going on with the Arduino board.
Looks like you could provide quite a learning experience for many FF'rs.
Title: Re: Arduino Setworks
Post by: MSSawmill on September 30, 2013, 10:10:41 AM
Quote from: hackberry jake on September 29, 2013, 06:30:59 PM
You guys saying "go for it" is taking the wind out of my sails. Usually when people say "you won't be able to do that" or "that'll never happen"... thats what gets me goin! Just kidding. Thanks guys!  Im committed now!
What a dumb idea! It'll never work! You aren't smart enough to make it happen! I bet you'll never even get the hardware figured out...

(Remember this when it works and I ask for schematics and source code, k?)
Title: Re: Arduino Setworks
Post by: uler3161 on September 30, 2013, 01:17:12 PM
I just built one with an Arduino a couple months ago and was actually planning on creating a thread on here when I got done. Only problem I have is apparently some electrical interference causing the Arduino to freeze. I think I need to put it in a faraday cage or relocate my stepper motor power supply. Just haven't got around to it. Seems to work fine when powering it from my laptop over USB.

I'm using an Uno R3, 600w dc-dc converter for the stepper, GeckoDrive driver and I think the stepper is somewhere around 1200 oz-in connected to the up/down gearbox on my LT40 using a small chain and wired bipolar parallel. I'm using the ArduinoStepper library which says it's only good for 4000 steps per second. That is fine for moving the head down and with the gear ratio I have, it moves down fast. The problem is moving up. I can't run it at 4000 because it doesn't have enough torque.

One gotcha I had was the backlash in the gearbox. I make the assumption that moving the head down to the cutting height is accurate, but when moving up, I go up an extra 1/8" worth of steps and then back down.

If you have any questions, feel free to contact me.
Title: Re: Arduino Setworks
Post by: hackberry jake on October 01, 2013, 11:44:11 AM
Wow, you beat me to it! Could you post your code for future arduino projects?
Title: Re: Arduino Setworks
Post by: uler3161 on October 01, 2013, 04:54:57 PM
Quote from: hackberry jake on October 01, 2013, 11:44:11 AM
Wow, you beat me to it! Could you post your code for future arduino projects?

Sure. I haven't had time to go through and clean it up, and there's a lot of code specific to the controls I am using, especially the rotary encoder. And I have an issue with the manual height control going crazy, so don't pay much attention to that part of it. I think this is the latest code I have, but it's been awhile since I even have looked at it.
Title: Re: Arduino Setworks
Post by: hackberry jake on October 01, 2013, 06:38:14 PM
Wholly cow! Thats a lot more involved that I was thinking it was going to be! I hadnt decided on using an lcd or not yet. It looks like the lcd added a lot of code.
Title: Re: Arduino Setworks
Post by: uler3161 on October 02, 2013, 11:24:45 AM
The LCD code isn't too complicated, just a lot of it. I will probably extract it to a separate file eventually.

Here's a photo of the hardware during development. I still have a lot of ideas I want to accomplish. Just need to find the time.



 (https://forestryforum.com/gallery/albums/userpics/29924/IMG_20130422_213620.jpg)
Title: Re: Arduino Setworks
Post by: Larry on October 02, 2013, 11:53:41 AM
Jake, I have a variety of nice weather proof electrical boxes to house components.  I could throw one on the Bridgeport to cutout holes for a LCD, switches, and etc. 

Just a thought after seeing uler's last pic.  You would have to supply that orange paint. :D
Title: Re: Arduino Setworks
Post by: hackberry jake on October 02, 2013, 03:42:27 PM
That would be pretty fancy larry! I had a wooden box in mind. I like your idea better  8)
Title: Re: Arduino Setworks
Post by: scrout on October 03, 2013, 04:18:10 PM
Jake,
You are reading my mind here.
I have one of these already:
http://www.grizzly.com/products/T23013
Then I want to do this:
http://www.yuriystoys.com/2012/09/do-it-yourself-dro-with-arduino-and.html
Just needs the specific setworks functions.

This still leaves the power drivers as discussed.  My up/down is a 120 vac motor, so I could probably do it with a triac driver.
Please keep us posted.
Title: Re: Arduino Setworks
Post by: Satamax on October 03, 2013, 04:44:26 PM
Duh, i wish i could understant stuff like that. I'm too dumb for the moment!   :(
Title: Re: Arduino Setworks
Post by: hackberry jake on October 04, 2013, 04:06:05 PM
Here is what I have so far:
// boardwalk setworks
// author: Jake Smith
// version 1

#include <AccelStepper.h>

AccelStepper mystepper(1, 10, 11);
//-----Defines------


//---pin assignments----
const int UpFivePin = 2;
const int UpOnePin = 3;
const int UpQuarterPin = 4;
const int UpSixteenthPin= 5;
const int DownFivePin = 6;
const int DownOnePin = 7;
const int DownQuarterPin = 8;
const int DownSixteenthPin = 9;
const int stepPin = 10;
const int dirPin = 11;
const int stepperAcceleration = 10000;
const int upSpeed = 2000;
const int downSpeed = -4000;


//-------Objects-----



//------set-up---

void setup()
{

//------Pin Modes------
mystepper.setMaxSpeed(400);
mystepper.setSpeed(80);
pinMode(UpFivePin,INPUT_PULLUP);
pinMode(UpOnePin,INPUT_PULLUP);
pinMode(UpQuarterPin,INPUT_PULLUP);
pinMode(UpSixteenthPin,INPUT_PULLUP);
pinMode(DownFivePin,INPUT_PULLUP);
pinMode(DownOnePin,INPUT_PULLUP);
pinMode(DownQuarterPin,INPUT_PULLUP);
pinMode(DownSixteenthPin,INPUT_PULLUP);

}


void loop()
{
  if (UpFivePin == LOW)
  mystepper.move(5000);
 
  if (UpOnePin == LOW)
  mystepper.move(1000);
 
  if (UpQuarterPin == LOW)
  mystepper.move(250);
 
  if (UpSixteenthPin == LOW)
  mystepper.move(62.5);
 
  if (DownFivePin == LOW)
  mystepper.move(-5000);
 
  if (DownOnePin == LOW)
  mystepper.move(-1000);
 
  if (DownQuarterPin == LOW)
  mystepper.move(-250);
 
  if (DownSixteenthPin == LOW)
  mystepper.move(-62.5);
 
}

I know it still needs a lot of work, but its a start. First arduino code I have ever written.
Title: Re: Arduino Setworks
Post by: uler3161 on October 07, 2013, 10:21:20 AM
Quote
I know it still needs a lot of work, but its a start. First arduino code I have ever written.

It's a good start. Do you have a stepper motor to try out with it? I think for experimenting, you could get a very small stepper and a stepper shield. Then hopefully just buy the bigger motor and driver if it all works out.

One thing you will want to do is put limits in your system so the sawhead doesn't go too low or too high. If you went through my code enough, you probably saw that I did it in the code. That kind of implies that everything in the system is working, so it's probably better to use limit switches. I just wasn't at the point where I wanted to attach too many things to my mill, but I may put switches on later.

I'm hoping to have more time to work on my setworks this winter. I know what I have looks complicated, but it's only the tip of the iceberg compared to what I really want to do.
Title: Re: Arduino Setworks
Post by: hackberry jake on October 07, 2013, 08:09:14 PM
I have some stepper motors and a g540 driver on my cnc router. The drive is only 3.5 amp but it should be big enough to see if this will work. And its still bigger than any of the shields ive seen. I am currently taking a c++ class but the c++ the arduino uses is a whole different animal from what I am learning.
Title: Re: Arduino Setworks
Post by: uler3161 on October 07, 2013, 09:26:46 PM
I thought the Arduino code was a lot simpler than C++, but then again it's been about 10 years since I wrote any C++ code. I haven't had to deal with pointers yet, so I'm happy.
Title: Re: Arduino Setworks
Post by: swampbuggy on October 07, 2013, 10:04:50 PM
I know nothing about what you are doing, but reading it makes me wonder if a vertical actuator might be easier to use. They have internal relays that can be operated on low voltage and some are designed to move a lot of weight. I think its great you have the mind to build something like this! Dan
Title: Re: Arduino Setworks
Post by: MSSawmill on October 08, 2013, 10:55:20 AM
Quote from: uler3161 on October 07, 2013, 09:26:46 PM
I thought the Arduino code was a lot simpler than C++, but then again it's been about 10 years since I wrote any C++ code. I haven't had to deal with pointers yet, so I'm happy.
No pointers makes C++ almost bearable...

I t think I saw that someone was working on a .Net library for the Arduino. Being able to back it out in C#would be amazing! But that's only a good thing if you know a .Net language...
Title: Re: Arduino Setworks
Post by: uler3161 on October 08, 2013, 11:15:44 AM
I thought I saw something about using C#, but I didn't investigate any further. I'm actually a C# developer at my full time job, so it'd be a more natural choice for me.
Title: Re: Arduino Setworks
Post by: hackberry jake on October 09, 2013, 09:18:43 PM
Here is the newer version of code... Still needs some work, but I'm learning.

// boardwalk setworks
// author: Jake Smith
// version 1

#include <AccelStepper.h>

AccelStepper mystepper(1, 10, 11);
//-----Defines------


//---pin assignments----
const int UpFivePin = 2;
const int UpOnePin = 3;
const int UpQuarterPin = 4;
const int UpSixteenthPin= 5;
const int DownFivePin = 6;
const int DownOnePin = 7;
const int DownQuarterPin = 8;
const int DownSixteenthPin = 9;
const int stepPin = 10;
const int dirPin = 11;
const int GoButton = 12;
const int stepperAcceleration = 10000;
const int upSpeed = 2000;
const int downSpeed = -4000;
int buttonState;             // the current reading from the input pin
int lastButtonState = LOW;   // the previous reading from the input pin
long lastDebounceTime = 0;  // the last time the output pin was toggled
long debounceDelay = 50;    // the debounce time; increase if the output flickers
//-------Objects-----



//------set-up---

void setup()
{
Serial.begin(9600);
//------Pin Modes------
mystepper.setMaxSpeed(400);
mystepper.setSpeed(80);
pinMode(UpFivePin,INPUT_PULLUP);
pinMode(UpOnePin,INPUT_PULLUP);
pinMode(UpQuarterPin,INPUT_PULLUP);
pinMode(UpSixteenthPin,INPUT_PULLUP);
pinMode(DownFivePin,INPUT_PULLUP);
pinMode(DownOnePin,INPUT_PULLUP);
pinMode(DownQuarterPin,INPUT_PULLUP);
pinMode(DownSixteenthPin,INPUT_PULLUP);
pinMode(GoButton,INPUT_PULLUP);
signed int xSteps = 0;
}


void loop()
{
  signed int xSteps;
  if (mystepper.distanceToGo() == 0)
  {
   
    if (digitalRead (UpFivePin) == LOW) 
    {
      delay(10);
    xSteps = xSteps + 4000;
    }
 
    if (digitalRead (UpOnePin) == LOW)
    {
      delay(10);
    xSteps = xSteps + 800;
    }
   
    if (digitalRead (UpQuarterPin) == LOW)
    {
      delay(10);
    xSteps = xSteps + 200;
    }
 
    if (digitalRead (UpSixteenthPin) == LOW)
    {
      delay(10);
    xSteps = xSteps + 50;
    }
 
    if (digitalRead (DownFivePin) == LOW)
    {
      delay(10);
    xSteps = xSteps - 4000;
    }
 
    if (digitalRead (DownOnePin) == LOW)
    {
      delay(10);
    xSteps = xSteps -800;
    }
 
    if (digitalRead (DownQuarterPin) == LOW)
    {
      delay(10);
    xSteps = xSteps - 200;
    }
 
    if (digitalRead (DownSixteenthPin) == LOW)
    {
      delay(10);
    xSteps = xSteps - 50;
    }
   
    if (digitalRead (GoButton) == LOW)
   
    {
    mystepper.move(xSteps);
    xSteps = 0;
    }
    Serial.println(xSteps);
   
  }
  else
{
   mystepper.run();
}
}
Title: Re: Arduino Setworks
Post by: uler3161 on October 09, 2013, 10:50:02 PM
I like how you have the go button. The manual mode I came up with was supposed to just read the changes to a rotary encoder handwheel and would read changes and move the sawhead at the same time, but it goes crazy most of the time. Just need to do some debugging and figure out what I'm doing wrong.

I'm not sure if it would help you at all, but there is an Arduino + breadboard simulator at http://123d.circuits.io/ (http://123d.circuits.io/). I just found it the other day, so I don't know much about it, but it seems pretty neat.
Title: Re: Arduino Setworks
Post by: hackberry jake on October 10, 2013, 12:01:48 PM
I ordered this stepper motor
http://www.automationtechnologiesinc.com/products-page/nema-23/nema-23-three_eighths-inch-dual-shaft-with-a-flat-570-oz-in
And this drive
http://www.automationtechnologiesinc.com/products-page/kl-stepper-drivers/kl-6050-bipolar-stepper-motor-driver
I bought this power supply when it was on sale a while back
http://www.trcelectronics.com/View/Mean-Well/SE-600-48.shtml
Counting the arduino, I have just a little over $200 invested so far for a 5 amp, 48 volt stepper system. Thats not too bad. Still need the mechanical parts to attach it to the mill but I will probably fabricate most of it.
Title: Re: Arduino Setworks
Post by: uler3161 on October 10, 2013, 12:33:40 PM
Quote from: hackberry jake on October 10, 2013, 12:01:48 PM
I bought this power supply when it was on sale a while back
http://www.trcelectronics.com/View/Mean-Well/SE-600-48.shtml

Are you planning to run an AC line then?
Title: Re: Arduino Setworks
Post by: hackberry jake on October 10, 2013, 02:55:26 PM
Yes, my sawmill is stationary. My hydraulics are also AC powered. I got a bunch of cable track flexible conduit stuff that I am going to run overhead. Are you running your steppers off of the 12 volts on the mizer?
Title: Re: Arduino Setworks
Post by: uler3161 on October 10, 2013, 03:43:19 PM
I'm using a DC-DC converter to up the 12v to somewhere around 60 or 70. I don't recall what I have it set at. But I think the power supply is causing enough electrical interference to lock up my Arduino. I've tried a couple different DC converters that I thought would work, including a cigarette lighter usb and it was always the same result. But I disconnected that stepper power supply and the Arduino would work. So I guess I need a faraday cage around the Arduino. Or maybe relocate the stepper power supply.
Title: Re: Arduino Setworks
Post by: ronwood on October 10, 2013, 04:20:13 PM
Will the stepper motor be big enough to raise the head?
Ron
Title: Re: Arduino Setworks
Post by: uler3161 on October 10, 2013, 04:37:09 PM
Quote from: ronwood on October 10, 2013, 04:20:13 PM
Will the stepper motor be big enough to raise the head?
Ron

I'm not sure how his stepper is going to be used, but I originally was using a 425 oz-in stepper and it did ok. Wasn't quite as fast as the original dc motor when raising the head, so that's why I went with a bigger stepper. That's with a 25hp kohler engine on a 1989 model LT40HD to give you an idea how much weight was being moved. I think his stepper should be sufficient with the proper gearing.
Title: Re: Arduino Setworks
Post by: hackberry jake on October 10, 2013, 04:42:25 PM
Quote from: uler3161 on October 10, 2013, 04:37:09 PM
Quote from: ronwood on October 10, 2013, 04:20:13 PM
Will the stepper motor be big enough to raise the head?
Ron

I'm not sure how his stepper is going to be used, but I originally was using a 425 oz-in stepper and it did ok. Wasn't quite as fast as the original dc motor when raising the head, so that's why I went with a bigger stepper. That's with a 25hp kohler engine on a 1989 model LT40HD to give you an idea how much weight was being moved. I think his stepper should be sufficient with the proper gearing.

It should do fine. 570oz @ 5amps is a pretty good sized stepper. It is also a nema 23 frame size which is capable of higher rpms without losing as much torque. So if it doesn't lift the head at first, I will just gear it down until it does. The boardwalk sawmills also have a garage door type spring that holds most of the weight of the head.
uler3161, is the arduino isolated from the drive side of things? if not you might be able to use one of these https://www.sparkfun.com/products/9118 on your step and direction lines to keep feedback from coming into the Arduino. Just a thought, at $5 it would be a pretty cheap fix.
Title: Re: Arduino Setworks
Post by: uler3161 on October 10, 2013, 04:53:06 PM
Quote from: hackberry jake on October 10, 2013, 04:42:25 PM
uler3161, is the arduino isolated from the drive side of things? if not you might be able to use one of these https://www.sparkfun.com/products/9118 on your step and direction lines to keep feedback from coming into the Arduino. Just a thought, at $5 it would be a pretty cheap fix.

I thought the converters that I bought would have accomplished the same thing, but apparently they didn't. For $5, I may have to try that. Thanks
Title: Re: Arduino Setworks
Post by: hackberry jake on October 10, 2013, 05:37:11 PM
I know some of the 7amp geckos are isolated but I dont know about urs.
Title: Re: Arduino Setworks
Post by: uler3161 on October 10, 2013, 05:47:49 PM
Quote from: hackberry jake on October 10, 2013, 05:37:11 PM
I know some of the 7amp geckos are isolated but I dont know about urs.

I'm sure it's a simple fix, whatever it is. If my degree had been in EE instead of CS, I would probably know what to do.
Title: Re: Arduino Setworks
Post by: hackberry jake on October 14, 2013, 08:34:20 PM
Got my drive and stepper in the mail today... Looks like I won't have time to Play with it til the weekend though. I am looking forward to see what exactly the code does with the stepper. Here is the latest code: note: I haven't adjusted all the step values to positive yet. I was going to wait to input that when I know the ratio of the stepper to head travel.

// boardwalk setworks
// author: Jake Smith
// version 1

#include <AccelStepper.h>

AccelStepper mystepper(1, 10, 11);
//-----Defines------


//---pin assignments----
const int FivePin = 2;
const int OnePin = 3;
const int QuarterPin = 4;
const int SixteenthPin= 5;
const int FourQuarterPin = 6;
const int FiveQuarterPin = 7;
const int SixQuarterPin = 8;
const int UpOrDownSwitch = 9;
const int stepPin = 10;
const int dirPin = 11;
const int GoButton = 12;
const int ZeroButton = 13;
const int stepperAcceleration = 10000;
const int upSpeed = 2000;
const int downSpeed = -4000;
double xSteps = 0;

//-------Objects-----



//------set-up---

void setup()
{
Serial.begin(9600);
//------Pin Modes------
mystepper.setMaxSpeed(400);
mystepper.setSpeed(80);
pinMode(FivePin,INPUT_PULLUP);
pinMode(OnePin,INPUT_PULLUP);
pinMode(QuarterPin,INPUT_PULLUP);
pinMode(SixteenthPin,INPUT_PULLUP);
pinMode(FourQuarterPin,INPUT_PULLUP);
pinMode(FiveQuarterPin,INPUT_PULLUP);
pinMode(SixQuarterPin,INPUT_PULLUP);
pinMode(UpOrDownSwitch,INPUT_PULLUP);
pinMode(ZeroButton,INPUT_PULLUP);
pinMode(GoButton,INPUT_PULLUP);
double xSteps=0;

}


void loop()
{
//signed int xSteps = 0;
while(mystepper.distanceToGo() == 0)
{
   if(digitalRead (FivePin)==LOW)
   {
     delay(500);
     xSteps = xSteps + 4000;
   } 
   if(digitalRead (OnePin)==LOW)
   {
     delay(500);
     xSteps = xSteps + 800;
   } 
   if(digitalRead (QuarterPin)==LOW)
   {
     delay(500);
     xSteps = xSteps + 200;
   } 
   if(digitalRead (SixteenthPin)==LOW)
   {
     delay(500);
     xSteps = xSteps + 50;
   } 
   if(digitalRead (FourQuarterPin)==LOW)
   {
     delay(500);
     xSteps = xSteps - 4000;
   } 
   if(digitalRead (FiveQuarterPin)==LOW)
   {
     delay(500);
     xSteps = xSteps - 800;
   } 
   if(digitalRead (SixQuarterPin)==LOW)
   {
     delay(500);
     xSteps = xSteps -200;
   } 
   if(digitalRead (UpOrDownSwitch)==LOW && xSteps > 0)
   {
    xSteps = -xSteps;
   } 
   if(digitalRead (UpOrDownSwitch)==HIGH && xSteps < 0)
   {
    xSteps = -xSteps;
   }
   if(digitalRead (GoButton) == LOW)
   {
     mystepper.move(xSteps);
     xSteps = 0;
   }
   
   if(digitalRead (ZeroButton) == LOW)
    {
    xSteps = 0;
    }

   Serial.println(xSteps/800,3);
}
//else
{
// mystepper.run();
}
}
Title: Re: Arduino Setworks
Post by: hackberry jake on October 18, 2013, 07:45:25 PM
 I got some time befor work today to work on the button console for the setworks. I drew up how I wanted it laid out in autocad then dusted off the cnc router to cut it out. It is 1/2" plywood (birch I think).
The buttons I am using are arcade buttons from sparkfun. I got 12 green, 2 yellow, 1 black, and 1 blue. I also sprung for a big fancy "end of the world" dome push button for the "Go" button. The rectangle hole at the top is for a lcd display to display different values. The black will probably just be the primer for some other color that I haven't yet decided on. I know Larry offered to cut out my console using his mill and steel, but I haven't got a chance to play with the cnc for a while and this gave me the chance. I am still working on my code in my spare time. I'm getting pretty excited about this project!



 (https://forestryforum.com/gallery/albums/userpics/25938/unpainted.jpg)

 

 (https://forestryforum.com/gallery/albums/userpics/25938/painted.jpg)
Title: Re: Arduino Setworks
Post by: beenthere on October 18, 2013, 08:09:22 PM
We're getting excited too   8)
Title: Re: Arduino Setworks
Post by: uler3161 on October 18, 2013, 08:17:39 PM
With those arcade buttons, maybe you should add one of these and let people pay you for the privilege of sawing your logs...

https://www.sparkfun.com/products/11719 (https://www.sparkfun.com/products/11719)
Title: Re: Arduino Setworks
Post by: hackberry jake on October 18, 2013, 08:28:00 PM
Here is the buttons.
1/16 to 2' across the top, each button is double what the button to the left is.
1.625 (2 by), 3.625 (4 by), 5.625 (6 by), and 7.375 (8 by) on the second row.
1.25 (4 quarter), and 1.5 (five quarter) on third row
All the buttons mentioned so far will be green.
The two buttons on the left are programable to whatever by holding them down log enough. They will both be yellow.
The two at the bottom are home (black) and zero (blue)
The big green dome button will be at the bottom right
The up or down switch will be the little hole on the left.
Title: Re: Arduino Setworks
Post by: hackberry jake on October 18, 2013, 08:37:11 PM
You can push as many buttons as you want the itll add up the distance (displayed on the lcd) then hit the go button. The lcd has four lines first line will be what distance is currently held. The second line will be saw height above bed, third and fourth lines will be what the two programmable buttons are holding.
Title: Re: Arduino Setworks
Post by: Ga Mtn Man on October 21, 2013, 07:14:52 PM
Very cool Jake.

What are the two programmable buttons going to be used for and how will you program them?
Title: Re: Arduino Setworks
Post by: hackberry jake on October 22, 2013, 10:43:05 AM
The programmable buttons will be for distances that I dont have a button for. Once the arduino is powered up the default will be 1/64 and 1/128 of an inch. If say you want a distance for 3/4", you would hit the 1/2" button, then the 1/4" button, then hold one of the programmable buttons down for ~7 seconds. The programmable button will then be for
3/4" until you either reset it to something else or turn the power off.
Title: Re: Arduino Setworks
Post by: hackberry jake on October 25, 2013, 04:17:52 PM
Just need to mount the lcd and finish up the wiring, Then I will start working on the mechanical parts of the system.



 (https://forestryforum.com/gallery/albums/userpics/25938/buttons.jpg)
Title: Re: Arduino Setworks
Post by: MSSawmill on October 26, 2013, 09:21:22 PM
Looking slick, Jake! I want to copy/paste the latest code into an editor so I can see what's going on!
Title: Re: Arduino Setworks
Post by: Solomon on October 26, 2013, 09:51:41 PM
Quote from: POSTONLT40HD on September 26, 2013, 09:28:06 PM
I have no idea what y'all are talking about but boy am I a reading.  :D

I'm with you PostonLT40,  I still have trouble posting pictures on here.  If it were not for Beenthere I wouldn't have any pictures on here at all.
  I have what Log Master calls a photo electric set works system on my LM4   It's a steel plate with spaced rows of holes that are drilled  x distance apart plus the thickness of the kerf  with fiber optic cables reading both sides of the plate.    I have a button I hold down as I lower the head , when the optics see each other through the hole it activates an optic switch and stops the head.    The plate has 14 presets  (rows of holes)   and if I want to , I can simply make another plate on my drill press with any presets I want,   It works like a champ!   And it came as standard equipment on my mill.    It's  about as electronic and computerized as My machine is gonna get.
Title: Re: Arduino Setworks
Post by: hackberry jake on October 27, 2013, 10:18:22 AM
Quote from: MSSawmill on October 26, 2013, 09:21:22 PM
Looking slick, Jake! I want to copy/paste the latest code into an editor so I can see what's going on!
The latest code has changed quite a bit since the last one I put on here. When I get home I will upload the latest code. It isnt far from being the finished code.
Title: Re: Arduino Setworks
Post by: hackberry jake on October 28, 2013, 11:13:41 AM
Here is the latest code. I haven't tried it with either the lcd or the stepper/driver so I am sure it still needs a lot of debugging.
Title: Re: Arduino Setworks
Post by: lowpolyjoe on October 28, 2013, 12:28:00 PM
What a great project!  I hear those Arduinos can do a lot.  I ordered a different micropocessor kit a while ago but haven't had the time to do anything interesting with it.

Sharing the code is awesome for the community
Title: Re: Arduino Setworks
Post by: hackberry jake on October 28, 2013, 09:29:15 PM
Quote from: lowpolyjoe on October 28, 2013, 12:28:00 PM


Sharing the code is awesome for the community
I have spent a few hrs on it for sure. I hope somebody can benefit from it. Maybe one day there will be a "sawmill library" for the arduino to make the code easier to write.
Title: Re: Arduino Setworks
Post by: hackberry jake on October 30, 2013, 10:15:30 PM
I ordered some mechanical parts from surplus center today. Looks like it will go from the stepper to a coupler to a 40:1 reduction gearbox (free from work) to a sprocket to a chain to a sprocket on the lift wheel of the mill. The sprocket on the gearbox is 10 tooth and the sprocket on the mill is 20 tooth. If the gear ratio is too far one way or the other I will just order a different sized sprocket. Im crossing my fingers...
Title: Re: Arduino Setworks
Post by: StoddardLumber on October 30, 2013, 10:18:57 PM
How do you plan on handling the backlash in the gearbox and chain system? ( or do you have cnc anti backlash 40-1 gearbox? )

Title: Re: Arduino Setworks
Post by: hackberry jake on October 30, 2013, 10:31:54 PM
I was kinda hoping the tension from the weight would eliminate backlash but if it doesnt I suppose I will address the backlash in the code. Each time it changes direction I could add in a few more steps.
Title: Re: Arduino Setworks
Post by: hackberry jake on November 13, 2013, 10:37:18 PM
Well, I got the code mostly ready, even got the code lined out for my LCD display...


 (https://forestryforum.com/gallery/albums/userpics/25938/lcd.jpg)
Here is my high dollar motor mount adapter to mount a nema 23 stepper motor to a 40:1 c-face gear reduction box. The gear reduction shaft is actually a female 5/8" so I cut the shaft off of a bad motor and connected my three piece coupler to it.
 

 (https://forestryforum.com/gallery/albums/userpics/25938/motor_mount.jpg)
This is the motor and gear reducer sitting on the mill. It is mounted permanantly now. I even left some room for washers to tighten up the chain.


 (https://forestryforum.com/gallery/albums/userpics/25938/motor_on_mill.jpg)
This is where I decided to mount the cabinet. My hydraulic levers for the log turner are just out of the photo to the right. I can access the setworks and the hydraulic valves at the same time (don't know why I would want to but I can  ;D.


 (https://forestryforum.com/gallery/albums/userpics/25938/mounted_cabinet.jpg)
I wired it all up for a test and it worked great. It didn't have a load on it yet but it worked for the test. The only big thing that is left is a wire transport type system. I have enough of the plastic cable track to build a tray the length of the mill (22') but I would need to keep the tray fairly parralell to the mill. I am also considering a pivot arm type setup like the big circle mills use. I haven't decided which path I will go with it yet.
Title: Re: Arduino Setworks
Post by: uler3161 on November 14, 2013, 11:19:52 AM
Very nice
Title: Re: Arduino Setworks
Post by: NMFP on November 17, 2013, 09:15:34 PM
Looking good!!!!! How do I know what size stepper motor to order for advancing the knees on my setworks?  Don't want to waste too much money with trial and error.

I have more questions but have been working hard at building construction so the mill build is coming close.
Title: Re: Arduino Setworks
Post by: hackberry jake on November 19, 2013, 05:44:31 PM
You could probably just get a decent sized motor and hook it up via chain and sprockets. Sprockets are pretty cheap and you can change the ratio fairly easily if its either under powered or too slow. I went with a 5amp system because automation technologies has a 5amp driver for $50 and a 5amp stepper for $55. To get a 7amp system it would cost more than twice that amount. You would probably be more suited for a 5amp nema 34 motor. Nema 34 motors are quite a bit bigger than my nema 23 and can make more torque. Automation tech has a nema 34 rated at 1200oz/in and 6amps. If you power it with a 5amp drive your stall torque would drop to 5/6 the rated torque or about 1000 oz/in or 5.2 ft/lb. Remember this is stall torque. The force it takes to move the rotor when its stationary. The torque the motor actually produces will be less depending on speed.
Title: Re: Arduino Setworks
Post by: drobertson on November 19, 2013, 06:10:34 PM
Way to stick with it Jake,  it looks like it won't be long,    david
Title: Re: Arduino Setworks
Post by: shelbycharger400 on December 24, 2013, 01:39:09 PM
this your project from your ideas a few years back?   I think I remember talking bout it.    I still have my books on programming.    Look up this isbn  978_0_07_301010_6       it's programmable logic controllers  with logixpro plc simulator it's   Allen Bradley setup  but you will learn a lot  but their is no way to export your program  but theirs lots you will learn,  it was worth the $
Title: Re: Arduino Setworks
Post by: hackberry jake on December 24, 2013, 03:03:36 PM
I worked on it a little bit today. I believe the code is done for the arduino. I made it to where when the home button is held down for 3 seconds. It acts like a go-to button. If cutting ties I could program one of the programmable buttons to 7" and the second programmable button to 9" and use the go-to button to make repeatable ties with minimal button presses. I haven't had much time to work on it lately but I am finished with school now so I will be posting a video of it working shortly (after Christmas and my honeymoon to winter park colorado). I will post the finished code as well with plenty of pictures for anybody that wants to build their own setworks project in the future.
Title: Re: Arduino Setworks (with video!)
Post by: hackberry jake on January 20, 2014, 04:57:24 PM
Shes alive!
http://www.youtube.com/watch?v=Fc5CRJCRSE8&feature=youtu.be
Title: Re: Arduino Setworks (with video!)
Post by: Den-Den on January 20, 2014, 05:22:55 PM
Good job!  Looks like it works great.
Title: Re: Arduino Setworks (with video!)
Post by: beenthere on January 20, 2014, 07:17:29 PM
That is pretty impressive. smiley_thumbsup
Title: Re: Arduino Setworks (with video!)
Post by: POSTON WIDEHEAD on January 20, 2014, 07:36:45 PM
Hack.....I watched your vid. twice. :) I'm proud of you....that's awesome.
I could never do something like that.
You may be the first one to make the WHEATIES BOX twice!  :D :D :D

Very impressed....good job!  smiley_thumbsup
Title: Re: Arduino Setworks (with video!)
Post by: pineywoods on January 20, 2014, 11:13:04 PM
 8)  8) Looks good ..
Title: Re: Arduino Setworks (with video!)
Post by: shortlogger on January 21, 2014, 01:21:53 AM
Pretty neat
Title: Re: Arduino Setworks (with video!)
Post by: mad murdock on January 21, 2014, 07:24:38 AM
That is slicker than sliced bread Jake!! Congratulations 8)
Title: Re: Arduino Setworks (with video!)
Post by: Magicman on January 21, 2014, 07:43:43 AM
Well, lookatyougo !!!   smiley_thumbsup smiley_thumbsup
Title: Re: Arduino Setworks (with video!)
Post by: mmartone on January 21, 2014, 07:48:45 AM
lookin good! Now lets get one mounted on an old LT40 and try it out. Just send it to me with some instructions!
Title: Re: Arduino Setworks (with video!)
Post by: diesel pap on January 21, 2014, 08:07:50 AM
looks good 8)
Title: Re: Arduino Setworks (with video!)
Post by: MSSawmill on January 21, 2014, 03:00:21 PM
Awesome, Jake! Very nice work! I'm sorry I never got to help you out with the code, but looks like you didn't need it. I like, man...
Title: Re: Arduino Setworks (with video!)
Post by: drobertson on January 21, 2014, 07:07:03 PM
Nice work Jake, right about now I am missing my brother Kevin, he was big into making the simple better!
Lots of work there for sure, not sure how the speed will affect the amp draw but its worth a try for sure,  looking forward to your next post,   david
Title: Re: Arduino Setworks (with video!)
Post by: rbhunter on January 23, 2014, 07:49:30 PM
Good work. I am glad you took your idea and made it work. The video was great.
Title: Re: Arduino Setworks (with video!)
Post by: highleadtimber16 on January 23, 2014, 09:14:14 PM
Wow. That is impressive!
Title: Re: Arduino Setworks (with video!)
Post by: mad murdock on January 23, 2014, 09:43:51 PM
Ya done good 8) very neat!!
Title: Re: Arduino Setworks (with video!)
Post by: Ga Mtn Man on January 25, 2014, 11:21:59 AM
Hey Jake,

I re-read this thread and couldn't find if you are using any sort of encoder for head position.  How does your setworks know where the head is?
Title: Re: Arduino Setworks (with video!)
Post by: schmism on January 25, 2014, 12:36:06 PM
I would include a micro-switch at the end of travel positions for  oh-sht moments.   this provides a safety so something doesnt get damaged and also serve as a reference point to re-zero the head/system.

Next thing you need to do is rig a system to your back log stops so that when its up the arduino knows what height it is and wont let the saw head go lower so you never have to worry about cutting into the back stops again.

as for your speed, try just reversing your sprokets first.  3 times faster than your current speed shouldn't be to bad although you may want to program in a cushion on the stop side.  If i remember my stepper programing from college there should be a ramp up/down function you can set that will help cushion your starts/stops


When you cut frameing material you expect to use it rough sawn?  or just expect for the surface to clean up good enough with just 1/16th off each side?
Title: Re: Arduino Setworks (with video!)
Post by: hackberry jake on January 26, 2014, 10:36:24 PM
Quote from: Ga Mtn Man on January 25, 2014, 11:21:59 AM
Hey Jake,

I re-read this thread and couldn't find if you are using any sort of encoder for head position.  How does your setworks know where the head is?
It uses a stepper motor so an encoder isn't needed. There are 200 steps per revolution. If you send it 200 steps it will rotate exactly 360 degrees.
Quote from: schmism on January 25, 2014, 12:36:06 PM
I would include a micro-switch at the end of travel positions for  oh-sht moments.   this provides a safety so something doesnt get damaged and also serve as a reference point to re-zero the head/system.

Next thing you need to do is rig a system to your back log stops so that when its up the arduino knows what height it is and wont let the saw head go lower so you never have to worry about cutting into the back stops again.

as for your speed, try just reversing your sprokets first.  3 times faster than your current speed shouldn't be to bad although you may want to program in a cushion on the stop side.  If i remember my stepper programing from college there should be a ramp up/down function you can set that will help cushion your starts/stops


When you cut frameing material you expect to use it rough sawn?  or just expect for the surface to clean up good enough with just 1/16th off each side?

there is 1/8 Kerr taken out so the cut size is actually pretty close to 1.5". I have thought about putting a limit switch on it and using it to zero the head, but after each move, the arduino saves its location. I would try swapping sprockets but the gearbox is a 5/8" bore and the mill is 3/4".
Title: Re: Arduino Setworks (with video!)
Post by: Ga Mtn Man on January 27, 2014, 05:39:17 PM
I realized it was a dumb question after I posted it.  Stepping a precise number of degrees really is the essence of what a stepper motor is. 
Title: Re: Arduino Setworks (with video!)
Post by: hackberry jake on January 28, 2014, 11:22:02 PM
I just modified the code to save the sawhead height last night and I haven't had a chance to try it, but I hope this works. If anybody else uses this in the future, I believe all you will have to change is the "ratio" variable to whatever ratio your mill is using.
Title: Re: Arduino Setworks (with video!)
Post by: shortlogger on January 29, 2014, 06:01:23 PM
How long till I can get my mill retrofitted with the Hackberry Jake setworks system ? Sure would beat my hand winch .
Title: Re: Arduino Setworks (with video!)
Post by: hackberry jake on January 29, 2014, 06:17:44 PM
Quote from: shortlogger on January 29, 2014, 06:01:23 PM
How long till I can get my mill retrofitted with the Hackberry Jake setworks system ? Sure would beat my hand winch .
i did all the hard work for ya. The research and development, the code writing, layout, ect. Now all you gotta do is buy parts and assemble it. And i just got done checking my sprockets. The 5/8" bore on the gearbox is a 10 tooth and the 3/4" bore sprocket on the hand crank shaft is a 20 tooth. I just ordered a 15 tooth sprocket for the gearbox, so that should give me a 50% increase in speed.
Title: Re: Arduino Setworks (with video!)
Post by: Ga Mtn Man on January 29, 2014, 09:20:22 PM
How much you gonna charge for one of those custom made motor-to-gearbox adapters? :laugh:
Title: Re: Arduino Setworks (with video!)
Post by: shortlogger on January 29, 2014, 10:45:39 PM
The mechanical stuff is no prob. but the computer part I'm exta ignorant in that department I need a pre wired preprogrammed controller that I just plug in
Title: Re: Arduino Setworks (with video!)
Post by: hackberry jake on January 29, 2014, 11:53:15 PM
Its almost that easy. Look at the code and just run a wire from whatever the code calls it to that pin on the arduino. Copy and paste the code I posted and thats it. Its easier than it seems, and if ya have any questions, just pm me and ill walk you through it.
Title: Re: Arduino Setworks (with video!)
Post by: shortlogger on January 30, 2014, 01:30:31 AM
I'm reading up on stepper motors and ardunio systems and it's starting to make sense . Will the system have  to be AC or  can it run off the mills DC battery  supply? Got a bunch going on for a few more weeks but when I get caught up I'm gonna try and make the switch . I'm sure I'll have some questions then thanks .
Title: Re: Arduino Setworks (with video!)
Post by: hackberry jake on January 30, 2014, 02:02:15 AM
My cabinet has three voltages in it. 120 vac comes inside and goes to the 48 vdc power supply and I have two wires from the ac running to the small plug-in 9vdc power supply for the arduino. The arduino just sends low level (like a fraction of an amp) 5volt signals to the stepper driver telling it which direction to move and how far. The stepper driver gets the 48volt supply and does all of the "heavy lifting" as far as the electronics go. My 48 volt supply is an ac to dc supply because i didnt know if my mills charging system could handle the setworks. If your mill has an alternator, then you could get away with a 12vdc to 48vdc inverter. The steppers that are "setworks sized" will run on anything from 24vdc to 80vdc, depending on the stepper. Most cheaper drives max out around 50 volt max. With steppers, voltage is correlated to speed and amps is correlated to torque.
Title: Re: Arduino Setworks (with video!)
Post by: whitedog on November 27, 2018, 08:26:49 PM
 Hello all. I would like to to add this setworks to a band sawmill I am building. When I paste the code ( setworks for boardwalk.txt (http://forestryforum.com/board/index.php?action=dlattach;topic=69216.0;attach=5506)) in the arduino IDE fine but when I try to verify it will not compile. What I get is this 
' serLCD' does not name a type. 

Has any one else used this code? Any Ideas? 
Title: Re: Arduino Setworks (with video!)
Post by: whitedog on November 29, 2018, 12:10:13 AM
 Code loaded with these changes.



// boardwalk setworks 
// author: Jake Smith 
// version 1 
 
#include <AccelStepper.h> 
#include <SoftwareSerial.h> 
#include <serLCD.h>                                                     //this line should read    #include <SerLCD.h>   not    #include <serLCD.h> 
#include <EEPROM.h>
 
SoftwareSerial mySerial(3,3); 
AccelStepper mystepper(1, 1, 2); //include the accelstepper library. 
//-----Defines------ 
 
 
//---pin assignments---- 
const int lcdPin = 3; 
const int stepPin = 1; 
const int dirPin = 2; 
const int SixteenthPin = 0; 
const int EighthPin = 4; 
const int QuarterPin = 5; 
const int HalfPin= 6; 
const int OnePin = 7; 
const int TwoPin = 8; 
const int TwoByPin = 9; 
const int FourByPin = 10; 
const int SixByPin = 11; 
const int EightByPin = 12; 
const int GoButton = 13; 
const int FourOrFiveQuarterPin = 14; //analog pin A0 
const int HomeButton = 15; //analog pin A1 
const int ZeroButton = 16; //analog pin A2 
const int Prog1Button = 17; //analog pin A3 
const int Prog2Button = 18; //analog pin A4 
const int UpOrDownSwitch = 19; //analog pin A5 
 
 serLCD lcd(lcdpin);                                                          // this line should read     SerLCD lcd(lcd);   not    serLCD lcd(lcdPin);
//const int stepperAcceleration = 10000; 
//const int upSpeed = 2000; 
//const int downSpeed = -4000; 
double xSteps = 0; 
double sawHeight = 1;
int dbt = 25; 
int TimesThroughLoop = 0; 
double Prog1Num = 1; 
double Prog2Num = 2; 
int ratio = 237;

//These are the eeprom addresses where the height of the
//head is saved after each move. When the power is turned 
//off to the setworks, the Arduino still knows where the 
//head is. There is an estimated life of 100,000 write cycles 
//on eeprom so these may need to be moved at a later date if
//false readings start occuring.
byte ThousandsDivideAddress = 1;
byte ThousandsModAddress = 2;
byte RemainderDivideAddress = 3;
byte RemainderModAddress = 4;

int thousands = (EEPROM.read(ThousandsDivideAddress)*250);
byte thousandsRemainder = EEPROM.read(ThousandsModAddress);
int remainderMultiplyByTwoFifty = (EEPROM.read(RemainderDivideAddress)*250);
byte remainderOfRemainder = EEPROM.read(RemainderModAddress);

long FirstThreeDigits = ((thousands + thousandsRemainder)*1000);
int LastThreeDigits = (remainderMultiplyByTwoFifty + remainderOfRemainder);
long ActualPosition = (FirstThreeDigits + LastThreeDigits);


 
//------set-up--- 
 
void setup() //runs once when power is applied or reset button is pushed. 

  delay(500);
  //Serial.begin(9600); 
  mySerial.begin(9600); 
  delay(500); 
  //------set pins------ 
  mystepper.setMaxSpeed(4000); 
  mystepper.setAcceleration(8000); 
  
  if(EEPROM.read(ThousandsDivideAddress) == 255)
  {
  mystepper.setCurrentPosition(80*ratio);
  }
  else
  {
  mystepper.setCurrentPosition(ActualPosition); 
  }
  
   
  pinMode(lcdPin,OUTPUT); 
  pinMode(stepPin,OUTPUT); 
  pinMode(dirPin,OUTPUT); 
  pinMode(SixteenthPin,INPUT_PULLUP); 
  pinMode(EighthPin,INPUT_PULLUP); 
  pinMode(QuarterPin,INPUT_PULLUP); 
  pinMode(HalfPin,INPUT_PULLUP); 
  pinMode(OnePin,INPUT_PULLUP); 
  pinMode(TwoPin,INPUT_PULLUP); 
  pinMode(TwoByPin,INPUT_PULLUP); 
  pinMode(FourByPin,INPUT_PULLUP); 
  pinMode(SixByPin,INPUT_PULLUP); 
  pinMode(EightByPin,INPUT_PULLUP); 
  pinMode(GoButton,INPUT_PULLUP); 
  pinMode(FourOrFiveQuarterPin,INPUT_PULLUP); 
  pinMode(HomeButton,INPUT_PULLUP); 
  pinMode(ZeroButton,INPUT_PULLUP); 
  pinMode(Prog1Button,INPUT_PULLUP); 
  pinMode(Prog2Button,INPUT_PULLUP); 
  pinMode(UpOrDownSwitch,INPUT_PULLUP); 
  
  lcd.clear();
  
   lcd.print("Relative = "); 
   lcd.print(xSteps/80);
   lcd.print("     ");  
   
   lcd.print("Saw Height = ");
   sawHeight = (mystepper.currentPosition());
   lcd.print((sawHeight/80)/ratio); 
   lcd.print("   ");
   
 
   lcd.print("Program 1 = ");
   lcd.print(Prog1Num/80); 
   lcd.print("    ");
   
   lcd.print("Program 2 = ");
   lcd.print(Prog2Num/80); 
   

             
 
void loop() //runs continually 

     if(digitalRead (SixteenthPin)==LOW) 
     //moves .0625 of an inch. 
     { 
       debounce (SixteenthPin); 
       xSteps = UpOrDown (xSteps, 5); 
     }  
     
     if(digitalRead (EighthPin)==LOW) 
     //moves .125 of an inch. 
     { 
       debounce (EighthPin); 
        xSteps = UpOrDown (xSteps, 10); 
     } 
     
     if(digitalRead (QuarterPin)==LOW) 
     //moves .25 of an inch. 
     { 
       debounce (QuarterPin); 
        xSteps = UpOrDown (xSteps, 20); 
     } 
     
     if(digitalRead (HalfPin)==LOW) 
     //moves .5 of an inch. 
     { 
       debounce (HalfPin); 
        xSteps = UpOrDown (xSteps, 40); 
     } 
     
     if(digitalRead (OnePin)==LOW) 
     //moves 1 inch. 
     { 
       debounce (OnePin); 
        xSteps = UpOrDown (xSteps, 80); 
     }  
     
     if(digitalRead (TwoPin)==LOW) 
     //moves 2 inches. 
     { 
       debounce (TwoPin); 
        xSteps = UpOrDown (xSteps, 160); 
     } 
     
     if(digitalRead (TwoByPin)==LOW) 
     //moves 1.625 of an inch. assuming .125 kerf. 
    // this setting will be used for 2x building material. 
     { 
       debounce (TwoByPin); 
       xSteps = UpOrDown (xSteps, 130); 
     }  
     
     if(digitalRead (FourByPin)==LOW) 
     //moves 3.625 of an inch. assuming .125 kerf. 
    // this setting will be used for 2x building material. 
     { 
        debounce (FourByPin); 
       xSteps = UpOrDown (xSteps, 290); 
     }  
     
     if(digitalRead (SixByPin)==LOW) 
     //moves 5.625 of an inch. assuming .125 kerf. 
    // this setting will be used for 2x building material. 
     { 
        debounce (SixByPin); 
       xSteps = UpOrDown (xSteps, 450); 
     }  
     
     if(digitalRead (EightByPin)==LOW) 
     //moves 7.375 inches. 
     { 
       debounce (EightByPin); 
       xSteps = UpOrDown (xSteps, 590); 
     }  
     
     if (analogRead(A0)<800)//if analog button pressed 
     // 10k resistor between pin A0 and 4/4 button. 
     { 
       { 
       delay(dbt);//delay to get accurate reading from button. 
       } 
       if (analogRead(A0)<50) 
         { 
           xSteps = UpOrDown (xSteps, 120); //0-50 is 5/4 
         } 
        
       if ((analogRead(A0) > 200) && (analogRead(A0) < 300)) 
         { 
          xSteps = UpOrDown (xSteps, 100); 
         } 
       while (analogRead(A0)<800) 
         { 
           delay (dbt); 
         } 
     } 
  
       
     if(digitalRead (Prog1Button)==LOW) 
     //Sets value in Prog1 if held for a while. 
     { 
         delay(dbt); 
         while (digitalRead (Prog1Button)==LOW) 
        { 
           delay(dbt); 
          TimesThroughLoop++; 
        
          if (TimesThroughLoop == 160) 
            { 
              Prog1Num = xSteps;  
             Display (xSteps, Prog1Num, Prog2Num);  
            } 
         } 
        if (TimesThroughLoop < 160) 
            {xSteps = UpOrDown (xSteps, Prog1Num);} 
       delay(dbt); 
       TimesThroughLoop = 0; 
     } 
     
     if(digitalRead (Prog2Button)==LOW) 
     //Sets value in Prog2 if held for a while. 
     { 
         delay(dbt); 
         while (digitalRead (Prog2Button)==LOW) 
        { 
           delay(dbt); 
          TimesThroughLoop++; 
        
          if (TimesThroughLoop == 160) 
            { 
              Prog2Num = xSteps;  
             Display (xSteps, Prog1Num, Prog2Num);  
            } 
         } 
        if (TimesThroughLoop < 160) 
            {xSteps = UpOrDown (xSteps, Prog2Num);} 
       delay(dbt); 
       TimesThroughLoop = 0; 
     } 
     
     if(digitalRead (HomeButton)==LOW) 
     //home button and goto function
     { 
         delay(dbt); 
         while (digitalRead (HomeButton)==LOW) 
        { 
           delay(dbt); 
          TimesThroughLoop++; 
        
          if (TimesThroughLoop == 160) 
            { 
             mystepper.runToNewPosition(xSteps * ratio);  
             Display (xSteps, Prog1Num, Prog2Num);
             savePosition(mystepper.currentPosition());  
            } 
         } 
        if (TimesThroughLoop < 160) 
            {
             if(digitalRead (UpOrDownSwitch) == LOW) 
             //and upordoswn switch is set to down 
               { 
               mystepper.runToNewPosition(80 * ratio); 
               
               Display (xSteps, Prog1Num, Prog2Num);
               savePosition(mystepper.currentPosition());
               } 
             else //if swith isnt down, then it is set to up. 
               { 
               mystepper.runToNewPosition(-2160 * ratio); 
                
                Display (xSteps, Prog1Num, Prog2Num);
                savePosition(mystepper.currentPosition());
               } 
             TimesThroughLoop = 0;
            } 
             delay(dbt); 
             TimesThroughLoop = 0;
             xSteps = 0;
             Display (xSteps, Prog1Num, Prog2Num); 
     } 
    
     if(digitalRead (ZeroButton) == LOW) //takes xSteps to "0". 
     { 
      xSteps = 0; 
     Display (xSteps, Prog1Num, Prog2Num);
      //Serial.println((xSteps * 1)/80,3); 
     } 
   
     if(digitalRead (GoButton) == LOW) 
     //takes amount of steps and runs the stepper. 
     { 
       debounce (GoButton);  
        
       mystepper.move(xSteps * ratio); 
       while (mystepper.distanceToGo() != 0) 
           mystepper.run();  
       xSteps = 0; 
      
       
      Display (xSteps, Prog1Num, Prog2Num);
      savePosition(mystepper.currentPosition());
       
       //Serial.println((xSteps * 1)/80,3); 
      } 
    
     if((digitalRead (UpOrDownSwitch)==LOW) && (xSteps > 0)) 
     //if the switch is LOW or switched to negative and we have a positive 
//number. 
    // make the number negative. 
     { 
      xSteps = -xSteps; 
     Display (xSteps, Prog1Num, Prog2Num);
     //Serial.println((xSteps * 1)/80,3); 
     }  
     
     if((digitalRead (UpOrDownSwitch)==HIGH) && (xSteps < 0)) 
     //if the switch is HIGH or switched to positive and we have a negative 
      //number. 
     //make the number positive. 
     { 
      xSteps = -xSteps; 
   Display (xSteps, Prog1Num, Prog2Num);
     //Serial.println((xSteps * 1)/80,3); 
     } 
 } 
 
 
 
 
 
 
 
 
 
               //debounce function 
               void debounce(int x) 
               { 
                   delay(dbt); 
                   while (digitalRead (x)==LOW) 
                      { 
                       delay(dbt); 
                      } 
                  delay(dbt); 
               } 
 
               //up or down function 
               double UpOrDown(double x, double y) 
               { 
                if(digitalRead (UpOrDownSwitch)==LOW) 
                     {x = x - y;} 
                   else 
                     {x = x + y;} 
                 Display (x, Prog1Num, Prog2Num);  
                 //Serial.println((xSteps * 1)/80,3); 
                  return x; 
               }
              
              
              //function to display current data on lcd. 
             void Display ( double x, double y, double z)
             {
              lcd.clear();
  
                 lcd.print("Relative = "); 
                 lcd.print(x/80);
                 lcd.print("     ");  
                 
                 lcd.print("Saw Height = ");
                 sawHeight = (mystepper.currentPosition());
                 lcd.print((sawHeight/80)/ratio); 
                 lcd.print("   ");
                 
               
                 lcd.print("Program 1 = ");
                 lcd.print(y/80); 
                 lcd.print("    ");
                 
                 lcd.print("Program 2 = ");
                 lcd.print(z/80);   
             }
             
             //function to save sawheight to eeprom.
             void savePosition(long currentPos)
             {
               int remainder = (currentPos%1000);
               
               long HowManyWithoutRemainder = (currentPos-remainder);
               
               int Thousands = (HowManyWithoutRemainder/1000);
               
               byte ThousandsDividedByTwoFifty = (Thousands/250);
               byte ThousandsModTwoFifty = (Thousands%250);
               byte RemainderDividedByTwoFifty = (remainder/250);
               byte RemainderModTwoFifty = (remainder%250);
               
         EEPROM.write(ThousandsDivideAddress,ThousandsDividedByTwoFifty);
         EEPROM.write(ThousandsModAddress,ThousandsModTwoFifty);
         EEPROM.write(RemainderDivideAddress,RemainderDividedByTwoFifty);
         EEPROM.write(RemainderModAddress,RemainderModTwoFifty);
             }
Title: Re: Arduino Setworks (with video!)
Post by: mitchstockdale on November 29, 2018, 02:49:45 PM
Quote from: whitedog on November 27, 2018, 08:26:49 PM
Hello all. I would like to to add this setworks to a band sawmill I am building. When I paste the code ( setworks for boardwalk.txt (http://forestryforum.com/board/index.php?action=dlattach;topic=69216.0;attach=5506)) in the arduino IDE fine but when I try to verify it will not compile. What I get is this
' serLCD' does not name a type.

Has any one else used this code? Any Ideas?
This is pretty neat, and would be very useful for the repeatability aspect.
Unfortunately not much of a coder ....the syntax thing gets me everytime always have some stupid mistake that takes hours to figure out.

How far along are you in your set up?  Have you been able to source a gear box yet. ?


Title: Re: Arduino Setworks (with video!)
Post by: whitedog on November 30, 2018, 09:48:33 PM
I have the saw head mostly complete. I started the saw lift with the intentions of using a stepper motor and a arduino (similar to what has been done here) but the code was to tough for me.I bought a nema 23 425 oz stepper with a 100 to 1 planetary reduction for this. When I could not program the arduino to do what I wanted I switched to a 10,000 lb winch motor and used the reduction drive that came with it   chained on to 5 pitch acme threaded rods. This is installed now and seems to work fine. Now that I found this thread I think I will have another go at the stepper thing again. Will be doing a bench build and test to see if it works for me. If it does I will change to the boardwalk setworks system. I have a nema 34 1800 oz in stepper that will replace the 425 oz in (hopefully). 
Title: Re: Arduino Setworks (with video!)
Post by: Georgia088 on February 09, 2021, 09:48:18 AM
@whitedog (https://forestryforum.com/board/index.php?action=profile;u=42827) did you ever get the system up and running?  We're you able to do it with a stepper motor and planetary gearbox? Running off of 12v dc battery? 

@hackberry jake (https://forestryforum.com/board/index.php?action=profile;u=15938) this is awesome! I would love to do something similar. Do you or anyone else think it's possible to do with a stepper motor and gear box reducer? My head now travels via cable and 1500 lb winch. Think it would be accurate if the stepper/gearbox would turn a spool of cable that lifts/lowers head.  I don't have a garage tho spring like you have. Thanks for any and all advice
Title: Re: Arduino Setworks (with video!)
Post by: hackberry jake on September 15, 2021, 11:29:41 AM
My first thought would be to run a cable from your sawhead to a pulley on your frame and use a counterweight. Mine used a smaller 4xx oz stepper I believe
Title: Re: Arduino Setworks (with video!)
Post by: Crusarius on September 22, 2021, 10:56:21 AM
you can also add encoders to the setup and have position accuracy that way. Encoders come in many different flavors. you can get rotary encoders, and linear ones. The scroll wheel on a mouse is a rotary encoder and can be adapted to work for many different things.
Title: Re: Arduino Setworks (with video!)
Post by: Ernste on September 30, 2021, 05:08:29 PM
Hey Jake
I've just now found this since I'm trying to find some way to automate my completely manual WM15.
What you've done here is nothing short of amazing.
I to built my own cnc and play around with 3d printing  but not at all am I even close to confident enough to take on a project like this when it comes to writing the code.
I will cut and paste your code and hope i can modify it for my needs and for metric.

I wish I could somehow thank you enough. 
BTW.
I saw that you wrote about like you no longer owns the sawmill?
Did you upgrade or?

Well anyway..
THANK YOU sawmill superhero.👍👍😃😃
Title: Re: Arduino Setworks (with video!)
Post by: JDowns71 on September 30, 2021, 06:18:20 PM
Great job to the author and very nice setup.

If I could offer a few tips and advice.

It's very common when running a state machine to implement some sort of watchdog to ensure that if there is a mechanical or software issue that the processor returns to setup, in order to restart the routine, rather than be get stuck and require a manual reboot.  Just make sure your current state is stored in NVM, so your setup routine can adjust accordingly.

Rather than all of the delays and debouncing you could implement a few things.  First would be the use of interrupts, when a button is pressed (pin hi/lo).  You could then store the required button command in a simple byte for 8 buttons. Manipulate the byte with bitwise operators.  For example button one was pressed would equal 00000001.  Button two would override the byte with 00000010.  If you have more than 8 buttons to process and follow, just use an integer.

Now that you have interrupts to track your buttons, you could then use a timer library to separate your loop tasks to track the state of button presses.   So rather than every single processor cycle to track and debounce button presses you now have a timer, for example set at every half second or >, that would then run your state machine.

I'll take a look at your video and dig in the code some more but I think you could also simplify things with an interrupt and with resistors only need to use one pin.  Each button would have a separate resistor value, when the interrupt is triggered read the value and that was the button that was pressed.   That would further simplify having to read multiple pins every single processor cycle.

Hope that makes sense.  I could write up a simple example this weekend if that would help.

Regards,
Title: Re: Arduino Setworks (with video!)
Post by: Mattjohndeere2 on October 01, 2021, 06:29:33 PM
Very nice. I haven't done my Arduino setup yet but my plan was to use a couple parts like the below to accomplish it. As long as there isn't much backlash in the gear/rack setup it should be pretty accurate.

Rotary encoder 
Incremental Photoelectric Rotary Encoder - 400P/R - DFRobot (https://www.dfrobot.com/product-1601.html)
Rack and gear like found here
McMaster-Carr (https://www.mcmaster.com/gears/metal-gears-and-gear-racks-20-pressure-angle/)
Keypad for manual entry like this one
Membrane 3x4 Matrix Keypad + extras [3x4] : ID 419 : .95 : Adafruit Industries, Unique & fun DIY electronics and kits (https://www.adafruit.com/product/419?gclid=EAIaIQobChMIlKK81aGq8wIVH4BQBh0g8gRhEAQYASABEgIl8fD_BwE)
Title: Re: Arduino Setworks (with video!)
Post by: Rickcnc on October 02, 2021, 06:39:49 AM
Quote from: Mattjohndeere2 on October 01, 2021, 06:29:33 PM
Very nice. I haven't done my Arduino setup yet but my plan was to use a couple parts like the below to accomplish it. As long as there isn't much backlash in the gear/rack setup it should be pretty accurate.

Rotary encoder
Incremental Photoelectric Rotary Encoder - 400P/R - DFRobot (https://www.dfrobot.com/product-1601.html)
Rack and gear like found here
McMaster-Carr (https://www.mcmaster.com/gears/metal-gears-and-gear-racks-20-pressure-angle/)
Keypad for manual entry like this one
Membrane 3x4 Matrix Keypad + extras [3x4] : ID 419 : .95 : Adafruit Industries, Unique & fun DIY electronics and kits (https://www.adafruit.com/product/419?gclid=EAIaIQobChMIlKK81aGq8wIVH4BQBh0g8gRhEAQYASABEgIl8fD_BwE)
Great to see people working on this. I experimented a few years ago and used the method referenced above with interrupts  tracking the encoder (worked flawless on the test bench, but when driven by the mill steps were lost.. I suspect noise could have been the issue, .. encoder I used was similar to the one referenced above. (Other priorities had me shelve the project for now)
Matt (few questions if you don't mind)
Have you given any thought as to how you will protect the encoder from the elements?
My prototype used a rubber 3D printer belt/rack and gear for the rack and Pinion which seamed to work.. I see your plan is much more industrial (appreciate your input on how we can keep them clean)
JDowns
Examples would be awesome.
Title: Re: Arduino Setworks (with video!)
Post by: marty3d on October 02, 2021, 11:27:35 AM
Nice to someone else appreciating what the Arduino can do.  I have just finished building a mill, based on the Arduino.  I use a mega2560 because it has two pairs of available interrupts to connect to encoders.  (it does have a third pair but that also handles serial communication so it isn't available).  I have a 100ppr encoder on a lift screw, and another on the carriage drive.  I also use a small rotary encoder knob to choose/set board thickness and kerf thickness.  I can set or select a given board thickness and push one button and the saw will go to the proper height and cut the board, stop at the end of the board and lift up to get ready to eject the board.  Push a second button and the saw ejects the board and drops down at the beginning of the log to get ready for the next cut.  Lifting is done by a pair of DC motors, carriage drive is done by another.  I am using one Curtis speed controller - the kind you find in golf carts.  The carriage drive has a PID feature - like cruise control - so it maintains a constant speed.  It is also strong enough to drag a log across the deck if needed for repositioning.

I tried steppers at first, but the largest ones I could find were too slow.