If a few devices are connecting fine to the wifi and yours connects fine in other locations, then I would unplug the router from the wall for about 15 seconds (this will reset the wifi connections on the routers end)
If this does not resolve it I would suggest calling your wifi provider or router manufactor and they can walk you through changing what channels your router uses for connections.
Usually most routers use the same wifi channels in the neighborhood and sometimes they can interfere or even block some wifi channels.
Ok so then we may be looking at wifi channel interference.
the standard way of checking the channels, is by doing the following
Type in your web browser
^this should be your default router settings address
It will take you to a login screen. The universal login is: Username:admin and password:password
This should work unless your internet service provider changed it at the time of setting it up (very possible its a 50/50 on whether they changed this)
If the above does not get you anywhere then the best place to contact is the router manufactor or ISP (interent service provider) they will be able to walk you through getting stronger router setting to handle more devices at once.
But before you do everything above also check
Settings>wifi>ask to join networks.
Be sure it is on or 'green'
This being on means it will automatically reconnect to any wifi networks youve joined in the past.
You need to type in the router's IP address in the browser window of another device that has successfully connected to the same wifi router.
Also, the URL address of the router should be printed on a sticker taped to the router.
It is usually 192.168.0.1 but could be anothe value, depending on the router manufacturer.
The admin login name and password should also be printed on the same sticker.
The default password for the admin user is also dependent on the router manufacturer.
When I first got my iphone5 back in Dec 2012, it didn't work very well with my existing wifi router (older unit and extremely affordable). After hours and hours of troubleshooting, I decided to get a better router, and it was good money spent!