Duncan Webster’s Arduino Tachometer – Equivalent Hall Effect switch and Software link

Advert

Duncan Webster’s Arduino Tachometer – Equivalent Hall Effect switch and Software link

Home Forums Electronics in the Workshop Duncan Webster’s Arduino Tachometer – Equivalent Hall Effect switch and Software link

Viewing 21 posts - 1 through 21 (of 21 total)
  • Author
    Posts
  • #475351
    Colin LLoyd
    Participant
      @colinlloyd53450

      In the latest MEW (June 2020) Duncan Webster uses a UGN-3040U Hall effect switch on the end of an Arduino Nano circuit to make a tacho. These switches don't appear to be available from any place I've tried, Ebay, Amazon, CPC-Farnell. These switches (from their datasheet) are 4.5 to 24V operation, are capable of fast repetition rate and are useful in applications requiring relatively large distances between magnet and switch.

      Does anybody know a suitable equivalent Hall effect switch to take the place of the UGN-3040U – or alternatively where I might find these switches online.

      Advert
      #32096
      Colin LLoyd
      Participant
        @colinlloyd53450

        Equivalent Hall Effect Switch to UGN-3040

        #475356
        Harry Wilkes
        Participant
          @harrywilkes58467

          Sorry Colin cant help but if you fail to find one consider one of these link

          H

          #475360
          Anonymous

            Looks like it's long been obsolete. A search only finds archived datasheets and brokers who may, or may not, have a link to some in stock. But you won't be able to buy one off!

            It was made by Sprague who sold out to Allegro Microsystems, I think. Farnell have loads of Allegro sensors listed so I expect one will be suitable.

            Andrew

            #475377
            Alan Wood 4
            Participant
              @alanwood4

              Hi Colin

              I used a Melexis device US5881 from RS on my tool setter. This is a low sensitivity device and will be more than adequate for the rev counter project. It needs around 5mm spacing to trip.

              **LINK**

              The RS pages are here

              **LINK**

              I have some excess US5881, SS495A and SS443A devices if you want to try any of these. These are three legged packages as per the MEW article. I also have some TSOT US5881 if you want eye strain.

              The circuitry around them is much the same. Some are uni-polar and some bipolar and you need to make sure the magnet is orientated correctly. If you are feeding an Arduino you don't need a high current or high voltage device.

              Send me a PM if of interest.

              Alan

              #475382
              JasonB
              Moderator
                @jasonb

                You could PM Duncan, he may know of a source or it may just have been one he had sitting around.

                #475383
                SillyOldDuffer
                Moderator
                  @sillyoldduffer

                  For a Nano, probably easier and cheaper to buy a ready made module from Amazon or ebay. They use 44E or 49E sensors, depending on whether digital (on/off) or linear (analogue field strength) is wanted. The modules come with long leads and the sensor chips can easily be removed from the module if needed.

                  Duncan used a digital sensor equivalent to the KY-003 module rather than the KY-035. Either module will work on a tacho, because the linear type rapidly saturates to full output as soon as a powerful magnet comes near. The modern sensors are probably better for 5V logic than Duncan's muscular golden oldie.

                  Dave

                  #475386
                  Maurice Taylor
                  Participant
                    @mauricetaylor82093

                    Try an engine crank trigger hall switch ,These are comparable with arduino Also heavy duty ,will bolt to lathe.I use one with speeduino ecu based on arduino mega .I use one from BMW E36 engine.

                    #475387
                    Maurice Taylor
                    Participant
                      @mauricetaylor82093

                      Where can I find software for this project please ?

                      #475396
                      duncan webster 1
                      Participant
                        @duncanwebster1

                        I didn't think anyone was interested! Software will appear on here later on (as soon as I find it in my labyrinthine filing system), but it would be easier perhaps if anyone wanting it sent me a pm with their email address and I can then send it digitally

                        Sorry about the redundant sensor, I've got quite a few. I've just found OH3144 at £1.31 each or £2.99 for 5, and 49E would do equally well, in fact any open collector hall effect switch

                        #475400
                        duncan webster 1
                        Participant
                          @duncanwebster1

                          Well that was easier than I thought, here's the code

                          You will find a line

                          rpm = 52554745/(timeNow-LastInt); //scaled for gear ratioo in head

                          the rather strange constant is to take account of the gear ratio in the centec vertical head. I got this by using
                          rpm = 60000000/(timeNow-LastInt);

                          for starters and using another accurate tacho triggered by a slotted wheel held in the chuck, noting the reading on the new tacho and adjusting the 60000000 to get both to read the same. If your sensor magnet is going at the same speed as the spindle is just use 60000000. If you don't have another tacho but do have a vfd then it should might be possible to drive an led off single wave rectified AC to generate a 50hz stroboscope and a painted black/white disc in the spindle

                          //08 feb 2014
                          // This version works as a tacho, counter added so that if more than n display updates happen between Interrupts the rpm is set to zero

                          #include "LedControl.h"
                          /*
                          pin 12 is connected to the DataIn
                          pin 11 is connected to the CLK
                          pin 10 is connected to LOAD
                          We have only a single MAX72XX.
                          */
                          LedControl lc=LedControl(12,11,10,1);
                          unsigned long timeNow = 0;
                          unsigned long LastInt = 0;
                          int delaytime=250;
                          int rpm = 0;
                          int USLI = 0; //Updates Since Last Interrupt
                          unsigned int ones;
                          unsigned int tens;
                          unsigned int hundreds;
                          unsigned int thousands;
                          unsigned int tenthousands;
                          #define IntPin 2

                          void setup()
                          {
                          /*
                          The MAX72XX is in power-saving mode on startup,
                          we have to do a wakeup call
                          */
                          lc.shutdown(0,false);
                          /* Set the brightness to a medium values */
                          lc.setIntensity(0,8);
                          /* and clear the display */
                          lc.clearDisplay(0);
                          //interrupt 0 (pin 2)
                          pinMode(IntPin, INPUT);
                          attachInterrupt(0, GetSpeed, FALLING); //interrupt 0 attached to pin 2
                          }

                          void DisplayDigits()
                          {
                          if (USLI > 20)
                          rpm = 0;
                          ones = rpm % 10u;
                          tens = (rpm/10u) % 10u;
                          hundreds = (rpm/100u) % 10u;
                          thousands = (rpm/1000u) % 10u;
                          tenthousands = rpm/10000u;
                          if (rpm == 0) {
                          ones = 0;
                          }

                          if(rpm > 9999) {
                          lc.setDigit(0,4,tenthousands,false);
                          lc.setDigit(0,3,thousands,false);
                          lc.setDigit(0,2,hundreds,false);
                          lc.setDigit(0,1,tens,false);
                          }
                          else if(rpm > 999) {
                          lc.setDigit(0,3,thousands,false);
                          lc.setDigit(0,2,hundreds,false);
                          lc.setDigit(0,1,tens,false);
                          }
                          else if (rpm > 99) {
                          lc.setDigit(0,2,hundreds,false);
                          lc.setDigit(0,1,tens,false);
                          }
                          else if (rpm > 9) {
                          lc.setDigit(0,1,tens,false);
                          }

                          lc.setDigit(0,0,ones,false);
                          delay(delaytime);
                          lc.clearDisplay(0);
                          USLI++;
                          }

                          void GetSpeed()
                          {noInterrupts();
                          timeNow = micros();
                          if (timeNow > LastInt)
                          rpm = 52554745/(timeNow-LastInt); //scaled for gear ratioo in head
                          // rpm = 60000000/(timeNow-LastInt);
                          LastInt = timeNow;
                          USLI = 0;
                          /* unsigned int i = 0;
                          while (i < 5000)
                          {
                          if (digitalRead(IntPin) != LOW) //not stopped bouncing start count again
                          i = 0;
                          i++;
                          }
                          rpm++;
                          */ interrupts();
                          }

                          void loop()
                          {
                          DisplayDigits();
                          }

                          #476711
                          Colin LLoyd
                          Participant
                            @colinlloyd53450

                            Alan Wood – thanks for the offer – but I've ordered some breakout boards with KY-003 chips on board.

                            Duncan Webster – grateful for the code – that's save me some time. Will run it as is to begin – together with an independent RPM meter to see what I need to take out/amend for my particular use.

                            To everyone else – thanks for the input. My Display modules and Nano boards have arrived – together with the KY-003 breakout boards. Now to put it all together and see what happens. I will let you know.

                            #485584
                            Neil Wyatt
                            Moderator
                              @neilwyatt

                              If people want to download the Arduino file directly it's here:

                              http://www.model-engineer.co.uk/Tacho3d.zip

                              Install the Arduino IDE and the .ino file should open in it.

                              Neil

                              #487786
                              John Rutzen
                              Participant
                                @johnrutzen76569

                                Hi Duncan,

                                I'm new to arduino, i've downloaded the software and am getting a development kit. I wonder if this will provide a divide by N output to drive a stepper motor to make my hobber? You mention something there about a counter being incorporated? Does the arduino provide a stable enough output? Thank you. John

                                #487801
                                duncan webster 1
                                Participant
                                  @duncanwebster1
                                  Posted by John Rutzen on 27/07/2020 09:46:29:

                                  Hi Duncan,

                                  I'm new to arduino, i've downloaded the software and am getting a development kit. I wonder if this will provide a divide by N output to drive a stepper motor to make my hobber? You mention something there about a counter being incorporated? Does the arduino provide a stable enough output? Thank you. John

                                  sorry, it won't go anywhere near doing that. If by 'hobber' you mean tying the movement of a dividing head to the movement of the hob there was an article some years ago in MEW about this, and I know Joe Noci has done it (not usiing an Arduino)

                                  #487802
                                  John Rutzen
                                  Participant
                                    @johnrutzen76569

                                    Thank you Duncan, I've just read the article on the hobber in MEW July issue. It seems it didn't work using a sensor, kept missing teeth. I found when I worked as a development engineer many years ago it was always better to ask around to see if someone else had tried rather than waste a lot of time trying to do the same thing.

                                    #487803
                                    SillyOldDuffer
                                    Moderator
                                      @sillyoldduffer

                                      Duncan's Tachometer code won't meet the requirement, but this example shows the basic principle. The code assumes a hobber turning the gear blank by one step for every 40 steps the gear hob turns.

                                      The code:

                                      hobberdemo.jpg

                                      The output:

                                      hobdemo.jpg

                                      Not counted them but one yellow step for every 40 blue steps.

                                      The accuracy is good according to my oscilloscope, the 15ms pulses really are 15ms.

                                      It's a get you started example, a bit too simple. Depending on the application, it might matter that the hob spindle pauses whilst the main is turned (see gaps in the blue pulse train). There's no way of starting and stopping the outputs, or of altering the hob ratio other than by recompiling the code. A real hobber would need some buttons and maybe a display.

                                      It took longer to write the post and upload the images than to write and test the code, but I am set up for playing Arduino on my Dining Table already.

                                      Dave

                                      #487817
                                      John Rutzen
                                      Participant
                                        @johnrutzen76569

                                        Thanks very much. If you can write the code please have a go at it. I'll build the hardware to try it out.

                                        #487821
                                        SillyOldDuffer
                                        Moderator
                                          @sillyoldduffer
                                          Posted by John Rutzen on 27/07/2020 14:04:13:

                                          Thanks very much. If you can write the code please have a go at it. I'll build the hardware to try it out.

                                          As long as you're not in a rush, we can have a go.

                                          I'm not familiar with how hobbers work in practice. I know the blank and hob are rotated at a ratio to suit the gear but that's it for me. Can you write a few words on how it might be operated please? For example:

                                          • What ratios are used (a few could be set by turning a knob, lots would better handled by typing the wanted one in with a keypad)
                                          • Starting and stopping. ( I guess the hob would be positioned against the blank on the machine, and then the machine would start, after which the blank would make one complete revolution and stop, plus provision for an operator stop.)
                                          • Reverse & Speed control? (I assume not)
                                          • Any need for a display? And if so what information does the operator need?
                                          • Anything else a computer controlled hobber needs to do?

                                          As a first step, I suggest familiarising yourself with the development kit and IDE by trying a few of the simple examples provided with the IDE before seeing if my code above works. If you've got some steppers and drivers, the code should turn the motors, which is good for morale!

                                          PM me if that's more convenient, and we might exchange email addresses as well. Or if you prefer we can open a build thread and amuse the forum! (And they should also be able to help.)

                                          Regards,

                                          Dave

                                          #487828
                                          John Rutzen
                                          Participant
                                            @johnrutzen76569

                                            Ok great, I'll start a new thread Arduino Gear hobber and answer your questions, I'm on a learning curve with this myself.

                                            #487831
                                            John Rutzen
                                            Participant
                                              @johnrutzen76569

                                              Actually there's a good series on the whys and wherefores of gear hobbing in MEW starting in May this year. He tried to get it to work for several years and only succeeded by driving the cutting spindle with a stepper motor. Keeping everything in sync is the difficulty. I suppose I just think that arduino should be able to do it. The parts are very cheap and readily available but I'm willing to be corrected on this.

                                            Viewing 21 posts - 1 through 21 (of 21 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

                                            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