Sawmill board measuring.

Hi I’ve done a few projects so far but still a newbie to programming. I want to build an automated board sorter for a sawmill. The boards have to be measured and any defects in width have to be determined. Defects such as a 6 inch board that is not 6 inches it’s entire length. Board length will be 1.25 metres and will have varying widths so the system has to determine which pieces will be 3 inch ,4 inch or 6 inch boards. It will be exposed to weather and a bush environment so I want to keep it simple and easily repairable. The boards will be sawn on 3 sides ( one edge and both faces ) leaving the arduino to decide how much to saw off to make a uniform board width. Boards will pass through the system at about 10 metres a minute or 8 boards a minute. I don’t want sophisticated sensors if they can be avoided due to the working environment.

My thoughts were a series of microswitches that feel along the board as it passes and sends a simple high or low signal if the switches are activated due to a defect ( have all switches read low if the board triggers the switch the whole length. If one switch reads High during this time it’ll be due to a defect in thickness and then have arduino decide which saw to send the board to. Example is a peice of timber that is 4.5 inches at the start but drops to 3.2 inches at the other end. The microswitches would read low and arduino would know to send it to the 4 inch saw but as the board passes through more switches would read high as width dropped to 3.2. When the board is finished passing its length through the switches the arduino would know that it’s width is under 4 inches because other switches had read high as it width dropped so the arduino would send it to the 3 inch saw. The major problem with this is lots of inputs to be read as it needs 12 microswitches to feel the board plus a trigger to tell arduino when to start and stop reading the switches. All these switches require a seperate read pin.

The other option is to use a potentiometer. As the board passes a wheel attached to a lever attached to the pot the pot will output a differing voltage. A 6 inch width will move the pot 60 degrees and a 4 inch would move the pot 30 degrees and a 3 inch will move it 25 degrees which will give different voltage response. Something simple like If volts equal >4 send board to 6 inch saw. If volts >3 send board to 4 inch saw ,if volts < 3 send board to 3 inch saw.
The volts have to stay within the parameters for the entire length. If volts read 4 ( a 6 inch width at the start but read only 3.9 ( indicating a board less then 6 inch in width )by the end it has to send the board to the 4 inch saw. If the voltage were to read 4 at the start and 3.9 in the middle and 4 at the end ( indicating a board less then 6 inch width in the middle ) it has to send the board to the 4 inch saw. Only boards that give a consistent voltage above the set point can be sent to the saw that will turn out a consistent board width.
Problem with this approach is that I need 4 pots and a switch to tell arduino when to read and stop reading. I can get away with 2 pots if I build a stage that determines if the board is orientated with the un sawn edge is nearest to the pots. This stage would read the board by switches using either method above and decide if the board requires flipping so that it enters the measuring area with the right orientation ( rough edge to pots ). Either way I have to build a way of flipping the boards to ensure they enter the saw with the rough edge being cut not the sawn edge.

Your knowledge about electronics in a most likely rather dusty environment is really good. Using a bar, a rib, carrying a number of width sencing micro switches ought to be a good, robust solution. Using swinging arms and pots introduces some more sophisticated mechanics but the advantage is the eas of changing the measuring rig, some numbers in the controller.
Sencing the thickness of the boards calls for covering a rather large Surface which is not so easy to do. Each such sensor will be working in a rather small range I think. That work calls for some clever compromises to awoid a thickness sensor for every inch of the width of the board.
Various Arduinos have different number of I/O pins so there is surely one that will fit Your project.

Not a solution, just throwing it out to maybe spark some ideas. Put a distance sensor on each side of the piece. Take readings as it passes by. One side will have a relatively constant reading while the other side will have stronger variations. When the piece exits the measurement area you can massage the readings to decide width and which is the rough side.

wood miser.png

For sure, the application is a challenge. Mechanically actuated limit switches and the like can get clogged/jammed with bits and pieces of stuff and sensors with no moving parts can be blinded by dust or fooled with spurious objects carried along by the workpiece.

Personally, for this application I'd seriously consider a PLC. They're rugged, relatively resistant to EMI, several have free programming software these days, and nearly any appropriate sensor will connect directly to the I/O.

YMMV

wood miser.png

I’m not scared to use more then one arduino if needed. Is it possible to set the micro switches up with different resistors and input to one pin. For example have 3 microswitches each with different value resistors inputing to a single pin. The pin would receive different voltage depending on microswitch activation. I have to keep in mind that I’ll have to stop and start the feed mechanism if the board requires flipping and thus requires a timed stop and start of the drive chain to ensure the board is in the right place in the system. This will require a reed swith sensing where the drive is positioned. Lots of inputs here. If you have a simpler way I’d like to hear it.

I grew up in a sawmill family, so I have a different perspective. The board, in all probability comes off the log in an upright, vertical, orientation. Keep it that way. You are wanting to measure the width along the uncut edge, so use a column of light source/sensors as the board moves along. After measuring the width, it can be laid flat. And you know immediately the minimum and maximum width of the board.

Paul

the distance sensor is a good idea and I had thought about it but I couldn’t find one that would ensure a .5 mill accuracy. I’m also concerned with dust and vibration distorting the readings. Ideally a system that can be easily rectified or diagnosed with a simple multimeter is better. I’m avoiding laser type setups as the laser could have problems with other light sources.

Using another plc maybe better but I’m only knew to this whole programming thing. I’ve built a few example projects from arduino and my own twin axis solar tracker so this project would be a challenge given my limited experience. Can you tell me what plc you’d recommend and are they programmed using the arduino language and do they have their own compiler

Paul I’m concerned about using light type sensors. The sawmill will be outdoors and I’m concerned that sunlight may interfere. The system is cants produced and fed to a frame saw by human. From frame saw they will fall into a bin where they will be picked up individually by a chain and delivered to the sorting and sawing line. From bin to sorting line there is every chance that the board will not be delivered with its sawn edge away from the pot or microswiches hence the need for a system to flip the board before the width is determined. Only other way is to employ somebody to watch the feed chain and manually ensure the boards are fed correctly

Ripcrow:
Using another plc maybe better but I’m only knew to this whole programming thing. I’ve built a few example projects from arduino and my own twin axis solar tracker so this project would be a challenge given my limited experience. Can you tell me what plc you’d recommend and are they programmed using the arduino language and do they have their own compiler

No, PLCs are programmed with ladder logic. As you would expect, each manufacturer has their own programming software, since each has differing features/capabilities. The program is developed on a PC then downloaded to the controller. Some nice things are realtime monitoring of program variables and ready-to-go timers. You don't have to cobble them together like on an Arduino. Some have a built-in version of the state machine called 'sequencers' or 'drums' if that's your fancy. There's generally also a mechanism to force I/O, through the connected PC, for debugging/testing.

Naturally, there's a learning curve.

And, since they're industrial equipment they co$t more than hobby gear.

A few examples;

https://www.automationdirect.com/adc/shopping/catalog/programmable_controllers

https://industrial.omron.us/en/products/cp1e

half a millimeter on rough cut wood ? the fibers will be more than that.

my thoughts are to use an arm with roller and potentiometer.

You can easily sort out the 4.5 inch boards
Then when you have 4.02 inch boards, you might need to be more careful about a crook a kink or a twist.

Any visual means is potentially vulnerable to dust. something you have in abundance.

Ripcrow:
Paul I’m concerned about using light type sensors. The sawmill will be outdoors and I’m concerned that sunlight may interfere. The system is cants produced and fed to a frame saw by human. From frame saw they will fall into a bin where they will be picked up individually by a chain and delivered to the sorting and sawing line. From bin to sorting line there is every chance that the board will not be delivered with its sawn edge away from the pot or microswiches hence the need for a system to flip the board before the width is determined. Only other way is to employ somebody to watch the feed chain and manually ensure the boards are fed correctly

Replace the bin and pickup chain by powered rollers to carry the cant from the saw station, being kept upright by guides on the sides. Build a light-tight box with canvas strips on the ends to limit light while the cant passes. Put light sources on one side of the box, sensors on the other. The cant will release a pair of brushes that will sweep the lights and sensors. Then you can determine which sensors stay dark for the entire passage of the cant. This will tell you the maximum usable with of the cant. Later, side guides can lay the cant over that same way for each piece.

If you need a buffer for the cants, make it later on in the operation.

Paul

Paul_KD7HB:
Replace the bin and pickup chain by powered rollers to carry the cant from the saw station, being kept upright by guides on the sides. Build a light-tight box with canvas strips on the ends to limit light while the cant passes. Put light sources on one side of the box, sensors on the other. The cant will release a pair of brushes that will sweep the lights and sensors. Then you can determine which sensors stay dark for the entire passage of the cant. This will tell you the maximum usable with of the cant. Later, side guides can lay the cant over that same way for each piece.

If you need a buffer for the cants, make it later on in the operation.

Paul

is the goal to position the cants so that 2x6 or 2x4 or 2x8 are cut ?
I got the impression that he was cutting boards and wanted to make sure that the board will be able to be trimmed to fit dimensional lumber.
the goal to only need to cut 3 sides on the mill.
you could almost do that while it is on the mill, before the cut.

dave-in-nj:
is the goal to position the cants so that 2x6 or 2x4 or 2x8 are cut ?
I got the impression that he was cutting boards and wanted to make sure that the board will be able to be trimmed to fit dimensional lumber.
the goal to only need to cut 3 sides on the mill.
you could almost do that while it is on the mill, before the cut.

My vision is that he is cutting small logs on three sides. The resulting piece may by thick enough to be resawn into several dimensioned pieces of lumber. The OP needs to know which resaw process to send the cant to.

Dad's mill usually cut big enough trees that several cants were cut from one log after the slabs were cut from four sides. The cants were then trucked to a resawing plant.

Paul

Paul_KD7HB:
I grew up in a sawmill family, so I have a different perspective. The board, in all probability comes off the log in an upright, vertical, orientation. Keep it that way. You are wanting to measure the width along the uncut edge, so use a column of light source/sensors as the board moves along. After measuring the width, it can be laid flat. And you know immediately the minimum and maximum width of the board.

Paul

with the speed mentioned, it would seem that we are talking about a circular sawmill. or a carriage moving the wood past the blade.
based on that, a set of sensors that look at the blade will tell you if the blade is exposed or covered by wood.
fixed in position, just like the blade, you could have a half dozen sensors for height, or a roller that rides on the wood.
As for orientation, the means of taking the wood off the mill after it has been cut seems to be the most likely location to orient the lumber for the next operation.

Thanks for the input. I’ll try to give a better explanation. The logs are cut into peices using a horizontal band saw. This produces a cant. The cant could potentially be any where from 40 inches wide down to 8 inches wide. The cant is fed directly into a frame saw which will cut the cant into 1 inch thick peices but because the log is not squared before the cant is produced the peices will have not be the same height. If you think of a semi citcle where it’s centre height is 7 inches you can see that some peices will make a 6 board and some will only make a 4 or 3 inch board. As the peices leave the frame saw they drop into a bin with a pickup feed chain that will feed the peices out to a conveyor one at a time and in any order.
This is where the arduino has to decide which resaw to direct the peices to so that maximum recovery is made.

Since I posted this I’ve been thinking about have the pots run on top and below the board at the 6 and 4 inch points. Have a switch to tell when the pots should start reading. As the board passes the pots will produce a voltage. If any voltage is outside spec the arduino knows it has to send the board to the smaller width saw. Only problem I can’t figure is if a 6 inch board doesn’t have a fault the arduino would decide to cut it at 6 inches but also if there is no fault at 6 inches there won’t be a fault at 4 inches and the arduino would have to decide to ignore the 4 inch pot voltage. Also how to code it so that the arduino reads both voltages while the switch is activated and then decide if any voltage was out of spec. Timing could be used but I’d like to just rely on the switch triggering read voltage on and off.
I need the electronics to be simple and easy repairable / debugged. It’s easy to carry spare microswitches and pots and both are easy to test with a simple multimeter.

If you take calipers and put upright rollers on the tips and a spring to pull them closed, could you set the rollers on opposite sides at one end and push the board through or pull the calipers along the length of the board without catching somewhere?

If you can, the caliper angle can be read and the smallest dimension saved to give the maximum width the whole board can be, pick the next saw based on that.

Hey at least you have one straight long edge? It would need that for a mount to slide along and keep the measure square across the board.

Look at how the debarking blade removes the bark and grit for the bandsaw
Look at how the rollers on a carwash move to clean the sides of a car.
You can have boards pass through rollers and use the rollers position to measure.
The robustness is in the mechanical parts not the electrical

The diameter of the roller says how deeply it can measure small dips instead of rolling over them too.
Look at how a skateboard wheel will lock in a hole that bicycle wheel rolls right over.
I'm all practical too, buddy! Just gotta gets sizes right and see if it still does the trick.

i tried a program today to test the potential of using two pots to measure an objects width. code is throwing pot values into the negative right up to 21000 also I cant get the code to read the pot only when the microswitch is activated . I set it up to read the pot only when the switch was activated and to light an led when pot value exceeded 500 but nothing works .[code

int val;
int potpin = A0 ;
int ledpin = 8 ;
int switchpin = 9 ;
void setup() {
  Serial.begin (9600) ;
 
 pinMode (8 ,OUTPUT);
 pinMode (9 ,INPUT_PULLUP);
 pinMode (A0 , INPUT);
  // put your setup code here, to run once:

}

void loop() {
 val = analogRead (A0) ;
 val=map(val,0,5,0,1023);
  digitalRead (9);
  if (9,LOW) analogRead (val);
  else digitalRead (9);
  Serial.println (val);
  if (val>500)digitalWrite ( 8,HIGH);
  else  (8,LOW);
  // put your main code here, to run repeatedly:

}

][/code] I have tried setting the switch to be read at a high and low status but neither works

Ripcrow:
i tried a program today to test the potential of using two pots to measure an objects width. code is throwing pot values into the negative right up to 21000 also I cant get the code to read the pot only when the microswitch is activated . I set it up to read the pot only when the switch was activated and to light an led when pot value exceeded 500 but nothing works .[code

int val;

int potpin = A0 ;
int ledpin = 8 ;
int switchpin = 9 ;
void setup() {
 Serial.begin (9600) ;

pinMode (8 ,OUTPUT);
pinMode (9 ,INPUT_PULLUP);
pinMode (A0 , INPUT);
 // put your setup code here, to run once:

}

void loop() {
val = analogRead (A0) ;
val=map(val,0,5,0,1023);
 digitalRead (9);
 if (9,LOW) analogRead (val);
 else digitalRead (9);
 Serial.println (val);
 if (val>500)digitalWrite ( 8,HIGH);
 else  (8,LOW);
 // put your main code here, to run repeatedly:

}



][/code] I have tried setting the switch to be read at a high and low status but neither works

does not look like the Arduino C++

play with the examples, try 'button' from the digital examples
see how to load values and how code is written.

read about if() statements.

here is your code with some adjustments.

in C++ you name the pins, then use the name, not the pin numbers.

in loop() it is customary to read all your pins in the beginning of the loop, then use them do to the logic parts
I am not saying this will work, only that is in a more customary layout.

also, in your IDE, there is a autoformat button. good to use to make it more readable.

int val;
int potpin = A0 ;
int ledpin = 8 ;
int switchpin = 9 ;
int switchState ;

void setup() {
  Serial.begin (9600) ;

  pinMode (ledpin , OUTPUT);
  pinMode (switchpin , INPUT_PULLUP);
  //  pinMode (A0 , INPUT);  no needed
  // put your setup code here, to run once:

}

void loop() {
  // read all pins, do the scaling
  val = analogRead (A0) ;
  val = map(val, 0, 5, 0, 1023);   
  switchState = digitalRead (switchpin);  // read the switch

//  all pins have been read.
//  now, do the logic bits

  if (switchState, LOW)
  {
    Serial.print ("width = ");
    Serial.println (val);
  }


  if (val >= 500) 
  {
    digitalWrite ( ledpin, HIGH);
  }
  else  
  {
    (ledpin, LOW);
  }