Shop OBEX P1 Docs P2 Docs Learn Events
WiFi & IOT for home controllers/monitors using WR703N $20 routers and xx-WRT - Page 7 — Parallax Forums

WiFi & IOT for home controllers/monitors using WR703N $20 routers and xx-WRT

145791019

Comments

  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-07-21 02:47
    RDL2004 wrote: »
    You can find that WR703N for under $25 shipped on eBay. If playing around with one sounds interesting to you, then place an order today. I almost bought one last year on a whim, just in case.

    And the MR3020 should be available outside of China in retail shops.... nearly the same thing, maybe a bit more LEDs and a switch to deal with. A wee bit bigger in overall size.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-07-21 02:52
    Cluso99 wrote: »
    Because one of the OpenWrt spells out how to enable the wireless connection. I posted this back #77 (the link is one of those in #55)
    You have to remove the line that keeps the wireless off in /etc/network
    And then add the lines in /etc/wireless

    I suspect that the ap mode is wrong to get the 703 to connect to the main router and hence the internet.

    Then the WiFi connection should be automatically set up on power up - no Luci commands required.

    I need to re-investigate this.
    BTW, my sense is that you got the wireless and network files reversed.
    You delete a line in the wireless file, and then add lines in the network file.


    What I did was to ONLY enable the wifi in the /etc/config/wireless file. I did not do any additions to the /etc/config/network file (which it did seem as if I should have).

    I may have just configured half the set modifications that are required to reach the outside world.

    I now have an active network that is 192.168.3.xxx, which is what I desired. The next step is to reach the outside WWW.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-07-21 02:59
    NWCCTV wrote: »
    Well, Of the 3 routers I have lying around not a one are on the list!!!! Oh well, will recondition at least one in to a wireless bridge.

    Well, there certainly are routers out there that cannot be modified. Usually it is one of two barriers -- [a] too little flash space, or unsupported (proprietary) wifi chipset.

    ++++++++++++++

    I will say THIS again and again. The WR703N and MR3020 maybe called wifi routers, but they do NOT have multiple LAN ports. They really are more akin to an adapter from LAN to wifi that just happens to become very useful with OpenWrt's additional software packages.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-07-21 03:03
    Cluso99 wrote: »
    Loopy,
    Perhaps you need to disable the /etc/network and remove the additions to /etc/wireless to get Luci to connect to the internet???

    I think ap mode has to be changed to 'lan' or 'wan' to get to the main internet router. Didn't have time over the w/e to do anything. Hopefully I can try later today.
    BTW I do have wifi working with the /etc/network and /etc/wireless mods as suggested but I had to use 'ap' mode.
    I want to plug in my serial and see what is happening there before I try the next things.

    heater,
    When you got the ser2net working outputting those messages, where were the messages showing up via? ie the serial or the Ethernet???

    I am learning while exploring. As long as I can get into the device to reconfigure, I think I am okay. The exploring is as important to me as the destination.

    I may have just been too conservative with enabling the wifi without additional tweaks to the network. I took baby steps as I wasn't sure that the document I was reading entirely applied to me.
  • Cluso99Cluso99 Posts: 18,069
    edited 2014-07-21 03:07
    Heater. wrote: »
    The d-link 615 has a button on the side. For years now I have wondered what on earth it was for. Now I find:

    "The D-Link DIR-615 has a WiFi Protected Setup Button (WPS) on the right side of the router. Wi-Fi Protected Setup (WPS) System is a simplified method for securing your wireless network during the Initial setup."

    Seems I don't need this at all with OpenWRT.

    That button is accompanied by a red and blue LED. I have only seen the blue LED flash at start up with the original firmware. With OpenWRT it does nothing. I have also managed to control the red LED from Luci. The blue one is not to be found in Luci.

    So with luck I have two GPIO I can use !
    heater,
    OpenWRT has a mode where you can push the reset button after it boots and the LED begins flashing (~10seconds later) - press and hold until the LED flashes faster. This causes OpenWrt to go into failsafe mode. So perhaps your switch will be used for this???

    A pair of the GPIO pins on the WR703N can be used for I2C and OpenWrt supports the I2C protocol/device(s).
  • Cluso99Cluso99 Posts: 18,069
    edited 2014-07-21 03:22
    I need to re-investigate this.
    BTW, my sense is that you got the wireless and network files reversed.
    You delete a line in the wireless file, and then add lines in the network file.


    What I did was to ONLY enable the wifi in the /etc/config/wireless file. I did not do any additions to the /etc/config/network file (which it did seem as if I should have).

    I may have just configured half the set modifications that are required to reach the outside world.

    I now have an active network that is 192.168.3.xxx, which is what I desired. The next step is to reach the outside WWW.
    See my post #179 (I have updated the part to add to the /etc/config/network file and the reference link I used for these instructions)
  • Heater.Heater. Posts: 21,230
    edited 2014-07-21 03:23
    Loopy,

    There is at least another option for using the serial port, write your own code to drive it.
    The modified Propeller loader for example.
    The Lua language is included on the routers so one could just write some Lua.

    Cluso,

    It's funny, I was Googling around for what that button does. Seems many others have been having that question since 2009. It's used for WPS which means its of no use. WPS is not supported by OpenWRT out of the box, I have no space for more packages, and well, who needs it anyway.

    The D-Link DIR-615d have a magic failsafe mode. If the reset button is pressed at boot up it does nothing but run a tiny web server on 192.168.1.1. That web server does nothing but allow you to upload an image and reflash the firmware. This is how I did the brain transplant originally, which is just as well because the normal D-Link WEB interface would not accept the images. This magic feature still works when OpenWRT is installed. It seems to be something built into the router outside of the regular firmware. As the documentation says, the DIR-615d are almost unbrickable due to this feature.
  • Heater.Heater. Posts: 21,230
    edited 2014-07-21 03:38
    Yay another big step!

    I just managed to get my PC talking through two routers to the net via WIFI. All done with Luci. No command line hacking required.

    So it looks like this:

    PC
    ethernet
    DIR-615/2 ~~~~wireless waves~~~~DIR-615/1
    ethernet----DSL INTERNET CONNECTION.

    DIR-615/1 is an OpenWRT router with a pretty much out of the box configuration. LAN on 192.168.1.0 but the WIFI has bee set up as the normal AP. It has a bunch of other PCs and laptops on it's subnet.

    DIR-615/2 has been configured as below to put the LAN on 192.168.2.0 and configure the WIFI as a client and it's WAN interface.



    WIFI setup of the "down stream" router using Luci
    =================================================

    1) Change the LAN subnet to 192.168.2.0 (the upstream router is 192.168.2.0)

    Go to Network->Interfaces

    Hit the edit button next to the LAN status.

    Change the ipv4 address to 192.168.2.1

    Hit the "Save and Apply" button.

    Note: This breaks the PC ethernet connection, get yourself connected to the new address.


    2) Configure the wireless interface

    Go to Network->wifi

    Hit the "Edit" button"

    In the "General Setup" tab:

    Ensure network is enabled.

    Set the "wan:" check box.

    Set the mode to "client".

    Set the ESSID to the same as the AP you want to connect to.

    In the "Wireless Security" tab:

    Select "WPA and WPA" encryption. (Should be same as your AP setting)

    Select Cipher "Auto"

    Enter your wireless key.

    Hit the "Save and Apply" button.

    Go to Network->Interfaces

    Hit the "Edit" button next to WAN

    Select the "Physical Settings" tab.

    Select the "Wireless Network" check box as the Interface.

    Hit the "Save and Apply" button.
    =================================================



    BINGO it all works and I'm typing this to you now through it. The internet speed test says it still maintains my 10Mbs up and down speed.
  • Cluso99Cluso99 Posts: 18,069
    edited 2014-07-21 04:22
    heater,

    PC
    ethernet
    DIR-615/2 ~~~~wireless waves~~~~DIR-615/1
    ethernet----DSL INTERNET CONNECTION.

    That is almost what I also have working. This is mine...

    PC
    Ethernet
    WR703N(OpenWrt) ~~~~~wireless~~~~~Xoom(hotspot)+3G~~~~~mobile internet connection

    I was able to get onto the parallax forum and other websites too.

    Great isn't it :)
  • Heater.Heater. Posts: 21,230
    edited 2014-07-21 04:35
    Totally awesome. So far nobody in the house has noticed any change, so my head is going to stay on my neck.

    Now I need to rustle up a Propeller board to connect to the router far end router. There's plenty of room in the box to put another board in there.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-07-21 07:17
    Heater. wrote: »
    It's funny, I was Googling around for what that button does. Seems many others have been having that question since 2009.

    LOL... I am convinced that 90% of the world has no idea of what their router does other than to allow them to plug in more computers.

    The MR3020 has a slide switch with 3 modes, and 4 LEDs. So far I can't quite figure out if the slide switch is engaged or ignored. The LEDs seem to be all configured, but very easy to hijack to other uses (such as debugging a new application).

    And of course there is a Reset button that does what it claims. I guess that is what OpenWrt would use with fast and slow blinking to recover a device that is not acting properly.

    ===============
    And so, I will just keep chasing to keep up with the two of you and your jubilant progress. I have a teaching schedule that keeps pulling me away from this.
  • Heater.Heater. Posts: 21,230
    edited 2014-07-21 08:45
    I got da power!

    That WPS LED on the side of my box is both blue and red.

    I finally found GPIO number of it's blue half and got it under control:

    From the command line, or in a script:
    # Get access to the BLUE LED, GPIO 11
    echo 11 > /sys/class/gpio/export
    
    # Set it's GPIO direction to output
    echo "out" > /sys/class/gpio/gpio11/direction
    
    # Set it high - Turns LED off
    echo 1 > /sys/class/gpio/gpio11/value
    
    # Set it low - Turns LED on
    echo 0 > /sys/class/gpio/gpio11/value
    
    # Release access - THIS DOES NOT WORK !
    echo 11 > /sys/class/gpio/unexport
    
    I basically did this the tedious way by try to export all GPIO from 0 to 15, then trying to set the ones that did not give errors.

    There is something up with "unexport", after I do that I cannot export it again or set it in any way!


    Edit: I just tried all the GPIO from 16 to 31, after 23 I don't get them exported. Setting high or low on the rest shows no sign of life.

    WARNING: Except the system totally hung up after writing to one of the GPIO. So be warned.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-07-21 09:05
    Okay. maybe progress... maybe not.

    My MR3020 now reaches the WWW as I changed the Br-Lan to DCHP client from Static. It works fine as an AP but I want back in to do more. That success seems to disallow me to log into LuCi which I need to request opkg packages over the internet. The openwrt repository is out there.

    Also, I can't seem to get back into a SSH connection either since I changed from 192.168.1.1 to 192.168.3.1. So it seems I have no Luci and no SSH. I guess it is time to try logging in on the Tx/Rx. I suspect I need to get out the soldering iron and build a level shifter to accomplish that... something I was hoping to avoid.

    First I will look into recovery modes... after all I have been ignoring the text entiled Failsafe Mode up until now. Seems I have fool around with cables and buttons to see if I can do something. I am in Attitude Adjustment 12.09

    I do get a LuCi screen, but it doesn't convert to a login.

    Any comments before I go off a cliff?
  • Heater.Heater. Posts: 21,230
    edited 2014-07-21 09:24
    Loopy,

    I'm not sure why anything needs changing to static. I always just let DHCP do it's thing. If you want fixed addresses on your machines then tell the DHCP server to use a certain IP address for the MAC address of the machine.

    I found that when changing my router's LAN subnet, from 192.168.0.1 to 192.168.0.2 and rebooting it my PC could no longer see it. It did not get the change. I had to do a "sudo ifdown eth0" and "sudo ifup eth0" so that it got the new address from DHCP. Then I could get into SSH and Luci again.

    Yep, I always love to have the serial console working on these occasions. We have no idea what state your config is in now so it would be great if you could connect to serial and dump the relevant files out for everyone to inspect.

    Did I say this was a labyrinth? With mines at the dead ends :)
  • Heater.Heater. Posts: 21,230
    edited 2014-07-21 09:27
    Don't you have a PropPlug some place? Or equivalent USB serial adapter?

    I just wired directly to a PropPlug, no level shifter.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-07-21 10:30
    YES. I guess the Prop Plug will do this just fine.

    The situation is this... It works fine to reach the outside world. I just can no longer reconfigure.

    AsusEEEpc_Wifi <<<....>>>> MR3020 WAN0 Bridge to LAN [192.168.3.1] <+++++++>ASUS router to WWW via PPPoE DCHP server [192.168.1.1] <++++++>ADSL modem <+++++++++> WWW

    Of course, my life would be easier if I could remember the password to log into the 192.168.1.1 , but that is not happening so far.
    I am tired, I can try the Prop Plug with a cable tomorrow. I do better when rested.
  • Heater.Heater. Posts: 21,230
    edited 2014-07-21 10:55
    Good idea, take a break, think about something else for a bit.

    If you can get serial into the router you can check how the upstream link from there works and we can all take a look at the configs.

    I worry now that you may have been following Cluso and my instructions too closely. I at least have a different situation. My PC is a wired connection to the first router. And then WIFI to the second upstream one.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-07-21 13:08
    I have realized that you and Cluso were doing something a bit different than myself. So I didn't try to follow the two of you closely. I was trying to follow OpenWRT up until I got all 'experimental' in LuCi.

    If I am lucky, I will be able to do a complete reload and start over.

    If I am not... I guess I am stuck with a little gadget that I can plug into anyone's router and have it sudden become a public wifi free-for-all. (That is if I don't brick it in trying to revive control.)

    Thus are the rites of passage into hacking routers.

    +++++++++++
    As near as I can figure, I got into trouble when I chose to enter a password and convert the device to SSH.

    I suspect I should have first changed the SSID and the network to 192.168.3.xxx.
    SSH apparently didn't like that I switched from 192.168.1.xxx to 192.168.3.xxx
    And LuCi just doesnt like the DCHP client configuration (though it might be that I should have had the gateway and the DNS on the same 192.168.3.1 address).

    I would like to figure out how to avoid repeated the same mistake again.

    I really need a good Linux Router Tutorial and about of week of serious study of it.

    ++++++++++++
    I moved my MR3020 (aka DogHouse) off my ADSL and on to the landlady's network. Other tenets in the building might enjoy a public wifi hot spot with unlimited access for now. It works beautiful as such... but this is a little be subversive. It might open a security hole.
  • Cluso99Cluso99 Posts: 18,069
    edited 2014-07-21 13:56
    loopy, why do you thiink you need a level shifter?
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-07-21 22:35
    If the Prop Plug works, I don't need a level shifter.

    I have to admit I am dragging my feet on this as I may get the Failsafe Mode to work over a LAN connection instead. The Uboot/serial firmware download is more tedious.

    If I use a USB2SER (which is what I had been considering), I thought I needed to invert the signals (high becomes low and low becomes high)... thus using a level shifter would both convert to a +5 and invert the signals. THIS is all wrong, the USB2SER WORKS just like a PROP PLUG.. 3.3V ttl logic.

    It is Tueday 1:30PM here and an incoming typhoon has a local ETA of 2:30PM. So it is time to rush home and settle in to fixing things.

    +++++++++++++++++
    I spent a few hours last night reading LAN tutorials and the MR3020 OpenWRT docs to see why I messed this up.
  • Heater.Heater. Posts: 21,230
    edited 2014-07-22 00:02
    Loopy,

    Your intended topology:

    AsusEEEpc_Wifi <<<....>>>> MR3020 WAN0 Bridge to LAN [192.168.3.1] <+++++++>ASUS router to WWW via PPPoE DCHP server [192.168.1.1]

    Seems to me that is the MR3020 in that picture was my router there is very little that actually needs to be changed to get it working.

    a) Change it's LAN subnet to 192.168.3.1, because we like it not to be the same as the upstream router.

    b) Enable the WIFI and set up ESSID etc.

    I did all this with the router not connected to anything except my PC via ethernet to LAN port. And then connected the router to the upstream.

    Now this is where I get a bit confused. Perhaps you can answer:

    1) I guess your "router" only has a single ether net WAN port. And WIFI.

    2) Normally WIFI is disabled on a fresh router. It was on my D-LINK.

    3) Normally one cannot telnet (or ssh) into a router via the WAN port.

    Is this all true for your router out of the box install? If so I fail to see how you get in via telnet or Luci to configure it !

    All in all I'd be much happier getting the serial console working before trying to configure this thing.




  • Cluso99Cluso99 Posts: 18,069
    edited 2014-07-22 00:49
    I have yet to verify that these actually work (ie I haven't put LEDs or Switches on these GPIO pins) but they seem to work as per the documents I have read...

    Connect Putty via the Ethernet port and SSH [EMAIL="root@192.168.1.1"]root@192.168.1.1[/EMAIL] 22
    Enter login password, then enter each of the following (should be self-explanatory)

    $ echo 13 > /sys/class/gpio/export
    $ echo out > /sys/class/gpio/gpio13/direction
    $ echo 0 > /sys/class/gpio/gpio13/value
    $ echo 1 > /sys/class/gpio/gpio13/value
    $ cat /sys/class/gpio/gpio13/value

    $ echo 14 > /sys/class/gpio/export
    $ echo in > /sys/class/gpio/gpio14/direction
    $ cat /sys/class/gpio/gpio13/value

    In the above example, if you don't do an echo in direction command, it always reads 0.

    Now to attach to my GPIOs some LEDs and switches/pullups/pulldowns.

    PostEdit: Here are some links and pics for more info...
    WR703N PCB and GPIO.jpg


    http://wiki.openwrt.org/doc/hardware/port.gpio
    http://wiki.openwrt.org/_detail/media/toh/tp-link/tl-wr703n/tp-link_wr703n_top-pcb-gpio.jpg?id=toh%3Atp-link%3Atl-wr703n
    http://squonk42.github.io/TL-WR703N/
    http://wiki.openwrt.org/doc/start
    http://wiki.openwrt.org/toh/tp-link/tl-wr703n

    Just came across this command...
    $ /sys/class/gpio# ls
    I will try this shortly.
    900 x 900 - 148K
  • Heater.Heater. Posts: 21,230
    edited 2014-07-22 01:12
    Sounds like the business Cluso. Worked for me, when I can find the right GPIO numbers.

    On my box everything screws up if I unexport a GPIO. It fails with some error and then I can no longer operate the pin or export it or anything until a reboot.

    I tried pins 0 to 31 as inputs hoping I could find one that responded to the WPS button. No luck. I might see if any higher pin numbers are exportable later.

    It was a bad morning this morning. This PC died and internet access was really slow for everyone. I mean like minutes to download a web page. Of course the router upgrade got all the blame, i.e. me!

    Turned out this box had just overheated in the night due to a CPU heat sink being totally jammed up with dust. No idea about the net slowdown, all seems to be well now. Phew...
  • Heater.Heater. Posts: 21,230
    edited 2014-07-22 01:58
    Hey guys, something weird is going on.

    I can no longer access openwrt.org with Chrome. Firfox throws a hissy fit about security but lets me continue if I say it's OK to do so.

    This is what Chrome says:

    Cannot connect to the real openwrt.org

    Something is currently interfering with your secure connection to openwrt.org.

    Try to reload this page in a few minutes or after switching to a new network. If you have recently connected to a new Wi-Fi network, finish logging in before reloading.

    If you were to visit openwrt.org right now, you might share private information with an attacker. To protect your privacy, Chrome will not load the page until it can establish a secure connection to the real openwrt.org.

    Well yes I have recently conected to a new WIFI network, I just built it! But what's all this about "finish logging in"?

    Oddly other secure connections work fine, like https://github.com

    Is this an issue with my router set up here, or something up with openwrt.org?

    I could have sworn it worked yesterday...
  • Cluso99Cluso99 Posts: 18,069
    edited 2014-07-22 02:06
    Well I tried the following, but didn't get a GPIO listing as I expected :(
    [EMAIL="root@OpenWrt"]root@OpenWrt[/EMAIL]:~# /sys/class/gpio# ls
    -ash: /sys/class/gpio#: not found
    [EMAIL="root@OpenWrt"]root@OpenWrt[/EMAIL]:~# cd /sys/class/gpio
    [EMAIL="root@OpenWrt:/sys/class/gpio"]root@OpenWrt:/sys/class/gpio[/EMAIL]# ls
    export gpio8 gpiochip0 unexport

    BTW heater, perhaps you have GPIO at higher addresses???
  • Cluso99Cluso99 Posts: 18,069
    edited 2014-07-22 02:11
    heater,
    FWIW I get the same messages on both Chrome and IE (expired security certificate). There is a bypass button.
  • Heater.Heater. Posts: 21,230
    edited 2014-07-22 02:28
    Ah yes, certificate expired. That is kind of really bad for a provider of router software. One might expect them to be on top of the security thing.

    Now why doesn't Chrome just tell me that so that I know, instead of suggesting something is up with my network. Stupid browser. And why does it not let me bypass that? More stupid browser.

    You should be able to do this:
    root@OpenWrt:~# ls /sys/class/gpio/
    export     gpio11     gpio18     gpio2      gpio21     gpio23     gpio4      gpio6      gpiochip0
    gpio1      gpio17     gpio19     gpio20     gpio22     gpio3      gpio5      gpio7      unexport
    
    or this:
    root@OpenWrt:~# cd /sys/class/gpio/
    root@OpenWrt:/sys/class/gpio# ls
    export     gpio11     gpio18     gpio2      gpio21     gpio23     gpio4      gpio6      gpiochip0
    gpio1      gpio17     gpio19     gpio20     gpio22     gpio3      gpio5      gpio7      unexport
    

    Note that those gpioxx will not be there until you have exported them.

    I will have a hunt around in the higher GPIO numbers later today.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-07-22 03:13
    Okay, I am back into my MR3020.... via the RS232 Rx and TX 115200 8N1 hardwire.

    First I attempted recover LAN and getting the LED to flash quickly for Failsafe mode, but it appears that the configuration was still shut out from that.

    So I got my SER2USB (which is actually NOT inverted AND 3.3v) instead of the Prop Plug. Built a 3 wire cable With a 10K ohm pullup from TX to 3.3V. The TX on the MR3020 goes to RX on the SER2USB and the RX on the MR3020 goes to TX on the SER2USB.

    The Attitude Adjustment v12.09 menu came up without any form of Login and Password and I am now at the prompt but unclear if I am login at root or some other user status.. but the root@DogHouse is included in the prompt.

    Typing 'reboot' at the prompt brings up all the boot process reporting and has an option to hit [f] for Failsafe mode. I ignored that and let the boot run until stopped.

    Hitting <enter> then brings me back to the Attitude Adjustment header and a prompt.

    Verified that I am logged in as root@DogHouse
    ++++++++++++
    It seems that I have a choice.

    A. Embark on a Failsafe reload, then reconfigure.
    B. Attempt to fix the problems from where I am.

    To do List
    1. Revive SSH login, involves Dropbear
    2. Revive LuCi
    3. Get Wifi right
    4. Get LAN right.

    +++++++++++
    The 3 wire cable constructed is good enough for a direct Forth on Propeller ttl RS232, but have not provided for a GPIO to Reset toggle... will have to build a separate 4-wire cable for that.

    And so,
    Slowly getting closer to Milestone ONE, but really MUST learn how all the /etc/config files should be working together.

    I need to reconfigure so that via LuCi I can run either SER2LAN or Minicom with a Propeller connected to the RS232. That means that either LuCi or SSH need to take over the /root login services (which neither can do right now).
  • Heater.Heater. Posts: 21,230
    edited 2014-07-22 03:36
    First order of the day is to list out all your /etc/config files. At least the ones relevant to the network set up. Get your terminal program to log to a file and then do:

    cat /etc/config/wireless

    and so on.

    Stop the logging. Post the resulting output here.
  • Cluso99Cluso99 Posts: 18,069
    edited 2014-07-22 04:11
    Loopy,

    I think your failsafe reboot has restored the settings and now needs a root password.

    Try at the prompt...
    passwd
    and enter your new root password

    This is from here...
    http://wiki.xinchejian.com/wiki/Install_OpenWRT_on_TPlink_WR703N
Sign In or Register to comment.