#BigGun. The simplest "frame" chronograph on the Arduino (measuring the speed of a bullet)

fool - she is such a bullet!


Electrically the sensor design consists of conductors only. Elementary.


No strapping - in principle - these are two “buttons” from the masses to ports 2 and 3, simpler than a detector receiver!


assembly of the device was carried out under the cover of night - for the summer-heat ;-)


A small excursion into history (italics) - I have been engaged in air guns for more than 20 years, and all this time I used the method of a ballistic pendulum to measure the speed of a bullet.
But Shotgun appeared - energy vs. 4.5mm magnum - 100 times !!! more - do not use the same log on suspensions!


At that time, I had already started using the Arduino for peaceful purposes._


Based on the construction of Mikhail Shevchenko on two pairs of optical sensors.


Made an option that is mounted on the barrel, but the return even spring pneumatic after a few shots destroyed the LEDs.


I tried to assemble a universal frame monster with a variety of optical sensors - FAIL.


Having decided to simplify, I came to the described construction, nowhere else ;-)


The principle of sensors borrowed from the creators of the program Airspeed (originally from the 90s).


sensor device


Just add a microcontroller (accuracy - an order of magnitude higher)!


That is, when it worked, it just looks like that!


Unlike sound cards, I had to operate not with an analog signal, but with a transition from logical 1 to 0.


Success was preceded by many experiments - 2 variants of the framework, 3 types of electrical "strapping" and 4 edits of sketches (programs).


Pulling the voltage on digital pins (PULLUP) turned out to be the most vital and stable solution!


As a result, the probability of making a mistake when repeating this scheme is scanty!


Everything, further there is no time to explain, the sensors can be assembled just by looking at the photos.


assembled and ready to work device


So, we start the game in SPECKS - raw materials - wooden bar 15x10x5cm, two pieces of plastic sheet 15x15cm, 2.5 mm thick.


On a greater thickness of the framework - the sensors may not work, on a smaller one - to short from the blow of the breeze.


You can take a 3-mm corrugated cardboard, balsa, or even make a frame of the usual lines!


The main thing to remember - 4mm thickness - is already a lot, it stops working at six!


The size of the "window" within - 9x9cm (initially there were ten) is not enough?


If you cannot get into the top ten, in the literal and figurative sense, then it’s too early to talk about the need for a chronometer!


Next - cut pieces of food foil 11x14 cm and with the help of an ordinary adhesive pencil gently fasten the frame on both sides.


The latter are fastened to the base (bar) so that the distance between them is 10 cm (the chronograph base embedded in the sketch).


At the same time, the bar itself should already be 100mm. on the thickness of one frame (in fact, the wood itself decreases in size as a result of drying out at the warehouse ;-)


U-shaped frames are made for reasons of "reusability" of one "set" of foil - after each shot with a ruler we draw between pairs of plates in order to break the contact in the area of ​​the bullet holes.


For the convenience and simplicity of ensuring contact with the foil clamps were made on the basis of pegs:


handy materials go into the business - even the clothespins were useful!


As conductors, I took a twisted-pair stranded wire - all ends were scored (we remember that copper and aluminum are not directly connected!)


So we figured it out.


Now let's move on to the microcontroller - everything is debugged on the arduino Uno (Atmega-328) 16Mhz + LCD Keypad Shield.


So, the text of the sketch (program):


//   #include <LiquidCrystal.h> //!    -     !!! LiquidCrystal lcd(8, 9, 4, 5, 6, 7); // : //  unsigned int data = 0; //     volatile unsigned long int time1 = 0; volatile unsigned long int time2 = 0; void setup() { //     LCD lcd.begin(16, 2); //      attachInterrupt(0, sensor_1, FALLING); attachInterrupt(1, sensor_2, FALLING); //     -  pinMode(2, INPUT_PULLUP); pinMode(3, INPUT_PULLUP); } void loop() { lcd.setCursor(0, 0); lcd.print("CHRON 100mm base"); //    nogood: //    -  -     #   CHRON if ( digitalRead(2) == LOW ) { lcd.setCursor(5, 0); lcd.print("#"); goto nogood; } else { lcd.setCursor(5, 0); lcd.print(" "); } //    -  -     #   base if ( digitalRead(3) == LOW ) { lcd.setCursor(11, 0); lcd.print("#"); goto nogood; } else { lcd.setCursor(11, 0); lcd.print(" "); } lcd.setCursor(0, 1); lcd.print("Speed "); lcd.setCursor(6, 1); lcd.print(data); lcd.setCursor(13, 1); lcd.print("M/S"); delay(100); while ( time1 == 0 && time2 == 0 ) ; delay(100); if ( time1 != 0 && time2 != 0 && time2 > time1 ) { data = 0.1 / ((time2 - time1) / 1000000.0); // v = s / t } // Serial.println(data) //      -       LiquidCrystal (lcd), //   - Serial.println -      Arduino IDE lcd.setCursor(6, 1); lcd.print(data); time1 = 0; time2 = 0; } void sensor_1() { if ( time1 == 0 ) { time1 = micros(); } } void sensor_2() { if ( time2 == 0 ) { time2 = micros(); } } 

In short, the principle of operation - with the PULLUP command on pins 2.3, a pull-up voltage is turned on (with internal resistors of 20-50 kΩ)
Span of a bullet does the short circuit registered by interruptions (sensor FALLING) as the fastest arduino commands.
Knowing the time difference and the distance between the sensors, the bullet velocity is calculated.


The order of sensors is IMPORTANT - the first one is for pin 2!


Everything.



Someone will argue that energy is spent on breaking through the foil, and the real speed of the bullet will be higher!


At first, everything seemed to be so!


Compared with the speed measured one and a half years ago by the device with optical sensors (280m / s) - the device on the foil gave out 260!


Energetically - this is 22Joule v 19! - loss immediately treshki!


But as soon as I reduced the base to 100mm, the "foil" began to show the correct result - why - a mystery!


Bullets used Luman FT 0.56gram, devices based on the same microcontroller, the base in both cases is 100mm, one rifle


Diana-54 Airking


Now about the stability of the testimony - out of 5 shots, the “release” is only one at a time, the numbers of the others - converge.


Yes, and last, ask - why in the age of electronics reinvent the wheel?


It's very simple - the answer is a shotgun!


When measuring the speed of charge on the flight - no problem - any device will do!


But at a distance the fraction tends to be scattered (the standard target for checking the talus is 75x75cm).


Now imagine the option of measuring the speed of a charge at 35 meters - if even a Chinese device for $ 50 is blown apart, it will be insulting.


Exit - either to "book" the case and sensors (enough boards 40mm), or use disposable.


There is something to measure and why - a ban on hunting with lead on reservoirs is not far off (after Europe), it will be necessary to use steel shot, in stores for such cartridges there will be queues (or a high price).


When self-collecting cartridges, one does not want to use the old-fashioned methods of evaluating the effectiveness of entering a dry pine board.


Apt for you shots, and to hunters - Not Down, Not Per!


To new meetings on Habré, Andrey.

Source: https://habr.com/ru/post/414745/


All Articles