Tips for Arduno software for Rotary Table Controllers

Home Model Engine Machinist Forum

Help Support Home Model Engine Machinist Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.
Hi Torfilli , thanks for your help ,I'm sorry to be a nuisance but I think I may be going insane ,( thats not unusual at my age )

I removed my original liquidcrystal.cpp and replaced it with yours that you just sent me , but it failed to compile I will attach the errors below in a file

I put the original .cpp file back and sure enough it worked again , all be it with the original problem of not recognising the left keypad button

I decided I would look at the original .cpp file and compare it with the one you sent me to see how you had changed it and thats when things seemed to go silly
my original .cpp file is nothing at all like the one you sent me , its completely different as though its from a different LCD library I will include both so you can see


Regards Don


Hi Don,

No problem at all; here it is.

I have commented the lines 323-327 in the original code (from the package that Rod has uploaded elsewhere here in the thread) and have added immediately afterwards my replacement-function to return a keycode from the ADC value. No magic involved.

The values in the if() statements vary from version to version, from resistors to resistors, of the shield so my version may not be cut-n-paste compatible. Just plug in the values you already have, and you should be good to go! If not, yell! and we'll find a way.

Enjoy life!

Torfilli

View attachment LCD ERRORS.zip
 
Hi Don,

I believe that's an easy one :)

The file I have sent goes into \Documents\Arduino\libraries\LCD replacing the file "LCD.cpp" that lives there. I believe you moved and renamed it into the utility subdirectory as LiquidCrystal.cpp - no good.

Let me know if this works out!

Cheers,
Torfilli
 
Don, from your error file you are using an Arduino Mega (or compiling for the wrong chip). The Mega is a totally different beast to the Uno on which this sketch was designed. I don't think this script is compatible with a Mega.

Furthermore, you have got confused and are playing with LiquidCrystal which is not necessary. Your errors are from including a file twice so stuff is generating. The LCD library has its own copy of LiquidCrystal in a subfolder.

I would suggest you:
1. Delete the LCD folder in the library folder
2. Download the zip file on my latest thread http://www.homemodelenginemachinist.com/showthread.php?p=273833#post273833
3. Follow the instructions and install it
4. Copy the LCD.cpp file Torfilli has given you into the /libraries/LCD folder
5. edit the mapButton() procedure that Torfilli has added to the file to agree with your hardware
6. Compile the new script installed in the zip file called RotaryTable10

I suspect however that you will also need to ditch your Mega chip and purchase an Arduino Uno compatible board and a different keyboard shield. In this case, my recommendation would be to place an order at freetronics for these items:

Arduino Compatible board ( I have used this board myself): http://www.freetronics.com.au/collections/arduino/products/eleven#
Keyboard and LCD: http://www.freetronics.com.au/collections/display/products/lcd-keypad-shield#

Prices are in AUD so currently about 70% of USD prices. There is a drop down to select other currencies. They do have distributors around the world
 
Torfilli and Rod

Thank you both so much for not giving up on me , I am pleased to say I now have it working :D and also using Torfillis file I have modified it so the left keyboard button now works great. You were both right I had confused my LCD and liquid crystal libraries and I had indeed put it into the utilities directory

Rod was also right I was trying to use an Arduino Mega , the reason why was,
I have an UNO but for some reason half way through uploading it would fail. .
Because of this I tried using an Arduino Leonardo and that was fine with version 9
but with version 10 of the software it failed saying there was not enough program space , and because I couldnt see a way around that I then tried the Arduino Mega

I am pleased to say I found out why the Uno failed , I renewed the bootloader and after that it worked fine . Well, I say fine , but I have yet to connect it to a stepper motor , but the LCD appears to be doing all the right things
I can also confirm it also appears to work fine on the Arduino Mega according to the LCD . It even loads into an Arduino Nano ok but as it has no way to easily connect it to a LCD shield I cant say how well it works . The only one I cant use it on is the Leonardo , which says it doesnt have enough program space

Once I have tried it with a stepper conected I will report back on how well it went on both the Uno and Mega

But once again thank you both for all your help

Don


Hi Don,

I believe that's an easy one :)

The file I have sent goes into \Documents\Arduino\libraries\LCD replacing the file "LCD.cpp" that lives there. I believe you moved and renamed it into the utility subdirectory as LiquidCrystal.cpp - no good.

Let me know if this works out!

Cheers,
Torfilli
 
Just to let you know

I conected it up with a 24V PSU an MSD 415 Driver and a nema 23 stepper.
Its working perfectly on both the Arduino Uno and also on the Arduino Mega.
I know it will mean hand wiring a LCD and switches but I am going to give it a try on an arduino Nano as it seemed to compile and load up fine

Thanks for all the help

Don
 
Hi Rod (hi everyone else also)
I have too been developing an arduino controller like so many others, and thought I was doing really good :D... I ironed out a lot of issues and rounding errors, I been doing really well, then I stumbled across your code... :eek: and mine is no way as efficient...

Well done Rod.

I am using a 128x64 oled display and analog joystick so I cannot simply use your code, but merely use it as a model and reverse engineer the goodness to suit my gear. I do like the graphics abilities on the oled.
I was asking too much of the AccelStepper library, which stalled whenever I wanted to update the oled display during continuous rotate mode, so after researching I am going to try to use interrupts. Also my C skills are not as refined (I did entry level C++ coding at tech back in the 90's, and since then I forgot all but the basics, but I am relearning quickly)

I am running this on a vertex style 10" rotary table, using a hi torque nema17 and a 3:1 reduction pulley to avoid loosing steps when milling on constant rotation.

P1010204%20resized.JPG
 
Hi Rod (hi everyone else also)

I have too been developing an arduino controller like so many others, and thought I was doing really good :D... I ironed out a lot of issues and rounding errors, I been doing really well, then I stumbled across your code... :eek: and mine is no way as efficient...
Don't you just hate when that happens. Makes you think " what was I doing".
Well done Rod.



I am using a 128x64 oled display and analog joystick so I cannot simply use your code, but merely use it as a model and reverse engineer the goodness to suit my gear. I do like the graphics abilities on the oled.

I was asking too much of the AccelStepper library, which stalled whenever I wanted to update the oled display during continuous rotate mode, so after researching I am going to try to use interrupts.
Arduino isn't really a good place to do graphics. At least for the base model Arduino and you want to draw with higher level primitives. The lack of power for computation is a problem even moving rasters around could use some help. Given that Arduino is a pretty powerful chip.
Also my C skills are not as refined (I did entry level C++ coding at tech back in the 90's, and since then I forgot all but the basics, but I am relearning quickly)
You are lucky, back in my day it was Modula 2 in school.

Realize though that much of what you learned in school, way back then, doesn't apply all that much to modern C++ coding. Especially if working with a state of the art C++ compiler. Arduino really isn't state of the art and frankly doesn't implement all of the C++ standard library, even so it doesn't hurt to upgrade your knowledge with respect to modern C++ practices.

I am running this on a vertex style 10" rotary table, using a hi torque nema17 and a 3:1 reduction pulley to avoid loosing steps when milling on constant rotation.


Cool! At the rate I'm going it will be sometime before I have my own hardware to work on. Going to Cabin Fever so who knows may get lucky with something priced right.
 
Bobwho, great to see another convert to this code base. In your case, I would start with the very first version on post #20 as it is a simple example of an interrupt driven stepper controller. The later ISR routines got more complex as they tracked the home position and ramp up and ramp down and the like. Get that working in your environment first.

Then, look at the additional features you wish to implement. Most of the routines that interact with the hardware are discrete modules so it should not be too hard to adopt.

Rod
 
Don't you just hate when that happens. Makes you think " what was I doing".
yep :fan:
Realize though that much of what you learned in school, way back then, doesn't apply all that much to modern C++ coding.
My coding was basic back then too, I got the hang of it but it was only an intro module first year and then a basics module the next. I was never a developer, I went to IT support... until I became an engineer 10 yrs ago that is.
Arduino isn't really a good place to do graphics.
Not using graphics as such, but highlighting menu choices with rectangles, and then just drawing black rectangles to clear them seems much better code-wise than reprinting text.
I made functions for displaying the headings of each menu and separate functions to update the variables but I didn't go the form route as using string arrays and PROGMEM'ing them looked way too complicated to me. I had only a few menus so simply print(F(this n that)); kept them out of ram for the sake of a few extra lines of code for each menu.
 
Bobwho, great to see another convert to this code base. In your case, I would start with the very first version on post #20 as it is a simple example of an interrupt driven stepper controller. The later ISR routines got more complex as they tracked the home position and ramp up and ramp down and the like. Get that working in your environment first.

Then, look at the additional features you wish to implement. Most of the routines that interact with the hardware are discrete modules so it should not be too hard to adopt.

Rod
I already have home position setup and looping from 359 back to 0. I like your arc mins and secs implementation and miraculously 1 sec equals 24 full steps for me so implementing it will be easy.
I was really stuck for a while and wanted to suit your sketch to my hardware, but as your lcd library has all the form code and the keyboard isn't the same, I'm steering toward just using your ISR technique, and optimizing my code from what I have recently learnt in books and internet.
My ram usage is high at 74% so i gotta reduce my global variables and run more local variables in my functions... I'll get there.

Changing the subject now... How do you find you AL-320g lathe? I run the same thing in my shed, and for what it is I am happy with the quality I am getting from it. I have modified mine quite a bit now and it gives better results each mod...
P1000968resized.jpg


Cheers,
Robbie
 
Bob, good luck with your project. Just be aware that local string variables that have been assigned a value before compiling will still consume PROGMEM global memory as the string has to be stored somewhere so it can get loaded into dynamic RAM. Menus and prompts are the worst offenders. To reduce your global RAM consumption, you have to use PROGMEM declarations or shorten the prompts. Which is why the final version has very cryptic menu items.....

The AL320G has been faultless for me. It is well used and nowhere near as pristine as yours anymore. If I had the space you have, I would have a bigger lathe with DI4 chuck and spindle brake etc but with the exception of bed length and lack of gearbox to select feeds, it has all the features and same spindle bore and swing of our much larger 3 phase lathe at work. My best mod was the 5C collet chuck but the most used mod aside from the DRO is my bed stop which lets me face each end and centre drill multiple parts quickly and accurately without having to do one operation at a time.
 
Hi all,

Recently found this most useful project, well done to all involved, must have taken a whole lot of time and skill. I am a dummy on all this coding and have more trouble learning these days, ho hum. Thought I would give it a go, so after lots of problems, deleted the IDE from my PC and all Arduino files I could find and started again. I find that when I compile the sketch it gets some errors although it appears to finish and tells me how much memory etc. has been used. I wonder if someone can tell me how to fix whatever it is causing the errors below:-

C:Users\Rog\Documents\Arduino\Rotarytablechuck10\Rotarytablechuck10\.ino: In Function 'Void goDeviceMenu()':

C:Users\Rog\Documents\Arduino\Rotarytablechuck10\Rotarytablechuck10\.ino:953:31:Warning deprecated conversion from string constant to 'char*' [Wwrite-strings] addDevice("NEW Dev?");

C:Users\Rog\Documents\Arduino\Rotarytablechuck10\Rotarytablechuck10\.ino:960:33:Warning deprecated conversion from string constant to 'char*' [Wwrite-strings] loadDevice("LOAD DEV?");

C:Users\Rog\Documents\Arduino\Rotarytablechuck10\Rotarytablechuck10\.ino:967:35:Warning deprecated conversion from string constant to 'char*' [Wwrite-strings] eraseEeprom(ERASE ALL?"):

Hope this is something daft and easy to get fixed, thanks to whoever will reply with a fix. (Probably down to my stupidity)

RogH
 
Hi all,

Recently found this most useful project, well done to all involved, must have taken a whole lot of time and skill. I am a dummy on all this coding and have more trouble learning these days, ho hum. Thought I would give it a go, so after lots of problems, deleted the IDE from my PC and all Arduino files I could find and started again. I find that when I compile the sketch it gets some errors although it appears to finish and tells me how much memory etc. has been used. I wonder if someone can tell me how to fix whatever it is causing the errors below:-

C:Users\Rog\Documents\Arduino\Rotarytablechuck10\Rotarytablechuck10\.ino: In Function 'Void goDeviceMenu()':

C:Users\Rog\Documents\Arduino\Rotarytablechuck10\Rotarytablechuck10\.ino:953:31:Warning deprecated conversion from string constant to 'char*' [Wwrite-strings] addDevice("NEW Dev?");

C:Users\Rog\Documents\Arduino\Rotarytablechuck10\Rotarytablechuck10\.ino:960:33:Warning deprecated conversion from string constant to 'char*' [Wwrite-strings] loadDevice("LOAD DEV?");

C:Users\Rog\Documents\Arduino\Rotarytablechuck10\Rotarytablechuck10\.ino:967:35:Warning deprecated conversion from string constant to 'char*' [Wwrite-strings] eraseEeprom(ERASE ALL?"):

Hope this is something daft and easy to get fixed, thanks to whoever will reply with a fix. (Probably down to my stupidity)

RogH

Rog, it looks like the Arduino environment has changed and is issuing warnings because my code base is using older coding conventions. There is a difference between a warning and an error in C. In this case, I would expect your code will compile, load and run Ok.

Note that errors mean the compiler throws its hands up in the air and stops dead in its tracks. Warnings on the other hand are saying "Hey, this is not quite right' do you know what you are doing?"

I always try to eliminate all warnings in my code because sometimes thay do cause problems...
 
That was quick, thanks very much for your reply, it does compile and load OK, but I have not yet got all the gear to test it for function. You did a brilliant job there, I wish I could understand even a couple percent of the coding. I will continue and hope the project works OK. Thanks once again.

Rog
 
Rod, earlier in the thread there was talk about memory size. I plan to use a 320x200 TFT touch screen display (it was cheap). Is there enough memory left in the latest version for what the display routines (input and output) will need?
 
Rod, earlier in the thread there was talk about memory size. I plan to use a 320x200 TFT touch screen display (it was cheap). Is there enough memory left in the latest version for what the display routines (input and output) will need?

I really have no idea about this hardware and its memory requirement.
 
Rod, earlier in the thread there was talk about memory size. I plan to use a 320x200 TFT touch screen display (it was cheap). Is there enough memory left in the latest version for what the display routines (input and output) will need?

I'm not great with these either, but I do know that if you put what you want in the code and compile it, it will tell you if there is enough room for it to fit.

That being said, I don't believe you will have a problem.
 
Ok Thanks! I won't be getting to the software part for a couple of weeks yet, still finishing up the hardware. Slight setback, broke a screw but it's not devastating.

Vince.
 
Just wanted to publically say "BIG THANKS" to Rod for producing the code. I ve downloaded it today and looked over the content. I can see there has been a bucket load of work thats gone into writing it.

I've loaded the code to the UNO. Still waiting on the screen.

Q. Does anyone have a diagram of the external wiring? If not, no biggie, will read through the code again and grab the important pins from it.

Cheers
Michael
 

Latest posts

Back
Top