Any WiFi module that supports ad-hoc mode should be able to do this. I've used the WiFly module before, and I know it has this capability. Note that the module can only be in ad-hoc or client mode at any given time; not both at once.
You can use that module directly with your Arduino (assuming Uno or compatible footprint) via this shield. There is also a standalone shield that might be more space-saving. Of course, other modules are available that are up to the task but these are the ones to come mind.
Here is how I would set up this specifically. In response to your comment, I've modified the approach to fix the problem of what happens if the WiFi association fails.
- Arduino starts up and sets WiFly to ad-hoc mode.
- You connect to the WiFly's network and navigate to the WiFly's "web server".
- You view the list of available networks, enter connection parameters, and click "Submit." * see note below
- The WiFly's response page contains a piece of JavaScript code that fetches a special page with Ajax after some fixed time interval (maybe 2 or 3 minutes). Maybe call the address
http://[WiFly address]:80/status
.
- While the aforementioned timer is ticking, the WiFly has turned off ad-hoc mode and turned on client mode (your laptop will have disconnected from the WiFly, of course). The WiFly attempts to connect to the network you specified. If successful, the WiFly's work is done. If the connection fails, it re-enables ad-hoc mode which your laptop should automatically reconnect to.
- The timer we set in #4 hits 0. The page attempts to asynchronously fetch that special page we mentioned. If successful, we know that the WiFly failed to connect to our network and thus has re-enabled ad-hoc mode. If the request fails, we know that the WiFly connected successfully to the network.
- In the former case, with JavaScript you can display the appropriate message to the user, and maybe even navigate to the WiFly's "home page" to start the process over.
Special considerations:
- You might need to play around with the timeout for step #4.
- Your laptop/device will need to be configured to automatically connect to the WiFly's ad-hoc network and even prefer that network over others.
* Interesting side note:
You might be wondering how the module can scan for networks while in ad-hoc mode. According to the manual:
The WiFly module supports adhoc and infrastructure networking modes.
However, it does not support both the modes simultaneously. Scanning
for wireless networks is a function of infrastructure mode. To do
this, the WiFly module has to disable adhoc mode and scan.
With the
release of firmware version 2.22 and later, it is possible to scan
from adhoc mode. Issuing the scan command temporarily disables adhoc
while the module is scanning. The adhoc is restored automatically
when the scan is complete. If you are connected to the module over
telnet, the result of the scan command is sent over telnet and then
adhoc is restored.
If your requirements allowed a separate user interface (perhaps an application on your laptop), you could have used this feature to your advantage and avoided crafting an HTTP server altogether. The application could have connected to the WiFly's ad-hoc network, opened a Telnet session, and then automated the Telnet session to configure the module.
Alternate approach
If cost is not an issue, you could use two WiFly modules - one to provide a constant ad-hoc network and the other to act as the WiFi client.
In your diagram the power supplies are wired in series 'back-to-back' so the top ESC is only getting the difference between their voltages. Most ESCs have their signal ground connected to battery negative internally. If the signal grounds are connected together and there is a significant voltage difference between them (eg. because the power supplies are in series), a large current could flow which may burn out the wires and/or destroy the Arduino.
Each power supply should be wired to each ESC separately. The ground wires of each ESC signal lead must go to Arduino ground. Powering each ESC from a separate PSU ensures that motor current won't try to go through the signal leads.
If you want to power two ESCs from the same PSU then make sure that the negative battery wires are firmly connected to the PSU with short thick wires. If the negative battery lead of an ESC becomes disconnected then it will draw power through the signal ground wire from the other ESC (not good if your motors are drawing high current!).
Best Answer
As Kevin commented, you can connect them to an Arduino directly providing they're using the same logic voltage. There's no harm in connecting the Arduino directly to the relay control, as the control will be isolated from the rest of the relay. Theoretically, you could pass a high enough current to cause the gas inside the relay to ionise and cause electrical arcs, but at that point I'd be worried for your safety, not the Arduino's. Basically, as long as you're careful when dealing with high currents, then you and your Arduino will be fine.
EDIT: In response to question 2, I doubt you could use just one power cord - you would need one connected to a 120V, 5A (600W) source, and one to a low current one. The exception to this would be if you used a modified ATX Power Supply - this would supply 600W (and so could be transformed to the correct voltage), and also has 5V logic lines which could power an Arduino - this has been done successfully in the RepRap 3D Printer.