DRO Z-Axis /4th axis “combiner”

Advert

DRO Z-Axis /4th axis “combiner”

Home Forums General Questions DRO Z-Axis /4th axis “combiner”

Viewing 24 posts - 26 through 49 (of 49 total)
  • Author
    Posts
  • #536388
    SillyOldDuffer
    Moderator
      @sillyoldduffer

      Which model Arduino is it? You have to select the right one before compiling because they're not interchangeable. Some Nanos are sold with the 'Old Bootloader', so try both old and new. See the Tools menu, and check the Board and Processor options.

      The lower black information pane is quite small, and clue warning messages may be out of view. The pane can be resized by moving the cursor on to the grey line bottom of the edit pane. Lefty click when the cursor changes to a double ended arrow and drag the pane.

      Finally, it may be worth going to Preferences->Settings and ticking the 'Show verbose output during upload' tick box. It may explain what the problem is.

      Not sure why your Arduino isn't auto detected by the IDE. Possibly the chip is damaged, or Windows needs a device driver. (W10 is quite good at auto-detect, but older versions may need help.)

      Dave

      Advert
      #536389
      David Tocher
      Participant
        @davidtocher94033

        I suggest you try a known program/sketch. Use the blink from the examples.

        There are different nano boards. The usual cheap ones require the old bootloader ATmega328P – go to the 'tools' menu and select it. If you have a 'proper' nano then use the ATmega328P option.

        Depending on your computer you may need to find the correct com port – I can't recall how I did it or if it was automatic.

        Once you can run the blink program/sketch you should be in business.

        As an aside I've got the Arduino IDE on a laptop running XP another running Win10 and a Raspberry PI running Raspasian (a version of LINUX) and, of course, they are slightly different but all work!

         

        SOD beat me too it – sorry about the repeat!

        Edited By David Tocher on 26/03/2021 18:47:54

        #536393
        ronald bakker
        Participant
          @ronaldbakker48084

          it might had been detected automaticly but i selected a com port before downloading , i tried all 3 of them (com3-4-5)

          i have tried the older bootloader like you and the program itself (link to arduino.cc) allso on al 3 ports available , windows did detect and loaded sumting when i plugged the arduino in the first time

          the lower black box is basicly showing it tried 10 times and could not reach the arduino with a small code behind it , might retry it tomorrow and will write down the exact text , i will allso try the blink sketch to see if that works , its supposed to blink the led's on the nano itself right ?, any chance of trying to reload the bootloader intoo the arduino ?

          the last option is to wait for my second order of arduino's to arive so i can see if its the arduino or me messing up , btw bought them cheap from aliexpress :

          "Arduino Nano ATMEGA328P Mini Usb with the Bootloader Compatibel Nano 3.0 Controller for Arduino CH340 Usb Driver 16Mhz"

          looks like the 328p bootloader look intoo it further tomorrow

          #536394
          SillyOldDuffer
          Moderator
            @sillyoldduffer

            Sometimes if the wrong bootloader or chip is selected the USB interface gets confused. Might be cleared by waiting several munutes for the interface to time-out. or by unplugging the Arduino, waiting a few minutes, and trying again. Or logout and back in again, or in an extreme case, reboot Windows to force the operating system to force a full USB reset.

            I see your Nano clone has a CH240, which is a simple minded USB chip that upsets Windows unless a particular driver is loaded.

            Dave

             

             

            Edited By SillyOldDuffer on 26/03/2021 19:23:25

            #536395
            David Tocher
            Participant
              @davidtocher94033

              I think the CH340 is the comms chip on the board that requires the old bootloader. If it did 'summat' the first time and you you had some mishap soldering you may have damaged the chip. Try the blink demo when you get the replacement(s).

              #536404
              ronald bakker
              Participant
                @ronaldbakker48084
                Posted by SillyOldDuffer on 26/03/2021 19:18:14:

                Sometimes if the wrong bootloader or chip is selected the USB interface gets confused. Might be cleared by waiting several minutes for the interface to time-out. or by unplugging the Arduino, waiting a few minutes, and trying again. Or logout and back in again, or in an extreme case, reboot Windows to force the operating system to force a full USB reset.

                I see your Nano clone has a CH240, which is a simple minded USB chip that upsets Windows unless a particular driver is loaded.

                Dave

                it sounds like that usb thing could be the problem , thanks for mentioning it i will try it tomorrow …..or tonight if i cannot sleep from thinking about it

                having people like you helping me makes figuring stuff out a lot more fun

                Edited By SillyOldDuffer on 26/03/2021 19:23:25

                #536409
                David Tocher
                Participant
                  @davidtocher94033

                  What system are you using for the Arduino IDE? My first Arduino efforts used the Raspberry Pi and I had awful problems – even some of the demo programs/sketches wouldn't compile. I had made the mistake of using 'sudo apt -get' to load in what transpired to be a very old, obsolete, version of Arduino IDE. I tried everything inc. new drivers. Once I loaded in the latest IDE from the main Arduino site all was well.

                  #536429
                  ronald bakker
                  Participant
                    @ronaldbakker48084

                    using a window 10 laptop

                    running the original and newest version of the arduino skietch_mar26a / arduino 1.8.13 

                    trying to load an arduino nano using usb

                    Edited By ronald bakker on 26/03/2021 22:53:49

                    #536438
                    duncan webster 1
                    Participant
                      @duncanwebster1

                      Assuming you don't want to move the knee and the quill together at the same time, can't this be done with just OR gates? No processor. No idea how fast it would go, above my pay grade

                      #536440
                      David Tocher
                      Participant
                        @davidtocher94033

                        One can buy an Arduino nano for between £1and £2 and I'd guess it would cost more to buy a couple of TTL gates and a bit of veroboard. The extra soldering, linking wires etc for a discrete build wouldn't help reliability either.

                        #542819
                        Stuart Smith 5
                        Participant
                          @stuartsmith5

                          I have just started to make this and had trouble uploading the sketch to my Arduino nano. I hadn’t noticed the previous suggestions to use the ‘old boot loader’ option, so I only realised the problem when I looked on the suppliers website and found the information. I haven’t had this issue before with other nanos.

                          Anyway it has loaded ok now and is working on a breadboard. Just need to make it permanent.

                          One thing I spotted when looking for ‘encoder.h’ was a note to say that as only pins 2 & 3 can be used as external interrupts an the nano, they should be the first in the ‘Encoder scale1(x,y);’ definitions. (So that it uses interrupts). So I changed the 2 lines from ‘Encoder scale1(4,2); ‘ to ‘Encoder scale1(2,4);’ & from ‘Encoder scale2(5,3);’ to ‘Encoder scale1(3,5);’. See **LINK**. Assuming this info is correct, if one of the encoders needs reversing, the actual data wires will need to be swapped, rather than the sketch changed.

                          Stuart

                          #542846
                          SillyOldDuffer
                          Moderator
                            @sillyoldduffer
                            Posted by Stuart Smith 5 on 03/05/2021 00:53:07:

                            I … had trouble uploading the sketch to my Arduino nano. I hadn’t noticed the previous suggestions to use the ‘old boot loader’ option, so I only realised the problem when I looked on the suppliers website and found the information. I haven’t had this issue before with other nanos.

                            Stuart

                            The bootloader is a short section of code pre-loaded into the Nano that recognises when a new user program has to be downloaded and installed.

                            The original Nano bootloader has a bug – it might collide with a Watchdog. Watchdogs can be programmed by advanced users to hybernate the microcontroller to save power. The CPU can be programmed to wake up periodically or when an event occurs. Watchdogs are useful for battery powered applications that only activate once in a blue moon. The problem is rare but worth fixing,

                            The new bootloader corrects the watchdog problem and, as a bonus, doubles the download speed. New Nanos bought from Arduino always have the new bootloader, but some clones still come with the old bootloader. Doesn't matter much except it thoroughly confuses anyone who's not bumped into the problem before! A further twist of the knife is using the wrong bootloader can temporarily confuse the PC's USB interface, so that switching to the right bootloader and trying again fails too. Try unplugging the Nano, waiting a few minutes and trying again.

                            Another quirk is some Clones are fitted with a different USB interface chip. Makes no difference to Apple and Linux but Windows may need to download a device driver.

                            None of this is rocket science, but having to mess with device drivers, bootloaders and confused USB links may be too much for beginners exploring a new technology. For that reason, I recommend starting with an Arduino Uno rather than a Nano. Pretty much the same computer, but no booby traps. Or begin by buying a Genuine Nano rather than a clone.

                            I felt-tip a big 'O' on any Nano found with an old bootloader: it reduces the frustration!

                            Dave

                            #542883
                            David Tocher
                            Participant
                              @davidtocher94033

                              I have a simpler solution; only buy the cheap nano boards then there's no confusion about which driver to use!

                              The cheap ones don't have the pins soldered in which makes the board easier to mount in small enclosures.

                              #542888
                              SillyOldDuffer
                              Moderator
                                @sillyoldduffer
                                Posted by David Tocher on 03/05/2021 13:40:04:

                                I have a simpler solution; only buy the cheap nano boards then there's no confusion about which driver to use!

                                Alas, buying cheapest possible doesn't guarantee getting the old boot loader! I must have nearly 20 Nanos bought at various times and places, mostly cheap clones, and they're a mixture of old and new. Some sellers say what's installed, others don't.

                                This chap's Nano came without a bootloader at all! A happy accident because the resulting instructable describes how to copy a bootloader from one Arduino to another. It's not difficult to swap old and new bootloaders, particularly if the Arduinos are jumpered with socketed wires rather than hacked together. Not as easy as my felt-tip though!

                                Dave

                                #578237
                                Roger Clark
                                Participant
                                  @rogerclark

                                  I've been trying to get my quill and head encoders to work together for a couple of months now, could not get a nano to work correctly. I purchased an M_DRO summing interface instead but that would not work either, just kept flashing between 0 and 5 microns.

                                  So yesterday and today I ported the code over to an Arduino MEGA, wired it up, switched on and hey presto it worked so I cannot understand why the M_DRO interface doesn't! The encoder are all 5 micron Vevor encoders.

                                  I'll put the code down below in case it's useful to anyone.

                                  Have a great New Year

                                  Roger

                                  #578241
                                  Roger Clark
                                  Participant
                                    @rogerclark

                                    Code as promised, had to split over 2 posts as too long!

                                    /*

                                    Code by Kealan O'Carroll, April 2019

                                    Encoder.h library by PaulStoffregen

                                    http://www.pjrc.com/teensy/td_libs_Encoder.html

                                    Ported to Mega by Roger Clark 03/01/2022

                                    Code intended for an arduino mega with the following wiring:

                                    Pins 10, 11 : Scale 1 inputs

                                    Pins 12, 13 : Scale 2 inputs

                                    Arduino Pins 8, 9 : Outputs to DRO A and B pins. (Pins 6 and 8 on a DSUB9 type plug)

                                    */

                                    #define ENCODER_OPTIMIZE_INTERRUPTS

                                    #include "Encoder.h"

                                    Encoder scale1(10, 11); //Wire first scale A & B quadrature lines to arduino Pins 10 and 11

                                    Encoder scale2(12, 13); //Wire second scale A & B quadrature lines to arduino Pins 12 and 13

                                    //If either of the scales reads in the wrong direction, reverse the pin numbers above (e.g. (4,2) changes to (2,4)

                                    long pos2 = 0;

                                    long pos1 = 0;

                                    long delt = 0;

                                    long oldpos1 = 0;

                                    long oldpos2 = 0;

                                    long delt1 = 0;

                                    long delt2 = 0;

                                    bool outA = LOW;

                                    bool outB = LOW;

                                    void setup() {

                                    // MEGA PORTS

                                    // PORTH maps to Arduino digital pins 0 to 7

                                    DDRH = DDRH | B01100000; // Defines D8 (PH5) & 9 (PH6) as outputs for Panel

                                    // PORTB maps to Arduino digital pins 8 to 13

                                    DDRB = DDRB | B00000000; // Defines 10-13 as inputs

                                    PORTH = B00000000; // sets digital pins all Low

                                    PORTB = B00000000; // sets digital pins all Low

                                    }

                                    #578242
                                    Roger Clark
                                    Participant
                                      @rogerclark

                                      //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;

                                      }

                                      #595710
                                      Neil Lickfold
                                      Participant
                                        @neillickfold44316

                                        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

                                        #595725
                                        DC31k
                                        Participant
                                          @dc31k
                                          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.

                                          #595726
                                          JasonB
                                          Moderator
                                            @jasonb

                                            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.

                                            #595735
                                            An Other
                                            Participant
                                              @another21905

                                              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

                                              #595737
                                              An Other
                                              Participant
                                                @another21905

                                                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

                                                #595807
                                                old mart
                                                Participant
                                                  @oldmart

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

                                                  #595818
                                                  duncan webster 1
                                                  Participant
                                                    @duncanwebster1

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

                                                  Viewing 24 posts - 26 through 49 (of 49 total)
                                                  • Please log in to reply to this topic. Registering is free and easy using the links on the menu at the top of this page.

                                                  Advert

                                                  Latest Replies

                                                  Home Forums General Questions Topics

                                                  Viewing 25 topics - 1 through 25 (of 25 total)
                                                  Viewing 25 topics - 1 through 25 (of 25 total)

                                                  View full reply list.

                                                  Advert

                                                  Newsletter Sign-up