Electronic counters for coil winding machines and transformers. Electronic thread counter for winding machine

Option 1: ATmega8 + Nokia 5110 LCD + 3V power supply

The circuit uses Atmega8-8PU (external quartz with a frequency of 8MHz), Nokia 5110 LCD and a transistor for processing pulses from the reed switch. The 3.3V voltage regulator provides power to the entire circuit.

All components were mounted on the breadboard, including connectors for: ISP programmer (USBAsp), 5110 Nokia LCD, power (5V supplied to 3.3V regulator), reed switch, reset button and a 2-pin connector used to read winding polarity machine drive motor to know whether to increase or decrease the counter.

Purpose of connectors:
J1: Power. 5V is supplied to the connector and then to the L7833 stabilizer to obtain the 3.3V voltage used by ATmega8 and LCD.
J2: LCD connector for Nokia 5110 LCD.
J3: Reed switch. Pulse input for counting by microcontroller.
J4: Polarity connector. It must be connected in parallel with the motor winding. The tracking circuit was designed for a 12-volt motor, but it can be applied to other motor voltages by adjusting the values ​​of the voltage dividers formed by R3-R4 and R5-R6. If the motor is connected to straight polarity, PD0 will have a high log. level, if the motor is connected to reverse polarity, then PD1 will have a high log. level. This information is used in the code to increment or decrement the counter.
J5: Counter reset. When you press the button, the counter will be reset.
ISP Connector: This is a 10-pin connector for the USBAsp AVR programmer.

Device diagram

Photo of the finished device


Option 2: ATmega8 + 2x16 HD44780 LCD + 5V power supply

Some of my readers have asked for a version of the counter that uses a 2x16 HD44780 display (or a smaller 1x16 variant). These displays require a 5V supply voltage, so a 3.3V stabilizer is not relevant.

Device diagram

Microcontroller configuration bits for both options: LOW - 0xFF, HIGH - 0xC9.

Archive for the article "Coil counter for winding machine"
Description:

Source code (C), firmware files for the microcontroller

File size: 111.35 KB Number of downloads: 257

In the work of radio amateurs and electricians, devices for winding copper wire with a diameter of 1.5 mm onto a special electric coil are useful. In an industrial setting, this process requires speed and precision. Home craftsmen can reproduce this technology. To do this you will need a homemade winding machine. It is characterized by the following symptoms:

  • ease of creation and operation;
  • possibility of using different transformers;
  • Availability additional functions: Counting the number of wire coils.

Winding machine operating method

A winding machine is a popular equipment with which transformer single-layer and multilayer cylindrical coils and all kinds of chokes are wound. The winding device evenly distributes the winding wire with a certain tension level. It can be manual or automatic, and works on the following principle:

  • Rotation of the handle sets the winding of the wire or cable onto the coil frame. It serves as the base of the product and is put on a special shaft.
  • The wire moves horizontally thanks to the guide element of the stacker.
  • The number of turns is determined by special counters. In homemade designs, this role can be played by a bicycle speedometer or a magnetic reed switch sensor.

The manual device for laying wires is quite primitive, so it is rarely used in production.

A mechanically driven winding machine allows you to perform complex winding:

  • private;
  • toroidal;
  • cross.

It operates with the help of an electric motor that drives the intermediate shaft using a belt drive and three-speed pulleys. The friction clutch plays a big role in this. Thanks to it, the machine operates smoothly, without shocks or wire breaks. A spindle with a fixed frame, on which a coil is placed, starts the counter. The winding machine is adjusted using a screw to any width of the reel frame.

Modern models are equipped digital equipment. They work through a specially defined program that stores information in a storage device. The value of the length and diameter of the wire allows you to accurately determine the point of intersection of the lines.

Winding machine mechanism

The winding machine is classified into groups:

  • private;
  • universal;
  • toroidal winding.



Each product has an individual design.

A winding machine that performs row laying of wire consists of the following elements:

  • The winding mechanism has the form of a welded frame, which is equipped with a motor, a toothed belt drive, a headstock and a tailstock.
  • The layout mechanism allows you to move long material along the winding axis. This is a welded structure along which a carriage with guide rollers for the wire moves.
  • Device models differ from each other in size and functionality.

The standard model of a device for laying wires with several bends in one turn assumes the presence of the following elements:

  • The main frame, consisting of wooden or metal posts that occupy a vertical position.
  • Between the supports there are two horizontal axes: one for the plates, the other for the coil.
  • Replaceable gears that send rotation to the reel.
  • The handle that rotates the reel axis. A collet clamp is used to secure it.
  • Fasteners: nuts, screws.

Winding of wire onto toroidal cores is carried out using specialized ring-type equipment:

  • The device looks like a shuttle, working on the principle of a sewing needle.
  • The spool is a mechanism of two intersecting rings with a removable sector on which a toroidal frame is installed.
  • The rotation of the spool is set by an electric motor.

Necessary materials and equipment for manufacturing

To make your own machine for winding wire on a round frame, you will need several parts.

Bed from sheet material, fastened by welding. The optimal thickness of the base is 15 mm, the side parts are 6 mm. The stability of the structure is ensured by its heaviness:

  • The side parts are placed next to each other, and holes are drilled into them at the same time.
  • The prepared elements are welded to the base.
  • Bushings are installed in the high holes, and bearings are installed in the lower ones, which can be taken from a used disk drive.
  • The fasteners on the outside of the sidewalls are securely fixed with lids.

Important components of the machine design are shafts:

  • The upper shaft with a diameter of 12 mm holds the reel frame. Its role can be played by a similar structural part of a failed dot matrix printer.
  • The feeder for long material rests on the middle shaft of the same diameter. It is advisable to polish it before putting it into operation.
  • The lower shaft is the feed element. Its dimensions depend on the thread pitch.

The stacker sleeve has a diameter and length of 20 mm. Its internal thread matches the thread of the lower shaft.

The pulleys are three-stage, machined from steel, with a total thickness of no more than 20 mm. Otherwise, you will have to increase the shanks of the upper and lower shafts. Each block contains three grooves with different diameters, depending on the cross-section of the wire. Their width is determined by the belts. This combination provides a wide variety of wire winding steps.

Wire laying device

Laying and winding of wire is carried out using three plates fastened together with screws with a diameter of 20 mm. A small 6 mm hole is made in the upper part, where the tension adjustment screw is inserted:

  • PTFE and steel bushings with a diameter and length of 20 mm are mounted in the upper and lower parts of the inner plate.
  • A leather groove up to 2 mm thick is glued between the outer elements, which is necessary for aligning and tensioning the coil wire.
  • A special threaded rod or mini-clamp is mounted at the top of the stacker, which fastens the outer plates and regulates the tension. The fastening distance depends on the diameter of the wire.
  • For ease of operation, the design is additionally equipped with a folding bracket for the reel.

Manufacturing of turns counter

To determine the number of wound turns on the machine, a special counter is needed. In a homemade machine, the device is made like this:

  • An electromagnet is attached to the upper shaft.
  • The sealed contact is located on one of the sidewalls.
  • The output contacts of the reed switch are connected to the calculator in the place where the “=” button is located.
  • The coil with the wire is placed separately - on another shaft with levers that lift the device up and fold it inside the machine.

Thanks to these elements, the equipment becomes compact and does not take up much space.

Operating principle of the machine

It is not difficult to work on the designed machine. Technological process requires certain actions:

  1. The upper shaft is prepared for work: the pulley is removed, the required length of the coil frame is set, and the right and left disks are installed.
  2. A fastener is inserted into the hole in the upper shaft, centered and the frame is clamped with a special nut.
  3. The required pulley for the primary winding is mounted on the feed shaft.
  4. A stacker is installed opposite the reel frame.
  5. The belt is placed on the pulleys in a ring or figure eight, depending on the type of installation.
  6. The metal wire is inserted under the additional shaft, placed in the groove, and secured.
  7. The wire tension is adjusted using clamps located at the top of the stacker.
  8. The wire should be wound tightly around the base of the coil.
  9. Recorded on the calculator numeric value"1+1".
  10. Each revolution of the shaft adds a given count.
  11. If the turns need to be rewinded, press “–1” on the computing device.
  12. When the wire reaches the opposite part of the frame, use a collet clamp to change the position of the belt.

For different thicknesses of metal wire, the pulley is correlated with the winding pitch.

Many household appliances and industrial automation devices of relatively recent production years have mechanical counters installed. They are products on a conveyor belt, turns of wire in winding machines, etc. In the event of a failure, finding a similar meter is not easy, and it is impossible to repair due to the lack of spare parts. The author proposes to replace the mechanical counter with an electronic one. An electronic counter, developed to replace a mechanical one, turns out to be too complex if it is built on microcircuits with a low and medium degree of integration (for example, the K176, K561 series). especially if a reverse account is needed. And in order to maintain the result when the power is turned off, it is necessary to provide a backup battery.

But you can build a counter on just one chip - a universal programmable microcontroller, which includes a variety of peripherals and capable of solving a very wide range of problems. Many microcontrollers have a special memory area - EEPROM. Data written into it (including during program execution), for example, the current counting result, is saved even after the power is turned off.

The proposed counter uses the Attiny2313 microcontroller from the AVR family from Almel. The device implements reverse counting, displaying the result with cancellation of insignificant

hive to quadruple led indicator, storing the result in EEPROM when the power is turned off. An analog comparator built into the microcontroller is used to timely detect a decrease in supply voltage. The counter remembers the counting result when the power is turned off, restoring it when turned on, and, similarly to a mechanical counter, is equipped with a reset button.

The counter circuit is shown in the figure. Six lines of port B (РВ2-РВ7) and five lines of port D (PDO, PD1, PD4-PD6) are used to organize dynamic indication of the counting result on the LED indicator HL1. The collector loads of phototransistors VT1 and VT2 are resistors built into the microcontroller and enabled by software that connect the corresponding pins of the microcontroller to its power supply circuit.

An increase in the counting result N by one occurs at the moment the optical connection between the emitting diode VD1 and the phototransistor VT1 is interrupted, which creates an increasing level difference at the INT0 input of the microcontroller. In this case, the level at the INT1 input must be low, i.e., the phototransistor VT2 must be illuminated by the emitting diode VD2. At the moment of a rising differential at the INT1 input and a low level at the INT0 input, the result will decrease by one. Other combinations of levels and their differences at the inputs INT0 and INT1 do not change the counting result.

Once the maximum value of 9999 is reached, counting continues from zero. Subtracting one from the zero value gives the result 9999. If counting down is not needed, you can exclude the emitting diode VD2 and phototransistor VT2 from the counter and connect the INT1 input of the microcontroller to the common wire. The count will only continue to increase.

As already mentioned, the detector of a decrease in supply voltage is the analog comparator built into the microcontroller. It compares the unstabilized voltage at the output of the rectifier (diode bridge VD3) with the stabilized voltage at the output of the integrated stabilizer DA1. The program cyclically checks the state of the comparator. After disconnecting the meter from the network, the voltage on the rectifier filter capacitor C1 drops, and the stabilized voltage remains unchanged for some time. Resistors R2-R4 are selected as follows. that the state of the comparator in this situation is reversed. Having detected this, the program manages to write the current counting result to the EEPROM of the microcontroller even before it stops functioning due to the power being turned off. The next time you turn it on, the program will read the number written in EERROM and display it on the indicator. Counting will continue from this value.

Due to the limited number of microcontroller pins, to connect the SB1 button, which resets the counter, pin 13 was used, which serves as the inverting analog input of the comparator (AIM) and at the same time as the “digital” input of PB1. The voltage divider (resistors R4, R5) here sets the level perceived by the microcontroller as high logical. When you press the SB1 button, it will become low. This will not affect the state of the comparator, since the voltage at the AIN0 input is still greater than that at AIN1.

When the SB1 button is pressed, the program displays a minus sign in all digits of the indicator, and after releasing it, it starts counting from zero. If you turn off the power to the meter while the button is pressed, the current result will not be written to the EEPROM, and the value stored there will remain the same.

The program is designed in such a way that it can be easily adapted to a meter with other indicators (for example, with common cathodes), with different wiring printed circuit board etc. A slight correction of the program will also be required when using a quartz resonator at a frequency that differs by more than 1 MHz from the specified one.

When the source voltage is 15 V, measure the voltage at pins 12 and 13 of the microcontroller panel relative to the common wire (pin 10). The first should be in the range of 4...4.5 V, and the second should be more than 3.5 V, but less than the first. Next, the source voltage is gradually reduced. When it drops to 9... 10 V, the difference in voltage values ​​at pins 12 and 13 should become zero and then change sign.

Now you can install the programmed microcontroller into the panel, connect the transformer and apply mains voltage to it. After 1.5...2 s you need to press the SB1 button. The counter indicator will display the number 0. If nothing is displayed on the indicator, check the voltage values ​​at the AIN0.AIN1 inputs of the microcontroller again. The first must be greater than the second.





When the counter has been successfully launched, all that remains is to check the correctness of the count by alternately shading the phototransistors with a plate opaque to IR rays. For greater contrast, it is advisable to cover the indicators with a red organic glass filter.



Also, if anyone assembles a meter on Atiny2313 without quartz,
I programmed the fuses like this



ASM source
Firmware

It so happened that I had the urge to wind the transformer, everything would be fine, but I just didn’t have enough machine - that’s where it all started! An internet search yielded some possible options machine-tool construction, but what confused me was that the counting of turns is again done with a mechanical counter taken from a speedometer or an old tape recorder, as well as reed switches with calculators. Hm …. I had absolutely no need for mechanics, in terms of a meter, I don’t have any speedometers to disassemble, and I don’t have any extra calculators either. Yes, and as Comrade said. Serega from RadioKat: " Good electronics engineers, often bad mechanics! I may not be the best electronics engineer, but I'm certainly a lousy mechanic.

Therefore, I decided to whip up an electronic meter, and entrust the development of the entire mechanical part of the device to the family (fortunately, my father and brother are aces in mechanics).


Having assessed one place to another, I decided that 4 digits of indicators would be enough for me - that’s not a lot - not a little, but 10,000 turns. The whole mess will be controlled by a controller, but it seemed to me that my favorite ATtiny2313 and ATmega8 were absolutely not comme il faut to shove into such a worthless device, the task is simple and it needs to be solved simply. Therefore, we will use ATtiny13 - probably the most “dead” MK that is on sale today (I don’t take PICs or MCS-51 - I can only program these, but I don’t know how to write programs for them). This little girl doesn't have enough legs, so no one is stopping us from attaching shift registers to her! I decided to use a hall sensor as a speed sensor.


I sketched out a diagram:


I didn’t mention the buttons right away - but where would we be without them? As many as 4 pieces in addition to the reset (S1).

S2 - turns on the winding mode (the mode is set by default) - with each revolution of the axis with the coil it will increase the value of the number of turns by 1
S3 - winding mode, accordingly, with each revolution, it will decrease the value by 1. You can wind the maximum up to “0” - it won’t wind to minus :)
S4 - reading information stored in EEPROM.
S5 - writing the current value + mode to EEPROM.


Naturally, we must remember to press the winding button if we are going to wind the turns, otherwise they will flatten. It was possible to install 3 hall sensors or a valcoder instead of 1 and change the controller program so that it chooses the direction of rotation itself, but I think in this case this is unnecessary.


Now not much according to the scheme:
As you can see, there is nothing supernatural in it. All this disgrace is powered by 5V, the current consumes something in the region of 85mA.


From the TLE4905L hall sensor (you can try plugging in another one, I chose based on the principle of “whatever is cheaper and available”), the signal is sent to the controller, an interrupt is generated and the current value changes, depending on the selected mode. The controller sends information to shift registers, from which it, in turn, is sent to seven segment indicators or on the keyboard. I used seven-segment anodes with a common cathode, I immediately had a quartet in one case, but no one bothers those who want to screw on 2 double or 4 single anodes connected in parallel. The dot on the indicators is not used; therefore, the H (dp) pin hangs in the air. The indicators operate in dynamic mode, so the resistance in R3-R9 is less than the calculated value. Drivers for indicators are assembled on transistors VT1-VT4. It was possible to use specialized microcircuits like ULN2803, but I decided on transistors, for the simple reason that I had accumulated them - “like dirt”, some of them are older than me.


Buttons S2-S4 - a la matrix keyboard. The “outputs” of the buttons hang on the same conductors as the register inputs, the fact is that after sending data from the controller to the registers, there can be a signal of any level at the SHcp and Ds inputs, and this will not affect the contents of the registers in any way. The “inputs” of the buttons hang on the outputs of the registers, the transfer of information occurs approximately as follows: first, the controller sends information to the registers for subsequent transfer to the indicators, then sends information to scan the buttons. Resistors R14-R15 are necessary to prevent “fighting” between the legs of the registers/controller. Sending information to the display and to scan the keyboard occurs at a high frequency (the internal generator in the Tini13 is set to 9.6 MHz), accordingly, no matter how quickly we try to press and release the button, during the time of pressing there will be many operations and, accordingly, the zero from the button will run towards the meeting one from the controller. Well, such an unpleasant thing as the rattling of the button contacts again.


Using resistors R16-R17, we pull our keyboard to + power supply, so that during idle time, a 1 and not a Z state comes from the keyboard outputs to the controller inputs false positives. It was possible to do without these resistors, there are quite enough internal pull-up resistors in the MK, but I couldn’t bring myself to remove them - God protects the careful.


According to the scheme, that seems to be all; for those interested, I provide a list of components. Let me make a reservation right away that the denominations may differ in one direction or another.

IC1 is an ATtiny13 microcontroller, can be used with the letter V. The pinout for the SOIC version is the same as in the diagram. If anyone has a desire to use QFN/MLF in the case, the datasheet will be in their hands.
IC2-IC3 - 8-bit shift registers with output latch - 74HC595, on the breadboard I used DIP packages on the board in finished device in SOIC. The pinout is the same.
IC4 is a digital unipolar hall sensor TLE4905L. The wiring according to the datasheet is R2 - 1k2, C2-C3 by 4n7. When installing the sensor on the machine, check which side of the magnet it responds to.
C1, C4 and C5 are power supply filtering capacitors, I installed 100n each, they should be installed as close as possible to the supply pins of the microcircuits.
R1 - with a resistor we pull the reset leg to the power supply, 300 Ohm - and so on. I bet 1k.
R3-R9 - current-limiting resistors for indicators. 33 Ohm - 100 Ohm, the higher the resistance, the correspondingly dimmer the light will be.
R10-R13 - limit the current in the transistor base circuits. On the breadboard there were 510 Ohms, and I screwed 430 Ohms into the board.
VT1-VT4 - KT315 with any letter indices, can be replaced with KT3102, KT503 and analogues.
R14-R15, as written above, to prevent “fighting”, I think you can set it from 1k and higher, but do not raise it above 4k7. With R16-R17 equal to 300 Ohms, the total resistance of series-connected resistors should not exceed 5k; during my experiments, with increasing resistance above 5k, false button responses appeared.


After checking the operation of the meter on the breadboard, it is time to assemble the piece of hardware into a “complete device”.


I laid out the board in SL, and most likely it wasn’t laid out optimally - I adjusted it to fit the existing parts, I was too lazy to go to the market to buy others. In general, I spread it out, printed it on transparent single-sided Lomond film for black and white laser printers. Printed in negative, in 2 copies. Negative - because I was going to make the PP using film photoresist, and it, in turn, is NEGATIVE. And in 2 copies - so that when combined, you get the most opaque layer of toner. I also have no desire for an aerosol can TRANSPARENT 21 buy.


We combine the photomasks, exposing them “to the light” so that the holes line up perfectly, and secure them with a regular stapler - this procedure must be approached responsibly, the quality of the future board largely depends on it.


Now we need to prepare the foil PCB. Someone rubs it with fine sandpaper, someone with an eraser, and I, in Lately, I prefer the following options:
1. If the copper is not too dirty with oxides, just wipe it with a swab dipped in ammonia - oh, stinking garbage, I’ll tell you, I don’t like this activity, but it’s quick. Ideally, the copper will not shine after this, but the alcohol will wash away the oxides and the board will be etched.
2. If the copper is quite dirty, I polish it with a felt wheel. I hang it on the drill and voila. There is no need to be particularly zealous here; I do not use GOI paste; for subsequent etching, only a felt circle is enough. Fast and efficient.
In general, we prepared it - I can’t post a photo, the infection shines like a mirror and nothing is visible in the photo, I’m also a lousy photographer.


Well, okay, then we will roll the photoresist.
I must admit that my photoresist is past its expiration date and the dog refuses to stick to the board, so I have to warm the board up first. I heat it with a hairdryer, but you can also use an iron. It would be nice, of course, to have a laminator for these purposes, but:
- the dough I feel sorry for him now
- when I didn’t mind the dough, I was just stupidly lazy :)


On hot fee roll on the photoresist, not forgetting to remove protective film. We try to do this as carefully as possible so that there are no air bubbles between the board and the photoresist. Fighting them later is a separate ass. If bubbles do appear, I pierce them with a needle.
You can roll in any lighting and not engage in crap, remembering amateur photographers, the main thing in our business is the absence of sunlight and other sources of ultraviolet radiation.
After knurling, I heat the board with a hot iron through a newspaper, this cures punctured bubbles, and the photoresist sticks tightly.


Next, we put the template on the board, here the board is double-sided, so the template will be on both sides of the board. We place this “sandwich” on a sheet of plexiglass and press it with the second sheet on top. 2 sheets are needed so that after one side is exposed, you can carefully turn the board over without moving the photomask.
Let's light it from the other side. I use this lamp:

I illuminate from a distance of about 150mm for 7 minutes (distance and time are selected experimentally).



Next, prepare a weak alkaline solution - a teaspoon of soda ash per half liter of water. Water temperature is not important. Stir until all the soda dissolves. This solution is not dangerous for your hands; it feels like soapy water to the touch.


We remove the protective film from our board and throw it into the solution, after which we actively begin to rub it with a brush - but do not press too hard so as not to tear off the tracks. You can, of course, not rub it, but then there is an option to wash off the photoresist:
- for a long time
- everything will be washed away
but neither one nor the other suits us, therefore three.
we get something similar:

We rinse the board with water, do not pour out the solution - we will need it later. If during the development of the board some tracks have peeled off or air bubbles have spoiled the tracks, you need to retouch these places with tsapon varnish or a special marker. Next we etch the board. I use ferric chloride.


After etching, we rinse the board again with water and throw it back into the alkaline solution to wash off the no longer needed photoresist. An hour is enough.


Next we fool around. For small circuit boards or very jewelry ones, I use Rose alloy; for circuit boards, I simply smear the tin on the board with a soldering iron with a flat tip. In this case, it makes sense to coat the board with flux; I use regular alcohol-rosin.

It may seem to some that the paths did not come out very smooth - the paths came out smooth :) this is the cost of the tinning method with a soldering iron, the tin does not lie evenly.

In the finished version there is no reset button - well, I had nowhere to stick it on the board, so there is not enough space, and if the MK freezes, then I will turn off the power and turn it on again. A diode also appeared in the power circuit - protection against polarity reversal. As for the rest of the parts, I used only those that were on hand, which is why there are both SMD and regular cases.


We attach a sensor to the stationary part of the machine, and install a magnet on the rotation axis so that when rotating it passes 3-5 mm from the sensor. Well, let's use it :)


That's all for sure now, thank you all for your attention, and comrades GP1 And Avreal for assistance in development.


One fine day I needed to wind the coils, and the question immediately arose of how to count the turns, but I didn’t want to count in my head. So the idea came to build a counter from a calculator.
To do this, I needed a Chinese calculator lying idle, a button, a couple of wires and a cam made from a piece of plastic to press the button.

Please don’t laugh at the so-called “machine”: I rarely wind reels, I don’t even know when the next time will be. So I put everything together hastily and didn’t bother doing anything grandiose.
A couple of corners, a threaded rod, nuts, washers of different sizes - all this is available in abundance at the nearest fastener store at very affordable prices.
The rod with the coil frame rotates freely in the holes of the corners.

An obvious improvement for regular use - it suggests itself reed switch instead of a mechanical button and magnet on the fist. Let's get a contactless speed sensor.


Manufactured plastic cam and discovered tact button.


We solder the wires to the terminals of the [=] button (they need to be found and cleaned on the calculator),
and the other ends to the button.


The result is a design like this:


When winding the first turn, set the cam to trigger the button
We type on the calculator


We start winding, the cam goes through a revolution and presses the button, the number 1 lights up on the calculator,
And so on: with each revolution, 1 is added.
1+1=2
2+1=3…
This is what happens gradually: