When I heard about the programmable SpikenzieLabs Calculator Kit I knew just what I wanted it to do. I wanted to hack the SpikenzieLabs calculator kit into a subnet calculator.
I support over 800 Internet devices so every day I run across the need to calculate subnets to find the useable host IP range. I end up Googleing “subnet calculators”. Then enter the IP and subnet mask to get first and last usable IP in the range. It’s not hard to do but just a PITA.
I thought it would be cool to add subnet calculation functionality to the SpikenzieLabs calculator. All my subnet calculations are on Class C / CIDR subnets so I can easily represent everything I need on a 6 digit display.
I hacked the stock SpikenzeLabs v1.1 calculator sketch that I downloaded from the SpikenzieLabs website to add the subnet calculator functionality. Because I have not programmed in many years and this is my first Arduino project I prefer to call my work a hack as not to insult real programmers. I am sure there are some bitwize operations that could do the CDIR calculations but I just hacked my code together using case statements. I was more interested in the functionality then I was in elegant coding and conserving RAM or CPU cycles. If anyone can clean up my code feel free to do as you wish.
How to use the subnet calculator on the SpikenzieLabs calculator kit using my custom sketch vt1.1
In this example I will be using an IP of 18.104.22.168 and subnet mask of 255.255.255.248 (ie /29). This has 6 usable IPs with a range of 22.214.171.124 – 126.96.36.199.
On the calculator
1. enter the last octet of the IP 123.
4. enter the last octet of the subnet mask 248 or the CDIR notation 29. For CDIR do not enter the forward slash (/).
I am more then thrilled with the SpikenzieLabs Calculator Kit and my subnet calculator hack. I always keep it within arms reach on my desk. The best part is how fast it is compared to using an online subnet calculator. Now I can calculate a usable IP range from an IP and subnet in less then 10 seconds.