0

I am trying to design a laser tag system using multiple NodeMCUs in the guns. I am trying to figure out how to connect and control them over WiFi. I also need a computer connected that will control the game. I was origionally just thinking I could use the PC as a server that tells all the guns what to do. Im sure this is possible, but it looks very complicated and I dont know a whole lot about theese types of things. So then I was thinking it might be better to have another NodeMCU connected to the computer with USB. That NodeMCU would then act as a WiFi server for the clients(Guns). That way, the PC would only have a GUI for that MCU, and once started the MCU would actually control the game. Is that the best option or is there some easier and simpler way? That seems like the best solution to me. I am just making sure this will work. Are there any other solutions or tips? Here is a basic idea of what would happen when someone shoots someone else.

Gun 1 will send IR signal (Shoot) gun 2.

Gun 1 will tell the server that it tried to shoot gun 2.

Gun 2 tells server it got IR signal from gun 1.

Server will first make sure no other guns were shot accidentally at the same time. If they were, it will determine which gun received the IR signal stronger. That gun will be the one actually shot.

Server will add points to gun 1 score and remove points from gun 2 score on both PC monitor and small screens on guns themselves.

Thanks!

Randomaker
  • 71
  • 6

1 Answers1

-1

I would not consider it easier to connect a NodeMCU to the PC just to act as a Wifi interface. Most computers already have means of connecting to a network. Wether it is via Wifi or LAN is not important. Every PC has a LAN port on it's mainboard. You could connect it directly to your Wifi router.

Using a NodeMCU as you proposed would mean, that you have to program for 2 platforms: The main logic on the PC and the Wifi communication on the NodeMCU. That does not really make it easier.

The communication depends on your wanted topology. I would build the PC as Server and the NodeMCUs as clients. You can easily create a webserver programmatically with python, for example with Flask, as I have done it once. Though there even might be better webserver modules for python. It is really not that difficult and you already need to write a program for the game logic on the PC,so why not using python. Though of course you could choose any language, that you like. Python is just an easy choice, that I already did.

chrisl
  • 16,622
  • 2
  • 18
  • 27