• Spring 2024 meetup in Calgary - date Saturday, April 20/2024. discussion Please RSVP Here to confirm and get your invitation and the location details. RSVP NOW so organizers can plan to get sufficient food etc. It's Tomorrow Saturday! you can still RSVP until I stop checking my phone tomorrow More info and agenda
  • We are having email/registration problems again. Diagnosis is underway. New users sorry if you are having trouble getting registered. We are exploring different options to get registered. Contact the forum via another member or on facebook if you're stuck. Update -> we think it is fixed. Let us know if not.
  • Spring meet up in Ontario, April 6/2024. NEW LOCATION See Post #31 Discussion AND THE NEW LOCATION

Bridgeport Mill Tachometer

Susquatch

Ultra Member
Administrator
Moderator
Premium Member
@whydontu

Oh Oh.... you mean I have to solder those headers on?

It's no biggy. Just strap on a static proof bullet vest, attach a grounding strap to your wrist and the ground on the Nano, and use a special IC grade soldering iron......

Just kidding. The wrist strap is prolly a good idea but the rest is optional.

Another plan is to get the wife to do it but leave the room when she does. For some unexplainable reason, mine gets really pissed off when I tell her how to do things better......

Ya, I don't want to solder it either. I'm a cheap SOB too, but my hands and eyes are not what they once were.
 

Susquatch

Ultra Member
Administrator
Moderator
Premium Member
Soldered headers:

https://www.simcoe-diy.ca/product-p...-atmega328p-arduino-compatible-mini-usb-cable

I‘m cheap. To save $3 I’ll solder on the headers myself.

Very cool! All these great new suppliers I never knew existed! A lot can happen as careers change.... And then you retire and take up farming!

I'm cheap too, but my eyes and hands are not what they once were.

for when I decide to change the software. Much easier to unplug the Arduino from the terminal board and move it to my Mac, leaving all the rest of the tach housing, sensor, and wiring still installed on my mill

I gather that this means that the Uno module itself doesn't need all that mill based stuff for reprogramming. I assume it gets its power and reprogramming instructions via the USB cord.

Does that also mean I can use a USB wall wart to power it on the mill too?

Timing thoughts. There is a couple of lines in the code .......... probably all you’d have to do is tweak the 600000000 value to compensate for 81 pulses per revolution.

Ya, I assumed that from reading your program code. The language is a bit new to me, but it's also familiar. And your documentation comments are excellent.

I will probably do just as you suggest.

However, I also want to try to access the Microcontroller hardware counters directly. If it can do all that for me, then why write higher level code that only slows things down.

I hope you don't take offense, but I really want to experiment and learn as much as possible. Those hardware timers are screaming at me!

All of the data I can find online show a Hall effect automotive crank sensor as using 5 volt supply and signal. Wouldn’t need any tweaking to directly interface with the Arduino.

I won't argue with that. But the keyword is Hall Effect. I don't plan to use that kind of sensor because I don't want to put a magnet on my gear. I want to use the teeth themselves to create a pulse in a what is often called a magnetic reluctance sensor. The passing tooth changes the reluctance of the sensor which results in an output waveform at very low amplitude not a 5V square wave.

Screenshot_20211004-170927_Chrome.jpg

Note that this example looks like it would work on a regular input because the voltage is about 8V peak to peak. But the amplitude goes way down at slow speeds with minimums well under a volt. No way to know till you test it.

On the surface, it looks like Hall effect is way easier to use, but it really isn't. Magnetic reluctance sensors are much more popular than hall effect because they are more reliable and don't need a magnet or a shutter. In my mind's eye, the circuit to clean up the reluctor signal is probably just a single transistor running at saturation, and a few passive components.

My sensor only has one paint stripe on the target, so one pulse per revolution. For idle curiosity, I just added 9 pieces of reflective tape, so ten pulses per revolution. The tach read 11,000 at a true 1100 RPM, so it’s likely that the software could keep up with 81 pulses per revolution. The tape wasn’t evenly placed so the display bounced around a lot, but it was clear that the software was counting microseconds between pulses and converting to RPM.

This is GREAT to know! THANK YOU!
 

whydontu

I Tried, It Broke
Premium Member
The Internet is smaller than you think. That’s exactly the same graphic I found when I was looking up how a crank sensor works.

A single transistor can do level translation from the mag sensor to digital.

https://www.hackster.io/mircemk/diy-6-5mhz-frequency-meter-with-max7219-7-segment-led-module-b6b98f

Stick the transistor circuit to feed the Arduino input pin. Tweak software to suit. I know it works because I used the same circuit to build an Arduino audio sniffer to tune music synthesizer modules.
 

Susquatch

Ultra Member
Administrator
Moderator
Premium Member
The Internet is smaller than you think. That’s exactly the same graphic I found when I was looking up how a crank sensor works.

Hahaha! That's a good one! Prolly the result of how search engines prioritize results.

A single transistor can do level translation from the mag sensor to digital.

Yup, except I was planning to use a 2n2222 instead. It's a great transistor for such applications and I have hundreds of them just gathering dust now. Hoping I don't need a Schmitt trigger, but will use one if I have to. The frugal side of me hates to see a hex version be used so wastefully. Then again it's prolly cheaper than a single unit.

I ordered the Arduino stuff you recommended except I got the USB-C version instead. I'll solder the pins on even though I'm not fond of doing it. I prefer that over ordering from two sources and I much prefer USB-C.

Thanks again @whydontu .
 

Susquatch

Ultra Member
Administrator
Moderator
Premium Member
....... The IR version only needs about a dozen external connections. Next one I build I’ll just solder some of these to the Arduino instead of using the terminal board........


I saw a two pin version as well.

https://leeselectronic.com/en/product/3017-terminal-block-254mm-2-pin-4pcs.html

This 6 pin version with pigtails might be equally useful.

https://leeselectronic.com/en/product/28642-connector-6-way-254mm-w-wire.html

I have not yet committed the pinout to memory so they may not be as useful as I think.

On the flip side, the terminal board has mounting holes in it. That's worth a few bucks alone.

What they really need is one of those clamping sockets that can be opened and closed like those used for the big CPUs.
 

whydontu

I Tried, It Broke
Premium Member
the nice thing about forums is they provide other modes of thought. I’m going to order a few of these:

https://www.adafruit.com/product/383

Still use the terminal board, just replace the pin headers on the terminal board with a ZIF socket. Lots of soldering but way easier to remove & replace.
 

Susquatch

Ultra Member
Administrator
Moderator
Premium Member
the nice thing about forums is they provide other modes of thought. I’m going to order a few of these:

https://www.adafruit.com/product/383

Still use the terminal board, just replace the pin headers on the terminal board with a ZIF socket. Lots of soldering but way easier to remove & replace.

I love it! I'll be getting me a few of those too!

And ya, that's one of my favorite things about forums too. This forum is better than most though. The members on here are all sharp cookies!
 

Susquatch

Ultra Member
Administrator
Moderator
Premium Member
the nice thing about forums is they provide other modes of thought. I’m going to order a few of these:

https://www.adafruit.com/product/383

Still use the terminal board, just replace the pin headers on the terminal board with a ZIF socket. Lots of soldering but way easier to remove & replace.

Why is it more soldering? Just push the zif socket into the headers on the terminal board once and be done with it.
 

whydontu

I Tried, It Broke
Premium Member
Duh again. I usually buy the terminal boards unsoldered, never thought of using already-soldered boards
 

Susquatch

Ultra Member
Administrator
Moderator
Premium Member
Hey, @whydontu. The project below apparently accesses the microcontroller timers directly. But I don't know enough about the IDE to recognize where that is happening.

Can you take a look at the code and see if you can spot it for me?

https://www.instructables.com/Rotary-Dial-Arduino-Input/

I guess I expected the code to identify the Atmega328P’s timers by their machine language address and execute a machine language subroutine to set them and read them. That does not appear to be the case. The article describes using a register to control the timers, but I couldn't see that either.

The comments that reference the timer code seem to describe an IDE method of control, but unless there are IDE code names (eg TCCR2A TCCR2B CS22 TCNT2 TIMSK2 etc) already predefined for the timers, it doesn't seem to be there either. The code certainly does not look like machine language to me.

Feel free to tell me to study the IDE first before asking dumb questions. I readily admit that would make more sense than diving right into a hardware programming issue. But I saw the project description and could not help but take a look.
 
Last edited:

Susquatch

Ultra Member
Administrator
Moderator
Premium Member
way beyond my programming skill. I hack up existing code to get what I want, mostly by trial and error. After seeing this it’s clear that I need to figure out how to use interrupts instead of brute force counting milliseconds. Here’s a decent write up that might make more sense

https://www.instructables.com/Arduino-Timer-Interrupts/

Yes, it does make more sense.

At least as far as this article goes, it appears that the IDE does indeed have dedicated code names (eg TCCR2A TCCR2B etc) already predefined for the timers. This avoids the need to write machine language code, but probably isn't as fast or as efficient as direct coding would be.

Based on this, I'll take a wild guess that this practice probably applies to all the CPU registers and hardware. That's probably a good thing, but I would have liked more direct control. Who knows though - maybe that exists too.

Thanks @whydontu
 

YYCHM

(Craig)
Premium Member
Yes, VERY USEFUL!

But I see that the timer registers are not included for some reason! Probably to keep it simple, but they should have at least included a section for direct chip access commands.

Thank you!

Did your stuff arrive yet?

Have a look at the function libraries, you might find they expose the info you desire. I compiled some of that timer code @whydontu linked to, so it all looks to be very CPPish to me.

No, my stuff hasn't arrived yet, it was snail mailed. Should see it this week I hope.
 
Top