By continuing to use this site, you agree to our use of cookies. Find out more
Forum sponsored by:
Forum sponsored by Forum House Ad Zone

DRO Z-Axis /4th axis "combiner"

All Topics | Latest Posts

Search for:  in Thread Title in  
Rockingdodge03/01/2022 13:50:44
avatar
396 forum posts
111 photos

//Part 2

void loop() {

pos1 = scale1.read();

pos2 = scale2.read();

delt2 = pos2 - oldpos2;

delt1 = pos1 - oldpos1;

delt = delt2 - delt1;

while (delt > 0) {

if (outA == LOW && outB == LOW) { //if 9 is low and 8 is low

PORTH = B00100000; //push 8 high & 9 low

outB = HIGH;

delt--;

}

else if (outA == LOW && outB == HIGH) { //if 9 is low and 8 is high

PORTH = B01100000; //leave 8 high, Push 9 high

outA = HIGH;

delt--;

}

else if (outA == HIGH && outB == HIGH) { //if 9 is high and 8 is high

PORTH = B01000000; //push 9 high & 8 low

outB = LOW;

delt--;

}

else if (outA == HIGH && outB == LOW) { //if 9 is HIGH and 8 is LOW;

PORTH = B00000000; //leave 8 LOW push 9 low

outA = LOW;

delt--;

}

}

while (delt < 0) {

if (outA == LOW && outB == LOW) { //if both are low,

PORTH = B01000000; //leave 8 low, Push 9 high

outA = HIGH;

delt++;

}

else if (outA == LOW && outB == HIGH) { //if 9 is low and 8 is high;

PORTH = B00000000; //push 8 low, Leave 9 LOW

outB = LOW;

delt++;

}

else if (outA == HIGH && outB == LOW) { //if 9 is high and 8 is low;

PORTH = B01100000; //push 8 high, Leave 9 HIGH

outB = HIGH;

delt++;

}

else if (outA == HIGH && outB == HIGH) { //if 9 is high and 8 is high;

PORTH = B00100000; //leave 8 high, Push 9 LOW

outA = LOW;

delt++;

}

}

oldpos1 = pos1;

oldpos2 = pos2;

}

Neil Lickfold24/04/2022 23:08:17
1025 forum posts
204 photos

Can these units have one scale at one rate, ie a 1um unit combined with a 5um scale , outputting a 5um position ? or a 5um scale mixed with a 10um scale outputting a 10um position.?

Is this possible?

Thanks Neil

DC31k25/04/2022 07:13:27
1186 forum posts
11 photos
Posted by Neil Lickfold on 24/04/2022 23:08:17:

Is this possible?

In principle, yes. I think you would need to work (store) internally in the finer units, incrementing or decrementing by 1 when the fine scale changes and incrementing or decrementing by 5 or 10 when the coarser scale changes. It is the delt++ and delt-- lines above - they need slight modifications. 50% of them will be unchanged.

Then you would have to write a little bit of extra code that takes the number above and rounds it to the nearest graduation of your desired output, pondering over the situation where the value ends in 5 for the 10um position.

There may be an issue with the code above in that it does not cover the case where delt=0, only doing something when it is greater or less than zero.

JasonB25/04/2022 07:20:31
avatar
25215 forum posts
3105 photos
1 articles

Getting the output to 10micron should simply be a case of setting how many decimal places the display shows which most of them can do so you just set it to 2 decimal places rather than 3 which shows the 5 at the end.

An Other25/04/2022 08:53:10
327 forum posts
1 photos

This has been a very interesting thread (for me) to follow, and I would like to make a suggestion - instead of using the Arduinos, which run at 16 MHz, try using an ESP32, which runs at up to 240 MHz. They are also usually even cheaper than Arduinos, but can be programmed using the Arduino IDE, or PlatformIO.

I went this route after I had a timing problem on a project, and now always use the ESP32. It also has a WiFi and BlueTooth interface built-in, so its very easy to add remote controls if required. It also has a much bigger memory space, so larger, more comprehensive programs are possible. They can be used with all the usual Arduino modules.

There is plenty of information online - I found this site very helpful when I first started using them:

LINK1

and also this:

LINK2

Many others if you search ESP32

An Other25/04/2022 09:05:52
327 forum posts
1 photos

Re the comments on which bootloader to use, and connecting to Arduino NANOs or UNOS. In the Arduino IDE 'Tools' menu is an option to 'Get Board Info' - if the Arduino is connected Ok, then clicking this will show a small window giving (IIRC) the board Serial number and other information - this doesn't appear if there is a connection problem - AFAIK this is the quickest way to know whether your particular board is connected without having to upload a sketch. Note the comments other have made regarding the 'Use Old Bootloader' option.

spelling edit

Edited By An Other on 25/04/2022 09:06:45

old mart25/04/2022 21:26:51
4655 forum posts
304 photos

I have heard that there is difficulty getting hold of any of the Arduino or Raspberry pi due to the computer chip shortage.

duncan webster25/04/2022 23:22:20
5307 forum posts
83 photos

Loads on ebay, but price has increased markedly over past year or so

All Topics | Latest Posts

Please login to post a reply.

Magazine Locator

Want the latest issue of Model Engineer or Model Engineers' Workshop? Use our magazine locator links to find your nearest stockist!

Find Model Engineer & Model Engineers' Workshop

Sign up to our Newsletter

Sign up to our newsletter and get a free digital issue.

You can unsubscribe at anytime. View our privacy policy at www.mortons.co.uk/privacy

Latest Forum Posts
Support Our Partners
cowells
Sarik
MERIDIENNE EXHIBITIONS LTD
Subscription Offer

Latest "For Sale" Ads
Latest "Wanted" Ads
Get In Touch!

Do you want to contact the Model Engineer and Model Engineers' Workshop team?

You can contact us by phone, mail or email about the magazines including becoming a contributor, submitting reader's letters or making queries about articles. You can also get in touch about this website, advertising or other general issues.

Click THIS LINK for full contact details.

For subscription issues please see THIS LINK.

Digital Back Issues

Social Media online

'Like' us on Facebook
Follow us on Facebook

Follow us on Twitter
 Twitter Logo

Pin us on Pinterest

 

Donate

donate