Looking for specifics to make a project (wireless)

Hi.
I got a project where we would like to make a cheap-ish arduino or raspberrypie controller with wireless switches (to send triggers to machines).

The idea is to have one controller for perhaps 1-20 different machines in reach of the controller.
So these wireless units has to be identifiable as seperated units some how.

And in turn the controller unit (arduino or a pie platform) would communicate via a wifi network over internet to a web server where credits are stored. (So one credit should be able to be spent on over the wireless switch or similar stuff to trigger something in the game to give a credit to play for)

What i need for suggestions is the wireless, identifiable switches, and maybe some shields that might needed.

The controller should be able to use an optional 4G connection if wifi stops working.

It is easy enough to get an 'Arduino' (or variant) to communicate with a network... or more so.. a 'webpage'

Your web server/script would need to be able to handle this incoming data/action.. and do 'whatever' it is you want done involving these 'credits'..

ie: update a database or something?

The part you have no touched on is.. how these 'machines' then get/see this updated credit information? Is that part of this project as well? or is that process already in working order?)

You could use an ESP wifi module (one that has as many IO's as you need)... and/or pair an Arduino board up with an ESP module..

  • Arduino would have the switches connected
  • Arduino would communicate to ESP via serial communication
  • ESP would get this incoming serial data
  • ESP would parse this data, and convert it to an action of some kind (whatever your code says to do with an incoming '1' value...etc)

What is the end point here? (Ie: the web server?)

Is there some sort of PHP script or something running on the server that will take some sort of 'info' from the ESP module and translate that into 'credits' (or whatever?)

Respond back with more info.... and myself or others will be able to give more advice.


Alternate solution/thought..

Maybe each 'machine' has an ESP module connected to it..
An ESP module can 'host' its own WEB page.... (so you can connect to this ESP_machine_1 module, using your phone.. it will load a webpage with a bunch of buttons/links...etc)

Each button can be like:

Add 1 credit
Add 2 credit
Add 3 credit..etc (whatever you want them to do)

Upon clicking the button.. it can then add the 'credits' to where/whatever you want?

If the machines are already connected to this web server.. and get its info from it.. this may be an 'overkill' suggestion then.. :slight_smile:

Hi, the webserver (over internet) is controlling the credits amounts and should initiate the credit giving to the correct machine.
Each machine has a pulse trigger to +1 credit for each credit (Think coin slot for credits).

The cheaper side would probably be 1 arduiono controller all the machines triggers. Tha rduino communicates with the webserver, is the starter idea.

The server will most likly use php to serve database information with certain parameters in/out.

The machines are only aware of them selves, but has pulse triggers to give free game or add credits for example. So bascially a remote controlled microswitch-like funktion would be usefull so the controller wont have to be wired to each machine.

I did a little doodle how it is in my mind (- - - <- wireless, ----- Wired towards internet)

The moment you say "WiFi" or "wireless" and "internet", the answer is ESP8266 (possibly ESP32 if it gets seriously complex) and just drop the Arduino. If you need more I/O you use port expanders.

Paul__B:
The moment you say "WiFi" or "wireless" and "internet", the answer is ESP8266 (possibly ESP32 if it gets seriously complex) and just drop the Arduino. If you need more I/O you use port expanders.

Hi. This is possibly the thing im looking for.
I guess the idea is to wire the ESP's onto the games and have them programmed to connect to a specifik wifi access with its own name, and then have the controller (arduino, rpi, similar product) talks to the webserver and sends back a trigger to the specific ESP to close a contact to trigger the pulse?

The web server doesnt 'send back' anything....

*maybe a response the initial submission/action.. but definitely NOT going to all off a sudden 'reach out' to all these machines and make them connect/close a circuit (ie: 'trigger pulse')

Sounds like you might want to use a RaspberryPi as the 'webserver'.. that is also running MQTT broker..

so that it 'can' reach out and update any/all subscribers to the 'topic' of credits.... and in turn the ESP's will close the circuit, making the trigger pulse you are after perhaps?

xl97:
The web server doesnt 'send back' anything....

*maybe a response the initial submission/action.. but definitely NOT going to all off a sudden 'reach out' to all these machines and make them connect/close a circuit (ie: 'trigger pulse')

Sounds like you might want to use a RaspberryPi as the 'webserver'.. that is also running MQTT broker..

so that it 'can' reach out and update any/all subscribers to the 'topic' of credits.... and in turn the ESP's will close the circuit, making the trigger pulse you are after perhaps?

The idea is to have a real webserver / vps, where the credits are stored. and smaller units where the games are located at, to handle the talk to the webserver and call the trigger of the ESP's.

The Raspberry Pi is the 'real web srver'

You can install the normal WAMP/LAMP package -as well as- have an MQTT broker/server running.

If you are not using an MQTT or subscribe and publish type of approach.. you will be wasting resources..

And depending on how many 'machines' you add to your platform.. you may have to have multiple 'servers' (depends on how many connections and request/response delays)

As each 'ESP' will constantly/continually be polling (querying) the database to see if there is a 'credit' that has been added for that machine.

No? ok.. I'll try again.. in 100 milliseconds!! (or whatever threshold you eventually set.. but I would imagine it would need to be fairly frequent to be a usable system)...

Now times that (above) by however many machines/esp's you plan on adding the projects.. (all constantly polling/asking if they been given any credits!??)

The difference between the two approaches is that:

In your current/shared approached you are:

  • calling your friends house to see if he is home
  • his mom answers
  • You ask
  • she says no, hes not home
  • you hang up, and call right back to see if your friend is home yet/again

*** rinse/repeat..

In an MQTT/ subscribe & response system/approach you are:

  • calling your friends house to see if he is home
  • his mom answers
  • You ask
  • she says no, hes not home... BUT... as soon as he gets in, I'll have him CALL YOU.

Make sense?

1 approach is clearly more efficient than the other.

Now...

taking your project, and removing the 'game' portion..

this is nothing more than a simple MQTT (subscribe & publish) project that is done all the time.

This MQTT system can also be 'cloud based' (FYI).. they have many free services (not sure on any limits)***

A bunch of ESP 'clients' are connected to this subscribe and response platform/service...

anytime there is something one of the 'subscribers' needs to know.. data is 'published'.. and any client listening will get alerted.

That 'alerted' subscriber (ESP module) will then simple trigger a relay or whatever that is connected to it..

This whole project could be done in a weekend if you have the hardware. :slight_smile: