# Bridgeport Mill Tachometer



## Susquatch (Sep 29, 2021)

I am pulling together a control box for my Bridgeport Mills. It is mainly to facilitate VFD controls like a fwrd/rev switch and a frequency Potentiometer. But I have a hankering to be able to see the actual spindle speed. 

My best idea to do this so far is a hall effect transducer on the nose. Basically, a small magnet glued to the spindle nose and a hall effect sensor screwed to the nose cap with a wire loop back up to the control box. 

I'm not thrilled with this idea though. The wire would have to be guarded, and might be easily broken. I wish there was a better way. 

Have any of you done this? Any better ideas?


----------



## John Conroy (Sep 29, 2021)

I've been thinking about a tach also. There doesn't seem to be an easy solution for placement of the sensor and magnet without major disassembly of the head. To read actual spindle speed in high and low range the magnet would have to be placed on the bottom of the spindle pulley on a variable speed head as the top of the pulley moves up and down with speed adjustment. I have made the parts to fit the spindle nose as you mentioned but I too would prefer something else.


----------



## Susquatch (Sep 29, 2021)

John Conroy said:


> I've been thinking about a tach also. There doesn't seem to be an easy solution for placement of the sensor and magnet without major disassembly of the head. To read actual spindle speed in high and low range the magnet would have to be placed on the bottom of the spindle pulley on a variable speed head as the top of the pulley moves up and down with speed adjustment. I have made the parts to fit the spindle nose as you mentioned but I too would prefer something else.


I'm not sure disassembling the head would help. It's the same problem top to bottom. Maybe a longer draw bar head that always sticks out above the housing? 

Let's see what others suggest.


----------



## YYCHM (Sep 29, 2021)

https://www.electronicsweekly.com/b...wi-fi-chip-nearly-hidden-hall-sensor-2019-10/

Would eliminate wires.  I've been looking for a wireless tach solution for my mill.  Battery operated would be fine with me.


----------



## CWelkie (Sep 29, 2021)

Not a Bridgeport but close enough ...
I also installed a VFD control box with a tach on my mill some years ago.  After much thought and fiddling around I ended up dismantling the head to install a hall effect sensor and magnet. (The project would have taken less time if I'd just done that in the first place!)  It really wasn't too much work or trouble to "do it right".

The tach was a Mach Tach kit that was commercially available a few years ago.  The developer is now making the information and files available through Thingiverse.
Anyway ... very happy with the result.


----------



## PeterT (Sep 29, 2021)

Could you paint a stripe on some inconspicuous area of output shaft & point at it with one of these? I'm thinking somewhere in the belt area out of the way, but maybe there s no direct line of site.  I've only used the gun style & they need either a color interruption? Would the sensor care if it was pointed at a white stripe on the black drive belt for example? 

https://www.amazon.ca/Digital-Displ...ocphy=9001292&hvtargid=pla-585002351704&psc=1


----------



## YYCHM (Sep 29, 2021)

PeterT said:


> Could you paint a stripe on some inconspicuous area of output shaft & point at it with one of these? I'm thinking somewhere in the belt area out of the way, but maybe there s no direct line of site.  I've only used the gun style & they need either a color interruption? Would the sensor care if it was pointed at a white stripe on the black drive belt for example?
> 
> https://www.amazon.ca/Digital-Displ...ocphy=9001292&hvtargid=pla-585002351704&psc=1



That's not optical, it relies on a magnet being installed on a shaft or pulley somewhere.


----------



## Susquatch (Sep 29, 2021)

PeterT said:


> Could you paint a stripe on some inconspicuous area of output shaft & point at it with one of these? I'm thinking somewhere in the belt area out of the way, but maybe there s no direct line of site.  I've only used the gun style & they need either a color interruption? Would the sensor care if it was pointed at a white stripe on the black drive belt for example?
> 
> https://www.amazon.ca/Digital-Displ...ocphy=9001292&hvtargid=pla-585002351704&psc=1




The one in your link is hall effect not optical.

I am using an optical gun right now with a stripe of reflective tape on the spindle nose. It works just fine but optical has its downsides and handheld just sucks. I prefer hall effect because the signal quality is heads and shoulders better than reflective optical.

Regardless, both are essentially the same from a functional standpoint. Nose Mounted, wiring loop required, very messy environment.


----------



## Susquatch (Sep 29, 2021)

CWelkie said:


> Not a Bridgeport but close enough ...
> I also installed a VFD control box with a tach on my mill some years ago.  After much thought and fiddling around I ended up dismantling the head to install a hall effect sensor and magnet. (The project would have taken less time if I'd just done that in the first place!)  It really wasn't too much work or trouble to "do it right".
> 
> The tach was a Mach Tach kit that was commercially available a few years ago.  The developer is now making the information and files available through Thingiverse.
> ...



I like this. I also like your control box. That's more or less what I want too.

So how does this connect internally inside the mill head?


----------



## CWelkie (Sep 29, 2021)

If I remember correctly, I potted a Hall effect sensor into a length of small diameter tubing  for positioning and mounting. An angled hole was drilled through the “gearbox” cover alongside the lubrication way to suit the tubing and the whole lot epoxied in place with JB Weld. The (shielded) cable was then routed out the side of the housing as shown. A magnet was epoxied into a shallow depression cut into the top of the large gear near the outer edge to trigger the Hall effect (remember North/south polarity if required for the sensor being used). Using a strong magnet will help ensure enough field to trigger the sensor if the sensor and magnet end up a bit further apart than intended.

Sorry no pictures “under the hood” and i don’t feel up to dismantling it all to take any right now. I have attached one showing the tubing in place.

The cable from the Hall effect is terminated in a 3 pin shielded connector that plugs into a matching receptacle on the back of the control box.


----------



## Dabbler (Sep 29, 2021)

Your Teco VFD has a scaling parameter that allows you to display the actual speed on the VFD display, once you have calibrated it with your tach.  This assumes you won't be changing your belts an modifying your ratios (just a thought)


----------



## Brent H (Sep 29, 2021)

Check this video out for how this guy gets his speed feed from the mill to sync with a servo - I may be making something like this in a while  - but it may help you out with a spindle speed that is highly accurate. 






The spring loaded diamond etcher is cool as well


----------



## whydontu (Sep 29, 2021)

Arduino, 16x2 LCD, IR transmitter/receiver, paint stripe on quill locknut. Maybe $30 in parts, a couple of hours work. Only snag I had was my shop door has a window that lets outside light shine on the mill. IR receivers don’t like sunshine. I have a Busy Bee CT129 / Grizzly G0704 mill, and I had removed the motor shroud, but had to put it back on to block the outside light hitting the sensor.

I tried the hall effect / magnet system, but the magnet kept picking up swarf.

Let me know if this sounds viable and I‘ll take some photos and dig up the links for the software.


----------



## YYCHM (Sep 29, 2021)

whydontu said:


> Arduino, 16x2 LCD, IR transmitter/receiver, paint stripe on quill locknut. Maybe $30 in parts, a couple of hours work. Only snag I had was my shop door has a window that lets outside light shine on the mill. IR receivers don’t like sunshine. I have a Busy Bee CT129 / Grizzly G0704 mill, and I had removed the motor shroud, but had to put it back on to block the outside light hitting the sensor.
> 
> I tried the hall effect / magnet system, but the magnet kept picking up swarf.
> 
> Let me know if this sounds viable and I‘ll take some photos and dig up the links for the software.



How many volts does it take to drive that?  DC I assume? I'm trying to avoid running a power cord from a wall wart.


----------



## PeterT (Sep 29, 2021)

Sorry, I should have read before I clicked. I thought it was a laser style & they have dropped in price, but alas not


----------



## Susquatch (Sep 29, 2021)

Dabbler said:


> Your Teco VFD has a scaling parameter that allows you to display the actual speed on the VFD display, once you have calibrated it with your tach.  This assumes you won't be changing your belts an modifying your ratios (just a thought)



I didn't notice that my VFD could do that. VERY COOL! Thank you @Dabbler !!!  I suppose I could select a standard belt and back gear setup and then program the VFD to match. 

I confess that I am still hoping I can at least use the back gear. If I can get a tach to work independent of belt position and back gear, then why not!


----------



## Susquatch (Sep 29, 2021)

Brent H said:


> Check this video out for how this guy gets his speed feed from the mill to sync with a servo - I may be making something like this in a while  - but it may help you out with a spindle speed that is highly accurate.
> 
> 
> 
> ...



I LOVE THE DIAMOND ETCHER!!! 

The Encoder - not so much. That would be a ton of work if it's even possible to get that installed on the spindle someplace. That said, perhaps it's possible to use the bottom clutch teeth as an Encoder albeit with reduced resolution (but plenty good enough for rpm). I'm in there anyway right now trying to get rid of that noise (see Hartford Thread), so I'll look at that idea too. Thanks @Brent H !


----------



## Susquatch (Sep 29, 2021)

PeterT said:


> Sorry, I should have read before I clicked. I thought it was a laser style & they have dropped in price, but alas not



No problem. 

A laser on the nose might work!


----------



## whydontu (Sep 29, 2021)

YYCHM said:


> How many volts does it take to drive that?  DC I assume? I'm trying to avoid running a power cord from a wall wart.



Arduino runs on 5 volt DC,  or can accept 7 to 12 volt DC  if I use the on-board regulator. maybe 50 mA. I run it off a wall wart.

 I never thought about it, butI bet I could parasite off the 5 volt supply feeding the glass scales on the DRO.


----------



## Susquatch (Sep 29, 2021)

whydontu said:


> Arduino, 16x2 LCD, IR transmitter/receiver, paint stripe on quill locknut. Maybe $30 in parts, a couple of hours work. Only snag I had was my shop door has a window that lets outside light shine on the mill. IR receivers don’t like sunshine. I have a Busy Bee CT129 / Grizzly G0704 mill, and I had removed the motor shroud, but had to put it back on to block the outside light hitting the sensor.
> 
> I tried the hall effect / magnet system, but the magnet kept picking up swarf.
> 
> Let me know if this sounds viable and I‘ll take some photos and dig up the links for the software.



Sounds great! I'm not sure how your system picks up a paint stripe though. My Quill nut moves up and down about 6 inches. And most of that is buried inside the mill head. 

Yes, I agree that swarf and magnets don't mix very well. Yet another reason to rule out that solution. 

If I end up going with an optical sensor system, I'll try to avoid IR. 

Boy, you do like Arduino don't you! 

If I do end up going that way, I'll get back to you and take you up on your offer.


----------



## whydontu (Sep 29, 2021)

Susquatch said:


> Sounds great! I'm not sure how your system picks up a paint stripe though. My Quill nut moves up and down about 6 inches. And most of that is buried inside the mill head.
> 
> Yes, I agree that swarf and magnets don't mix very well. Yet another reason to rule out that solution.
> 
> ...



A $5 microcontroller with a USB port, a dozen digital i/o, four analog in, four PWM out, UART, I2C, 32k EEPROM? What’s not to like? All support circuitry is on the board. Plug-n-play.

Only snag with the tach is it tops out about 1500 RPM. No big deal, I’m usually spinning cutters no higher than 1000 RPM.

My mill has a big washer attached to the top of the drive gear that rotates the quill. Busy Bee CT129, part #206. I took a plastic cap from a can of spray paint and painted a couple of white stripes. Bolted the cap to the washer, aimed the IR sensor at the stripes.


----------



## Susquatch (Sep 30, 2021)

CWelkie said:


> Not a Bridgeport but close enough .......... I ended up dismantling the head to install a hall effect sensor and magnet.........
> 
> The tach was a Mach Tach kit that was commercially available a few years ago.  The developer is now making the information and files available through Thingiverse.



No worries. One of my mills is a Hartford too. I really like it. You are right, the differences really are minor. 

No worries on the kit. I have found lots of hall effect kits like that on Ali, Amazon, and E-Bay. I have even found a few DROs with hall effect based tachs built right in. 

I like your control box. My motor has a mounting flange on one side that looks dumb just sitting there with nothing on it. So I had planned to mount my control box there. But I had planned to add a DRO in the next while, so what you did makes sense. 

For now, my issues are all with where and how to mount the sensor. 

I like your idea of picking up off the spindle side of the bull gear assembly. But I'm thinking it might be possible to use the teeth themselves directly instead of a magnet. Many modern car engines have a sensor that picks up the teeth on the starter ring gear to know exactly where the crankshaft is at any point in time. 

Might be a great application for an Arduino too......


----------



## Susquatch (Sep 30, 2021)

whydontu said:


> Only snag with the tach is it tops out about 1500 RPM. No big deal, I’m usually spinning cutters no higher than 1000 RPM.
> 
> My mill has a big washer attached to the top of the drive gear that rotates the quill. Busy Bee CT129, part #206.



Part 206 looks like a gear to me. But I get the idea now. I had imagined a big long vertical stripe on the spindle not a horizontal one on a washer or gear. 

IIs your IR sensor a two part (emitter/receiver)? 

Why does it top out at 1500? Is that a speed limitation of the Arduino? If so, I would think they would have a faster version available too..... 

I sort of like the idea of counting teeth (have to research that more)....... But that would need even more speed...... Even so, those microcontroller things are WAY faster than us.


----------



## CWelkie (Sep 30, 2021)

Susquatch said:


> I like your idea of picking up off the spindle side of the bull gear assembly. But I'm thinking it might be possible to use the teeth themselves directly instead of a magnet. Many modern car engines have a sensor that picks up the teeth on the starter ring gear to know exactly where the crankshaft is at any point in time.



One optional input for a Mach Tach option was/is a gear tooth sensor.  The application including a housing and circuit diagram can be found here:
https://www.thingiverse.com/thing:1463559
Perhaps this information will help in your quest.


----------



## Susquatch (Sep 30, 2021)

CWelkie said:


> One optional input for a Mach Tach option was/is a gear tooth sensor.  The application including a housing and circuit diagram can be found here:
> https://www.thingiverse.com/thing:1463559
> Perhaps this information will help in your quest.



Here is a typical automotive tooth sensor. $20 on Amazon. Even cheaper at a junk yard. The dots at the bottom of the right image (number 1) is a cross section of the coil winding.


----------



## whydontu (Sep 30, 2021)

Photos.

Tachometer, simple plastic box. Held on to the mill control panel with a magnet from a trashed disk drive. Simple and cheap and I can move it when needed (when I'm trying new software).

Sensor is also simple. The disc on the drive collar is just a flat metal plate with a bunch of holes. The original tach setup was a sensor and light pair shining through the disc, counting holes. This tach is long gone, previous mill owner was attempting to convert the mill to CNC and he trashed all of the electronics.

New sensor is a $3 IR card and a plastic cap, painted black, with a white stripe. You can see in the photos that a green LED light comes on when the strip reflects IR from emitter to receiver. Arduino measures milliseconds between pulses and converts to RPM. I just checked, and it will read >2000 RPM, so at least as high as my mill will go.

I thought I'd throw in photos of my Z-axis power lift. A $10 reversible gear motor I found at a thrift store, bracket, and a couple of Lovejoy couplings. I can undo the Lovejoy couplings to allow using the manual hand wheel, but in the two years I've run this setup I've never needed to.

Also another hard drive magnet bolted to the side of the mill. Holds my scriber and the pin to tighten/loosen the drawbar


----------



## YYCHM (Sep 30, 2021)

whydontu said:


> Let me know if this sounds viable and I‘ll take some photos and dig up the links for the software.



I'm liking the sounds of this, can you please post links for the wiring diagram and software?

Craig


----------



## whydontu (Sep 30, 2021)

Parts from Universal Solder, Canadian reseller https://www.universal-solder.ca

. I also buy this stuff in bilk off eBay, cheaper off eBay but U/S is a really nice guy to deal with.

Arduino Nano https://www.universal-solder.ca/product/arduino-nano-v3-atmega328-compatible/

Nano board - saves a tonne of soldering https://www.universal-solder.ca/pro...arduino-nano-and-canaduino-bread-board-buddy/

16x2 LCD https://www.universal-solder.ca/product/green-yellow-lcd-1602-2x16-character-parallel-or-i2c/

LCD I2C interface (way fewer wires) https://www.universal-solder.ca/product/i2c-interface-with-pcf8574-for-lcd-1602-2004-etc/

IR sensor pair - odd that Universal Solder doesn't have any of these, but Amazon has them. I bought five, figured they're in a crappy location so best to have some spares.
Gikfun IR Infrared Obstacle Avoidance Sensor Module for Arduino Smart Car Robot Practice DIY (Case Pack of 5) EK1254x5C
by Gikfun_Official_Store
Learn more: https://www.amazon.ca/dp/B07FFM7DYQ/ref=cm_sw_em_r_mt_dp_8MAZYBH0HCVCK4G74DVY?_encoding=UTF8&psc=1

The usual power supply parts and connectors. Shielded cable from the IR sensor to the Arduino.

I use a 9v wallwart for power. If you can parasite anything from 5 volt to 12 volt from another device it might save a 120VAC outlet.

The LCD display and I2C interface in the photo are connected using a chunk of strip board. The case I had in my parts bin was too small to fit the LCD and adapter properly, so I had to make up a board to kick the adapter over to fit the case. I was too cheap to go buy the proper case.

The beauty of Arduino is the IDE is simple, the parts are stupid cheap, all inputs/outputs have built-in protection circuitry. I used to add all sorts of external components to protect the Arduino, and then I realized that the Arduino is cheaper than the protection parts. Now, when I fry an Arduino, I just pop in another one.

Link for the Arduino .ino file: https://1drv.ms/u/s!Aohw2pqlpunshBhKvxaZhqE86pji?e=aVtYhq

Software, Arduino IDE program:

#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);
const int dataIN = 2; //IR sensor INPUT

unsigned long prevmillis; // To store time
unsigned long duration; // To store time difference
unsigned long lcdrefresh; // To store time for lcd to refresh

int rpm; // RPM value

boolean currentstate; // Current state of IR input scan
boolean prevstate; // State of IR sensor in previous scan

void setup()
{
  pinMode(dataIN,INPUT);
  lcd.begin();     
  prevmillis = 0;
  prevstate = LOW;  
}

void loop()
{
 // RPM Measurement
  currentstate = digitalRead(dataIN); // Read IR sensor state
 if( prevstate != currentstate) // If there is change in input
   {
     if( currentstate == HIGH ) // If input only changes from LOW to HIGH
       {
         duration = ( micros() - prevmillis ); // Time difference between revolution in microsecond
         rpm = (60000000/duration); // rpm = (1/ time millis)*1000*1000*60;
         prevmillis = micros(); // store time for nect revolution calculation
       }
   }
  prevstate = currentstate; // store this scan (prev scan) data for next scan

  // LCD Display
  if( ( millis()-lcdrefresh ) >= 500 )
    {
      lcd.clear();
      lcd.setCursor(0,0);
      lcd.print("Spindle LAST");
      lcd.setCursor(0,1);
      lcd.print("RPM = ");
      lcd.print(rpm);         
      lcdrefresh = millis();   
    }

}


----------



## YYCHM (Sep 30, 2021)

@whydontu What's this stuff?


----------



## whydontu (Sep 30, 2021)

YYCHM said:


> @whydontu What's this stuff?
> 
> View attachment 17404


3-pin DIN socket for the cable to the IR sensor, barrel jack for the wall wart cord, on/off switch


----------



## YYCHM (Sep 30, 2021)

whydontu said:


> 3-pin DIN socket for the cable to the IR sensor, barrel jack for the wall wart cord, on/off switch



Would this work for the IR sensor?  https://www.universal-solder.ca/pro...idance-tracking-ir-sensor-robots-arduino-etc/


----------



## whydontu (Sep 30, 2021)

absolutely. I used the end-mounted version because I didn’t have room for the tracking style. Other than the orientation of the transmitter / rrecover pair the circuitry and functions are the same


----------



## YYCHM (Sep 30, 2021)

whydontu said:


> absolutely. I used the end-mounted version because I didn’t have room for the tracking style. Other than the orientation of the transmitter / rrecover pair the circuitry and functions are the same



Well..... $25 cad got me all the parts in your list except a PS, on/off sw and enclosure.  Will see where this goes.

Do you really need shielded wires from the sensor to the Arduino?

Craig


----------



## Susquatch (Sep 30, 2021)

Busy day today harvesting beans. Hoping to be able to play with my toys again soon. I want to get the back gear cover off, relieve it to fix the noise problem and investigate where/how to install a speed sensor. 

@whydontu - You are having WAY too much fun........

@YYCHM - You are not far behind.... 

Seriously though, I'm very grateful for the suggestions, ideas, and discussion.


----------



## Susquatch (Oct 3, 2021)

I'm bad. I ask you guys a question and then disappear. I am sorry about that and my apologies. Harvest time came early this year and caught me off guard.

Took some time this morning while my beans are still full of dew to get the cover off, investigate options, and write this post. There are lots of options. That big bull gear literally screams "PICK ME, PICK ME!"

1. I could drill a hole in the side of the housing to install an automotive engine position sensor as I described in an earlier post on this thread above. The sensor will need a long tip to reach the bull gear through the housing but then all the wiring would be external and this option would sure make it easy to replace a bad sensor.

2. Or attach a small magnet to the top of the gear and a hall effect sensor in the cover above it. This introduces a possible balance issue. But I could always add a counter weight at 180 degrees. This will require internal wiring, but entire kits are available off the shelf for $30 - nothing to do but hook it up.

3. Or an optical sensor similar to what @whydontu described. But the entire bull gear area is packed with grease and I don't think grease and optical sensors will like each other very much. Also, there is no place for a shutter style window so it would have to be reflector style.

Or.....???

Prolly because of my automotive career I am leaning heavily toward using the engine sensor. Most of all, I like the reliability and the high resolution.

Anyway, it looks to me like it's nowhere near the ugly problem I originally thought it was going to be and installing a sensor shouldn't be that difficult after all. It's just a matter of making a good decision.

The electronics should not be too hard either.  I do love the idea of using an Arduino, if for no other reason than the opportunity to learn how to use one! But I'm a bit worried about the speed limits because there are 81 teeth on the bull gear. At 4500 rpm (max Spd on the varispd dial), that's a counting frequency of 364,500 pulses per minute or 6,075 pulses per second (6KHz) which might be too fast for the arduino.  Even if it is, that doesn't really matter. I'll use one if I can, and if not there are lots of single chip counters that can be used to generate an extremely accurate tach readout. I'd even bet I already have a few highspeed counter chips already in my electronics supplies.

THE FOLLOWING IS PURE SPECULATION BY A TOTAL IDIOT WHO NEVER USED AN ARDUINO BEFORE BUT WHO HAS USED MICROCONTROLLERS.

I confess that I am a little surprised that there are any concerns about the frequency limits of the Arduino Nano. It just doesn't seem reasonable that any microcontroller might not be able to follow a high frequency input. With a clock frequency of 16MHz, most microcontrollers can follow an 8MHz input, and 4MGz should be easy. So I did a little Arduino research this morning. Apparently, the Arduino IDE does not provide documented access to the full capabilities of the Atmega328P microcontroller itself. So I checked on the capabities of the microcontroller chip. As I had guessed it seems to have 5 hardware timers right on the chip that can be configured as an 8 or 16-bit TC with two compare/capture channels or one 32-bit TC with two compare/capture channels by using two TCS. It also has four 24-bit Timer/Counters for Control (TCC).  All are rated at half the clock frequency (ie 8MHz).

So, unless I am all wet AGAIN, it ought to be possible to have the program setup and use a hardware counter (no additional code required except for setup) to count gear tooth pulses until it hits 81 (or any arbitrary higher or lower number, then increment an rpm counter or some such equivalence. A 20 pulse timer would prolly be accurate enough and would make it possible to calculate a high resolution rpm output that is refreshed at a decent rate (say once every 5 seconds). A hardware timer would eliminate the need for software to check the sensor state.

@whydontu - have you tried outputting an on/off pulse on one of the digital outputs from within your measurement loop to see how fast your program really is?

I also gather that the Nano board has to have some pin straps soldered to it before it can be inserted into the Nano Project Board but that the Nano Project Board makes wiring a lot easier after that. This seems really odd. Why wouldn't the Nano board come with the pins already on it? Or is that already an option I didn't see? Or maybe I just missed something....... I did notice that some of the photos had the pins and some didn't.

Is that display the brightest one available? Generally, I need reading glasses for such things so big bright digits are always a blessing. I saw some bright blue and bright green displays on the universal-solder website. But that could be just the photo or web image not the true size and brightness.

I plan to order a set of parts to play with once I get answers to the questions above.

Sorry for all the dumb questions.

And sorry in advance for prolly not replying AGAIN for a few days.......


----------



## Susquatch (Oct 3, 2021)

Here is my bull gear and below that is the proposed location of an engine position sensor. The socket I used for representation is 0.465" OD and that is probably still too big. A sensor with an OD of 3/8" would be ideal. Heaven forbid that I have to make one........


----------



## whydontu (Oct 3, 2021)

Comments:

I‘m not familiar with the auto engine sensors, but my guess is it would work fine. My first attempt at the tach used a proximity switch, only problem was it was too big to fit inside my mill quill housing.

The update time on my software is pretty quick. Less than 1 second.

The smaller arduino cards can be ordered with soldered or not-soldered pin headers. I suppose you could use the not-soldered version and hard wire, but it makes it a pain to update any software. I use the pin headers and the terminal board so it’s easy to unplug the arduino and move it to my Mac when I want to modify the software.

LCDs have a contrast trimpot, my eyesight isn’t what is was 60 years ago but once I get the contrast pot set it’s easy to read.

The best I can recall was being able to toggle an output port at about 100kHz. 

81 teeth @ 2000 RPM <should> be doable, but if I was doing this I’d put in a prescaler ahead of the arduino, a simple CMOS binary counter to divide the raw pulse count by 16 to reduce it to a range that’s going to work better with the arduino.

Higher speed tachometer:

https://www.instructables.com/Measure-RPM-DIY-Portable-Digital-Tachometer/

I didn’t use this design because I didn’t need the range, and the setup I used had only three active components, Nano, LCD, and IR sensor. This one needs a multiplexer and more parts than mine.


----------



## Susquatch (Oct 4, 2021)

whydontu said:


> Im not familiar with the auto engine sensors, but my guess is it would work fine. My first attempt at the tach used a proximity switch, only problem was it was too big to fit inside my mill quill housing.
> 
> The update time on my software is pretty quick. Less than 1 second.
> 
> ...



You really are quite amazing you know....... 

Since I believe that the Arduino microcontroller already has prescaling built in, I'd like to try and use that first. Especially since it can scale to any 8 or 16 bit variable desired. No need to revise circuitry, just change the program. However, the nature of the engine position sensor is such that the signal is probably way too low to be directly usable so I will need an amplifier anyway and I could add some signal conditioning to square up the sine wave and even add an external scaler if I need to. 

Since I have no experience with the Arduino, I really don't know what I'm getting into by mixing machine code with the higher level Arduino code.  Right now, I don't even know if that is possible, but I don't see why not. The original versions of C were loved by most programmers BECAUSE you could add machine language modules to the C code. We will see. If it doesn't work out, a prescaler is doable, but I'd like to try the direct approach first. I have already created an order at universal-solder. I will place it and let's see what happens. It will be a great winter project! 

Since the head of my mill is already apart, I was going to drill for the sensor right now. But I have not yet decided which mill to keep so I think I will put it back together as is and do everything as a later project this winter instead. That will also give me time to read up on how to use the Arduino and play with it a bit. Heck, I could even chuck a gear in my lathe and test out the sensor and sensor circuitry before I make any permanent changes to the mill. 

I have two followup questions before I order though. The picture below is the one for the Arduino that you specified above. As you can see in the photo, the pins are not attached so I had assumed that I would have to solder them on. 





But your note above says "The smaller arduino cards can be ordered with soldered or not-soldered pin headers." I could not find it with them soldered on, but I would prefer that. How do I find that? 

You also said that I could probably "use the not-soldered version and hard wire, but it makes it a pain to update any software. I use the pin headers and the terminal board so it’s easy to unplug the arduino and move it to my Mac when I want to modify the software."   As I already said, that's my preference too. But I don't really understand what you mean by unplugging and moving to your Mac....... Unplugging it how? Do you mean unplugging it from the terminal board or unplugging everything from your mill? 

Thanks again @whydontu!


----------



## whydontu (Oct 4, 2021)

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.

My builds always use the terminal boards, so I can remove the Arduino from the terminal board as needed:

> for when I fry an Arduino by shorting something, or accidentally putting a 12v signal somewhere it shouldn’t be

> 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

Timing thoughts. There is a couple of lines in the code that define the ratio of sensor pulses in microseconds to RPM display:

duration = ( micros() - prevmillis ); // Time difference between revolution in microsecond
         rpm = (60000000/duration); // rpm = (1/ time millis)*1000*1000*60;

probably all you’d have to do is tweak the 600000000 value to compensate for 81 pulses per revolution.

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.

The original proximity sensor I used was a 12 volt output pulse, to use it with the 5 volt Arduino all I did was make up a simple resistor voltage divider.

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.


----------



## YYCHM (Oct 4, 2021)

@whydontu 

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


----------



## Susquatch (Oct 4, 2021)

YYCHM said:


> @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 (Oct 4, 2021)

whydontu said:


> 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. 



whydontu said:


> 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? 



whydontu said:


> 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! 



whydontu said:


> 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. 






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. 



whydontu said:


> 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 (Oct 4, 2021)

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.


----------



## whydontu (Oct 4, 2021)

I should have looked up the info.

http://interface.khm.de/wp-content/uploads/2009/01/preamp.gif

YYCHM - you don’t need any transistor circuit if you use the IR transducer setup


----------



## Susquatch (Oct 4, 2021)

whydontu said:


> 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.



whydontu said:


> 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 .


----------



## YYCHM (Oct 4, 2021)

Post a link to the Arduino you ordered please.


----------



## Susquatch (Oct 4, 2021)

Here you go! 

https://www.universal-solder.ca/pro...patible-atmega328p-ch340-usb-with-usb-c-port/

Too bad we can't have a soldering party with @whydontu........


----------



## whydontu (Oct 4, 2021)

Duh. Writing this up made me think of better ways to do things. 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.

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


----------



## Susquatch (Oct 5, 2021)

whydontu said:


> ....... 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 (Oct 5, 2021)

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 (Oct 5, 2021)

whydontu said:


> 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 (Oct 5, 2021)

whydontu said:


> 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 (Oct 5, 2021)

Duh again. I usually buy the terminal boards unsoldered, never thought of using already-soldered boards


----------



## Susquatch (Oct 10, 2021)

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.


----------



## whydontu (Oct 10, 2021)

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/


----------



## Susquatch (Oct 10, 2021)

whydontu said:


> 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


----------



## Susquatch (Oct 11, 2021)

Hey guys, (@whydontu & @YYCHM), looks like universal solder has the terminal blocks too. This way you can get em all at the same place and save on shipping.

https://www.universal-solder.ca/product/terminal-block-5-00-3p-screw-clamp/

At the bottom of the page are links to other blocks with more or less terminals.

Heading home today.


----------



## YYCHM (Oct 11, 2021)

You might find this useful....

Arduino Reference - Arduino Reference


----------



## Susquatch (Oct 11, 2021)

YYCHM said:


> You might find this useful....
> 
> Arduino Reference - Arduino Reference




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?


----------



## YYCHM (Oct 11, 2021)

Susquatch said:


> 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.
> 
> ...



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.


----------



## Susquatch (Oct 11, 2021)

YYCHM said:


> 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.



I had a good look and didn't see it.

Let me know if you run across a function called TCCR2A or TCCR2B in the documentation. I believe that those are the two 8 bit timers that are most commonly used.


----------



## YYCHM (Oct 11, 2021)

Susquatch said:


> I had a good look and didn't see it.
> 
> Let me know if you run across a function called TCCR2A or TCCR2B in the documentation. I believe that those are the two 8 bit timers that are most commonly used.



I think the info you are after is in what they call the microcontroller datasheet. 

ATmega328P pdf, ATmega328P description, ATmega328P datasheets, ATmega328P view ::: ALLDATASHEET :::


----------



## Susquatch (Oct 11, 2021)

YYCHM said:


> I think the info you are after is in what they call the microcontroller datasheet.
> 
> ATmega328P pdf, ATmega328P description, ATmega328P datasheets, ATmega328P view ::: ALLDATASHEET :::



Not exactly. The data sheets provide the machine language structure and codes and as such they describe the timers as well as the machine language instructions to use them.

However, it's unlikely that the C++ compiler for the Arduino uses the same terminology for them. That would be REALLY confusing.

At any rate, you are definitely poking around in the stuff I wanted to understand and use.

Let me expand a bit. Programs are written in languages. But microcontrollers don't understand all languages. They ONLY understand machine language. Machine language is the basic logic that operates the processor. On the other hand, people have a hard time programming in machine language. It takes too long and it is easy to make mistakes. So companies have developed higher level languages together with compilers that convert the higher level programs that people can use into the low level language that microcontrollers use. The Arduino is programmed in a custom version of c++.  When a program written in C is compiled, it is basically converted into machine language. Best of all, the C language can be compiled into different versions of machine language for different processors.

Although it's entirely possible that a C instruction or target would work the same as the machine language version, it's unlikely. Typically, one line of C code compiles into dozens or even hundreds or thousands of lines of machine language code.


----------



## Susquatch (Oct 11, 2021)

Btw, that version of the data sheet is a bit hard to use because it's online only. Here is a downloadable version.

https://www.google.com/url?sa=t&sou...CBAQAQ&sqi=2&usg=AOvVaw1saIayRRDKrz7YCcviikuY


----------



## YYCHM (Oct 12, 2021)

Oh Oh.....  This stuff is teeny tiny






I don't think there is a chance in hell of me ever soldering something this small LOL.


----------



## Susquatch (Oct 12, 2021)

YYCHM said:


> Oh Oh.....  This stuff is teeny tiny
> 
> View attachment 17661
> 
> I don't think there is a chance in hell of me ever soldering something this small LOL.



Wow......  Just wow......

Did you just assemble the pins without soldering?

And if you can do that, surely you can solder too...... If not, maybe SWMBO or a daughter could do it for you......

Anyway, I'm sure you can do it. Just need a big magnifying glass, a light, some small project clips to hold it together, and two nice square cushions to lay your arms on to steady the shakes..... 

Very cool.


----------



## YYCHM (Oct 12, 2021)

Susquatch said:


> Wow......  Just wow......
> 
> Did you just assemble the pins without soldering?
> 
> ...



Give me $5 and the cost of postage and the solder yourself Nano, LCD and I2C interface are yours


----------



## whydontu (Oct 12, 2021)

or send me the bits and I’ll solder them, make up the interconnect cables, load the software, and send it back to you. You can make up your own cabinet and cabinet-to-sensor wiring.  I have all the gear and no objections to helping as long as you don’t want it done in a screaming panic.


----------



## YYCHM (Oct 12, 2021)

whydontu said:


> or send me the bits and I’ll solder them, make up the interconnect cables, load the software, and send it back to you. You can make up your own cabinet and cabinet-to-sensor wiring.  I have all the gear and no objections to helping as long as you don’t want it done in a screaming panic.



Thanks for the offer, I may take you up on it.  I really don't think I could solder this stuff without messing it up big time. For now I ordered a Nano with pre-soldered pins and a USB cable (couldn't find anything around here that fit) and a pre-assembled 2x16 I2C LCD.  If this Tach works out, I'm thinking a FPM meter for my shaper.

Craig


----------



## Susquatch (Oct 13, 2021)

YYCHM said:


> Give me $5 and the cost of postage and the solder yourself Nano, LCD and I2C interface are yours



Same offer as @whydontu.

I'll just do yours next to mine and ship you back the best one.

But if you really don't want them, send me a PM with your email address and I'll take your offer and add a nice tip.

I'm really looking forward to all the learning and projects.

For example, I've always wanted to be able to turn off individual rows on my corn & bean planter on the fly. Seems like a great job for an Arduino or two, a few solenoids, and some parts I make on my new to me Hartfort mill!


----------



## whydontu (Oct 13, 2021)

easy peasy. Not exactly the same, but I use an Arduino to trigger drum sounds in my music synthesizer. Reads a MIDI digital data stream, and outputs seven individual 5v pulses in response to specific musical notes. 

There‘s a more robust version of the Arduino that has a more industrial layout, includes integral relays, RTC, etc.

https://www.universal-solder.ca/pro...lectronics-diy-kit-for-arduino-nano-included/


----------



## Susquatch (Oct 13, 2021)

whydontu said:


> easy peasy. Not exactly the same, but I use an Arduino to trigger drum sounds in my music synthesizer. Reads a MIDI digital data stream, and outputs seven individual 5v pulses in response to specific musical notes.
> 
> There‘s a more robust version of the Arduino that has a more industrial layout, includes integral relays, RTC, etc.
> 
> https://www.universal-solder.ca/pro...lectronics-diy-kit-for-arduino-nano-included/



Oh my! That is a beauty!

No soldering @YYCHM!

It's on backorder, but that might save a ton of extra hardware. I'd have to get two of them and twin them for each half of my eleven row planter. But no biggie. At $35 its still WAY cheaper than making a multiplexed set of drivers!

My son dropped off I an engine position sensor this morning.






This particular one is way too big to use directly because it would weaken the flange too much. I might grind a bit off to find out how thick the plastic casing is though. If it's really thick, I might be able to turn it down on my lathe to fit inside the flange. 

I'm not concerned about durability or strength. The environment on the mill head is like heaven compared to the hell such sensors must endure mounted onto a car or truck engine. I can even hear angels singing in the background.... Oh, sorry - I think that's my VFD rated motor singing!


----------



## YYCHM (Oct 13, 2021)

Susquatch said:


> Oh my! That is a beauty!
> 
> No soldering @YYCHM!



According to the description https://www.universal-solder.ca/pro...lectronics-diy-kit-for-arduino-nano-included/  is a DIY soldering kit, a bunch of pieces you have to solder together.


----------



## Susquatch (Oct 13, 2021)

YYCHM said:


> According to the description https://www.universal-solder.ca/pro...lectronics-diy-kit-for-arduino-nano-included/  is a DIY soldering kit, a bunch of pieces you have to solder together.



Crap! As we have both learned the hard way....... Gotta read the details!

Oh well, that doesn't really upset me. Soldering is not my favorite thing to do, but Lord knows I have done a crap load.

In my early days, it was all transistors and components. Later it was chips and components. Still later it was processors, chips, and components. I have built several computers from the ground up making my own circuit boards and soldering every single joint. What a huge job!

But I was young then with rock solid hands and incredible eyes. Now I need a magnifying glass, arm rests, and part holders to see what I'm doing and stop the shaking. Crap.


----------



## YYCHM (Oct 13, 2021)

What do they call the plug type/style that would connect to the 3 pins on this sensor?


----------



## Susquatch (Oct 13, 2021)

YYCHM said:


> What do they call the plug type/style that would connect to the 3 pins on this sensor?
> 
> View attachment 17681



Generally, they are called PCB connectors (short for printed circuit board). But they go by other names depending on the pin size and spacing. The two, three, and 4 way connectors we discussed earlier have 1/10th inch spacing and are called terminal blocks because they take a wire on the other end with a screw clamp. The size stuff is all over the map. I wish all suppliers would provide connector names and dimensions.

What is that thing?


----------



## whydontu (Oct 13, 2021)

IR LED and IR phototransistor, plus level translator and bias circuitry. Three wires: ground, +5V, TTL 5v digital output. Output goes high when IR is reflected from LED to transistor. Bulletproof.

Connectors are standard 2.54mm / 0.1” pins. Dupont is the generic term. Amazon has a kit with all the bits. I make most of my interconnects with these, no soldering. If there’s vibration I just put on a glob of glue gun snot.

https://www.amazon.ca/Hautton-Crimp...uPWNsaWNrUmVkaXJlY3QmZG9Ob3RMb2dDbGljaz10cnVl


----------



## Susquatch (Oct 13, 2021)

Hey @YYCHM & @whydontu 

I'm not vouching for this outfit but thought it was interesting. Visuino is a drag and drop visual programming environment for various microcontrollers including Arduino. 

There is a free limited version. Full versions require a license. 

I can't seem to get past the home page on my phone. So I tried other ways of getting in. This works better but you do get the price first. Just hit the menu button up top to explore. I watched the intro video and was impressed. 

https://visuino.com/orders


----------



## YYCHM (Oct 13, 2021)

whydontu said:


> IR LED and IR phototransistor, plus level translator and bias circuitry. Three wires: ground, +5V, TTL 5v digital output. Output goes high when IR is reflected from LED to transistor. Bulletproof.
> 
> Connectors are standard 2.54mm / 0.1” pins. Dupont is the generic term. Amazon has a kit with all the bits. I make most of my interconnects with these, no soldering. If there’s vibration I just put on a glob of glue gun snot.
> 
> https://www.amazon.ca/Hautton-Crimping-Terminal-Ratcheting-Connectors/dp/B083DRCFRY/ref=sr_1_49_sspa?dchild=1&keywords=crimp+2.54mm&qid=1634170929&refinements=p_85:5690392011&rnid=5690384011&rps=1&sr=8-49-spons&psc=1&spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUFBUVpVTlJLQVFGNVAmZW5jcnlwdGVkSWQ9QTAwODU5OTRFUllWM1FJM09RUFkmZW5jcnlwdGVkQWRJZD1BMTA0MjQ4MjFCWlpXVVJXSkRaWjcmd2lkZ2V0TmFtZT1zcF9idGYmYWN0aW9uPWNsaWNrUmVkaXJlY3QmZG9Ob3RMb2dDbGljaz10cnVl



This should work for me.

Flexible Jumper Wires - M-F, 100/200mm, 80 Pcs | Active Tech Electronics Distributor (active123.com)

These guys seem a little pricy though.


----------



## whydontu (Oct 13, 2021)

I bought my last batch from Amazon. I use these all the time, fastest way to prototype. 

https://www.amazon.ca/Multicolored-Dupont-Female-Breadboard-Arduino/dp/B08BZHX8K7/ref=sr_1_52_sspa?dchild=1&keywords=jumper+wires&qid=1634182932&refinements=p_85:5690392011&rnid=5690384011&rps=1&sr=8-52-spons&psc=1&smid=A24IR8QY1N5T6H&spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUExRVU2NlpRWFc0QTNLJmVuY3J5cHRlZElkPUEwNjI1NTc4M0pYTDNHQTFBVEk2WSZlbmNyeXB0ZWRBZElkPUEwNjA5NzU4UTFSOUpBUkdFTjJWJndpZGdldE5hbWU9c3BfYnRmJmFjdGlvbj1jbGlja1JlZGlyZWN0JmRvTm90TG9nQ2xpY2s9dHJ1ZQ==


----------



## YYCHM (Oct 13, 2021)

@whydontu since you're so into this stuff.  What sensors would measure velocity and distance down to 0.001"?  I can't find either?


----------



## whydontu (Oct 13, 2021)

What are you trying to achieve? I use an acceleration sensor in a flow meter, but it’s insanely expensive.


----------



## Susquatch (Oct 14, 2021)

YYCHM said:


> This should work for me.
> 
> Flexible Jumper Wires - M-F, 100/200mm, 80 Pcs | Active Tech Electronics Distributor (active123.com)
> 
> These guys seem a little pricy though.



I like the variety of lengths in this set, but I also like the variety of connections in the set that @whydontu linked to on Amazon.

Someplace in my electronics shop I have a shoebox of wires (all male both ends) that I used to use for breadboarding. I think all my breadboards are gone though - loaned to various people over the years - usually as completed protype projects for evaluation and never returned. But who knows, I might get a surprise when I look. I'll have to watch the nostalgia hormone levels when I do that.....

Anyway, if you think about the price per wire, neither set is all that expensive.

As a bonus, you can also cut those wires in half and use the ends separately - they are solid wire not braided.

If you do plan to do any prototyping, a small breadboard will save a crapload of soldering.

But, I think it's time that you grew a pair and took on some soldering...... If you can run a mill, a shaper, a lathe, and lord knows what else, you can solder. It's WAY EASIER than you think. 

Buy yourself a decent soldering iron for electronics, some fine wire (0.6mm) rosin core solder, some braided copper ribbon for solder removal, a magnifying glass, and a parts holder with tiny alligator clips on a stand.

Here is a Soldering Iron Kit that even includes a Digital Multimeter, Rarlight 60W 110V Adjustable Temperature Welding Tool with ON/OFF Switch, Soldering Iron Tips, Desoldering Pump, Solder Wire, Tweezers, Stand, Screwdriver, and Wire Stripper Cutter. 

https://www.amazon.ca/dp/B07L3VNMKX/ref=cm_sw_r_apan_glt_i_BAT62BACA83ATH55XVX5?_encoding=UTF8&psc=1

Here is some desoldering braid - you will love this stuff - it beats a vacuum solder sucker all year long. 

https://www.amazon.ca/dp/B008O9VQ5M/ref=cm_sw_r_apan_glt_i_M30965WWDRXRTZYMV3X9

Here are a few parts holders with stand and magnifying glass. Some even have a soldering iron holder. I like the last one cuz it has a third hand. 

https://www.amazon.ca/dp/B08FCK33HF/ref=cm_sw_r_apan_glt_i_P6HMMWJXP9EYYNKTS7Y6

https://www.amazon.ca/dp/B08V4B554Y/ref=cm_sw_r_apan_glt_i_6TZM3QWJ9DY5509G2QAR

https://www.amazon.ca/dp/B07JD935J6/ref=cm_sw_r_apan_glt_i_T2H4B3F0PQ4Z9785PAEH

There are lots of choices. That's just what I found on Amazon in a few quick searches. It seems funny that a place called Canada Solder doesn't have much - or I don't know where to look!


----------



## YYCHM (Oct 14, 2021)

Susquatch said:


> I like the variety of lengths in this set, but I also like the variety of connections in the set that @whydontu linked to on Amazon.
> 
> Someplace in my electronics shop I have a shoebox of wires (all male both ends) that I used to use for breadboarding. I think all my breadboards are gone though - loaned to various people over the years - usually as completed protype projects for evaluation and never returned. But who knows, I might get a surprise when I look. I'll have to watch the nostalgia hormone levels when I do that.....
> 
> ...



Actually, I pretty much have everything you linked to already, but not to worry there will be some soldering to do before this endeavor is finished


----------



## Susquatch (Oct 14, 2021)

This is good to hear. I was worried about you......


----------



## Tom O (Oct 14, 2021)

Lol my first soldering experience was around 8 or 9 after getting a wood burning set for Xmas I used it to reconnect the earphone to the crystal rocket radio that use to get ripped of while sleeping.


----------



## Susquatch (Oct 14, 2021)

Tom O said:


> Lol my first soldering experience was around 8 or 9 after getting a wood burning set for Xmas I used it to reconnect the earphone to the crystal rocket radio that use to get ripped of while sleeping.View attachment 17706



That wasn't my first soldering adventure, but I had one of those too! 

Can you imagine? And @YYCHM actually thinks this endeavour of his will be finished some day.... 

The adventure is just beginning!


----------



## YYCHM (Oct 14, 2021)

whydontu said:


> What are you trying to achieve? I use an acceleration sensor in a flow meter, but it’s insanely expensive.



For velocity, the FPM of the ram on my shaper.

For distance, the horizontal displacement of the table on my shaper.


----------



## Susquatch (Oct 14, 2021)

I realize scales are not cheap, but what about two dro scales and read em with the Arduino instead of a DRO monitor? The Arduino can calculate velocity from displacement. 

Just suggestions - I am not familiar with what your shaper looks like. 

If scale level precision is not required, maybe an ultrasonic distance sensor could be calibrated to provide your desired accuracy. Canada solder sells them. 

https://www.universal-solder.ca/pro...-measuring-sensor-hc-sr04-arduino-compatible/

Here is the same thing at Amazon with mounts and wiring - cheaper if you have prime free shipping. 

https://www.amazon.ca/dp/B071P91YDS/ref=cm_sw_r_awdo_navT_g_2488YYTN2JWCFVNRQ78X


----------



## YYCHM (Oct 14, 2021)

Susquatch said:


> I realize scales are not cheap, but what about two dro scales and read em with the Arduino instead of a DRO monitor? The Arduino can calculate velocity from displacement.
> 
> Just suggestions - I am not familiar with what your shaper looks like.
> 
> ...



A DRO scale would be impossible (or should I say very difficult) to mount for the table displacement and that's the measurement where you would want 0.001" or better resolution.  The US sensor might work for measuring the RAM velocity, I'll have to think on that one.


----------



## Susquatch (Oct 14, 2021)

YYCHM said:


> A DRO scale would be impossible (or should I say very difficult) to mount for the table displacement and that's the measurement where you would want 0.001" or better resolution.  The US sensor might work for measuring the RAM velocity, I'll have to think on that one.



I think if you really need one thou direct precision, you are probably stuck with scales of some kind. However, I'd be tempted to take a real good look at the table actuating mechanism. Maybe some other kind of scale could be used there instead. In fact, if there is any leverage (gearing, timing belt, etc) built into the drive, you might need less precision there to get what you need at the table itself. 

Again, just me trying to generate ideas for you.


----------



## whydontu (Oct 14, 2021)

FPM would be fairly simple. Two Hall effect sensors  or even mechanical limit switches spaced a fixed distance apart, count ten pulses from each, calculate the time span, convert to FPM with a little math. Ideal for an Arduino. How fast does the ram travel?

I don’t think 0.001” is possible using any type of IR or US sensor. 

Other than the backlash was a pain in the bum, I used to have a 7x12 mini lathe with a dro using a rotary encoder. 

https://littlemachineshop.com/products/product_view.php?ProductID=5675&category=-1536942993


----------



## YYCHM (Oct 14, 2021)

whydontu said:


> FPM would be fairly simple. Two Hall effect sensors  or even mechanical limit switches spaced a fixed distance apart, count ten pulses from each, calculate the time span, convert to FPM with a little math. Ideal for an Arduino. How fast does the ram travel?
> 
> I don’t think 0.001” is possible using any type of IR or US sensor.
> 
> ...



Hey I had those rotary encoders on my 7X12 as well.  The cross slide DRO worked ok but the compound DRO was totally useless.

The shaper challenge is that the ram can be set for length of stroke and start of stroke, so kind of hard to set a fixed distance relative to a fixed sensor (if that makes any sense).  A timed ping of ram distance no matter where it is from a fixed sensor might work I think?


----------



## whydontu (Oct 14, 2021)

is the extend and retract speed and distance the same?


----------



## YYCHM (Oct 14, 2021)

whydontu said:


> is the extend and retract speed and distance the same?



If I understand what it is you are asking, the ram stroke distance is the same going forward and backward, but apparently the ram velocity is faster going backwards on most shapers (I don't about all).  So, a good point, only sample distance and time on a forward stroke.  Obviously the ram is accelerating and decelerating for part of the stroke so a running average velocity would be in order.


----------



## YYCHM (Oct 14, 2021)

Susquatch said:


> This is good to hear. I was worried about you......



As promised.....






Tonight I soldered leads onto a 9V battery holder I intend to use


----------



## whydontu (Oct 14, 2021)

I’ve never run a shaper, but am I right that it only cuts on the extend stroke?

So - one sensor, two triggers. On trigger at full retract, one trigger    located rearward at a point that would trip the sensor at the shortest forward stroke. Time between the two trigger would be proportional to speed. My tach can read 11,000 RPM with 10 reflectors, equal to 180 pulses per second. Calculating from this, assuming using the same hardware & software.

If the sensor triggers are spaced 1” apart, 1” in 0.006 seconds, 1 foot on 0.07 seconds, 15 fps, 900 fpm. Space the triggers 2” apart and it could easily read 1800 fpm.


----------



## Susquatch (Oct 15, 2021)

YYCHM said:


> As promised.....
> 
> Tonight I soldered leads onto a 9V battery holder I intend to use



Looks good!

The trick with most soldering is to apply enough heat to melt the solder and fuse it to the part without melting everything else around it (plastic, wire insulation, etc).

There are many ways to skin a cat but I find that a smaller iron works better for electronics. 20Watts is more than enough but you will find some who say that is too much and some who say it's not enough.

If you want, a better option is a temperature controlled iron. They have lots of heat but never too much! 

Plug the iron in (or turn it on) and let it heat up on its own until it will melt a thin solder wire, then let it heat up some more! When you run out of patience, clean the tip off with a sponge or paper and tin the tip so it is covered in solder, then clean it again. The idea is to get a tip that is covered in wet melted solder but not dripping. Wet solder will help the iron tip transfer heat to the work faster.

Avoid the temptation to use the tip to transfer solder to the work. Use the tip to heat the parts. Apply the tip and the solder wire together to the part a tiny bit apart. For example, put the tip on one side of the joint touching both parts and the solder on an adjacent side. That way, the solder will flow as soon as the part heats enough to take it, but well before other stuff in the area gets too hot.

Also, a good rosin core fine wire solder is a blessing. I like 0.6mm but 0.8 works too. You will use it up faster but you will be happier with the results on small parts because it's way easier to control how much solder you get on the joint. Too much no good. But when it does happen, that's when a little de-soldering braid comes in really handy! Suckers suck - which is bout all I can say about em. I put my soldering vacuum away the first time I used braid and I've never touched it again since.

As you probably already found, bigger parts and heavier wire require a bigger iron. For really big parts and big wire, a gun is required and I like to use paste separately with the wire (which can still be rosin core but can be plain solder too and also much thicker wire.

Large joints are actually harder to do because it's easy to get cold joints. A cold joint is when the solder doesn't fuse to the part it just sits on it like a sticky gob of snot. Not good.

I wish I knew more about shapers.......


----------



## Susquatch (Oct 15, 2021)

whydontu said:


> If the sensor triggers are spaced 1” apart, 1” in 0.006 seconds, 1 foot on 0.07 seconds, 15 fps, 900 fpm. Space the triggers 2” apart and it could easily read 1800 fpm.



So, as you have alluded, the problem with close sensors is resolution. Resolution error arises from many sources - errors in the spacing, errors in the trigger edge from one sensor to the next, the difference between one count and the next, the impact of the clock input, and of course the speed of the processor and program - to name the big ones. You can control some of these, you can calibrate some of these, and some you just have to live with. 

One of them is king - that is spacing - the bigger the better.


----------



## Susquatch (Oct 15, 2021)

Does your shaper get driven by an eccentric of some kind to move the ram? If so, you could do the math to translate motor speed into ram speed. It will be mostly sinusoidal. But it should be easy to write a formula for cutting tip speed based on motor speed. Motor speed is more constant and therefore MUCH easier to both measure and calibrate.

If you can trigger the Arduino on any point in the rotation of the eccentric, you can then write a formula and then a program to calculate position and velocity of the Cutter as they are totally dependant on the position of the eccentric and the rotational speed of the drive motor. 

Exact positioning of the table to a thou is a whole nuther kettle of sardines. If you can't get a DRO scale in there someplace, could you use a rotary scale on the position adjustment crank? Sorta the same as what I'm trying to do with my rotary table?


----------



## whydontu (Oct 15, 2021)

I have a theremin that uses two US sensors that can differentiate movement of about  0.3cm. Off the top of my head, one US sensor, one trigger plate, take ten sets of absolute distance measurements, calculate the difference between closest and farthest, some math gets FPM. Wouldn’t be affected by the ram settings of start, end, or stroke. With some clever code it could calculate extend and retract speeds independently.

start
read distance1
wait time milliseconds
read distance2
if distance1>distance2 measurement is extend
if distance1<distance2 measurement is retract
subtract distance1 from distance2 = distancenet
make distancenet an absolute value
distancenet / time multiplied by conversion factor becomes FPM
display extend and retract values on lcd

this could be a real down-the-rabbit hole idea. Picture a relatively simple device with two dials - cutter diameter, number of flutes. Sensor to measure transverse speed of milling machine table. Sensor to read quill RPM. Some math gets display to show quill RPM, FPM of table, FPM of cutter.


----------



## Susquatch (Oct 15, 2021)

YYCHM said:


> Hmmmm..... wrong thread, I think... https://canadianhobbymetalworkers.com/threads/rotary-table-questions.3941/ ?
> 
> Have you put that Bridgeport up for sale yet?



Ya, you guessed it. I'll delete it and repost in my rotary table thread.

No, not for sale yet. My wife and I are busy cleaning out my mother's condo. She has dementia and won't be going back so we have sold it and the closing date is next Wednesday.  

After that, I hope to be able to clean the Bridgeport, paint it, and then post it for sale. I'm sure it will take longer than this makes it sound though.


----------



## Susquatch (Oct 15, 2021)

YYCHM said:


> ........
> Have you put that Bridgeport up for sale yet?



Good catch.

Btw, my Arduino stuff arrived today. Lotta great stuff for so little cash......

Think I'll do what you did and just try a sample simple download for the sheer fun of it!


----------



## whydontu (Oct 16, 2021)

First pass at adding a FPM function to my tachometer software. 

Added a 10K pot, reading the pot position selects a cutter size from an array. For my machine, the size lookup array will be 1/16" to 1" by 1/16th, then 1-1/2", 2", and 3". I doubt I'm ever going to be running a face mill bigger than 3". My mill is a Busy Bee CT129, same as a Grizzly G0704

From cutter size and RPM it calculates real-time cutter FPM. I haven't uploaded it to my tach yet, just want to make sure it works before I start drilling holes in the case.

So instead of having a big chart with cutter size vs. material vs. RPM, all I'll need is a cheat sheet with suggested FPM vs. material. If I make a new slightly bigger tach case I could engrave the cheat sheet on the case.

If you're interested I'll send you the code once I have it finished.


----------



## Susquatch (Oct 16, 2021)

whydontu said:


> First pass at adding a FPM function to my tachometer software.
> 
> Added a 10K pot, reading the pot position selects a cutter size from an array. For my machine, the size lookup array will be 1/16" to 1" by 1/16th, then 1-1/2", 2", and 3". I doubt I'm ever going to be running a face mill bigger than 3". My mill is a Busy Bee CT129, same as a Grizzly G0704
> 
> ...



This is super cool! I love it! 

I have these charts on the wall behind my lathe that show graphs of fpm and material etc. I confess I rarely look at them as most of my work is pretty standard and I have a pretty good feel for what diameter does to fpm. 

Still, how cool is that to be able to display fpm right on the tach display!


----------



## Susquatch (Oct 16, 2021)

@whydontu - Is that display the one you recommended earlier?


----------



## whydontu (Oct 16, 2021)

yup. bog standard 16x2 LCD with I2C adapter. using the adapter means you only need two of the digital io ports to communicate. Without the I2C the LCD uses 5 io pins.


----------



## Susquatch (Oct 17, 2021)

whydontu said:


> yup. bog standard 16x2 LCD with I2C adapter. using the adapter means you only need two of the digital io ports to communicate. Without the I2C the LCD uses 5 io pins.



No worries. I ordered two displays and two I2C adapters to go with them. 

I just liked the way it looked in your photo - especially with 2 lines of data. So I hoped that is what mine would look like too.


----------



## whydontu (Oct 17, 2021)

I got to play all day, SWMBO wanted to spend her day reading. Here's my current code, and photos of the device mocked up. I use a 10K pot to set the cutter diameter, values from 1/16" to 1" x 1/16", then up to 4" in larger jumps. 

It's reading a signal generator for the RPM input. It's stable at an input signal of 180hz, equivalent to 10,000 RPM with a single reflective stripe on my mill quill.

At a simulated 10,900 RPM with the cutter selected at 1-1/2", it reads FPM at 4400. The math isn't perfect as I did it all in 2s-complement integers, but it's close enough for our uses. And nobody in their right mind is going to run an 1-1/2" cutter at 10K RPM.  

I ran out of display characters, need at least 9 for RPM and at least 7 for FPM. so fpm is lower case because it was hard to read as RPM 2000 FPM800, RPM 2000 fpm800 was cleaner. spacing is easy to change, the lcd.setCursor commands will move the starting points for the lcd.Print commands. (column, row) starts at (0,0) at the upper left corner.

By gentle when you look at my code. I'm not a very good programmer, my older brother who is a great programmer calls me a script kiddy.

Code:

#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);
const int dataIN = 2; //IR sensor INPUT


unsigned long prevmillis; // To store time
unsigned long duration; // To store time difference
unsigned long lcdrefresh; // To store time for lcd to refresh

int rpm; // RPM value

boolean currentstate; // Current state of IR input scan
boolean prevstate; // State of IR sensor in previous scan

void setup()
{
  pinMode(dataIN,INPUT);
  lcd.begin();     
  prevmillis = 0;
  prevstate = LOW;


}

void loop()
{

  //fill array of cutter diameters
 int CutterSixteens[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,20,24,32,48,64}; // cutter diamters in sixteenths
 char* CutterNames[] = {"1/16","1/8","3/16","1/4","5/16","3/8","7/16","1/2","9/16","5/8","11/16","3/4","13/16","7/8","15/16","1","1-1/4","1-1/2","2","3","4"}; // cutter descriptions in text

 // Set cutter diameter
 int sensorValue = analogRead(A0); // 10K pot wipre to analog Pin 0
 int  Cutter = map((sensorValue),0,1023,0,20); // converts 0-5V to 0 to 20 fixed number to identify array values



 // RPM Measurement
  currentstate = digitalRead(dataIN); // Read IR sensor state
 if( prevstate != currentstate) // If there is change in input
   {
     if( currentstate == HIGH ) // If input only changes from LOW to HIGH
       {
         duration = ( micros() - prevmillis ); // Time difference between revolution in microsecond
         rpm = (60000000/duration); // rpm = (1/ time millis)*1000*1000*60;
         prevmillis = micros(); // store time for nect revolution calculation
       }
   }
  prevstate = currentstate; // store this scan (prev scan) data for next scan

  // LCD Display
  if( ( millis()-lcdrefresh ) >= 500 )
    {
      lcd.clear();
      lcd.setCursor(0,1);
      lcd.print("Cutter:");
      lcd.setCursor(8,1);
 lcd.print(CutterNames[Cutter]);

 lcd.setCursor(9,0);
 lcd.print("fpm");
 lcd.setCursor(12,0);
 lcd.print(rpm / 61 * CutterSixteens[Cutter]); // calculates FPM as an integer - formual is RPM x diameter in inches x pi divided by 12. RPM x sixteenths / 61 is close enough
 lcd.setCursor(14,1);
 lcd.print("in");
 lcd.setCursor(0,0);
      lcd.print("RPM ");
      lcd.print(rpm);         
      lcdrefresh = millis();   
    }

}


----------



## Susquatch (Oct 17, 2021)

whydontu said:


> I got to play all day, SWMBO wanted to spend her day reading. Here's my current code, and photos of the device mocked up. I use a 10K pot to set the cutter diameter, values from 1/16" to 1" x 1/16", then up to 4" in larger jumps.
> 
> It's reading a signal generator for the RPM input. It's stable at an input signal of 180hz, equivalent to 10,000 RPM with a single reflective stripe on my mill quill.
> 
> ...



That's Awesome @whydontu! 

No time to review your code right now. Big furniture move planned for tomorrow. I'll get to it soon enough though. No worries about your code. Only emotion I'm likely to display is jealousy! 

What's the blue display in the last photo.

Consider a columnar display with rpm & fpm on the left one above the other and  Cutter/size on right. Also change in to ". Then it will all fit and look nice too.

RPM  2734    Cutter       (or TOOL) 
FPM  1056    1-1/2"


----------



## whydontu (Oct 17, 2021)

Duh. Never thought of that. 

I think it’s possible to address each pixel, so I should be able to put a vertical line between the data groups.

This stuff is so cheap it’s unbelievable. Remember buying Heathkit stuff? $350 for a 10Mhz scope that took three days to build? I just finished putting together a basic prototyping case with a simple LCD scope, signal generator, frequency counter, power supply, component tester, voltmeter, breadboard. Photo below. It ain’t lab quality, but it’s just fine for mucking about with microcontroller stuff. This maybe cost a total of $100, including the case.

All bolted to a dollar store nylon cutting board.

$7 signal generator
https://www.universal-solder.ca/pro...nction-generator-1hz-150khz-0-100-duty-cycle/


----------



## Susquatch (Oct 17, 2021)

I built a HeathKit oscilloscope too! But I think mine was only 100khz.

It was a beginning. Over the course of many years I bought quite a few used Tektronix and HP oscilloscopes on ebay auctions. About 30 years ago I bought a well used dual channel 50MHz digital storage scope the size of a carry on suitcase for 2 grand. They were prolly 20 grand new. But today you can get a brand new 4 channel 250MHz programmable digital storage scope the size of an Ethernet Router that uses your pc as a display screen for well under a grand. Every so often I think about buying one. Yes, it's an amazing world.

Nice multifunction setup! I love it!

You forgot to tell me what the thingy with the blue display in the last photo of your previous post is.

Or is that the signal generator you mentioned above?


----------



## whydontu (Oct 17, 2021)

The blue thing is the $7 signal generator. 

updated display configuration

much clearer


----------



## Susquatch (Oct 18, 2021)

whydontu said:


> The blue thing is the $7 signal generator.
> 
> updated display configuration
> 
> ...



Very nice @whydontu !

I love it! This is useful on a variety of tools. I know the fpm isn't perfect, but neither are the other methods - especially lathes where the diameter changes.

I feel badly about the status of my Arduino work right now. I am way behind where I should be. Too busy cleaning out my mother's condo and fall farm work. The only Arduino work I get to do for now is research in bed or on breaks. 

But my mind is racing full speed and flooding with ideas. 

Eg - A better DRO with things like FPM and other Readouts built in. Quasi Actuators. Automating various aspects of my farm equipment especially my row crop planter. I built a 1cm precision GPS system last year. An Arduino could use its output to do a trillion things (literally!). 

Quick question to save me some research: can that display be set for double height digits for things without having to resort to single pixel addressing?


----------



## whydontu (Oct 18, 2021)

nope, fixed 16x2 unless you want to design custom characters. There are piles of pixel-addressable cheap displays for Arduino, take a look at www.adafruit.com for lots of arduino components.


----------



## Susquatch (Oct 18, 2021)

whydontu said:


> nope, fixed 16x2 unless you want to design custom characters. There are piles of pixel-addressable cheap displays for Arduino, take a look at www.adafruit.com for lots of arduino components.



OK, I figured that might be the case. No biggie.


----------



## YYCHM (Oct 21, 2021)

@whydontu I got this display... Blue IIC I2C TWI 1602 16x2 Serial LCD Module | Simcoe Diy Elect. (simcoe-diy.ca)

Changed the LCD address in your code to 0x3F, compiled, and uploaded, but I'm not seeing characters displayed.  Quadruple checked my wiring was correct.  The display lights up and the IR sensor appears to be working but no characters displayed.   Any ideas?

Craig


----------



## whydontu (Oct 21, 2021)

YYCHM said:


> @whydontu I got this display... Blue IIC I2C TWI 1602 16x2 Serial LCD Module | Simcoe Diy Elect. (simcoe-diy.ca)
> 
> Changed the LCD address in your code to 0x3F, compiled, and uploaded, but I'm not seeing characters displayed.  Quadruple checked my wiring was correct.  The display lights up and the IR sensor appears to be working but no characters displayed.   Any ideas?
> 
> Craig


When you powered up the board, did you see a band of dark square on the top row of the LCD?  

No insult intended, but try tweaking the contrast pot. They tend to be fiddly.

I don’t think I’ve ever needed to change the LCD address, but I get mine from Universal Solder and maybe they have a different manufacturer than Simcoe.

Try this sketch to confirm the address:

https://www.ardumotive.com/i2clcden.html


----------



## YYCHM (Oct 21, 2021)

whydontu said:


> When you powered up the board, did you see a band of dark square on the top row of the LCD?
> 
> No insult intended, but try tweaking the contrast pot. They tend to be fiddly.
> 
> ...



Yes, it has the band of dark squares on the top row of the LCD.

I tried tweaking the contrast.

0x3F is the documented address per the  Simcoe product description, but the scan sketch you linked to says it's 0x27?

Are you using the pull up resistors Universal Solder talks about?


----------



## whydontu (Oct 21, 2021)

YYCHM said:


> Yes, it has the band of dark squares on the top row of the LCD.
> 
> I tried tweaking the contrast.
> 
> ...



I don’t use any pull-up resistors, just the I2C board connected to the LCD pins. 

Did you change the sketch LCD address to match the I2C address scan from the ardumotive sketch?

Any chance you have a cold solder joint in the LCD pins? (I’ve used the LCDs and address info on dozens of different designs)


----------



## YYCHM (Oct 21, 2021)

whydontu said:


> I don’t use any pull-up resistors, just the I2C board connected to the LCD pins.
> 
> Did you change the sketch LCD address to match the I2C address scan from the ardumotive sketch?
> 
> Any chance you have a cold solder joint in the LCD pins? (I’ve used the LCDs and address info on dozens of different designs)



I've tried addresses 0x27 and 0x3F with no luck.  The I2C LCD came from Simcoe preassembled so if there is a cold joint it came that way.  I traced pin to pin continuity to eliminate bad wiring with an ohm meter as well.

*UPDATE: * I got her going.  Changed the lcd.begin(16,2);  statement back to lcd.init(); which wouldn't compile before for some reason and away she went.  Had to add a lcd.backlight(); statement otherwise it was very hard to read.


----------



## YYCHM (Oct 22, 2021)

Finally bundled into an enclosure....






The processor shield and battery holder are being held down with 2 sided tape, will see how long that lasts LOL.

The LCD I ended up hot gluing to the enclosure lid.






Nice and compact once it's sealed up.  I'll hot glue some magnets to the back of the enclosure and stick it to the belt cover where the IR sensor needs to feed in to clock the spindle pulley.

And the readings match my hand held Tach.....


----------



## whydontu (Oct 22, 2021)

Cool!  Can you parasite 9 volt DC from something nearby?


----------



## YYCHM (Oct 22, 2021)

whydontu said:


> Cool!  Can you parasite 9 volt DC from something nearby?



Nothing that I care to break into to find.  A 9V battery should last a long time should it not?


----------



## Susquatch (Oct 23, 2021)

YYCHM said:


> Nothing that I care to break into to find.  A 9V battery should last a long time should it not?



Very nice project @YYCHM ! I'm super jealous.

I soldered up the headers on one of my Nanos yesterday. It wasn't as easy as I remembered from years gone by. I've had several surgeries on my right eye and then a cataract lens replacement on it too. Looks like my left eye is doing the same thing now - I really can't see out of it any more. Covid has delayed the required surgery. Soldering with just one eye is a challenge because it's very hard to gauge the distance. I kept missing the joint with the tiny solder wire. Missing with the solder wire placement also bridged a few pins that had to be fixed.  I guess I need to get on with fixing that eye. Anyway, I don't even know if I got everything right at the end.

@whydontu - do you know of a program download specifically designed to test the function of each pin once installed on the breakout board?

I'm no fan of 9v batteries. Those snap clips they use to attach them are a Royal PIA and they always break after a while. I don't mind the compartment style compression attachment though.

While I'm on the subject of batteries, here is a tip for everyone. If you need alkaline batteries, never buy anything but Eveready Energizer Max alkalines. They are the ones with the red nike swoosh on them. They are the only batteries that have never leaked on me. They are designed and marketed with that feature. I hate finding a perfectly good flashlight or whatever ruined by dead alkalines that leaked. The Energizer Max batteries don't do that. Duracells are the absolute worst.

There is nothing wrong with a 9v battery supply, but if I needed batteries, I'd prolly use a pack of AAs instead. I am planning a separate power supply for my stuff. Prolly running off the input supply for my VFD or maybe a block running on a separate 115V.


----------



## YYCHM (Oct 23, 2021)

Got her finished up today.....






One thing I discovered is that this IR sensor is more of a proximity switch than anything else.  It will trigger if any object is close enough no matter what color it is.  As a result mounting the sensor with the correct distance from the spindle pulley was a bit fiddley.  Here you can see the white spot I painted on the bottom pulley sheave.






Here is the enclosure stuck to the bottom half of the belt cover with magnets.

I'm pretty happy with this arrangement as I only had to drill two holes in the belt cover rather than figure out how to mount a magnet on the spindle pulley for a Hall Effect sensor.  Plus I couldn't find any Hall Effect sensors that were self contained like this.

I'll have to have a serious look at the algorithm used to compute RPM as there are some aspects of the output I don't care for.

Now back to the RT-Chuck adapter plate project the postman so rudely interrupted.


----------



## whydontu (Oct 23, 2021)

YYCHM said:


> Got her finished up today.....
> 
> View attachment 17810
> 
> ...


if you can, put a small dark shroud around the sensor. My first try was jittery if the shop was brightened by light coming in from my shop window. Putting in a shroud helped a lot. Jitter wasn‘t noticeable when I built the tach in November (monsoon season in Vancouver)


----------



## YYCHM (Oct 23, 2021)

whydontu said:


> if you can, put a small dark shroud around the sensor. My first try was jittery if the shop was brightened by light coming in from my shop window. Putting in a shroud helped a lot. Jitter wasn‘t noticeable when I built the tach in November (monsoon season in Vancouver)



The sensor is under the belt cover, it should be nice and dark in there.  I'm not seeing any jittery readings.  The LCD refresh rate is noticeable and a little annoying, but maybe it's just me.  I'm not liking the fact that it doesn't measure 0 RPM when I stop the mill but I'm pretty sure that's just a given for the algorithm being used and why you labeled it Spindle LAST.  From 1200 RPM to stop the residual reading is 170 RPM.


----------



## whydontu (Oct 23, 2021)

I try to avoid creeping featuritis. The simplest solution would be to add a bit of code to clear the display if there’s no sensor activity after 5 seconds. 

The code refreshes every 500 ms, I haven’t tried tweaking the refresh vs the sensor timing, but I’m sure it could be modified.


----------



## YYCHM (Oct 23, 2021)

whydontu said:


> I try to avoid creeping featuritis. The simplest solution would be to add a bit of code to clear the display if there’s no sensor activity after 5 seconds.
> 
> The code refreshes every 500 ms, I haven’t tried tweaking the refresh vs the sensor timing, but I’m sure it could be modified.



Ah yes.... Feature Creep.... I know it well.  Was the Bain of my existence when I was RT SCADA programming


----------



## YYCHM (Oct 25, 2021)

Ends up the the magnets I glued to the back of the Tach weren't strong enough.  My Sunday milling session ended with me holding the Tach with one hand and cranking with the other LOL......







Today, I added more magnets and moved her off to the side for more metal contact.  Time will tell if she stays put


----------



## whydontu (Oct 25, 2021)

suggestion: go find some dead computer hard drives. Killer magnets, usually flat, semi-circular poles, with backing plates and mounting holes. I use them all over my shop. Goofiest application I have: the tail stock quill on the Busy Bee B2227 lathe retracts completely into the barrel, so there’s no way to attach a dial indicator. Big hard drive magnet, aluminum bar bolted to the magnet, magnet stuck to the quill, dial indicator plunger against the magnet. (yes, the plunger is crooked, I just set it up quickly to take the photos)









						How to get the neodymium magnets out of the hard drive - Magnets By HSMAG
					

Hard Drive Magnets – Strong and Fun Hard drive magnets can be heaps of fun. I take them out of my old hard drives and distribute them to my brothers. They can be useful for holding things together and are fun to fiddle with. They can be used to fix the book that was open […]




					www.hsmagnets.com


----------



## YYCHM (Oct 25, 2021)

LOL.... I ditched something like 15 old HDs this summer in a cleaning frenzy.  The wife keeps giving me the gears about being a pack rat


----------



## Susquatch (Oct 25, 2021)

YYCHM said:


> LOL.... I ditched something like 15 old HDs this summer in a cleaning frenzy.  The wife keeps giving me the gears about being a pack rat



I bet they can be had at any computer store as broken scrap. 

But you can also buy neobium magnets in bulk on amazon in different sizes and attachment styles.


----------



## YYCHM (Oct 25, 2021)

Susquatch said:


> I bet they can be had at any computer store as broken scrap.



Ya, I doubt that, they take their recycling quite seriously.  I got chased out of a Staples store 10 years ago for tying to liberate a power supply from the computer recycling bin LOL.....


----------



## Susquatch (Oct 25, 2021)

YYCHM said:


> Ya, I doubt that, they take their recycling quite seriously.  I got chased out of a Staples store 10 years ago for tying to liberate a power supply from the computer recycling bin LOL.....



Wish I had been there to see that! 

Better yet, we could have made a great team. Two old guys stealing junk from the garbage. I could have distracted them by making a scene about no toilet paper in the paper aisle while you went through their garbage.


----------



## whydontu (Oct 25, 2021)

Best I ever did was use the hoist on the back of my pickup to fish a gas reel lawnmower out of a skip at the Vancouver landfill. Site attendant just shook his head and walked away without a word.


----------



## YYCHM (Oct 25, 2021)

Here's one for you guys (@CalgaryPT will appreciate this as well) LOL.

CO calls me and tells me the Regiment is refreshing their IMP supply (He knows I like to use them for my mountain sheep hunting trips).  I beetled down to HQ and sure as heck there were stacks and stacks of unexpired IMPs beside the dumpster.  Got the van half loaded when the Regimental QM stepped out the back door for a smoke.  Oh.... Oh.... That was the end of that... drove away with nothing LOL...


----------



## DPittman (Oct 26, 2021)

YYCHM said:


> Here's one for you guys (@CalgaryPT will appreciate this as well) LOL.
> 
> CO calls me and tells me the Regiment is refreshing their IMP supply (He knows I like to use them for my mountain sheep hunting trips).  I beetled down to HQ and sure as heck there were stacks and stacks of unexpired IMPs beside the dumpster.  Got the van half loaded when the Regimental QM stepped out the back door for a smoke.  Oh.... Oh.... That was the end of that... drove away with nothing LOL...


Bummer!


----------



## Tom O (Oct 26, 2021)

Pms hobbies has a good supply of magnets


----------



## Susquatch (Oct 26, 2021)

YYCHM said:


> Here's one for you guys (@CalgaryPT will appreciate this as well) LOL.
> 
> CO calls me and tells me the Regiment is refreshing their IMP supply (He knows I like to use them for my mountain sheep hunting trips).  I beetled down to HQ and sure as heck there were stacks and stacks of unexpired IMPs beside the dumpster.  Got the van half loaded when the Regimental QM stepped out the back door for a smoke.  Oh.... Oh.... That was the end of that... drove away with nothing LOL...



It is sooooo sad that has to happen. You would have put them to much better use than filling a big hole in the ground.


----------



## YYCHM (Oct 28, 2021)

For what it's worth, here are my mods to @whydontu s RPM code......  I wanted to reduce the LCD flicker and have RPM go to zero when I turn off the mill.

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);
//LiquidCrystal_I2C lcd(0x3F, 16, 2);
const int dataIN = 2; //IR sensor INPUT

unsigned long prevmillis; // To store time
unsigned long duration; // To store time difference
unsigned long lcdrefresh; // To store time for lcd to refresh
unsigned long SCCount = 0; // State change count
unsigned long SCCheck = 0; // State change timeout check

int rpm; // RPM value

boolean currentstate; // Current state of IR input scan
boolean prevstate; // State of IR sensor in previous scan

void setup()
{
pinMode(dataIN,INPUT);

lcd.init();
lcd.backlight();
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Spindle RPM");
lcd.setCursor(0,1);

prevmillis = 0;
prevstate = LOW;
}

void loop()
{

// RPM Measurement
currentstate = digitalRead(dataIN); // Read IR sensor state
if( prevstate != currentstate) // If there is change in input
{
SCCount++;

if( currentstate == HIGH ) // If input only changes from LOW to HIGH
{
duration = ( micros() - prevmillis ); // Time difference between revolution in microsecond
rpm = (60000000/duration); // rpm = (1/ time millis)*1000*1000*60;
prevmillis = micros(); // store time for next revolution calculation
} // if state HIGH
} // if state change


prevstate = currentstate; // store this scan (prev scan) data for next scan

// State Change check
if( ( millis()-SCCheck ) >= 1000 * 5 )
{
  if (SCCount > 0) SCCount = 0;
  else rpm = 0;

  SCCheck = millis();
}

// LCD Display
if( ( millis()-lcdrefresh ) >= 1000 )
{
lcd.setCursor(0,1);
lcd.print(rpm);
lcdrefresh = millis();
}

}//loop


----------



## Susquatch (Oct 29, 2021)

YYCHM said:


> For what it's worth, here are my mods to @whydontu s RPM code...... I wanted to reduce the LCD flicker and have RPM go to zero when I turn off the mill.



Very very cool @YYCHM !  Well done! I'm jealous. 

I shall use your code as the starting point for mine - which is still a few months away due to other priorities (especially my bride's).

Still looking for some code to test the Arduino with though. 

I meant to ask you how your soldering turned out. Obviously it worked, but were you happy with it? Mine wasn't what I expected or remembered. My left eye abandoned me to the distance wolves.


----------



## YYCHM (Oct 29, 2021)

Susquatch said:


> I meant to ask you how your soldering turned out. Obviously it worked, but were you happy with it? Mine wasn't what I expected or remembered. My left eye abandoned me to the distance wolves.



Didn't solder the headers on, got these instead LOL.....



			https://www.simcoe-diy.ca/product-page/nano-v3-0-16-mhz-5v-atmega328p-arduino-compatible-mini-usb-cable
		




			https://www.simcoe-diy.ca/product-page/blue-iic-i2c-twi-1602-16x2-serial-lcd-module
		


The unsoldered versions have been sent to @whydontu for assembly.


----------



## Susquatch (Oct 29, 2021)

YYCHM said:


> Didn't solder the headers on, got these instead LOL.....
> 
> 
> 
> ...



I see! Well, that's one way to skin a cat! 

Glad you didn't send them to me. I didn't realize how bad my eyes were when I made the offer. 

For the peanuts it costs to solder them up with headers, it amazes me that they don't sell them already done at Canadian solder. 

I'll have to check at Simcoe to see if they sell a USB-C version.


----------



## whydontu (Oct 29, 2021)

Solder the I2C adapter direct to the LCD panel, or solder in a header socket to the LCD so you can remove the adapter if needed?

Should I replace the 4-pin angle header on the I2C adapter with a straight one? I found having the I2C pins come of at an angle was a pain getting the display to fit in tight spaces.

Let me know...


----------



## YYCHM (Oct 29, 2021)

whydontu said:


> Solder the I2C adapter direct to the LCD panel, or solder in a header socket to the LCD so you can remove the adapter if needed?
> 
> Should I replace the 4-pin angle header on the I2C adapter with a straight one? I found having the I2C pins come of at an angle was a pain getting the display to fit in tight spaces.
> 
> Let me know...



Angled?  You lost me?  I didn't have any issues mounting this arrangement.  But what ever you suggest is fine by me.


----------



## whydontu (Oct 29, 2021)

YYCHM said:


> Angled?  You lost me?  I didn't have any issues mounting this arrangement.  But what ever you suggest is fine by me.


I always find the four pins on the right mean the mating wires have to stick out quite a ways from the edge of the LCD. If you look at the photo of my tach, the case is very small and the connector fouls the inside of the case.


----------



## JohnW (Dec 8, 2021)

I haven' been around this forum for a while (not for any good reason), but as it turns out Brent H was over at my place picking up various Opel parts for his new project (I am involved with Opels as well) on the Monday after he picked up his new project and had the meetup. I was actually in Winnipeg at the time of the meetup, but did the 900km/h return on Sunday night. I have driven that WAY too often, and all I had to bring back was several homemade apple pies from my Mom. We got to talking about machining and he mentioned the CHM site and this thread in particular after I showed him something I had built a couple of years ago. He suggested that people might be interested in what I had done.

I built an Arduino based tach type project that is similar to what is discussed in this thread for my lathe. Here is what I built . . .





This is the control box / display that sits on top of my VFD that is just above the headstock on the lathe. It can be switched to use Imperial or Metric modes. The second switch selects what is displayed: the X-feed (distance/rev), Y-feed (distance/rev) or Lead Screw (TPI or metric pitch). The knob sets a work diameter that is used to calculate the surface cutting speed (FPM or MPM).

In the first row, it displays the current spindle RPM, followed by whatever the diameter knob is set to ('in' or 'mm'), and the calculated surface speed ('F' or 'M').

The second row shows 'X', 'Y' or 'T' to indicate X/Y feed or threading mode, followed by the feed rate ('in/R' or 'mm/R') or the thread pitch ('TPI' or 'mm/T').

The three connectors on the upper right lead to the encoders I installed on the spindle shaft, feed shaft, and lead screw. Here is what I installed on the LHS of the headstock (under the cover that is normally there):





The encoder provides 360 pulses / rev and is driven by a GT2 timing belt. The plastic spindle pulley was salvaged from an old ink jet printer and epoxied to an aluminum sleeve I made. It is held on with two set screws which you can't see here since it is blurred because it is spinning. The pulley ratio is 99:60, so the encoder actually provides 594 pulses per revolution of the spindle.

On the RIHS of the lathe I installed two encoders. One on the feed shaft, and one on the lead screw:





Not really exciting with the aluminum protection cover on it, but from the back side you can see this:






These are two 400 pulse per rev encoders. I have been thinking about installing this sort of thing for a while, so when I rebuilt the lathe a couple of more years ago, I put the end of the two shafts in my old smaller lathe, faced them nice and flat and drilled a centered, threaded hole in the ends that the adapter pieces you can see here are threaded into.

The Arduino code monitors the state of the switches to see what it should display, then uses pin change interrupts to count both the rising and falling edge of each pulse from each encoder. That provides 1188 interrupts per spindle revolution and 800 interrupts per revolution of the lead screw and feed shafts. It then calculates the RPM from the number of pulses per second on the spindle, and calculates the ratio of the spindle pulses to the pulses from one of the shafts to calculate the feed or threading rate. The code uses the pitch of the lead screw (1/4") and the internal ratios in the carriage to calculate the feed or threading rates to display.

It updates the display 4 times a second using the averages it calculates over several revolutions of the spindle.

If you are interested in any more of the internals I'd be happy to share.


----------



## whydontu (Dec 8, 2021)

Very nice! Way more sophisticated than mine, I might have to get ambitious.
I use my tach in a mill, and I tweaked my setup to display the cutter size and calculate the cutter FPM. I’d love to see your code to see if I can steal (borrow) some ideas.

I use an ancient glorious Monarch 62 lathe at work, and the coolest thing about it is the hydraulic system that adjusts spindle RPM by rotating one dial to desired FPM and another dial to workpiece diameter.  So looking at your design, and thinking about the Monarch, think how cool it would be to have a VFD control combined with a linear scale that reads workpiece diameters and adjusts motor speed to maintain fixed FPM. I have visions of an Arduino to 4-20mA converter. A winter project!


----------



## Susquatch (Dec 8, 2021)

@Brent H was right. I'm glad you took the time to share. That looks awesome! 

How did you make the lettering on the face of the display unit? 

Is the selector a discrete switch setting or a continuous potentiometer? 

I'd love to see your code too. 

You have also answered my questions earlier about resolution. Did you manage the interrupts directly at the processor level or using the IDE?


----------



## JohnW (Dec 8, 2021)

It is built a lot like yours using an Arduino Nano (with 16MHz ATMega328 CPU @ 16 MHz), a standard 16x2 LCD display with an I2C to parallel converter for the LCD.




The heat-shrinked device in the foreground is a constant current source for the LCD backlight. The LCD is a bit of an older device I've had around for a while that is unique in that it has larger than usual fonts (good for old eyes like mine), but uses the standard LCD parallel interface.. The disadvantage is that the LED backlighting uses old design LED's that are quite inefficient so it needed a special supply.

A design mistake is that I should have mounted the Nano with the USB port at the edge of the box with a hole. As it is, to re-program it, I have to open it up and use a 90 degree USB adapter to connect it to my laptop. On the other hand, I've only had to do that once since I found a bug after installing it, and will likely never update the code since it seems to work well.

The board is just perf board with point to point wiring on the back. A DC-DC converter takes 24VDC (that I had available in the lathe control circuitry) and brings it down to 5V that the Arduino and encoders are happy with.

The encoders are cheap units from Aliexpress: (something like: https://www.aliexpress.com/item/1005002241818396.html - I don't remember exactly which ones I ordered), so nothing fancy.

It would be cool to interface an Arduino to my DRO Y-axis and use it to drive the VFD to achieve a semi-constant speed across a face like you are suggesting.

This has gotten me thinking that I need to build a simpler version of this for the mill giving RPM and feed rate for a cutter diameter. 

I am willing to share my code (it also provides much of the project's detailed documentation), but I do not want to post it on a public forum. Send me a PM with an e-mail address and I will send it to you.

The front panel is created by back engraving a thin sheet of clear acrylic with a laser cutter. The acrylic has a layer of sliver and then black paint on it (I didn't coat it, I bought it like that). The lettering is then painted with a couple of colors of acrylic paint (stolen form my wife's art supplies) so the text shows up as colored text on the front, but does not have to be applied carefully. The clear window was engraved in the same way and then polished with a Dremel since the engraver leaves a matt finish in the acrylic.






The diameter control is a pot that is read with an AnalogRead(), and fed into a log function to make it non-linear so it can reasonably be used from 0.1 - 12".

It was all written using the Arduino IDE, but there is no official Arduino support for the ATMega328 pin-change interrupts (maybe there is a library, but I didn't really look for one and performance is really important there so I wanted to do it myself), so that is done by directly manipulating the CPU registers and writing the (very simple) interrupt functions.


----------



## Susquatch (Dec 9, 2021)

JohnW said:


> It is built a lot like yours using an Arduino Nano (with 16MHz ATMega328 CPU @ 16 MHz), a standard 16x2 LCD display with an I2C to parallel converter for the LCD.
> View attachment 18809
> The heat-shrinked device in the foreground is a constant current source for the LCD backlight. The LCD is a bit of an older device I've had around for a while that is unique in that it has larger than usual fonts (good for old eyes like mine), but uses the standard LCD parallel interface.. The disadvantage is that the LED backlighting uses old design LED's that are quite inefficient so it needed a special supply.
> 
> ...



Your use of the interrupts and on chip timers is EXACTLY what I have been after. My instincts told me it could be done that way, but you are the first one I've seen who has actually done it. I'm pretty sure there are others, but I never saw them. 

My wife has paint that I can swipe. But sadly, I have no laser engraving capabilities here. It's something I have always wanted to do though. So mine will not look nearly so nice. 

Yes, I noticed the log scale and thought it was a great way to handle big ranges. 

I am new to the Arduino but not to programming or microcontrollers. 

All in all what you have done is very impressive. Thanks so much for sharing! 

I appreciate your privacy needs. I'll send you a PM for the code!


----------



## whydontu (Dec 9, 2021)

This is thevengraving toy I use for my front panels. takes forever to engrave aluminum faceplates, but does the job. I‘ll need to try JohnW’s method.






						RATTMMOTOR GRBL Control CNC 3018 3 Axis DIY Mini Engraving Milling Router Machine Working Aera 30x18x4.5cm for Carving Acrylic PVC PCB Plastic Wood : Amazon.ca: Industrial & Scientific
					

RATTMMOTOR GRBL Control CNC 3018 3 Axis DIY Mini Engraving Milling Router Machine Working Aera 30x18x4.5cm for Carving Acrylic PVC PCB Plastic Wood : Amazon.ca: Industrial & Scientific



					www.amazon.ca


----------



## JohnW (Dec 9, 2021)

I don't directly use the CPU timers. The pin-change interrupts simply increment a count when the pin change occurs (the ATMEGA368 has exactly three independent pin-change sources, so it worked out).

I just count the number of pin changes over 250ms (1/4 second). I use the Arduino micros() function to get the 250ms elapsed time to the nearest 4 microseconds. That function reads one of the CPU timers (timer0, I think) that is set to run at 4us/tick - I assume they've used a 64x pre-scaler on the hardware timer.


----------



## Brent H (Dec 9, 2021)

Haha!  Glad to have you back @JohnW !  Now you can share a few other cool projects like machining pistons etc - LOL.  It was super amazing to see your shop set up and the neat things you are working on!!   I will send you an email about a few Opel projects for advice


----------



## Susquatch (Dec 9, 2021)

JohnW said:


> I don't directly use the CPU timers. The pin-change interrupts simply increment a count when the pin change occurs (the ATMEGA368 has exactly three independent pin-change sources, so it worked out).
> 
> I just count the number of pin changes over 250ms (1/4 second). I use the Arduino micros() function to get the 250ms elapsed time to the nearest 4 microseconds. That function reads one of the CPU timers (timer0, I think) that is set to run at 4us/tick - I assume they've used a 64x pre-scaler on the hardware timer.



That sounds to me like the IDE actually does access the timers pretty directly. I'll know a bit better after I read your code. If the IDE can access the timers, then that's all I would need. From 1000 ft up, it certainly appears that even it it doesn't, the resolution is plenty fine enough for this job. 

I guess I just have to get off my butt and move the Arduino learning curve up the priority list. Right now looking after my mother's dementia is consuming most of my priority time. I did get one unit soldered up ready for programming. But I have not read much about how to use the IDE yet. I'm not expecting that to be a big challenge despite all my white hair, but I guess you never know. Hopefully later this winter it will all happen. If not, then next winter, or the winter after that....... LOL! 

I have been able to squeeze a little time into using my new mill and I'm making a 3-way tram fixture for it as we speak. It's driving my bride crazy. "Every time I turn around you are sneaking off to your Fg shop and playing with your toys..... You are never gunna get your mom looked after this way" She is right of course. Good thing she has no idea what all I am up to! (sorry for the short complaint guys.....)


----------



## YYCHM (Dec 16, 2021)

whydontu said:


> I bought my last batch from Amazon. I use these all the time, fastest way to prototype.
> 
> https://www.amazon.ca/Multicolored-Dupont-Female-Breadboard-Arduino/dp/B08BZHX8K7/ref=sr_1_52_sspa?dchild=1&keywords=jumper+wires&qid=1634182932&refinements=p_85:5690392011&rnid=5690384011&rps=1&sr=8-52-spons&psc=1&smid=A24IR8QY1N5T6H&spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUExRVU2NlpRWFc0QTNLJmVuY3J5cHRlZElkPUEwNjI1NTc4M0pYTDNHQTFBVEk2WSZlbmNyeXB0ZWRBZElkPUEwNjA5NzU4UTFSOUpBUkdFTjJWJndpZGdldE5hbWU9c3BfYnRmJmFjdGlvbj1jbGlja1JlZGlyZWN0JmRvTm90TG9nQ2xpY2s9dHJ1ZQ==



Where can I get the single strand wire version of this stuff?  The stuff I got ended up being multi strand and a royal pain to work with.  FPM meter for my shaper in progress now.


----------



## whydontu (Dec 16, 2021)

As in solid wire, or stranded wires but not multi-conductor?


----------



## YYCHM (Dec 16, 2021)

whydontu said:


> As in solid wire, or stranded wires but not multi-conductor?



Solid wire, multiple colors with the Dupont ends, like the Amazon image only solid wire.

Or put it this way.  What gauge solid core wire is good for bread board projects?  Is that called wrapping wire?


----------



## whydontu (Dec 16, 2021)

wrap wire is 32 ga. snaps when you look at it. 

For soldered boards I usually go with just 22 ga solid wire and cut and strip as needed

I think this might be what you have in mind






						140Pcs Solderless Flexible Breadboard Jumper Cable Wires : Amazon.ca: Industrial & Scientific
					

140Pcs Solderless Flexible Breadboard Jumper Cable Wires : Amazon.ca: Industrial & Scientific



					www.amazon.ca
				









						watersouprty 130 Pcs 13 Value 24AWG Breadboard Jumper Cable Wire Kit Double Tinned Colorful : Amazon.ca: Electronics
					

watersouprty 130 Pcs 13 Value 24AWG Breadboard Jumper Cable Wire Kit Double Tinned Colorful : Amazon.ca: Electronics



					www.amazon.ca


----------



## Susquatch (Dec 17, 2021)

whydontu said:


> For soldered boards I usually go with just 22 ga solid wire and cut and strip as needed



That's what I use for prototype and breadboard too. Then I keep them for reuse 

Braided or stranded wire is useless for this purpose but can be used if you solder the ends to stiffen then up a bit.

The first kit in @whydontu 's post is probably what you want. Saves a lot of stripping and bending.


----------



## YYCHM (Dec 17, 2021)

whydontu said:


> wrap wire is 32 ga. snaps when you look at it.
> 
> For soldered boards I usually go with just 22 ga solid wire and cut and strip as needed
> 
> ...




Hmmm.... this stuff is too short https://www.amazon.ca/140Pcs-Solderless-Flexible-Breadboard-Jumper/dp/B09NN1P653/ref=sr_1_9?crid=34P31G3LY39C&keywords=breadboard+jumper+wires&qid=1639720643&sprefix=breadboard+jumper+wires,aps,153&sr=8-9&tag=chmw-20  I'm not bread boarding.  I want solid wire to go from the nano shield to the sensor, shield to LCD display, shield to on/off switch to battery, battery to shield etc.  Preferably with dupont ends.

This stuff maybe?  https://www.amazon.ca/Gauge-Wire-Solid-Core-Hookup/dp/B088KQFHV7?th=1  What gauge to get?


----------



## Dabbler (Dec 17, 2021)

If you are connecting one board to another, use stranded wire.  You will end up with a lot longer life. I go with nickle or tinned copper wire, you can pick up a 100' spool at Active electronics.


----------



## whydontu (Dec 17, 2021)

YYCHM said:


> Hmmm.... this stuff is too short https://www.amazon.ca/140Pcs-Solderless-Flexible-Breadboard-Jumper/dp/B09NN1P653/ref=sr_1_9?crid=34P31G3LY39C&keywords=breadboard+jumper+wires&qid=1639720643&sprefix=breadboard+jumper+wires,aps,153&sr=8-9&tag=chmw-20  I'm not bread boarding.  I want solid wire to go from the nano shield to the sensor, shield to LCD display, shield to on/off switch to battery, battery to shield etc.  Preferably with dupont ends.
> 
> This stuff maybe?  https://www.amazon.ca/Gauge-Wire-Solid-Core-Hookup/dp/B088KQFHV7?th=1  What gauge to get?


The 22ga solid is exactly what I use for soldered wiring. I think I  misunderstood your question.


----------



## YYCHM (Dec 17, 2021)

whydontu said:


> The 22ga solid is exactly what I use for soldered wiring. I think I  misunderstood your question.



Can I put dupont connectors on it if needed?


----------



## whydontu (Dec 17, 2021)

yup. They’ll solder on no problem, crimp and solder works best, crimping alone tends to pull apart


----------



## JohnW (Dec 17, 2021)

For most of my hookup wire needs, I re-use old cables.

I have a bunch of 25-pair 24ga telephone cable (salvaged from an old building) that I use for bits of solid wire. Just lop off 4" and you have 50 - 4" pieces of 24ga solid wire for breadboarding in a bunch of colors. Old CAT5/6 works OK, but it is too twisted for my liking. You need to be super careful when striping thin solid wire since the slightest of nicks in the conductor creates a weak point where the wire will break after a few flexes.

For final projects, I have salvaged a bunch of conductors from old computer parallel, serial or SCSI cables. Just rip off the outer jacket and you usually end up with a bunch of 3-10' long 24-30ga stranded wires in multiple colors. HMDI cables can be good too if you have one with a damaged end, or just some extras. They have about 20 conductors of 28ga (or finer) stranded wires in multiple colors inside.

This is of course assuming you are a hoarder of old technology stuff (like me). Things like an old 6'-10' parallel printer (or SCSI) cables are usually available at re-cycling centers or garage sales for $1 or less.


----------



## whydontu (Dec 17, 2021)

I also use the old 4-wire telephone cable, but I was reluctant to suggest as removing the outer jacket is such a pain. Also the wire isn't tinned so can be tricky to solder.


----------



## whydontu (Dec 18, 2021)

As they say in my culture, oy veh. I picked up a couple more Arduino bits, including a 20x4 LCD display. Brain started working, always dangerous. My wife says she can hear the gears grinding when I'm sitting on the couch watching mindless TV.

My mill uses a DC motor, with a KBIC-120 variable speed PWM controller that uses a simple 10K pot to control speed. I also have a Rube Goldberg column lift system using a 120VAC gear motor and a couple of pushbuttons.

So, picture this:

20x4 display
Pot to select material (I use pots, it's easy, cheap, and simple to scale to discreet values using the Arduino AnalogRead function)
Pot to select cutter diameter
Arduino displays material name, cutter diameter, does a lookup from an array to get and display an appropriate SFM value
Calculates and displays appropriate cutter RPM
Reads current RPM

Speed control can be a 10k pot, or a 0-7vdc signal. Problem is the 0-7vdc signal isn’t ground-referenced so my brain hasn’t figured out how to interface the Arduino to the KBIC board.

Photos of my cobbled-together existing control package. The speed control faceplate was my first attempt using a CNC engraver. Not great, but I'm too lazy to re-do it.

Proposed new control panel sketch attached. (the numbers at the top are my way to make sure my display won't run out of characters). I'm pretty sure I can get the entire mess inside an 8x8 electrical box.

Thoughts? (I might beg for your much-better programming skills to work out the stepper control details.)


----------



## YYCHM (Dec 18, 2021)

whydontu said:


> yup. They’ll solder on no problem, crimp and solder works best, crimping alone tends to pull apart



Are JST connectors the same as Dupont connectors?


----------



## whydontu (Dec 18, 2021)

sort of. JST will work with Dupont, but JST is 2.5mm spacing but Dupont is 2.54mm spacing. Works OK for single-row up to about 6 conductors, anything more and the mis-match of pin spacing starts to be a problem.


----------



## PeterT (Dec 18, 2021)

I go through this JST headache on my RC stuff. Even under the Japan Solderless Terminal standard the dimensions vary by series name. 








						JST connector - Wikipedia
					






					en.wikipedia.org
				




To make matters more confusing, there is a lot of stuff sold under JST name where they presumably attempt to copy the dimensional standard but quality sucks, they are 'different' Or they kind of make up their own rules & standards without documenting (so again different). So beware hobby & ebay/amazon type stuff, it can be a bit of crap shoot. If you buy from a reputable electronics supplier you stand a better chance. Sometimes its worth it, sometimes not. If the clone price is low & its not critical application, some buy a combo bag of 100 male and female & label it Ebay Sh*t dd/mm/yy & they function together. It may not properly engage a 'real' JST plug though.


----------



## Susquatch (Dec 19, 2021)

PeterT said:


> I go through this JST headache on my RC stuff.



What RC stuff?


----------



## PeterT (Dec 19, 2021)

Radio Control (model aircraft).


----------



## YYCHM (Dec 19, 2021)

Susquatch said:


> What RC stuff?











						Radial engine build
					

Some work-in-progress pics of my current project. It’s a 5-cylinder 4-stroke model radial engine, 24mm bore x 22mm stroke 50cc total displacement. Uses RC methanol based fuel & glow plug ignition. About 950-5500 rpm. I bought (2d-paper) plans from a builder in Germany. This is my first attempt...




					canadianhobbymetalworkers.com


----------



## PeterT (Dec 19, 2021)

Thanks Craig, the radial build is rabbit hole #103 but more the mechanical rabbit hole, not the RC flying rabbit hole LOL (I see I kind of fell off the wagon posting, but construction has continued!)

More what I meant was all the crazy number of electrical plugs & connectors out there now. It's getting so hard to keep track of. Especially with offshore suppliers that throw out trade names or standards with reckless abandon, but no real guarantee theirs actually match. Also varying quality of pins & housings. So I'm just saying 'don't assume'. But these comments may be weighted to RC. Back in the day life was simple with just a few standardized plugs. But now the hobby is so multi-faceted, electric models, drones, FPV, whatever... & therefore all the electronic sub-components that support them. Life is getting 'interesting'.


----------



## Susquatch (Dec 19, 2021)

PeterT said:


> Radio Control (model aircraft).



I had hoped that is what you meant. I don't think I mentioned RC in my hobbies list, but it is there. I only have one airplane - a Corsaire that I have never flown. Not enough runway space for me even though I have a farm. Too many rocks. Too many bumps. Too much mud. 

So my real RC passion is Helicopters. I have 6 minus 1. The 1 was really a drone that had a stroke and headed off into Lala land on its own. It never came home. I still have not found it. But it has to be out there within 4 miles or so. 

So now I have 5 ranging from a tiny little Nano CPx that I have not been able to break to a big 790mm 360 CFX that I don't really enjoy. It's just too much bird. My favorite is a 200 class bird that is just plain fun to fly - fast, agile, bucks the wind, and seems quite adept at reading my mind. 

The biggest thorn in my side is the new rules which preclude flying RC near the airport - I am in the circle. So it's been a good 2 years since I've been able fly anything. I might have to learn how all over again!


----------



## YYCHM (Dec 19, 2021)

Look what Amazon delivered today.....






Haven't a clue how to use this stuff


----------



## PeterT (Dec 19, 2021)

Down near the bottom of this page is a video link showing some crimping basics. The plugs & wires & orientation & bodies might have their own subtleties depending on the connector type, but something to get you started. 





__





						Hansen Hobbies - Home
					

Hansen Hobbies - Electronics for Radio Controlled Aircarft



					www.hansenhobbies.com


----------



## Susquatch (Dec 19, 2021)

YYCHM said:


> Look what Amazon delivered today.....
> 
> View attachment 19151
> 
> Haven't a clue how to use this stuff



No clue? You could try glueing little loops of string on each piece, dust them with glitter, and then hang them on your wife's Xmas tree! Ho Ho Ho!


----------



## whydontu (Dec 19, 2021)

the 40-conductor rainbow wire looks quite festive


----------



## Tom O (Dec 20, 2021)

Don’t touch it! It’s terminal!


----------



## Dusty (Dec 20, 2021)

YYCHM said:


> Look what Amazon delivered today.....
> 
> View attachment 19151
> 
> Haven't a clue how to use this stuff



Hey Craig, don't leave us hanging there what is this kit called with item number on Amazon besides terminal?  Ho, ho, ho, 5 more sleeps!


----------



## YYCHM (Dec 20, 2021)

Dusty said:


> Hey Craig, don't leave us hanging there what is this kit called with item number on Amazon besides terminal?  Ho, ho, ho, 5 more sleeps!





			Amazon.ca
		




			Amazon.ca
		


Still to come......


			Amazon.ca
		




			https://www.simcoe-diy.ca/product-page/arduino-nanoadapter-prototype-shield
		




			https://www.simcoe-diy.ca/product-page/sharp-2y0a02-ir-analog-distance-sensor
		




			https://www.simcoe-diy.ca/product-page/hc-sr04-ultrasonic-sensor


----------



## Tom O (Dec 21, 2021)

Have you tried looking at Solarbotics here in Calgary they are situated around 32Ave and 12St in the north.




__





						Homepage
					

Solarbotics produces unique DIY electronic products and kit and now with the Active-Tech Calgary store, also offers a full line of electronic parts and tools.




					www.solarbotics.com


----------



## YYCHM (Dec 21, 2021)

Tom O said:


> Have you tried looking at Solarbotics here in Calgary they are situated around 32Ave and 12St in the north.
> 
> 
> 
> ...



Yup... kind of pricey.  I got a switch, enclosure and 9V battery holder there.





__





						Active Tech: Electronic Components, Parts, Supplies and Equipment
					

Since 1971, Active Tech has been Canada's largest supplier of electronic components and electrical equipment. Thousands of electronics parts, testing equipment from the top manufacturers and hundreds of tools.




					www.active123.com


----------



## whydontu (Jan 26, 2022)

still working on my mill controller, ran across a MUCH better tachometer framework. This library uses the main system clock to measure microseconds between pulses, takes maybe ten pulses and averages the time. 

(correction - 30 pulses, should have read the code)

In testing it can easily track from1 Hz to 2500 Hz with good accuracy. 60 RPM to 150k RPM with my single trigger per revolution. Is not affected by other code in the loop, which I proved by adding a delay-flash-an-LED-delay after the frequency function, and changing the length of delay has no effect on accuracy.






						FreqMeasure Library, for Measuring Frequencies in the 0.1 to 1000 Hz range, or RPM Tachometer Applications
					






					www.pjrc.com
				




The library is available in the usual Arduino <Manage Libraries> menu.

Here's my testing code:

#include <FreqMeasure.h>

// pin 8 is input

void setup() {
  Serial.begin(57600);
  FreqMeasure.begin();
  pinMode(LED_BUILTIN, OUTPUT);
pinMode(8, INPUT);
}

double sum=0;
int count=0;

void loop() {
  if (FreqMeasure.available()) {
    // average several reading together
    sum = sum + FreqMeasure.read();
    count = count + 1;
    if (count > 30) {
      float frequency = FreqMeasure.countToFrequency(sum / count);
      Serial.println(frequency);
      Serial.println(frequency *60); // converted to RPM
      sum = 0;
      count = 0;
  // otherstuff   
      digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(10);                       // wait a bit
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(10);                       // wait a bit
    }

 }
}


----------



## deleted_user (Jan 26, 2022)

whydontu said:


> still working on my mill controller, ran across a MUCH better tachometer framework. This library uses the main system clock to measure microseconds between pulses, takes maybe ten pulses and averages the time.
> 
> (correction - 30 pulses, should have read the code)
> 
> ...


that is the best method of sampling to achieve fast and accurate rpm returns


----------

