More progress on the prototype DRO. Buttons are now working – Axis reset and Measurement toggle.
Also added a startup config option to allow default metric/imperial measurement and reverse axis options.
New board has been designed and back from the PCB house. I have added a header for S/W SPI port and select
lines in case anyone whats to use standard 7-segment displays via MAX7219/MAX7221 drivers.
The board uses a surface mount TQFP ATMEGA328P. ICP and FTDI headers provided for Bootloader/Prog.
I managed to load the bootloader using either an UNO as a programmer or using a cheap USBASP programmer board.
Both worked. The board is treated as a Arduino Uno and must be set as this in the Arduino ADE for either bootloading or programming via FTDI.
Font still needs updating for the OLED display.
Sensors have been mounted in the aluminium cases I made earlier. I have potted these in epoxy resin and added armoured cable.
The top of the AS5311 sensor sits above the resin and casing by a small amount.
My small Taig mill will be the first recipient of the DRO. I’ve spent a few days making the mounting brackets for this.
Here’s the Z Axis sensor mounted and ready to go. The magnetic strip is mounted in a 16mm square aluminium U channel.
I’m in the process of mounting the X and Y sensors.
Next step is to mount the display board. For this I plan to mill the case from a solid block of one inch thick aluminium.
So the first batch of PCBs for the DRO display have arrived. Looking good.
First problem, I made the holes too small for the header pins on the Nano and OLED display.
Drilling will remove the thru-hole plate so since this is a prototype, I will use strip sockets with smaller pins to mount these.
I plan to use a SMD ATMega328p TQFP chip on the final board. the final board will have a FTDI and ICP header.
I also purchased a TQFP 32pin socket to allow me to pre program the chips.
Still waiting on some voltage regulators and shottky diodes to complete but have enough bits to make a start.
Hooked up three sensor boards, the Nano and the OLED. modified my single axis code to support three.
Seems to be working well. Basic code fits in about 13k program space. No noticable lag in display update.
The encoder read happens every 50mS and the Arduino seems to cope with this.
Remember that most of the work is done by the LS7366 Encoder/counters. The LS7366’s sole purpose being to count the pulses from the AS5311 encoders and store the count. All the Arduino needs to do is retrieve the count over the SPI bus and display to the OLED in either metric or imperial. No interrupts needed….
Next step is to add the zero and metric/Imp switches for each axis (6 switches). I’m planning on doing this with one analog input and six 1k ohm resistors in a ladder configuration. So here’s the schematic with the planned switches. The switch portion being untested so far.
The display font is a scaled 5×7 pixel standard font. As shown in the photos, it is scaled twice size so looks a bit blocky. I’ll look at adding some better looking fonts so the layout looks better. One I confirm the switch design is working, I will re-design to use a smaller PCB with a SMD ATMega328p. I’ll also add a jumper to select the default measurement unit at power on. Currently this is set to imperial but can be changed on any axis by the push buttons.
These OLED displays are really impressive. I originally planned to use standard MAX7221 driven seven segment displays as seen in the first prototype but after using these OLEDs, I can’t see the point. I’ll include a 3 channel SPI header on the final board for anyone that wants to stick with seven segments, but OLEDs are now my favourite.
For those who are keen on the seven segments, here’s the schematic.
One for each axis. Use either MAX7219 or MAX7221. Datasheet is online.
Sensor case looks like a good candidate for some home anodising….(or Anodizing if you are American)
You can do this pretty easily without acid and get pretty good results.
I’m in New Zealand… The nice caring authorities here don’t trust people like me with sulphuric acid needed for the usual methods. It’s not that easy to buy here. Never mind.. there are alternatives.
Sodium Bisulphate – commonly used to lower the PH of swimming pools. This is a salt of Sulphuric acid and for my purpose, will work fine. Usual disclaimers here… I’m not responsible for any damage you do to yourself etc if you attempt this. Use common sense when using these chemicals. This works for me.
Here’s how I do it.
First I make sure the aluminium is really clean and all those machining marks have been taken out. And when you think it’s really clean, clean it again. I like to etch the aluminium in some Sodium hydroxide (NAOH, Drain cleaner) for a few minutes. A few teaspoons in a 1/2 litre of water is all you really need. Sodium Hydroxide is nasty stuff on skin and eyes….cover them. I don’t soak it longer than about 5 minutes. This eats aluminium nicely.
I wash in water taking care not to touch with my oily hands….
I use a piece of aluminium about 120mmx100mmx6mm thick for the cathode. I use a low current car battery charger. Mine is 2200ma capacity. This is more than enough for such small objects and finally a Sodium Bisulphate solution. I use about 1 part NaHSO4 to 4 parts water by weight. So about 200g disolved in 800ml water. Negative to the cathode, positive to the nicely cleaned case connected with some aluminium wire. Place them a few inches apart and let it bubble away for anything from 1 to 2 hours. Small hydrogen bubbles will be seen bubbling up from the cathode. Best done outside since hydrogen is of course flammable…..Here’s one of the cases being anodised. Current is about 250mA. (bubbles not really visible in the photo)
So I have my newly anodised case. Time to dye it.
I’ve experimented with a number of dyes/inks. I’ve had varying degrees of success with black acrylic dyes and inks. Most of these give a blue or purple colour on aluminium. So black acrylic ink gives me any colour between purple and black depending on concentration. A bit of experimmentation is required here. For this, I’m using some ‘Pebeo colorex’ black ink.
I now use the ink non diluted. I apply it with a small brush. Providing your anodizing process has worked properly, this should soak up the ink almost instantly. If you can still see the metal after applying the ink, the aluminium is either not clean enough or hasn’t been anodized long enough. I then boil it for about 20 minutes in boiling water to seal.
You can remove the anodised coating if necessary by soaking it in Sodium Hydroxide again.
Ok. So while I’m waiting for the prototype display board to come back from the PCB Fab.,
I’ll spend some time on the enclosures for the encoder boards. I ended up redesigning the encoder
board to be slightly smaller and to use the Molex pico-blade connectors rather than a 0.1″ header.
I also changed the crystal case and dropped one of the LEDS I used originally on the index line.
Not much point in putting an LED on this line. It pulses every 2mm travelled for 1uS. Barely visible.
So here’s the encoder board – front and back.
LEDs and resistors for the A and B incremental lines are not installed. Nice to have them blinking away while testing, but otherwise pretty useless. LEDS installed for power and Mag Dec/Inc. these should be visible through some 1mm holes in the case.
For the enclosure/casing, I’ve used a piece of 10mm aluminium bar, milled a pocket for the PCB with four mounting points.
(using a 1/4″ end mill) The PCB sits 0.1″ from the surface, leaving the top of the sensor chip flush with the surface.
Once the PCB is installed I’ll encase it in resin, leaving the sensor chip flush with the top.
There’s probably not much point in actually installing the LEDS on the sensor board unless you plan to make them visible
through a few small holes. The LEDS were useful when testing the code.
Here’s the case…
After many magic words to assist in crimping the pico-blade connectors on a test lead (these are small!), I’m not sure I will continue using these. Maybe a few holes in the PCB and the wires mounted directly is the best way to go. Once the board is epoxied in place, it won’t be going anywhere.
While I have tapped the mounting holes M2, I probably won’t use these except for temporarily mounting of the board before potting in epoxy.
Encoder case looks like a good candidate for some home anodizing….and since the main PCB still hasn’t turned up, that’s next…
The prototype encoder PCB has been made and tested with an Arduino Nano.
You will notice in the photo that I’m using 7 segment displays and a small OLED display.
I plan to support a number of different displays. One version with the ‘traditional’ 7 segment displays and one version with a large OLED display showing all data. I tend to favour the OLED displays. They have low power consumption, fantastic contrast, excellent refresh rate and easy to use.
The LED display shown in the photo is connected via SPI. The display board is based on the MAX7221. Current per segment has been limited to less than 5mA per segment since I’m powering it from the USB port.
The small 1″ OLED is connected via I2C so only requires two I/O ports on the Arduino. This particular board is labelled ‘CRIUS’ and used on multicopter controller boards commonly available off Ebay for a few bucks. If you buy one of these CRIUS boards, make sure you buy the version 1.2 board. The earlier boards don’t work well with the Arduino without modification.(adding a resistor/capacitor on the reset line). I used the U8glib library for this display.
The 300mm magnetic strip for the encoder is visible at the bottom of the breadboard.
Code needs to be refined more with X,Y,Z axis and reset/unit switches. Hopefully this will fit in the Arduino ATMega328 code space.
Next prototype will use a 2.4″ green I2C OLED display based on the SSD1305 controller. This display is 128×64 pixel and should be big enough to display all X,Y,Z readings with a metric or imperial unit indicator. Unfortunately this display isn’t current supported by the U8glib library. It is very similar to the SSD1306 based displays so should be easy enough to modify the library. Waiting on a Display PCB to arrive to test this….
I have a few machines in my home workshop. I guess most people like me have found that the cost of the machine is small compared to the accessories you need… So I spend most of my time making accessories. I’d like some digital readouts for my machines. Problem is that they cost lots for lots of machines… Why not make some. How hard can it be? Magnetic scales seem to be the easiest way to go for the serious DIY’er Small in size, scalable to any size simply by cutting the magnetic strip and of course, relatively cheap. Austrian Micro Systems make a range of linear encoders suitable for this project. I’ve picked the AS5311 device. This device has a resolution of about 0.5um. It also has quadrature output that provides a resolution of 1.95um 1.95um is good enough for me. 0.00195mm So, how am I going to read these devices? The Arduino was my first thought. Cheap and easy to program. The Quadrature output of the AS5311 gives 1024 pulse per 2mm magnetic pole pair. I want my project to have at least 3 axis capacity. I don’t think the Arduino would cope with this on three separate inputs. After some searching for quadrature counters, I came across the LS7366R from LSI. This is a 32bit Quadrature counter with a SPI interface. Perfect. So, my sensor consists on an AS5311 and a LS7366R to count the pulses. Then, it’s just a matter of reading the pulse counter on the LS7366R and displaying the results. This should allow me to use the Arduino to process the counts and drive a display. Here’s my circuit: Circuit board time.