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

Duncan Webster's Arduino Tachometer - Equivalent Hall Effect switch and Software link

Equivalent Hall Effect Switch to UGN-3040

All Topics | Latest Posts

Search for:  in Thread Title in  
Colin LLoyd27/05/2020 15:06:14
avatar
211 forum posts
18 photos

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.

Harry Wilkes27/05/2020 15:20:24
avatar
1613 forum posts
72 photos

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

H

Andrew Johnston27/05/2020 15:29:03
avatar
7061 forum posts
719 photos

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

Alan Wood 427/05/2020 16:24:21
257 forum posts
14 photos

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

JasonB27/05/2020 16:50:22
avatar
25215 forum posts
3105 photos
1 articles

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

SillyOldDuffer27/05/2020 16:57:38
10668 forum posts
2415 photos

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

Maurice Taylor27/05/2020 17:13:48
275 forum posts
39 photos

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.

Maurice Taylor27/05/2020 17:27:59
275 forum posts
39 photos

Where can I find software for this project please ?

duncan webster27/05/2020 18:14:17
5307 forum posts
83 photos

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

duncan webster27/05/2020 18:31:13
5307 forum posts
83 photos

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();
}

Colin LLoyd01/06/2020 16:07:52
avatar
211 forum posts
18 photos

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.

Neil Wyatt14/07/2020 13:00:04
avatar
19226 forum posts
749 photos
86 articles

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

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

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

Neil

John Rutzen27/07/2020 09:46:29
411 forum posts
22 photos

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

duncan webster27/07/2020 11:47:52
5307 forum posts
83 photos
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)

John Rutzen27/07/2020 11:57:28
411 forum posts
22 photos

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.

SillyOldDuffer27/07/2020 12:04:30
10668 forum posts
2415 photos

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

John Rutzen27/07/2020 14:04:13
411 forum posts
22 photos

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

SillyOldDuffer27/07/2020 14:47:36
10668 forum posts
2415 photos
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

John Rutzen27/07/2020 17:06:14
411 forum posts
22 photos

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

John Rutzen27/07/2020 17:40:39
411 forum posts
22 photos

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.

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