Open vickash opened 11 years ago
Hello vickash!
I ordered wifi module and now wait it.
But I have question, can I connect to arduino by USB and WiFi at the same time in one daemon file?
You can connect to two (or more) separate boards, one via wifi, and one via USB, in the same script. But there isn't any way to connect to one board over 2 different connections. If you uncomment the debug
directive (in src/lib/Dino.cpp
) before compiling the wi-fi sketch, the serial connection gets used for debug messages.
Let me know if the WiFi shield works with your Mega please. Given the amount of flash memory that gets taken up when you add either the Ethernet or Wifi library to an Arduino sketch, only boards with more memory (like the Mega), will be able to hold those versions of dino soon.
I think that's fine, because there are cheaper and smaller wireless options than the official shield available. They attach to the serial pins on the Arduino and require zero changes to the code for the serial version of the dino sketch, which is by far the most lightweight.
Here are a couple:
HC-21 Serial Bridge: https://www.youtube.com/watch?v=1Hr_WmiSOO0 ESP8266: http://hackaday.com/tag/esp8266/
The final result of either is the same as the WR703N router. It sets up a TCP server on your wifi network, and passes data between it and the Arduino's native serial interface. You just connect with the TxRx::TCP
class instead, giving it an IP and port number.
I've tried the HC-21, and it was easy to set up and get working, since It's specifically sold as a serial bridge.
The ESP8266 works well, and is the cheapest option, but it needs special firmware since it's designed to be more general purpose than a straight serial bridge.
There's this project: https://github.com/jeelabs/esp8266-lua-bridge, which is trying to turn the 8266 into a serial bridge but leave it's GPIO pins available to remote reset an attached Arduino. This would make it possible to update firmware over the air.
There are a some simple fixes that we should make before 0.12. I'm creating a separate issue for each one. If you can solve any of these problems and want to contribute, read the explanation of the problem and submit a pull request in response to the relevant issue.
The code for the WiFi shield is untested on actual hardware.
I'd buy a WiFi shield and test it myself, but I just can't justify it. I have like 10 of these tiny TP-Link routers with OpenWRT on them.
The code compiles and uploads fine. It's based on the ethernet sketch, which I've tested extensively, and the official Arduino WiFi shield examples. I just don't have any hardware to be 100% sure that it works. If you have a WiFi shield and want to try it out:
From the project root, run
./bin/dino help
to see how to set options for the WiFi sketch. You should just need to give it your network's SSID and password. It only works with WPA and WPA2, cuz you shouldn't be using WEP anyway. Then run./bin/dino generate-sketch wifi
with your options.IP is not settable (Arduino issue), so once it's connected you'll have to find its IP on your router or something, and try to connect to it with
Dino::TxRx::TCP
. See the example atexamples/ethernet.rb
for a starting point, just swap out your IP. The ethernet sketch and wifi sketch talk to Ruby the same way, it's just some of the Arduino code that's different.PS: You'll need to add
#include <SoftwareSerial.h>
at the top of dino_wifi.ino to make it work. That change should be committed as well.