Shop OBEX P1 Docs P2 Docs Learn Events
The $30 (or less?) Wifi Wireless Propeller programming interface — Parallax Forums

The $30 (or less?) Wifi Wireless Propeller programming interface

LoopyBytelooseLoopyByteloose Posts: 12,537
edited 2014-09-25 11:00 in Propeller 1
Heater, Cluso, and myself spent a lot of time exploring the WR703n and MR3020 wifi mini-router devices and successfully reconfigured them so create a RS232 Tx, Rx, and Reset and/or a USB to Propeller interface with OpenWrt firmware.

These devices are tiny (less than 3 inches x 3 inches x .9 inches) and low power (less that 0.6 watts at 5VDC). They have been successfully operated on a single Li Ion 18650 cells in portable operations.

I am getting the MR3020 in Taiwan for $20USD. It is also available in the USA and Europe, but seems to cost more in those markets.

http://www.ebay.com/itm/TP-LINK-TL-MR3020-Portable-3G-4G-USB-Modem-Internet-Share-Wireless-N-WiFi-Router-/281138266677?pt=COMP_EN_Routers&hash=item4175258235

Heater has even cross compiled a Spin compiler and his pi-propeller-loader into binaries that have worked. So a user with a Android or Apple touch pad can write Spin code, transfer the file to the device, have it compiled, and then load the binary to the Propeller ... all via Wifi.

I also have used it for my preferred Forth interface and have installed Minicom for an RS232 link to an active Propeller. The link is stable for days on end.

If anyone is interested in using OpenWrt firmware to hack into one of these devices. I am including the attached Zip files to make it easy to get started. But there will be a bit more to explain.

Just consider that this wireless programer costs about twice the price of a PropPlug interface, but can provide a wireless terminal and Real Time Clock services. If you use the RS232 port, you can program in direct ttl level RS232 rather than bother with plugging the PropPlug into the provide USB port.

Of course, OpenWrt is all a Linux project... so Linux adverse users are out of luck.

http://wiki.openwrt.org/toh/tp-link/tl-mr3020
http://wiki.openwrt.org/toh/tp-link/tl-wr703n


Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2014-09-04 10:03
    I'm not Linux adverse but I'm pretty Linux ignorant.

    Would the code you posted work with this thing?

    It's one of the options shown when I searched for "TP-Link TL-MR3020".

    Do you now of a better cheap router to try the code with?
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-09-04 10:13
    No, the WR-702 doesn't have enough firmware Sram space to work with the code from OpenWrt.

    You need a WR-703 or an MR-3020. There are other choices as well, but it gets hard to support all and every possibility. These two are among the most commonly available and lowest in cost that have everything to do the job.

    BTW, I own a WR-702 that I bought by mistake. I can't easily hack it, but it is a very handy mini-pocket-router that works well. It just won't program a Propeller unless you replace the Sram chip and maybe the Dram as well. It becomes a big job and may not save you any money.

    Both the WR-703 and the MR-3020 has a USB port that will directly connect to Propeller boards that use USB to program. If you only desire to program via the USB port, you don't have to open the device or solder anything.... just load the new firmware, reconfigure, and use.

    This might be a useful device for teachers to use in schools as a shared wireless programmer. That is why Heater compiled and tested compiling Spin into binaries on it.
  • Cluso99Cluso99 Posts: 18,069
    edited 2014-09-04 14:59
    I have a few different routers. So far, the WR703N seems the easiest to me and it has the required minimum memory configuration.
    Our link to the project is here
    http://forums.parallax.com/showthread.php/156414-WiFi-amp-IOT-for-home-controllers-monitors-using-WR703N-20-routers-and-xx-WRT
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-09-04 23:12
    Cluso prefers the WR703, which he located on EBay out of China.
    Like here ===> http://www.ebay.com/sch/i.html?_nkw=TP-Link+TL-WR703N

    I have the MR3020 which I was able to buy retail in Taiwan.

    It seems that the WR703 was intended to be sold in China only, whereas the MR3020 is being sold in North America and Europe. I have no idea why.

    The MR3020 is a bit larger and has a 3 position switch for different functions, more indicator LEDs. But it also has an easier to attach header -- TX, RX, with GND and 3.3VDC. Other GPIO has to be set up by soldering and working with very tiny pads on the board.

    IF you choose the WR703, you may have to have better soldering skills to get an RS232 port as there are NO holes provided for a header for the TX, RX, GND, and 3.3VDC in its motherboard.

    ++++++++++
    I do want to emphasize that you can used the USB port and a PropPlug if you don't want to open the device and don't want to solder anything. You just have to load the OpenWrt firmware and configure.

    The RS232 offers a lower power, less clutter choice for direct ttl programing of the Propeller. And you will need the RS232 if you mess up your configuration and want to rescue the unit via OpenWrt's Failsafe mode.
  • jazzedjazzed Posts: 11,803
    edited 2014-09-05 08:20
    Does this WRT package have a web browser control?

    The original (slapped by Stallman) Cisco WRT uses web pages for configuration.

    It would be neat to have it startup with a web-app for programming instead of requiring apps for a dozen phones, tabs, and desktops.
  • Heater.Heater. Posts: 21,230
    edited 2014-09-05 09:36
    Jazzed,
    Does this WRT package have a web browser control?
    Yes, openwrt has a web configuration interface. It's optional though.
    The original (slapped by Stallman) Cisco WRT uses web pages for configuration.
    Please elaborate. I have no idea what Cisco WRT is or why Stallman would slap it.

    Openwrt is basically just another Linux distro tailored for the very tight memory constraints of these devices and built for whatever processor architecture and hardware they have. I'm sure Stallman would approve.
    It would be neat to have it startup with a web-app for programming instead of requiring apps for a dozen phones, tabs, and desktops.
    Yes indeed. I have been thinking about that.

    Ideally such a router could serve up the Propeller IDE web interface as requested on the "Propeller IDE for Chromebook" thread.

    The Spin compiler could be run on the router (we have done that) or in the browser, whatever. The binaries could be sent back to the router for programming into the Propeller. We know we can do that already.

    A couple of problems with this whole idea:

    1) There are hundreds of different routers out there. And they seem to keep changing all the time. Different versions of the same model can be totally incompatible. Loopy has offered binaries for one such hardware, which is great, but in general it's impossible to keep up with.

    2) Most routers don't have enough FLASH space to add new and interesting stuff, like serving up the Propeller web IDE and doing the compilation.
  • jazzedjazzed Posts: 11,803
    edited 2014-09-05 09:51
    Heater,

    Let's just say that WRT was a "collaboration" between Cisco and the FSF ;-)

    It has been running on my WRT routers for years and years.


    So there isn't enough room for any web content?

    Does openwrt support WifiDirect connections?
  • David BetzDavid Betz Posts: 14,516
    edited 2014-09-05 10:00
    Heater. wrote: »
    J2) Most routers don't have enough FLASH space to add new and interesting stuff, like serving up the Propeller web IDE and doing the compilation.
    Don't these routers tend to have USB ports? Can't you plug in a cheap USB memory stick to gain additional program storage space?
  • Heater.Heater. Posts: 21,230
    edited 2014-09-05 10:13
    Jazzed,


    Well now I don't know. I have no idea if WRT is anything to do with openwrt. As in https://openwrt.org/ And I have no idea what the FSF has to do with it. Apart from authoring the licence that most of it is published under.
    So there isn't enough room for any web content?
    Well, on my old DLINK DIR-613 no. Not even enough room to add the propeller loader. The devices Loopy is using may well have useful free space.
    Does openwrt support WifiDirect connections?
    Might be. No idea. What on earth is "WifiDirect connections"? Never heard of such things.


    So far I have used the WIFI under openwrt as a normal client and as an access point. I believe "ad hoc" mode is possible as well.
  • Heater.Heater. Posts: 21,230
    edited 2014-09-05 10:21
    David,
    Don't these routers tend to have USB ports? Can't you plug in a cheap USB memory stick to gain additional program storage space?
    Yes indeed. I believe Loopy has been making use of this on occasion.

    But then we have added expense and complexity and unreliability to the whole idea. Might as well use a Raspberry Pi at that point. An idea which make Loopy shiver :)
  • David BetzDavid Betz Posts: 14,516
    edited 2014-09-05 10:38
    Heater. wrote: »
    David,

    Yes indeed. I believe Loopy has been making us of this on occasion.

    But then we have added expense and complexity and unreliability to the whole idea. Might as well use a Raspberry Pi at that point. An idea which make Loopy shiver :)
    A Raspberry Pi + case + power supply + WiFi adapter + SD card would be more expensive though wouldn't it? And it would still have the WiFi adapter plugged into the USB connector so it might not be any more robust.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-09-05 10:42
    Heater. wrote: »
    Most routers don't have enough FLASH space to add new and interesting stuff, like serving up the Propeller web IDE and doing the compilation.

    Well, both the WR703 and the MR3020 have a USB port that can be used to add upwards to 32Gbyte to the file size with an application called ex-root and a USB thumb drive.

    or...
    You can replace the existing Sram with a larger one, recompile the whole thing to fit the bigger Sram and have it all under one cover. (seems tedious to me).

    ++++++++++

    The main attraction of these devices to me personally was they have the wifi, they have USB that can be expanded to more ports with a bridge, they are about the same price as a Raspberry Pi (but with an enclosure and power supply included and no HDMI, keyboard, or mouse).

    OpenWrt provides a complete listing of all the devices one may choose from. But in all honesty, the WR703 and MR3020 are provided to make this an easier entry point than running through all that shopping and selection process.

    The WR703 has pretty much gone viral as a cheap hack. I have even posted the Ebay ads that sell is with FREE shipping. (Cluso claims to have both a couple out of HK via that route for about $20 and prefers them.) Personally I think the slide switch and the extra LEDs were added to the MR3020 just to justify adding $15USD to the price for pretty much the same thing.. resources available are pretty much the same. And the slide switch and extra LEDs can be ignored in OpenWrt; or configured for your own whims.

    ++++++++++
    Please note, I started this thread to help people that really wanted a wifi Propeller programmer and wifi serial terminal link to Propellers. I am using mine with Forth on the Propeller and delighted.

    BUT....
    You will find that OpenWrt supports endless possiblities and permutations if you are willing to learn more about Linux and the open-source software repositories that are available. OpenWrt even has a version of Python and a version of Forth that can be deployed if that is your heart's desire.

    I have a list of the 'opkg' repository choices for the MR3020 (see the attachment) and the WR703 will like take all the same. There is lots of good stuff and all the software is FREE to those that desire to use it. But please be aware this might be a journey far into Linux and may keep you busy for years.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-09-05 11:03
    BTW, please forgive my near-psychotic disdain of the Raspberry Pi. I have made peace with Heater and don't want to drag down the Forums with that.

    Will I ever get over it? I doubt it. Therapy is expensive and there really aren't any psychiatrist that speak English in Kaohsiung.
  • Cluso99Cluso99 Posts: 18,069
    edited 2014-09-06 01:57
    I find the WR703N to be nice and small. It is easy enough to solder on the TX & RX & GND. The other GPIO may/maynot be s easy. Certainly it is not easy to solder the other ends to the USB power connector, if that's what you want. I have done it to two units without problems. I have a couple of others to play with too, but my time is currently on the P1V.

    BTW heater, what are you using to compile on OpenWRT? On another thread, someone is asking to compile on a Raspberry Pi and I thought you had that running.
  • Heater.Heater. Posts: 21,230
    edited 2014-09-06 02:26
    Cluso,
    ...what are you using to compile on OpenWRT? On another thread, someone is asking to compile on a Raspberry Pi and I thought you had that running.

    I have done all my OpenWRT building on a regular Intel PC running Debian.

    In the same way that the OpenWRT build system cross-compiles for our routers (MIPS based) it can cross-compile for the Raspberry Pi. You just have to run "make menuconfig" and select "Broadcom BCM2708/BCM2835" as the target system. The target profile option then shows "RaspberryPi".

    I have built an image for the raspi that way but have not checked that it actually boots on a Pi yet. However doing that does create a nice cross-compiler for the Pi which can the be used for other things, like compiling a Propeller loader for the Pi.

    I would not even try to build OpenWRT on the Pi. The directory with my OpenWRT sources and builds in it is 28GBytes ! In order to build OpenWRT for a target it first has to build GCC and all the tools and libs for that target. Then it has to build the Linux kernel and everything else. It would take for ever. Well, a day or three.
  • Cluso99Cluso99 Posts: 18,069
    edited 2014-09-06 02:32
    Sorry heater. I didn't word that very well.
    I meant compiling for the propeller. So homespun, bst, SimpleIDE, etc - does any run on the Rpi or a router???
  • Heater.Heater. Posts: 21,230
    edited 2014-09-06 02:59
    Ah, I should have read that more carefully.

    One can compile Spin on the Rasberry Pi with the open source spin compiler, openspin, by Roy Eltham. Just get the sources from here : http://code.google.com/p/open-source-spin-compiler/ and build it on the Pi.

    Or one can use Simple IDE. I can't find my SimpleIDE binaries for the Pi just now. Bill Henning has some though.

    The new PropellerIDE might be a problem. Last I checked it used Qt5 which is a bit of a pain on the Pi.

    Homespun should work on the Pi if one installs mono to run it. I can't remember if I tried Homespun on the Pi but I did have it run on other RAM boards.

    BST is closed source and we only have binaries for Intel machines, no go there.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-09-06 08:36
    @Heater
    My zip files just provide binaries for OpenWrt firmware (two kinds of binaries) and your pi-propeller-loader binary.

    I have NOT included a SPIN to loadable Propeller binary application. I think Cluso was digging for what that is and how it is compiled.

    The firmware binaries in the zips provided, are compiled by me -- not Heater. But I have yet to master cross-compiling other C source code to the WR703 and MR3020. There is a binary mentioned and maybe even provided in the original thread ... but this is getting very deep into the 'Art of cross-compiling C source' on a Linux machine. I also used Debian and the compile run was slow (about a day).

    ++++++++++++
    Too all,
    I am going to try to simply address what to do with the provided zip files.

    1. Buy yourself a WR703 or MR3020.
    2. Familiarize your self with what OpenWrt has to say about firmware installation on your particular device. And be aware that you may have to rename the firmware you want to load because the names are too long for the resident firmware upgrade that comes with TP-Link. Try something with 8 characters.
    3. Load the firmware and reboot
    4. Log on via Telnet, if you can figure out how to do so ( I will explain more to those that ask) and reconfigure wifi and network services to your preference.
    5. Reassign 'opkg' to a good working repository in OpenWrt.
    6. Test 'opkg' by asking for 'opkg update'

    At this point, you pretty much have all the basic services work.

    7. Download 'opkg' packages for FTDI USB services and for 'LuCi'
    8. If you understand how to use SSH (for security), instead of Telnet; create a login password.

    The FTDI USB package will allow you to load propeller binaries via the USB port.
    The SSH (which is an application called Dropbear) also includes a secure file tranfer protocol that will be used to load the WR703 or MR3020 with the pi-propeller-loader software, a Spin to propeller binary compiler, and any propeller binary you desire.

    +++++++++
    So that is an outline of how to get started if anyone is interested.

    I have a fresh, unopened MR3020 here. And I will run through the installation process in parallel with anyone that wants mentoring while doing. Sorry, but it seems that I can't get a WR703 shipped to Taiwan... the usual political nonsense.
  • Heater.Heater. Posts: 21,230
    edited 2014-09-06 09:31
    How to get a Spin compile running on a router running OpenWRT:

    Get yourself set up with a openwrt tool chain. Loopy has the instructions for that.
    I simple followed the instructions on the openwrt website for building openwrt from it sources. That process creates the cross compiler and other tools required.

    Check out the open source spin compiler source code:
    $ git clone https://github.com/reltham/OpenSpin.git
    
    Add the path to the cross opewrt cross compiler to your PATH environment variable.
    export PATH=$PATH:~/openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin
    
    Edit the Makefile in the top directory of the openspin you downloaded. Comment out the lines defining CC and CXX like so:
    #CC=gcc
    #CXX=g++
    
    Change to the openspin directory and build it:
    $ make OS=linux CXX=mips-openwrt-linux-g++
    
    Check that it built the correct thing:
    $ file openspin
    openspin: ELF 32-bit MSB executable, MIPS, MIPS32 rel2 version 1, dynamically linked (uses shared libs), not stripped
    
    Copy that to your MR3020 with scp:
    $ scp openspin yourUserName@xx.xx.xx.xx:
    
    Log into your router with ssh and run it:
    $ ./openspin
    
    You may need to set execute permissions on it first:
    $ chmod +x openspin
    
    That should dump the help text.

    Now, write a web interface for openwrt that can be used to edit Spin code in the browser and send it back to the router for compiling and loading to the Prop. Then we have Kens latest open source project done:)


    Edit: OpenSpin is now in github so changed instructions accordingly.
  • jazzedjazzed Posts: 11,803
    edited 2014-09-06 10:58
    Heater. wrote: »
    The new PropellerIDE might be a problem. Last I checked it used Qt5 which is a bit of a pain on the Pi.


    I changed it to allow using Qt4 libraries last month. You can also make .deb binary packages for it now.


    Also, the latest openspin is hosted on github. The svn repository is no longer maintained IIRC.
  • Heater.Heater. Posts: 21,230
    edited 2014-09-06 11:23
    Jazzed,

    Sounds like I have some rebuilding to do. I making a .deb part of the build process now?

    I managed to totally forget about the switch to git. I do actually have OpenSpin from git here.
  • jazzedjazzed Posts: 11,803
    edited 2014-09-06 11:29
    Heater. wrote: »
    Is making a .deb part of the build process now?

    Added some notes on the main page for you: https://code.google.com/p/easyside/
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-09-07 03:46
    @Heater
    Thanks for the clarification on getting OpenSpin compiled to the WR703 and MR3020 (which CANNOT use the same binaries as the Raspberry Pi -- different architecture).

    My own personal use of my MR3020 pretty much allows me to compile on an ASUS notebook that already has Brad's Spin Too and Simple IDE installed. I suspect that anything compiled on the WR703 or MR3020 can be compiled faster and just loaded into these for a final installation on the Propeller.

    IOW, I can't see the need to actually compile on the WR703 or MR3020 unless you are using a device that won't load an available compiler application. Those may only be smart phones and touch pads. And even then, you have to sort out how you write and edit your source code.

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

    I guess I should do a cross-compile of OpenSpin to provide the binary for WR703 and MR3020. Since the two devices use Antheros AR71xx architecture, they accept the same binaries of applications (other routers and the Raspberry Pi do not --- verify architecture compatibility before using).
  • hinvhinv Posts: 1,255
    edited 2014-09-25 11:00
    Now you can get them already upgraded. You should then be able to do the web site stuff you were discussing.

    http://www.ebay.com/itm/SLBoat-The-TL-WR703N-Mod-64Mbyte-RAM-16Mbyte-Flash-And-TTLout-Inside-MicroUSB-/181078954797?pt=COMP_EN_Routers&hash=item2a2925932d

    Having sold 800+ of them with 100% feedback, looks like they are pretty good at it.
Sign In or Register to comment.