DIY hand held Hall Effect tach with Arduino

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.

Lloyd-ss

Well-Known Member
HMEM Supporting Member
Joined
Mar 8, 2019
Messages
861
Reaction score
737
Location
Charlottesville, VA
(EDIT) More Details and Video added in post #2
ArduinoHallTach.jpg
Coming

Just finished is this NJK-5002C Hall Effect/Arduino tachometer. Details coming shortly. It works like a charm. Just tape a magnet to a rotating object, press the button on the side of the tach and it displays the rpm.


BUT, as happens sometimes when working too late at night on a project, I crammed the project between 2 pieces of 13mm bamboo flooring with a cavity neatly milled out. I knew the project was working so I glued the 2 halves together. Perfect!
No.
I had calibrated the tach with a hand drill, but now, checking a 1725rpm bench grinder the tach reads 1938rpm instead of 1725. Fixing that is just a number change in the little Arduino code. Only problem is I can't get to the USB connector on the Arduino!!! Oh well, I will pop the 2 halves apart and carefully calibrate it. Embarrassing.
Lloyd
 
Last edited:
I am curious on how you programmed the Arduino.
Hi Timo, You might be sorry you asked because I could talk about this all day, LOL. Also, I don't know what your experience with small electronics projects or micro processors (like the Arduino and Raspberry Pi) is, so I will just give the basics for you and anyone else who might be curious.

The Arduino is basically a stripped down computer with no display, keyboard, power, etc, but with the capability to interface with and control a multitude of devices.
The picture shows all that is needed to get started.
First is any laptop. You download all the free programming software and examples that you need from the Arduino website onto the laptop.
Next is an Arduino micro processor (computer, cheap) that comes in a mind boggling variety of capabilities and prices.
Last is a USB cable to connect the Arduino to the laptop. This provides the communication and power to the Arduino.

The programming is all done on the laptop. The software (the Arduino IDE) that you download to the laptop has built in example programs that you can upload to the Arduino. For example, the Arduino has a couple of LEDs on it that you can program to blink, etc, without needing any other materials. There is a button (virtual button) in the IDE that you press to upload the program to the Arduino. If it works, great, if it doesn't, you modify the program and upload it again until it works. Once the program is in the Arduino, the Arduino is a stand-alone computer (you have to hook 5 volts to it, though). You can also overwrite the program to make the arduino do something else. The Arduino can also send messages back to the laptop display if you program it to do so.

Now this is where the real capability comes into play. For my project, I needed a Hall Effect sensor to sense the rotating magnet. I also needed a little LCD display to show the rpm. Within the arduino IDE there are examples of code for both of those devices. You literally cut and past the appropriate pieces of code into the new program (they call it a sketch) that you are writing. Then you upload it to the Arduino and it works like magic. Ha Ha. Just joking. It will BECOME easy, but the first projects will be frustrating because they won't work and it might be just a misplaced comma. But you try it, then fix it, then try again, until it works. There is a very active on-line forum with helpful people to get you through the initial problems.

I could go on and on, but please let me know if I am being helpful with my answer for you.
Lloyd

ArduinoSetUp.jpg
 
Nicely done! I enjoy using the Arduino platform - very versatile, and inexpensive for a nano clone. I'm guessing you don't have more than about $5 in that project, unless the sensor is very expensive. And of course, $5000 of programming time, but hey, who's counting that, right? At least, I never mention that part to my wife when I am telling her how little I spent on my latest project ... :)

At the risk of "barging in" on this thread, but in case it is of interest: Lately I've been using an AT-Tiny84 for projects like this, and recently I worked up a design in KiCAD and ordered a PCB that allows an AT-Tiny84, rotary input, and 2-line LCD to be soldered directly to the board, making for a compact device that can do input and output while still having 7 pins available for whatever it needs to control or sense. With a slight modification to the board, it can also connect to a 4-line LCD display. I'm still testing the first unit that I soldered up - so far it seems to be working well with the first test program involving a simple PWM output, but I have not yet verified that all of the available GPIO pins are working as intended. If anyone is interested, I'm happy to post additional details ... and again, apologies for any distraction from the OP.
 
Nicely done! I enjoy using the Arduino platform - very versatile, and inexpensive for a nano clone. I'm guessing you don't have more than about $5 in that project, unless the sensor is very expensive. And of course, $5000 of programming time, but hey, who's counting that, right? At least, I never mention that part to my wife when I am telling her how little I spent on my latest project ... :)

At the risk of "barging in" on this thread, but in case it is of interest: Lately I've been using an AT-Tiny84 for projects like this, and recently I worked up a design in KiCAD and ordered a PCB that allows an AT-Tiny84, rotary input, and 2-line LCD to be soldered directly to the board, making for a compact device that can do input and output while still having 7 pins available for whatever it needs to control or sense. With a slight modification to the board, it can also connect to a 4-line LCD display. I'm still testing the first unit that I soldered up - so far it seems to be working well with the first test program involving a simple PWM output, but I have not yet verified that all of the available GPIO pins are working as intended. If anyone is interested, I'm happy to post additional details ... and again, apologies for any distraction from the OP.
Andy, no problem at all mentioning the AT-Tiny84. There are so many micro processors available now that making a choice on what to start with can be intimidating for someone new to the game. I just stumbled onto the Nano at an Amazon "Bin" store where they sell all of the Amazon returned items. I happened to see 3 of the little Arduino Nanos in an envelope and it was a $5 day, so the three cost me $5 total. and I think the Hall was from ebay 3 for $10. And the display was something I bought years ago. And if it left over from a previous project, it is free, right?

I started with a Parallax Stamp micro processor 15 years ago. Then dropped it for years. And then picked back up with the more capable Arduino a few years ago. They are an intimidating mystery if you've never messed with one, but once you are over the learning curve, it is a lot easier. Getting into the hobby can be very cheap, maybe with a project kit package with a bunch of cook book projects in it. Once the light bulb goes on it becomes pretty exciting.
Lloyd
 
Agreed! And once one has mastered the basic Arduino and related microcontrollers, one can use the same Arduino infrastructure with an STM32 or other 32-bit ARM processor, or an ESP32 or ESP8266 processor. All kinds of possibilities! :)
 
Hi there Lloyd-ss
Would you be willing to share the code by any luck? I’d also like to make one. Not a specific reason for one right this moment but seems like a nice little arduino project. No worries if not, thank you!

Chris

(this isn’t my first post. I joined many years ago as craynerd but can’t access my account!)
 
Hi Timo, You might be sorry you asked because I could talk about this all day, LOL. Also, I don't know what your experience with small electronics projects or micro processors (like the Arduino and Raspberry Pi) is, so I will just give the basics for you and anyone else who might be curious.

The Arduino is basically a stripped down computer with no display, keyboard, power, etc, but with the capability to interface with and control a multitude of devices.
The picture shows all that is needed to get started.
First is any laptop. You download all the free programming software and examples that you need from the Arduino website onto the laptop.
Next is an Arduino micro processor (computer, cheap) that comes in a mind boggling variety of capabilities and prices.
Last is a USB cable to connect the Arduino to the laptop. This provides the communication and power to the Arduino.

The programming is all done on the laptop. The software (the Arduino IDE) that you download to the laptop has built in example programs that you can upload to the Arduino. For example, the Arduino has a couple of LEDs on it that you can program to blink, etc, without needing any other materials. There is a button (virtual button) in the IDE that you press to upload the program to the Arduino. If it works, great, if it doesn't, you modify the program and upload it again until it works. Once the program is in the Arduino, the Arduino is a stand-alone computer (you have to hook 5 volts to it, though). You can also overwrite the program to make the arduino do something else. The Arduino can also send messages back to the laptop display if you program it to do so.

Now this is where the real capability comes into play. For my project, I needed a Hall Effect sensor to sense the rotating magnet. I also needed a little LCD display to show the rpm. Within the arduino IDE there are examples of code for both of those devices. You literally cut and past the appropriate pieces of code into the new program (they call it a sketch) that you are writing. Then you upload it to the Arduino and it works like magic. Ha Ha. Just joking. It will BECOME easy, but the first projects will be frustrating because they won't work and it might be just a misplaced comma. But you try it, then fix it, then try again, until it works. There is a very active on-line forum with helpful people to get you through the initial problems.

I could go on and on, but please let me know if I am being helpful with my answer for you.
Lloyd

View attachment 163192
Yes a good writeup what it is and how it works. Fun stuff. I collect those little bugs, but do often not do much with them, but when I see a new board at the local shop I need to have it (just in case I need one :) ).
(Last year I made a little box Touch DRO following the instruction)
https://www.touchdro.com/resources/adapters/diy/

Then there was this thread about Arduino Rotary table, so I made one too. This was mainly to have a test platform for the software discussion.
https://www.homemodelenginemachinist.com/threads/help-with-arduino-idexer.35108/
I still need to finish "boxing" the rotary into a proper enclosure. (maybe today is the day! :-O ) Haha!

Greetings Timo
 
@timo_gross and @raynerd
I am glad you guys liked the tach. I am building a similar one that uses an IR optical sensor. It will be almost identical to the Hall Sensor one except that it won't sling magnets across the shop like bullets.
And I do plan on putting the code and schematic on the forum for anyone that is interested.
 
Andy, no problem at all mentioning the AT-Tiny84. There are so many micro processors available now that making a choice on what to start with can be intimidating for someone new to the game. I just stumbled onto the Nano at an Amazon "Bin" store where they sell all of the Amazon returned items. I happened to see 3 of the little Arduino Nanos in an envelope and it was a $5 day, so the three cost me $5 total. and I think the Hall was from ebay 3 for $10. And the display was something I bought years ago. And if it left over from a previous project, it is free, right?

I started with a Parallax Stamp micro processor 15 years ago. Then dropped it for years. And then picked back up with the more capable Arduino a few years ago. They are an intimidating mystery if you've never messed with one, but once you are over the learning curve, it is a lot easier. Getting into the hobby can be very cheap, maybe with a project kit package with a bunch of cook book projects in it. Once the light bulb goes on it becomes pretty exciting.
Lloyd
LOL, I haven't been particularly interested in arduinos, tho' I am familiar with the concept of what they do. I figured if I ever have a need for them, I could pick it up then. HOwever, a colleague told me a bout an arduino game. So, having lots of time, I decided to get one. Well, it went well for the first extremely simple project, and a little tougher for the 2nd project. But after that, the "game" part was that one has to figure out some of the stuff oneself! Well, I'm used to having electronics with CLEAR instructions or at least a schematic. I don't know how a complete beginner would have a chance at understanding this the way the "game" is made up. Yes, cook book, but this game is more like throw in a rabbit (uh, do you skin the rabbit, what do you do with the head and tail, guts?) into a stew.
In the mean time, I bot some more parts to the arduino, but the parts are unlabelled. Haven't got much of a clue as to what they are. (Oh, I know what resistors, caps, relays and all those are)
 
LOL, I haven't been particularly interested in arduinos, tho' I am familiar with the concept of what they do. I figured if I ever have a need for them, I could pick it up then. HOwever, a colleague told me a bout an arduino game. So, having lots of time, I decided to get one. Well, it went well for the first extremely simple project, and a little tougher for the 2nd project. But after that, the "game" part was that one has to figure out some of the stuff oneself! Well, I'm used to having electronics with CLEAR instructions or at least a schematic. I don't know how a complete beginner would have a chance at understanding this the way the "game" is made up. Yes, cook book, but this game is more like throw in a rabbit (uh, do you skin the rabbit, what do you do with the head and tail, guts?) into a stew.
In the mean time, I bot some more parts to the arduino, but the parts are unlabelled. Haven't got much of a clue as to what they are. (Oh, I know what resistors, caps, relays and all those are)
Can I guess that you bought a sensor kit for Arduino. Mine came without labels too but I found this image on another site. Maybe it will help you.
 

Attachments

  • Arduino_aensors.jpg
    Arduino_aensors.jpg
    151.2 KB
Can I guess that you bought a sensor kit for Arduino. Mine came without labels too but I found this image on another site. Maybe it will help you.
:Yes, it's called the "hero". The site I bougjht it from really, I thimpfk, is one of those get rich quick sites, that sells you stuff that is OK, but provides absolutely NO support. That type of place goes out of business quickly but in the mean time they can wrack up quite a supply of $$. However, they would do even BETTER, if they would take the time to support their product. They wouldn't go out of business. I've seen that happen many times.

And MANY thanx for the photo. It looks exactly like what I have. Many of the items, I could recognize the parts on the little boards but many I could not.
 
There are at least 2 kits of modules, a 37 piece one and a 45 piece set. I may be able to get a picture of the 45 piece kit too if some of you want it.
I have to say that I have so little experience with these that from what you are saying, I can deduce that these parts will work with any arduino. So in that case, they all must have the same power requirements.
 
@Richard Hed
There you go Richard, @RM-MN gave you a big hint. And you are a smart guy... you will figure it out.

We all learn differently and know what our most successful methods for learning are. I am a good reader, but a slow reader, and verbose tutorials are tough for me to wade thru. Other folks can pick up a manual and learn straight from that.
I personally like youtube videos but you have to find a reliable source. The channel called Great Scott! is one of my favorites. Very honest and practical explanations. I like to use some of his simpler projects as starting points and get them to work first. Then on the Arduino site I use the language reference and syntax section. It is very brief but has a ton of info. I very seldom go in cold. Find something that is like what you want and build it. Then when you get stuck, search the Arduino 'community, forum' for a matching problem. Somebody has already had the same problem and has been helped by experienced folks on solving it. Build a project in stages, and by that I mean get one easy part of it to work to get the Adrenalin flowing, then add a feature to it. Like for this tach, I first got the sensor to actually show a number on the laptop screen. Putting an LED temporarily into a circuit to give a visual confirmation is helpful. After I got the hall sensor to be recognized and show "something," I tried adding a little bit of coding to get it to actually calculate RPM. For me its showing persistence for each small portion of the project. Trying to do too much is the kiss of death for me. Start small and add to it.
Just my 2 cents.
 
@Richard Hed , have you got the Arduino IDE (i think that means independent development environment, but the name doesn't matter) loaded onto your laptop, along with a USB cable to plug into the Arduino? The IDE is downloaded from the Arduino.cc site.


EDIT- I am pretty much a novice but can fumble thru a project. Each problem solved is a learning experience.
 
I have used the Arduino for many projects, CNC Control of a long-arm quilting machine, many lighting controls for shutting off the lights etc in the shop, Temp control for radiant heaters that were manual control originally, Contol system for use in converting a central AC system to a heat-pump.

The most complex control was for my Processing furnace for aluminum, It is running on a Arduino MEGA2560, with t-couple sensors in the pool and flue, it controls 2 waste oil burners with variable firing rate,750kbtu to 20kbtu with propane start and stabilization, the waste oil is preheated to 160F for winter operation. This furnace will melt 150-200 lb per hour, total process time including melting and ingot pouring is 2.5 hours.
My processing busineess is getting to the point I'm going to need to sell it, Im 72 and it is taking all my energy to run it so I don't get to do muche fun machining etc. I sell betweed 2.5 and 3 tons per year of ingots. I will need to rebuild the control system to include 2' X 3 inch screen and keypad for adjusting set-points etc and viewing operational conditions as well as the ability to manual override if necessary, the old system required the laptop to monitor or change any settings.

My other project is a totally programmable lead screw control for my 12 x 36 atlas lathe with metric and imperial feeds as well as slow cutting rate for clean cuts.

I'm willing to share code etc, as well as other questions. I don't want to steal this thread so IF there is a desire for further discussion I will open a new thread.
 

Attachments

  • 20240408_130021[1].jpg
    20240408_130021[1].jpg
    3 MB
  • 20210907_094241[1].jpg
    20210907_094241[1].jpg
    4.2 MB
  • 20221010_110039[1].jpg
    20221010_110039[1].jpg
    4.1 MB
  • 20241230_161401[1].jpg
    20241230_161401[1].jpg
    4.5 MB
Last edited:
@master531yoda Excellent. A very complex project that probably took many months and involved a lot of trial and error, but in the end it worked. And now it sounds like you are thinking of a second generation.

@Richard Hed But here is the other end of the spectrum in the picture below of the first part of the optical tach.
So far, it is just a battery of 5v, a Craftsman meter, 3 resistors, a few jumper wires, and an LED IR emitter (the black looking LED gizmo), and a photo transistor (the clear LED looking thing facing the emitter. All this does is read a voltage coming out of the photo transistor. The voltage is normally about 5v, but if I put a piece of paper between the 2 LED looking gizmos, the voltage drops to about 0.3 volts. It switches from 5.0 volts to 0.3 volts. Think digital. It switches from high to low. And that is the start of it. Its like a simple on-off switch that the Arduino can sense and time. If you can time it, you can calculate RPM.

IMG_20250104_110100548 (1).jpg
 
I have to say that I have so little experience with these that from what you are saying, I can deduce that these parts will work with any arduino. So in that case, they all must have the same power requirements.
All of those parts will work with any Arduino as they all work on 5 volts and low current. Some of them will work with the 3.3 volts of the ESP32, some will not. The Arduinos have a current limit of about 20ma per output pin and a cumulative limit too so you can't necessarily use all the pins at once.

There are several different displays for the Arduino and a bunch more that will only work with 3.3 volts. For the latter you can use a logic shifter to take the 5 volts down to 3.3 or a voltage divider with resistors. One of the displays is what they call a shield, sits directly on top of the Arduino Uno or Mega. It takes up most of the pins of the Uno so it really limits what you can do with it but the Mega has a double row of digital pins across the end that you can use.
 

Latest posts

Back
Top