I was asked, in response to my Optical CNC Tachometer instructable, if it could be modified to display speed for a bandsaw. The Arduino code was 95% the same, so I decided to create a new instructable on how to add a speed display on your bandsaw. This time with custom built wooden display box and sensor unit.
- $6.99 Arduino Nano
- $5.99 IR LED/IR Photodiode (5 pairs)
- $7.99 OLED display 1.3" blue I2C
- $4.99 Jumper wires
- $1.00 30 inches (75 cm) 3-conductor-stranded wire. Can be purchased from your local home supply store (Home Depot, Lowes) in the buy-by-the-foot section
- $0.05 220 ohm resistor ($6.99 if you want 750 assorted resistors)
- $0.50 Heat shrink tubing ($5.99 if you want a complete assortment)
- 1"x4" Wood (I used clear pine)
The display is fully configurable to display SAE or Metric units in either units per minute or units per second
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Make the OLED Display Box
Measure and cut a piece of wood to hold the OLED display and the Arduino Nano. (Approx. 2 3/4" x 2 3/4") I used a 1" thick board, while it held everything, the jumper wires stick up beyond the back, so a thicker board (or a two piece version) would be needed for a final installation.
Measure the OLED display and transfer the dimensions to the wood block. The OLED display doesn't go all the way to the edge, so you can make the opening a little small than the OLED display. It just needs to be as big as the display, not the entire OLED circuit board.
Step 2: Cut Out the OLED Frame and Hollow Out the Box
Drill a hole at the corners of the square markings. Using a scroll or coping saw, cut out the square.
On the back side of the block, measure out a perimeter. Use a Forstner bit to hollow out the block. Make sure that you have your depth stop set properly
Step 3: Bevel the OLED Frame and Test Fit the Electronics
Use a sharp carving knife, carefully carve a bevel in the front for the OLED display.
Carefully cut a bevel edge along the outside if desired.
When test fitting the Arduino Nano, mark where the USB port is located. A hole will need to be cut to allow the USB cable to connect to the Nano for power and programming. This hole can determine how the frame is mounted on the bandsaw.
Step 4: Build the Sensor Block
Cut a much smaller block of wood to hold the IR LED and IR Photodiode sensor. (Approx 1 1/2" x 1" x 1/2")
Bevel the edges if desired
With calipers, measure the diameter of the front of the LED and Photodiode. The LED and photodiode have a larger lip at the bottom. Choose a drill bit that is larger than the front of the LED but smaller than the lip at the bottom.
Drill two holes, evenly spaced all the way through the block.
Choose a drill bit that is slightly larger than the LED lip. Test the depth needed by holding up the LED to the edge of the block. The LED domes should extend out of the block slightly. Set your depth stop and drill the larger hold into the back to the depth needed. This will allow the LED to be inserted from the back, but it can't go all the way through.
Now take a very small dowel (also known as a round toothpick) and choose a drill bit that fits the toothpick. Determine where the rear of the LED/Photodiode end. Turn the block on its edge and drill a hole through the side of the block that is just behind the LED lip and just above the centerline. The toothpick will be inserted to prevent the LED from coming out the rear of the block. The hole needs to be just above center, because the leads from the LED come out of the center.
Step 5: Give the Wooden Frame and Sensor Mount a Quick Coat of Paint
Coat the frame and sensor block with a couple of coats of spray paint in any color you choose.
Step 6: Mount the Electronics
Carefully line up the OLED display with the frame opening and mark inside. I used a popsicle stick with holes drilled in the ends and some small screws to mount the circuit boards. Make sure the screws don't extend through the front of the frame.
Step 7: Mount the Arduino and Connected the Jumpers
A piece of popsicle stick can be used to mount the Nano on the opposite side from the USB port.
Attach a 4-wire jumper cable to the following pins from the OLED to the Nano
Note: The wires do not all attach in the same order to each other.
- VCC -> Pin 5V
- GND -> Pin GND
- SCL -> Pin A5
- SDA -> Pin A4
Step 8: Build the Sensor Wiring Harness
The IR LED requires a current limiting resistor. The easiest way, is to incorporate the resistor into the wire assembly.
Bend the tips of each into a U-shape and interlock them. Crimp with a pair of pliers and then solder them together.
You can splice jumper wires to connect them on Arduino header pins.
Cut a piece of heat shrink tubing and slide over the wire before connecting them. Slide the heat shrink tubing back over the connection (or entire Resistor) and shrink the tubing by using a heat gun or running a flame quickly over the tube until it shrinks. If using a flame, keep it moving quickly or it can start to melt.
Step 9: Insert Diodes Into Holder
Both the IR LED and the IR Photodiode look similar, each having a long (anode or positive) lead and a short (cathode or negative) lead.
Take the IR LED (clear diode) and insert it into one of the LED holder holes. Rotate the LED so that the long lead is on the outside. In the photo, you can see the clear LED in the top hole with its long lead at the very top.
Take the IR photodiode (dark diode) and insert it in the other hole. Rotate the photodiode so that its long lead is in the center. As shown in the photo, the short lead of the LED and the long lead of the photodiode will both be in the center. These two leads will be spliced to a common wire back to the arduino.
Insert a toothpick into the lock hole behind the diodes. This will lock the diodes in place and prevent them from rotating or coming out.
Bend the two center diode leads so that they form a single lead. Add small sections of shrink tubing to the outer diode leads
Step 10: Connect the Wiring Harness to the IR Sensor
The current limiting resistor (220 ohm) built into the wiring harness, needs to be connected to the long (anode) lead of the clear IR LED. The wire connecting the two common leads will be connected to ground, so you may want to use a black or bare wire for that connection.
Slip sections of heat-shrink tubing over the large wire and each small wire prior to connecting the wire to the diode leads.
Solder the connections to make them permanent.
After the joints have been soldered, use a match or lighter to shrink the tubing on the diode leads first. First move the heat-shrink tubing on the wires as far away from the heat as possible.
Mix up a bit of epoxy to glue two neodymium magnets to the sensor block back
Step 11: Connect the Sensor Wire to the Arduino Nano
Connect the wires to the Arduino as follows:
- IR LED (with integrated resistor) -> Pin D3
- IR Photodiode -> Pin D2
- Common wire -> Pin GND
Step 12: Prepare the Bandsaw Wheel
The bandsaw wheel will act as an optical encoder. Small pieces of reflective aluminum tape will be added to the edge to cause the sensor to trigger. Make sure that the wheel is not already reflective. My wheel was silver cast aluminum. I gave the wheel a quick coat of flat black spray paint to ensure that it wasn't reflective. The picture shows when I was initally spray painting only the spokes, but I ended up spray painting the entire outer rim.
Make sure that you are careful when spraying the wheel, try not to get any paint on the rubber outer rim that the blade runs on.
Step 13: Add the Reflective Tape
For a standard 2"-wide roll of Aluminum tape, cut the tape into 1/2" strips lengthwise. Then cut 1/4" reflective segments to be added to the wheel
Make a cardboard template that measures between the spokes of the wheel. Divide the distance between the spokes into even sections and mark on the template. I found that 24 reflective strips provided a very stable speed reading. With 6 spokes on the wheel, that resulted in 4 reflective strips between each spoke.
The number of reflective strips is fully configurable in the Arduino code.
Step 14: Mount the IR Sensor
The IR sensor is thin and needs to be placed to sense the reflective strips. Measure the distance from the edge to the center of the reflective strip. On the cover, measure the same distance and align the diodes so that they are vertical, one over the other.
Close the cover and verify that the sensor does not interfere with the movement of the wheel.
Step 15: Mount the OLED Frame
Mount the OLED frame anywhere you would like. Make sure that you leave access to the USB port for programming and power.
Step 16: Upload the Arduino Sketch
A program for an Arduino is called a sketch. The Integrated Development Environment (IDE) for Arduinos is free and must be used to load the program to detect the sensor and display the RPM.
If you don't already have it, here's a link to download the Arduino IDE. Choose the downloadable version 1.8.5 or above.
Step 17: Add the Required Arduino Libraries
To run the OLED display, you'll need a couple of additional libraries.
If you are using the 1.3" OLED display, you will need a special modified version of the OLED driver library.
The 1.3" OLED display need the SH1106 library. Click on the link to open up the GitHub page that hosts the library. Click on the green "Clone or Download" button and choose "Download Zip". Open the Arduino IDE and select "Sketch | Include Library | Add .ZIP Library..." from the menu. Choose the .zip file that you just downloaded to install it in the Arduino IDE.
You will also need the Adafruit-GFX-Library as well. Click the "Download Adafruit_GFX Library" button and follow the above directions to install the graphics library.
Once the libraries are installed, they're available for any Arduino sketch you create. The Wire.h and Math.h libraries are standard and are automatically included in your IDE installation.
Note: If you are using a 0.96" OLED display you will need the Adafruit_SSD1306 instead of the SH1106 library
Step 18: Compile and Upload the Sketch
Using a standard USB cable, connect the Arduino Nano to your computer with the Arduino IDE.
Launch the IDE
From the Tools menu, select Board | Arduino Nano
From the Tools menu, select Port |
Now you are ready to load the sketch, compile it and upload it to the Nano
Step 19: Download the Arduino Sketch
The Arduino Sketch code is attached and is also available on my GitHub page where any future improvements will be posted. Note: Be sure to select the OpticalSpeedOledDisplay Branch from GitHub.
Download the OpticalSpeedOledDisplay file and place it into a work directory with the same name (minus the .ino).
From the Arduino IDE, choose File | Open...
Navigate to your work directory Open the OpticalSpeedOledDisplay.ino file.
Step 20: Customize the Arduino Sketch
There are several configurable settings that may need to be modified to suit your needs.
All of these settings are at the very top of the Arduino Sketch.
First - Define the type of OLED display you are using
//One of the next two #defines must be uncommented for the type of OLED display //SSD1306 is typically the 0.96" OLED //#define OLED_TYPE_SSD1306 //SH1106 is typically a 1.3" OLED #define OLED_TYPE_SH1106
The // is a the start of a comment and the line is ignored
The #define creates a symbol that the compiler uses for a value, or just to signify that some feature has been turned on. In this case the //#define line is ignored, so the 0.96" OLED is not defined.
The #define OLED_TYPE_SH1106 is valid and signifies to include the correct library and to use the correct display calls.
Step 21: Customize the Arduino Sketch
Second - Specify the size of the wheel with the reflective strips
//Wheel diameter in either inches or CM #define WHEEL_DIAMETER_IN_INCHES 13.8 //#define WHEEL_DIAMETER_IN_CM 35
Third - Specify the number of reflective strips that were added to the wheel
#define WHEEL_REFLECTIVE_STRIP_COUNT 24
Forth - Specify either SAE units or Metric units, but not both. This will determine what is displayed on the meter
//Specify either SAE units or Metric units #define DISPLAY_SAE_UNITS //#define DISPLAY_METRIC_UNITS
Lastly - Specify if the speed will be displayed in units per minute or units per second
If the line SPEED_PER_SECOND is commented out, it will display units per minute
Step 22: Compile the Sketch
Click the 'Check' button or choose Sketch | Verify/Compile from the menu to compile the sketch.
You should see the compile area in the bottom, with a status bar. In a few seconds the message "Done Compiling" and some statistic on how much memory the sketch takes up will be displayed. Don't worry about the "Low Memory Available" message, it does not affect anything. Most of the memory is used by the GFX library needed to draw the fonts on the OLED display and not the actual sketch itself. If you see some errors, they are most likely the result of missing libraries, or a configuration issues. Double check that the libraries have been copied into the correct directory for the IDE. If that doesn't fix the problem check the instructions on how to install a library and try again.
Step 23: Upload the Sketch
Press the 'Arrow' button or choose Sketch | Upload from the menu to compile and upload the sketch.
You'll see the same 'Compiling..' message, followed by an 'Uploading..' message and finally a 'Done Uploading' message. The Arduino starts running the program as soon as the Upload is complete or as soon as power is applied afterwards. At this point, the OLED display should come alive with a FPM: 0 display (or whatever units you have configured) with the dial at zero. Make sure the bandsaw cover is closed, you can turn on the switch and see the display read out the bandsaw speed.