Last time, I installed OpenWRT on the TL-MR3220 router and added a connector for it’s serial interface. Today, I wanted to try and connect this interface to an Arduino to make the two communicate. The router’s interface operates at 3.3V while the Arduino’s UART operates at 5V, so we need to convert between those levels. The cheapest way to do this that I could find is described here. It involves using a 74LS04 hex inverter chip to convert the 3.3V signal up to 5V and two resistors for a simple voltage divider to convert the 5V signal down to 3.3V.
Category Archives: Making and Tinkering
OpenWRT and the Serial Console of the TL-MR3220 Router
The TP-LINK router TL-MR3220 is a very cheap (around €22 in Germany) yet feature-rich wireless 802.11n router that supports the open source OpenWRT firmware. It offers a USB port, allowing a bunch of additional peripheral hardware to be connected. Installing the matching OpenWRT nightly build was easy enough, the original firmware offers to do so using the standard web interface.
I was thinking about connecting one of them to an Arduino in a project to come. The integrated serial interface seems to be the obvious way to achieve this. The router’s board readily exposes the interface, so I added a 4-pin header to do a few tests. The pin-out of the interface is documented in the OpenWRT wiki. Using a standard FTDI adapter I then got access to the router’s serial console. From here it should not be to hard to use the same interface to connect to an Arduino instead.
Seeeduino Stalker: Writing to the SD Card
After I managed to upload the first sketches to the Seeeduino Stalker last week, I was eager to try the special features offered by this special kind of Arduino platform. I decided to try writing to an SD card first and followed the example included in the Stalker’s documentation. Which turned out to not work at all.
A couple of hours later and looking for errors in all the wrong places, I finally managed to find out how to use the FileLogger library:
- The SD card needs to be FAT16 formatted.
- The file that the the Arduino is writing to must exist 615-544-6598 , the library does not create files.
- The file must not be empty, it must contain at least one byte of data.
If these conditions are met, the following tiny sketch will work just fine and append data to the file:
#include "FileLogger.h" void setup(void) { byte buffer[] = "Hello World!"; FileLogger::append("data.txt", buffer, 12); } void loop(void) {}
Update 10/8/12: Please note that this example will work with version 1.0 of the Stalker, only. For newer versions of the board you should try sadfatlib.
Connecting to the Seeeduino Stalker
A few weeks ago, Seeed Studio were celebrating their anniversary with a bunch of limited offers. Among other things, I acquired a pair of Seeeduino Stalkers v1.0 with an Atmega 168. Unfortunately, the serial interface on those boards is not labeled. So it took me a while to figure out how to connect the FTDI breakout board. With a small adapter board, programming the Stalkers with the Arduino IDE now works like a charm. (Select board type “Duemilanove w/ 168”.)
Unboxing the DSO Nano
On Friday, I received a late Christmas present to myself: after about 4 weeks of travel, my DSO Nano finally arrived! A long time, but that’s alright, it didn’t take much longer than I had expected. Also, the current weather conditions are not really fit to speed up delivery times.
The oscilloscope and the few other parts I had ordered were well packaged and thus arrived in excellent condition. Seeed even replaced the spare probes I had ordered with the adapter I would have liked instead, just as they promised. Unfortunately, my time is somewhat limited right now, so I can’t get to thoroughly trying out my new toy right away. All I managed yesterday, was to install the battery and to turn on the DSO. So far, everything seems to be working fine.
Oh, I really like the white box that the DSO is packaged in. Very professional!
Waiting for my DSO Nano
I always wanted my own oscilloscope. Not that I really needed one or missed it more than a couple of times. But you can never have enough tools! What kept me from ordering one or from buying a used one online so far, was not so much the price. It’s the fact that the space I have to keep my tools is somewhat limited. A regular oscilloscope would be yet another big box standing in my way and gathering dust most of the time.
Then, a few month ago, a post on hack-a-day pointed me to Justblair’s review on the DSO Nano. Justblair got his hands on one of the “beta test” models of the DSO Nano, a brand-new pocket-sized digital oscilloscope developed by Seeed Studio. While it has a few limitations and draw-backs, it’s size and the price tag of only $89 do make it a really interesting option. When I checked back two weeks ago, I noticed that Seeed Studio was accepting pre-orders for the final version of the DSO Nano to be shipped on December 10th. So I had to order one.
The probes that come with the DSO Nano are supposed to be rather basic, which is alright at that price. Seeed Studio offers a BNC adapter, allowing standard probes to be connected to the DSO Nano. Unfortunately, the adapter was sold out the day that I placed my order. When it was back in stock a couple of days later, I sent an email, politely asking if they could replace the spare probes that I had ordered with one of those adapters. They are both the same price. My email was answered quickly, and Xiang Fan promised to update my order. Great customer service!
By now, the DSO Nano seems to be ready, and the shipping seems to be in progress. I can’t wait to try it out. But it probably won’t make it all the way to Germany before the beginning of next year. Well, you always need something to look forward to.
Making a XU1541 Cable
I have been documenting interesting software and programming related findings in my own private Wiki for a few years now. This turned out to be really useful in many cases, especially on topics that I would run into only very infrequently. Most of these notes would not be of any interest to anybody else but me, while a few of them might be worth offering to a wider audience. All it would take would be some nice presentation and a little effort to write things down in whole sentences. Or so I thought.
When I began tinkering with electronics again, I soon decided this would be a great excuse to start my own blog, sharing my progress. After my initial enthusiasm had worn off, I soon realized that I had somewhat underestimated this project. It takes a good deal of time and effort to write things down in whole sentences and to present them nicely. As a result, there are a few projects that I finished this year that I failed to put up here so far. Most likely, I have forgotten a lot of interesting details by now. But I’ll try and summarize what I do remember.
Making a XA1541 Cable
As you might have read in my previous post, I retrieved my old Commodore hardware from the attic and found it still working. Even most of the 5 1/4″ floppy disks that I inserted into one of the squeaking 1541 drives seemed still readable. So, I decided this might be the last chance to save those very early lines of code from oblivion that I had written so many years ago. Not that it was really worth it, it’s mostly a matter of principle to not let a single bit of code get lost if I can help it. To convert what was still readable to d64 disk images, I first needed to make a suitable adapter cable.
The XA1541 seemed like a good choice to start. It’s an adapter to connect the Commodore 1541 disk drive to the parallel port of a PC. While there are other solutions, the XA1541 seemed easy enough to build and reported to work with most (all?) parallel ports found in today’s PCs. If there is a parallel port to be found at all. We’ll cover that in a later post on making a XU1541 cable, though.
Also, there are excellent instructions by Stefan Uhlmann on how to make one of these. The page is available in German only but very well illustrated.
All that is needed are two connectors (obviously), a length of shielded wire, four resistors, and four transistors to drive the interface. Just as Stefan suggested, I wanted to fit the active components onto a small piece of prototyping board inside the D-sub casing of the parallel port connector. The first step is to cut the board so that it will fit into the casing while still leaving as much room for the components as possible.
The board fits smoothly between the two rows of the D-sub connector, and the connector is then soldered directly onto the board. The lead-wire spacing of the connector does not match that of the prototyping board, but that doesn’t matter. Only the four left most leads 14-17 of the connector, marked with a green box in the picture, must not be shorted. The other leads 18-25 on this side get all connected to GND anyway.
Next, I placed the four resistors and transistors on the board and fixed their wires with soldering points.
It really helped and saved time to have Stefan’s images as a guideline. Since I placed the components exactly where Stefan did, all I needed to do then was to spread solder onto the copper side of the board until the shiny pattern looked like the one on Stefan’s picture.
Finally, the the leads from the shielded wire are attached and everything gets stuffed into the D-sub connector’s casing. The DIN connector fitting into the Commodore IEC serial bus is soldered to the other end of the cable and we’re all done.
The XA1541 is ready to connect our trusty 1541 drive to our PC. Using a great piece of code called OpenCBM (formerly known as cbm4linux) we are now able to access the data from the 5 1/4 inch disks.