Finally, here is how I did the job. In short, I separated the two topics of getting a trace of any user using socket.io
and giving a limitations of the number of users.
First, my Arduino Yun is on a Ethernet network where a router, acting also as the internet gateway, is a dhcp server. My Arduino Yun have a static IP address in the subnet of this router (so it is not a dhclient). This can be set either by modifying the file /etc/init.d/network
.
Including the lines:
config 'interface' 'wan'
option 'proto' 'static'
option 'ifname' 'your_interface_name'
ipaddr xxx.xxx.xxx.xxx
or by using the LuCi interface.
For more information about the way to properly configure the network in OpenWRT, see Network configuration.
Then the router is set to authorize only few IP addresses.
The last step is to bridge the Wi-Fi and the Ethernet (WAN and LAN) keeping the configuration of the Ethernet interface. This can be done using the LuCi interface. Be careful of what interface configuration you keep. How to setup an OpenWRT router as a Wi-Fi bridge to an Ethernet router gives the way to do this.
Note that this can also be done using the Arduino Yun as a DHCP server if you don't want to be connected on a network.
In the end, any connections on the Arduino Wi-Fi will get its IP address in the authorized range (up to 16 users at the same time in my case) by the router/DHCP server through the bridge.
In socket.io
, I took the id that is given to any connected client and the IP address to ensure that I have a same user.
About the NFC dynamic tag, I developed a NFC specific board with a dynamic tag in the Arduino Yun/Uno format and its library to push through the bridge between ATmega and Atheros any new Wi-Fi code or any webpage. I think it is outside of this scope so if you need anything about this I can give you in PM.
I finally get at the end a device:
- Connected to an existing network and accessing the internet,
- Serving the webpages I want using my node serve,
- Able to push any information on any other devices on the network through my nodeJS server,
- Enabling access to people to local or network content,
- Serving some specific local information through the NFC shield.