Universal DRO based on Arduino Nano - shDRO

Ladies and gentlemen, hello.

In this article I will talk about the development of a device for taking readings from digital rulers and other sensors located on turning and milling machines.

Development is not yet completed and what has been done at the moment will be described.

Who cares, welcome to cat.

Why own development, but not a finished product.
I have two metal machines (Chinese): milling and turning.

I periodically produce products of varying degrees of complexity on them (I am not a turner or milling machine operator, this is just a hobby). And, if the product is complex, then you had to pick up a calculator and calculate the progress of the cutter or cutter. And also, if the cutter / cutter stroke turned out to be large enough, then we had to consider the revolutions of the caliper handles, which frankly annoyed. As a result, I thought about DRO (digital calipers were bought just for this purpose for a long time, but the lack of time constantly delayed the manufacture).

Before starting the development of my DRO, I had to answer two questions regarding the appropriateness of my own development:

  • why not buy the finished product?
  • there are many DRO projects on the network, of different difficulty levels, with detailed descriptions of DIY manufacturing. So why not collect one of them?

I answer myself.

Yes, there are many products on the market, both domestic and foreign, with different prices and with different functionality. The same Ali offers ready-made DRO with three optical lines at a price of about 13,000 rubles. - a very low price for such a device. But I’m interested in the manufacturing process itself, so the option “bought and installed” was dropped.

Answering the second question, I put myself in the place of a person who himself will assemble the device according to some description, and what he should do. Namely:

  • purchase the necessary components: processor, indication, buttons and small things like resistors, capacitors, stabilizers, etc. (without this, of course, nowhere);
  • depending on the complexity of the project, make / purchase a printed circuit board;
  • then solder everything and flash the processor;
  • after, do the work on the bugs;

And only after these steps, you get a finished product. Each step takes some time, and since a person is a lazy and impatient creature (in the good sense of these words), he wants to see the result of the device’s work as quickly as possible, even if it’s intermediate. And yet I decided to develop my device in such a way that a person, even at the very beginning of the assembly process, would see intermediate results of his work.

Now it was necessary to choose a board for implementation.

Choose between Arduino based on Atmega and STM.

I am a top-level programmer, but at work I had to program Atmega and MSP-430 microcontrollers, I was not familiar with STM. Therefore, I chose Atmega. I chose the cheapest board (or not? I just had them) Arduino Nano based on the Atmega328 microcontroller.

Features of shDRO:

(crossed out functionality that has not yet been implemented)

  • Arduino Nano board, Atmega328 processor;
  • 12 independent Arduino channels / ports to which readers are connected;
  • Each channel has the following properties: Type (CLKin, DATAin, Ain, Bin, etc.), EI (Enable Interrupt), IL (Interrupt Level), Inv (Invented Signal);
  • maximum number of connected devices: 6;
  • each device can be assigned one or more channels out of 12 available;
  • protocol support: 24BIT, 21BIT , BCD7 , BIN6, quadrature signal, periodic signal from the tachometer (it is possible to add new protocols);
  • console: allows using the terminal program to configure and test shDRO during assembly and operation;
  • in console mode, a “pseudo” logical analyzer is implemented that allows you to read the levels of channels specified in the console and determine the exchange protocol. The maximum number of samples is 256, the minimum measured time between samples is 8 microseconds. At least one channel under analysis must be configured to interrupt;

Modular scheme:

The device consists of the following modules:

  • three voltage stabilizers 5v., 3v., 1.5.v. 3v stabilizers. and 1.5.v. adjustable. These voltage levels are used in digital calipers (1.5v.) And in the iGAGING line (3v.);
  • 4 eight-digit seven-segment indicators based on MAX7219, connected in cascade to hardware SPI;
  • keyboard. The keyboard consists of two resistive matrices: 2x4 and 4x4 in this case, the layout of the tracks on the board is simpler (but you can make two 3x4 matrices, to whom it is more convenient). Each matrix is ​​connected to the ADC channel;

    Using resistive matrices is a big minus for me, because over time, the resistance of the buttons will increase, and the voltage levels measured by the ADC will accordingly change. But the “honest” matrix simply lacked the legs / ports of the board (for 24 buttons, 10 ports are needed). Based on this, the firmware implements the learning functionality of the keyboard, learning can be done at any time, and you do not need a connection with the terminal program (training will be written below).
  • a speaker connected to the hardware leg of timer 1;
  • adapter board, which are designed to coordinate levels between devices and Arduino ports;
  • 4 DB9 female connectors (for good you need to install 6 connectors, because shDRO supports up to 6 devices, but I did not clutter the future rear panel of the case, assuming that three connectors will be used for axes, and one connector will be shared between other devices) . The connectors are the simplest, with legs for soldering wires. The wires, in turn, are soldered to the adapter board;

    The choice of this type of connector is due to the following reasons: reliability (compared with USB connectors and RJ-45), a large number of pins and ease of wiring. And also I have one optical line with this type of connector.

Schematic diagram:

In the next part I will describe the logic of shDRO, describe the currently available console commands, and also lay out the first version of the firmware.

Second part.

Also popular now: