Thoughts about WiFi

Post Reply
enigma32
Posts: 74
Joined: Fri Apr 26, 2013 11:48 am
Location: Los Angeles and NYC

Thoughts about WiFi

Post by enigma32 »

First of all, let me say that I was very excited to receive my hardware in the mail today! It was painful having to wait for the end of the workday before jumping in head-first to get this thing up and running.

That said, I have a few observations I thought would be worth bringing up:

1) WPS setup did not work for my Wifi attachment. I tried both using the button and the "wps" command via serial. I see that the app is there (though not named just "wps_app"), but I'm not sure how to make it run. (The LEDs never blinked differently, which I understand to be the indication of being in WPS setup mode.)
2) After deciding that WPS wasn't going to work, I looked at using the wifi setup wizard. Unfortunately I couldn't find it. I'm sure it wouldn't be an issue if I were on windows, but I'm not sure where to find it for use in linux.
3) I skipped the WifiSetup arduino sketch and went right to manual configuration over a serial line. FYI, my Wifi Attachment came preconfigured for 57600 baud, as opposed to the 9600 indicated in the Wifi Attachment manual. I was really confused why nothing was working until I tried that :-)
When I saved the settings the device indicated that there was a configuration issue, however after reboot it connected to my access point without incident...

Most importantly:
4) I think there are some serious security issues with using port forwarding to make these devices accessible from outside. It took me exactly one try to crash my controller from outside my home network. I'm relatively sure there is not a good way to protect against the particular type of attack I tested. I think adding the access credentials (as was done very recently) is a good start, but not an effective solution for the long term.

As a possible solution, I propose switching to either frequent polling or, ideally, long-polling from the embedded device to the "real world".
Upsides:
- No need for port forwarding (easier setup!)
- Don't care about dynamic addresses (easier setup!)
- Not possible for an attacker (or accident) to crash the controller from outside the home network

Downsides:
- Requires an outside server for remote connections, rather than allowing for direct connections from mobile devices
- Slower response time when given commands from mobile devices or the Portal

I think with a proper implementation this would be almost imperceptibly slower than using direct connections, and would be a lot safer with a lot less hassle.
With the remote server source code distributed openly, this would allow for a single central server that could be used, or for individuals to run their own outside access if they are so equipped. It could even be integrated seamlessly with the Portal (either directly, or as a proxy of sorts).

As long as the mobile clients and Portal supported it, this scheme could be used alongside the existing topology without an issue. Users could choose which firmware to build.


I plan on doing this for myself regardless of feedback here. However, I'm hoping to gauge interest and hopefully have something that everyone can benefit from.

Thoughts?

Thanks,
-Matt
Current setup:
60g 24" custom cube (fish and softies right now)
AI Sol Blue, Ecotech MP-10wES
Coralife skimmer
100% customer controller, transitioning to ReefAngel
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Thoughts about WiFi

Post by rimai »

Hey Matt,

I've always wanted to do that, but never got my head around on how to accomplish.
The Portal server is windows based. Is it possible?
By the looks of it, you know what needs to be done :)
I'd love to see what you can come up with!!!
By the way, the new firmware 4.00 was just released and I did not have time to change the manual.
I'm still going back and forth with the manufacturer on how to better handle the wifi setup.
The default is not WPS anymore. They actually created a softAP built-in that implements everything from wireless AP to DHCP and everything you need to connect to a separate wifi network, so you can simply connect to "ReefAngelWifi" wireless network, either with your PC or smartphone and browse 1.2.3.4, which will bring up the internal webserver for configure the settings.
I was very excited and it worked very good until I realized the way it is won't work for us.
So, I'm in touch with the manufacturer to see how to handle it.
There are much more detailed instructions on how to get this done in their manual.
But it looks like we will dump the WPS, since it wasn't much used by anyone anyway.
Roberto.
enigma32
Posts: 74
Joined: Fri Apr 26, 2013 11:48 am
Location: Los Angeles and NYC

Re: Thoughts about WiFi

Post by enigma32 »

Cool, if you're on board then I'll definitely see what I can come up with over the weekend.
I don't think it should be a problem having a Windows server... the server app could easily be a Java program that just runs in the background... or if there are any masochists around here they could write it in .Net (I won't touch the stuff ;))
I'll keep an eye on this thread in the mean time in case anyone else has any thoughts about this.

As for the wifi config... that explains a lot! The internal AP sounds pretty interesting. Oh well, at least I got it working :-)
Current setup:
60g 24" custom cube (fish and softies right now)
AI Sol Blue, Ecotech MP-10wES
Coralife skimmer
100% customer controller, transitioning to ReefAngel
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Thoughts about WiFi

Post by rimai »

I think you were the first one that used that section of the manual :)
Anyway... It need to be updated too.
Here is a list of commands I send when I setup the modules before they are shipped:

Code: Select all

set ftp address 198.175.253.161
set wlan ssid testing
set wlan pass a01b02c03d
set option deviceid ReefAngelWifi
set w j 1
set c c 0
set c r 0
set c o 0
set c i 3
set dns name www.reefangel.com
set i h 198.171.134.6
set i r 80
set i f 0x06
set s t 0x10
set u m 2
set i p 2
set u b 57600
set s p 0
set c s 1420
Roberto.
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Post by binder »

i can help test with the android app. if you have an android device, i can generate a custom test build to try stuff out or if you know how to build android apps, my source code is posted on github (and my private git server).
enigma32
Posts: 74
Joined: Fri Apr 26, 2013 11:48 am
Location: Los Angeles and NYC

Re: Thoughts about WiFi

Post by enigma32 »

rimai: haha it doesn't surprise me-- I'm glad you had that section in there though, otherwise I would have been stuck... And thanks; that list of commands will definitely be handy, especially after all of the configuration changes I've been making over the past few days.

binder: Great to hear. I actually do have an android dev environment set up here, so I can coordinate with you on that.

Also, after a number of issues, I'm happy to report I have an elementary proof of concept working!
At the moment, it just stays connected to a simple server program I wrote (with 60 second long-polls), and switches the backlight off and on depending on commands sent to it in a simple time loop. But this shows that what I had in mind will work. I believe the polling can be extended as well, to reduce the network overhead, but that is a relatively trivial and unimportant task.

The next step is to whip up a real server app and reimplement commands handled by the current wifi implementation in the server and on the embedded side. Once I've got that done, I'll be at a point where I can share code and probably run a test server to work out the bugs.
Might take a couple weeks to get to that point, but I want to get this finished so I can actually use my toy, so it'll go as quickly as possible :-)
Current setup:
60g 24" custom cube (fish and softies right now)
AI Sol Blue, Ecotech MP-10wES
Coralife skimmer
100% customer controller, transitioning to ReefAngel
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Thoughts about WiFi

Post by rimai »

That's awesome!!!
Just remember that that the server application must be able to hold all the connections open from everyone and be able to service every single one independently.
Roberto.
enigma32
Posts: 74
Joined: Fri Apr 26, 2013 11:48 am
Location: Los Angeles and NYC

Re: Thoughts about WiFi

Post by enigma32 »

yeah, I've definitely got that in mind, and I've already got plans to account for individual users on the forum potentially having more than one RA device.
Once I've got the basic outline of this thing I'll run it by you in a couple days to see if I've missed anything.
Current setup:
60g 24" custom cube (fish and softies right now)
AI Sol Blue, Ecotech MP-10wES
Coralife skimmer
100% customer controller, transitioning to ReefAngel
dapg8gt
Posts: 104
Joined: Tue Apr 16, 2013 7:33 pm
Location: 650 Bay Area..

Re: Thoughts about WiFi

Post by dapg8gt »

Subscribing to this one as I am all for more secure connection.. I don't know much about what you guys are talking about LOL but I want to..

I will go along for the ride just to be aware and research on my own what I should be doing and looking forward to..

Thanks in advance this sounds like a good thing in today's world.
My other hobby has 450rwhp and eats tires instead of mysis!
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Thoughts about WiFi

Post by binder »

yeah that's fine. just let me know.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Thoughts about WiFi

Post by rimai »

Also, what happens if the connection breaks somehow? Is it going to just reconnect on the next cycle?
Roberto.
enigma32
Posts: 74
Joined: Fri Apr 26, 2013 11:48 am
Location: Los Angeles and NYC

Re: Thoughts about WiFi

Post by enigma32 »

Yup. Right now I have a 10 second timeout for retries for the 60 second polls, but we can of course set that to whatever. I have further testing to do with things like having the access point itself disappear, but I've done some testing with just refusing connections on the server end (killing it while there was a connection active and also before booting the controller) and randomly cutting and restoring power to the controller itself.
Current setup:
60g 24" custom cube (fish and softies right now)
AI Sol Blue, Ecotech MP-10wES
Coralife skimmer
100% customer controller, transitioning to ReefAngel
thekameleon
Posts: 137
Joined: Sat Feb 16, 2013 7:44 am

Re: Thoughts about WiFi

Post by thekameleon »

How does this scale? Would each controller effectively have a dedicated connection? (e,g, streaming)
Post Reply