Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Help please


New Member
Hello, I’m quite new to this field and was hoping to get some step by step guidance on a project please. I am looking to build a small counting device working with motion sensor to count up and count down with plus and minus buttons. (I’m trying to build an ammo counter for an airsoft rifle). Ideally I would love to put an IOT chip in the device to connect to an app which can display information from the device.

Can anybody give me a guide on what I need and how to do it please.

Many thanks


Well-Known Member
Most Helpful Member
So my first read is you want to increment or decrement a counter, count down from n or count up to n. This is where n is a variable preset. You start with a sensor but you need to decide how you want to sense. For example I could place a sensor at my muzzle and have a preset of 20 rounds of ammunition. Each shot will decrement the count as 20, 19, 18, ... 0. You mention buttons which can be used to preset a count? That what you have in mind?

A project like this can be built using a pile of discrete components or simply using a uC (micro controller). Any number of available pre assembled uC boards would work. You would need to develop some programming. Likewise any number of displays can be interfaced with your uC to display a count. The sensor can be a simple beam break where as a projectile exits the barrel a pulse is generated which decrements or increments a count. What I am doing here is trying to make you a simple sort of plug and play solution.

Using discrete components also is an option but will require considerably more effort and parts.

Define exactly what you want.

If as you mention you want an IOT to send data to for example a smart phone that is also doable. The assorted ESP 32 modules are popular for this. A Google of "node mcu esp32" will get you a dozen hits. I have played around with boards like this one. Widely available on Amazon and other distributors and inexpensive. They send data WiFi or BlueTooth so data is easy to view on a smartphone using a browser. I am currently monitoring temperature and humidity and can use my PC web browser or smart phone to see my data. The data could just as easily be a shot count.

Last edited:


New Member
Thank you Ron, thats very helpful. To be exact, I am looking to 3d print a case which will be 2.5 inches in length and 1 inch in height with compartments inside for electronic components. Ideally, the discrete components may be more ideal. In a nutshell, I am looking to clip this device to a rifle magazine (easily clipped on and removed) and the device have the capability of counting up as bullets are inserted and counting down as bullets are fired.

Thank you very much for your help and support.


Well-Known Member
Most Helpful Member
Well alrighty then. :) I do not shoot airsoft but I do shoot mostly high power rifle and some handgun. Starting with a sensor one would really need to see the magazine. Most rifle magazines have a floor plate, a spring pushing down on the floorplate and on the top what we call a follower. Each round loaded into the magazine creates more downward force on the mag floorplate. Sensing pressure on the floor plate may be one way to sense how many rounds are in the magazine. That just being a single possible example. Having no experience with airsoft I have no other options to offer but can tell you a round count will start with some form of sensor.



Active Member
Here is an approach used by new learners to program an Arduino. Board is $ 3, Arduino Nano.

mBlock is application, you drag and drop blocks onto design canvas, config, and mBlock when you
are done generates C/C++ code for the Arduino. You can see that in right window. Kids in 6'th
grades on are using mBlock to program robots.

Here I have implemented functionality of Up and Down buttons, and then written data to LCD display.
Adding sensor to this quite easy as well. And maybe a button to initialize/reset the counts and display.



mBlock is free. There are a number of gui IDE/programmers like this, Flowcode, Snap4arduino, Scratch, NodeRed, each with common
capabilities as well as specific ones. Once you learn one the rest quite easy to use. Lots of videos to learn from. And you can as you
develop, look at C/C++ code generated to get an idea of what that looks like.

If you want to do IOT consider TUNIOT, web version free. That allows you to do all sorts of communications with phones and other PCs.
Its graphical also. An example for a different problem -

I am doing an application now that uses ESP8266 to measure a Gas alarm detector and notify a person on their cell phone
if a problem at site exists, fire/gas leak....etc.. Tuniot and ESP8266 very versatile.

Regards, Dana.
Last edited:

Latest threads