loading

Add an Arduino-based Optical Tachometer to a CNC Router

by:Transon     2020-12-07
Build an optical RPM indicator for your CNC router with Arduino Nano, ir led/IR photoelectric diode sensor and OLED display for less than $30.
My inspiration comes from the measurement RPM of eletro18-
Optical tachometer instructions, want to add a tachometer on my CNC router.
I simplified the sensor circuit and designed a custom 3D-
Print stand for my Sienci CNC router.
I then wrote an Arduino sketch showing numbers and analog dials on an OLED display showing a few simple parts and hours of time, you can add digital and analog RPM display on your CNC router.
The following is available for 2-day shipping.
If you are willing to wait longer, you may be able to get the parts for less. Parts List:$6.
$5 Arduino Nano 99.
99IR LED/IR photoelectric diode (5 pairs)$7.
99 OLED display 0.
96 yellow/blue I2C $4.
Jumper $99 1. 0030 inches (75 cm)3-conductor-stranded wire.
Can be purchased from your local home goods store (
Home Depot (Lowes)in the buy-by-the-foot section$0.
05220 ohm resistance ($6.
99 if you want 750 various resistors)$0.
50 heat shrink tubes ($5.
If you want a full classification, 99)
3D printed bracketsarawaide (free)
Note: I added one initially.
After I fixed all the wires and noticed some unstable RPM values when the CNC moved, the 01 μF capacitor.
For RPMs below 20 k, the capacitor works fine, but for anything higher it smooth too much signal.
I track the noise, power the Nano and display it directly from the CNC shield.
All RPM can be powered separately.
I left the steps for the time being, but you should use a separate USB power supply.
Print the 3D holder to keep both the ir led and the IR photoelectric diode.
The location of the 3D file and in Thingiverse.
The angle installation of the Sienci Mill is used to mount the sensor onto the aluminum angle bar, but the flat mount may be more suitable for your project.
I chose to connect the OLED to the tilt display stand I screwed on the top of the Sienci electronic housing.
Here is the link to the 3D printed part I use.
Sienci electronic housing 3D part 0.
96 \"OLED display mounting bracket this housing is a good place to install the OLED display holder, it fits the Arduino Nano well and it is mounted on the back of Sienci Mill.
I drilled a few holes at the top of the case to connect the OLED stand.
I also drilled a few holes in the bottom and went through a small zipper that would be 3-
The sensor will be connected using a wire.
For ir led and IR photodiodes, one line will be a common ground, and each of the other two lines will enter the respective components.
The ir led needs a current limiting resistor.
The easiest way is to incorporate the resistance into the wire assembly.
Bend each tip into U shape
Their shape and interlocking.
Curl with pliers and weld together.
You can splice jumpers on the Arduino head pins to connect them.
Before connecting the Heat Shrink tube, cut a heat shrink tube and slide through the wire.
Slide the Heat Shrink tube back to the connection (
Or the whole resistance)
And shrink the tube by using a hot gun or burning a flame quickly on the Tube until it shrinks.
Keep the flame moving quickly if flame is used, or the flame starts to melt.
Both the ir led and the IR photodiodes look similar and each LED has a long one (
Anode or positive)
Lead and short (
Cathode or negative pole)lead.
Take ir led (clear diode)
And insert it into one of the LED bracket holes.
Rotate the LED so that the long lead is located outside.
In the photo you can see the clear LED in the top hole with a long lead on the top.
Take IR photoelectric diode (dark diode)
Then insert it into another hole.
Rotate the photoelectric diode so that its long lead is located in the center.
As shown in the figure, both the short lead of the LED and the long lead of the photoelectric diode will be in the center.
The two leads will be spliced back to the public wire of the arduino. (
See the final technical note if you would like more details)
Take a small piece of 1.
Insert it behind the diode.
This will lock the diodes in place and prevent them from spinning or flowing out.
I went through several design iterations before solving this problem.
When the diode is aligned with the collet nut, the diode sticks out a little bit to greatly increase the tolerance.
You\'ll want to trim the locked filament a little longer than the width of the holder.
Heat the nail with a vise or pliers for a few seconds.
Place your finger at the other end of the filament and press to melt and melt the lock pin in the holder.
According to your application, flush and organize the wires into length.
For the Sienci factory, you need about £ 30 inch (~75cm)in total (wire + jumpers)
There is slack in router movement.
Bend the wire and lead tip to U shape
Make them lock each other and make it easier to weld.
Take some thin heat-
Shrink tubing, trim two short tubes and two short tubes that are slightly longer.
Slide the shorter part over the external diode lead.
Slide the longer part over two center leads.
Joints with two different lengths offset the joints and offset the thicker ones from each other, thus reducing the diameter of the wiring.
It also prevents any short circuit between different wires, cutting three pieces of slightly larger diameter heat
Shrink the pipes and place them on the three lines in the harness.
It is important to ensure that there is a little gap between the end of the heat shrink tube and the joint point on the wire.
The wires get hot, and if the heat shrink tubes are too close, they start to shrink at the end, which may make them too small to slip through the joint.
Current limiting resistance (220 ohm)
Built-in wiring harness, need to be connected to long (anode)
Clear lead for ir led.
The wires connecting the two common wires will be connected to the ground, so you may need to connect using black or bare wires.
The welding connection makes it permanent.
After welding the joint, first shrink the pipe on the lead of the diode using a match or lighter.
Hot first-
As far away as possible from the shrink pipe on the Heat wire.
When the flame shrinks and rotates, keep the flame moving quickly to make all sides even.
Don\'t stay, otherwise the pipe will melt instead of shrink.
After the diode lead shrinks, slide a slightly larger amount of heat-
Shrink the pipe from the wire, joint and shrink repeatedly.
Depending on your app, select the installation block that suits your app.
For self-grinding, select the angle to install the block.
Take a M2 nut and a M2 screw.
Screw the nut to the end of the screw.
Flip the mounting block and test to install the M2 nut into the hole.
Remove and heat the nut slightly with a match or flame, then quickly insert it into the back of the mounting block.
Unscrew the screw and insert the nut into the plastic mounting block.
To add some strength, apply a drop of super glue on the edge of the nut and attach the nut firmly to the block.
Make sure the screws are not too long or the sensor is not tightened against the mounting block.
For angle mounting blocks, make sure the M2 screws are 9mm short or a bit short.
For the Sienci Mill, attach the angle mounting block to the bottom inside the Z-rail with a few drops of super glue.
Place the adjustable arm into the mounting block, use the washer to pass the M2 screw through the slot of the adjustable mounting arm and screw it into the nut.
Slide the adjustable arm until the LED and the photodiodes tighten the screws with the router collet nut, using a small piece of aluminum tape (
For furnace tubes)
And attach it to one side of the collet nut.
This reflective band will allow the infrared optical sensor to pick up a single rotation of the spindle.
The tape must be located only on one side of the collet nut.
The tape is thin enough and light enough to not interfere with the wrench to replace the end mill or affect the spindle balance.
Use an aluminum tape strip to connect the wire to the inside of the Z-rail.
It is best to place the tape near the edge of the corner rail to clear the screw nut assembly.
Connect the wire to the Arduino as follows: Unplug 4-
Jumper Cable group plug the wire into 4 pins of the I2C interface: connect the jumper to the following pins.
Note: These wires are not all connected to adjacent pins in the same order.
Use the stand you printed earlier, connect the OLED display to the stand, and then connect the display to the CNC frame.
The Arduino program is called sketch.
Integrated development environment (IDE)
It is free for Arduinos and must be used to load programs that detect sensors and display RPM.
If you haven\'t already, here\'s a link to download the Arduino IDE.
Select download version 1. 8. 5 or above.
To run an OLED display, you will need several additional libraries, adafruit _ ssd136 library and adafruit-GFX-Library.
Both libraries are free through the links provided.
Follow the Adafruit tutorial on how to install libraries for your computer.
Once the libraries are installed, they can be used for any Arduino sketch you create. The Wire. h and Math.
The H Library is a standard library and is automatically included in the IDE installation.
Use the standard USB cable to connect the Arduino Nano to your computer using the Arduino IDE.
Now you are ready to load the sketch, compile the sketch, and upload it to the nano. The Arduino sketch code has been attached and can also be found on my GitHub page where any future
Download opticaltachmetereddisplay.
Ino file and put it in the working directory with the same name (minus the . ino).
Select File | open from Arduino IDE \". . .
The positioning of opticaltachomeoleddisplay directory open to your work. ino. ino file.
Click the check button or select sketch | verify/compile from the menu to compile the sketch.
You should see the compilation area with the status bar at the bottom.
After a few seconds, the \"complete compilation\" message and memory statistics taken up by the sketch will be displayed.
Don\'t worry about the \"low memory available\" message, it won\'t affect anything.
The GFX library uses most of the memory to draw a font on an OLED display, not the actual sketch itself.
If you see some errors, it is likely that the library is missing or the configuration problem is caused.
Check again if the library has been copied to the correct directory of the IDE.
If this does not solve the problem, check out the instructions on how to install the library and try again.
Press the arrow button or select sketch | upload from the menu to compile and upload the sketch.
You will see the same \"compile \". .
Message, then \"upload \". .
Message, and finally \"complete upload\" message.
Arduino starts running the program immediately after the upload is completed or after power-on.
At this point, the OLED display should be displayed at RPM: 0 and the dial is zero.
If you have regrouped your router together, you can turn on the switch and see the monitor read out the RPM when you adjust the speed. Congrats!
Note: This is the source of signal noise that results in unstable RPM display.
I\'m looking into installing some filter caps on the Power jumper, but now you need to power it through a separate USB cable. --------
You can use a USB cable to run the monitor connected to your computer, but in the end you need a dedicated power supply.
You have several options where you can get a standard USB wall charger and run Arduino from it.
Alternatively, you can run the Arduino directly from the CNC router electronics.
The Arduino/OLED display draws only 0.
04 am ps so won\'t overload your existing electronics.
If you have an Arduino/CNC router shield electronics (
Like Sienci Mill)
You can then access the required 5 V power supply using several unused pins.
In the upper left corner of the CNC router shield, you can see that there are several unused pins marked 5 v/GND.
Connect a pair of jumper cables to both pins.
This one is easy but the label is not very good.
On the Arduino Nano, there is a set of 6 pins at the end of the board.
They are not tagged, but I have included the pin output diagram and you can see that the two external pins in the diagram closest to the led of the indicator are marked as GND and 5 v.
Connect the jumper on the 5 v pin on the CNC shield to the closest pin to the marked VIN (
Instead of connecting it to VIN, connect it to the inner corner pin of the 6-pin group).
VIN uses 7 V-to power the Nano. 12V power.
Connect the jumper from the GND pin on the CNC shield to the pin closest to the TX1 pin.
Now, the oled rpm display will also appear when you turn on the CNC router electronics.
The sensor circuit uses an ir led/IR photoelectric diode pair.
Ir led works like any normal LED.
Leading positive (
Longer or anode)
Connected to positive voltage.
The output pin on the Arduino Nano is set to high.
Negative lead (
Short or cathode)
Connect to the ground to complete the circuit.
Since the LED is sensitive to too much current, a small resistor is placed in series with the LED to limit the electrical flow.
This resistor can be anywhere in the circuit, but it makes the most sense to put it on the positive side of the circuit, because the negative lead is connected to a common ground with the photoelectric diode.
The behavior of IR photodiodes and any other diodes (
LEDs (led) included)
Because they only Upload conductive in one direction, they block electricity in the opposite direction.
That\'s why the correct polarity is important for led work.
The important difference between photodiodes is that when they detect light, the photodiodes allow electricity to flow in any way.
This property is used to make a light detector (
In this case, infrared or infrared).
Infrared photodiodes are connected in reverse polarity (
Called reverse bias)
The positive 5 v on the Arduino pin is connected to the negative lead of the photoelectric diode, and the positive lead is grounded with the ir led through the common lead.
The IR optoelectronic diode blocks electricity without IR light, allowing the Arduino pin to have an internal pull
The upper resistance is in a high state.
When IR Photo diodes detect IR light, it allows the current to flow, ground the pin and causes the high value on the photo diode pin to drop to the ground, resulting in the falling edge that Arduino can detect.
This state change on the Arduino pin is used in the sketch to calculate the rotation speed.
The aluminum tape on the Collet nut reflects from always-
The on ir led returns to the IR photoelectric diode each time it rotates through the sensor.
Arduino sketches drive OLED displays and react to both ir led/IR photoelectric diode sensors.
Sketch in the entire he I2C (Inter-
Integrated circuit)protocol.
The protocol allows multiple monitors/sensors to share a connection and can read and write a specific connection device with a minimum of wires (4).
This connection reduces the number of connections between Arduino and OLED displays.
It then turns on the ir led by setting the pin height to provide the 5 v voltage required for the LED.
It attaches the interrupt function to a pin that is called when a change in the state of that pin is detected.
In this case, the incremental revolution ()
Whenever a drop edge is detected on pin 2, the function is called.
The interrupt function does what it implies, it interrupts anything that is currently being done, executes the function, and then restores the action where it is interrupted.
The interrupt function should be as short as possible, in which case it just adds one to the counter variable.
Arduino Nano runs at 16 Mhz
16 million cycles per second
Fast enough to handle 30,000 rpm interrupts with only 500 rpm per second. The Loop()
The function is the main action function for any Arduino sketch.
As long as the Arduino has power, it will be called repeatedly.
It gets the current time and checks if the specified time interval has passed (
1/4 seconds = 250 ms).
If so, it calls updateDisplay ()
A function that displays the new RPM value.
The loop function will also dim the display after 1 minute and turn off the display after 2 minutes-
Fully configurable in the code.
Update display ()
Function call calculator pm ()function.
This function accepts the number of revolutions. The interrupt function has been steadily increasing, and the RPM is calculated by determining the number of revolutions per time interval and pushing them out to the number of revolutions per minute.
It displays the values and uses some high school trig to plot the analog dial and indicator arm to reflect the same values.
If you want an RPM dial with different size values, you can modify the constant at the top of the sketch.
Update intervals and average intervals can also be modified.
Custom message
Chat Online 编辑模式下无法使用
Leave Your Message inputting...
88888888888888888888888