tag:blogger.com,1999:blog-43155893500113836542024-03-19T16:18:36.457-07:00Welding HamstersBreeding super junk from regular junk.mrvasshttp://www.blogger.com/profile/07293056727282181285noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-4315589350011383654.post-69913275995303580682009-11-27T14:23:00.000-08:002009-11-27T15:04:43.853-08:00Card Reader TinkeringSo, I have a habit of collecting electronics that even I can only refer to as "junk." It's even in a big box, labelled "junk." There's around 15kg of it that I just can't bear to leave behind every time I move... Needless to say, much of it consists of equipment pulls and junk I desoldered from old VCRs, microwaves, fridge relays, and such, and these are often sensors or actuators I want to try interfacing. This has turned into a regular hobby and has actually opened up a larger part of the world of electronics for me...<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1n0aSGvRzvnvFMnTE-g-7jm85cWqyGmUELnLNoAaYuDceUYkwerLMTEAdGrwhbVsbqMtHF_SYAZ4PUXRUSCVk4PbiCuG9pnBXM9j533Sfjh35TMp-2SjLrCqCeNpEdgUUwhpLeunQCHSH/s1600/Stripe+Reader+Small.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1n0aSGvRzvnvFMnTE-g-7jm85cWqyGmUELnLNoAaYuDceUYkwerLMTEAdGrwhbVsbqMtHF_SYAZ4PUXRUSCVk4PbiCuG9pnBXM9j533Sfjh35TMp-2SjLrCqCeNpEdgUUwhpLeunQCHSH/s320/Stripe+Reader+Small.JPG" /></a><br />
</div><br />
All that garble aside, I had a Mag-tek 21006505-based Track 2 magnetic card stripe reader sitting around, which I had purchased surplus from <a href="http://www.blogger.com/www.allelectronics.com">All Electronics</a> way back in the day. It's a slide-through system that can be mounted on just about anything flat, and was purchased for ~$4USD... These days, they offer <a href="http://www.allelectronics.com/make-a-store/item/MCR-12/MAGNETIC-CARD-READER/-/1.html">a different model</a> for about the same price, but this one requires the card be inserted into a slot and removed quickly... Coincidentally, <a href="http://hackmiami.org/2008/12/21/magnetic-stripe-card-reader/">Hack Miami made a Sanguino interface program</a> for this particular reader, but I didn't know about this until after my tinkering. Also, Sparkfun has <a href="http://www.sparkfun.com/commerce/product_info.php?products_id=8633">a 3-track RS-232 serial reader</a>, even <a href="http://www.sparkfun.com/commerce/product_info.php?products_id=8634">an expensive USB reader/writer</a>, but I can't say I'm "$60 interested" in this field. $4 for Track 2 is just fine with me. <br />
<br />
So, why did I bother? Well, besides the thing just gathering dust in the Junk Box, who hasn't, at one point, wondered was was on the magnetic cards in their wallet? I had some hope that more interesting things than just the number on the front would be there, and I wasn't disappointed. I don't plan on using this anywhere else, so I just used the Arduino platform to get a quick prototype "sketch" going, reporting the information back through the Serial Port. Rather than just throw the code at you, however, I'll explain what's being read off Track 2, and what resources I used to figure this out...<br />
<br />
<a name='more'></a><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiV40BaO6rsV5_eBylgcL8YL_NKHiNWQzlaryMxn5gCdEPQDdwBBFbuaTQlxO5N_WbT_872kyPbegNLHhvRjHMwLvbaLfwDI7Pi9qV5Pd5K3g-gfmttDHbUfjT57ThwE3PQltlYjNebqYaT/s1600/Reader+Internals+Small.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiV40BaO6rsV5_eBylgcL8YL_NKHiNWQzlaryMxn5gCdEPQDdwBBFbuaTQlxO5N_WbT_872kyPbegNLHhvRjHMwLvbaLfwDI7Pi9qV5Pd5K3g-gfmttDHbUfjT57ThwE3PQltlYjNebqYaT/s320/Reader+Internals+Small.JPG" /></a><br />
</div><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOP67L896t-3xoO0Azq-KuzgX4W7mr3XmjHAInK4j_vKrXL_Rg42OIcWry-JlfhcGhJ9-eZiR6f53mzNz5aC03GmZweD_rODp8LkQQuAAgAU4cGTncvSpDhJO9TeVSu_HxefsJiU_12Dcl/s1600/Reader+Serial+Small.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOP67L896t-3xoO0Azq-KuzgX4W7mr3XmjHAInK4j_vKrXL_Rg42OIcWry-JlfhcGhJ9-eZiR6f53mzNz5aC03GmZweD_rODp8LkQQuAAgAU4cGTncvSpDhJO9TeVSu_HxefsJiU_12Dcl/s320/Reader+Serial+Small.JPG" /></a><br />
</div><br />
Track 2 magnetic cards hold data in an alternating magnetic flux pattern in a strip similar to what is found in cassette tapes. Track 2 is usually used for numerical/banking data, dissimilar to Track 1 or 3 which often contain ASCII data, such as names or personal information. The Mag-tek21006505 reads an analog magnetic sensor, and returns data to a microcontroller at its own speed on three lines: /Data, /Strobe, and /Card Present. The "/" represents "not," which means that the data's logic value is inverted (a "1" is actually a "0", and vice-versa). I got most of what I know from <a href="http://stripesnoop.sourceforge.net/devel/magtek-app.pdf">a nice app note.</a> /Card Present is supposed to go low when... Well, a card is present... But I found it a bit unreliable, and just stuck to reading /Data when /Strobe becomes active, which indicates that the /Data line has a valid data bit. The smart way of doing this is by using an interrupt, but because I was just tinkering and not planning to integrate the code into a system, I just used a polling-based system that wastes cycles waiting for the next /Strobe pulse.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfsibIVWF_3o1kwI7eRAN3zO8rCayfJI03alGABGZpmR4F4b5QAZ6dJmH5u0hYS-2QmK0avL-dhEahNYuD15b6-zBSKLzx0BIRLU3uGrbq2lrOoqEPQz66dkyQEaABNAURZRXfIKHQqheW/s1600/Reader+Header+Small.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfsibIVWF_3o1kwI7eRAN3zO8rCayfJI03alGABGZpmR4F4b5QAZ6dJmH5u0hYS-2QmK0avL-dhEahNYuD15b6-zBSKLzx0BIRLU3uGrbq2lrOoqEPQz66dkyQEaABNAURZRXfIKHQqheW/s320/Reader+Header+Small.JPG" /></a><br />
</div><br />
<br />
The reader uses a RJ-25 plug, which I almost immediately cut off for lack of an interface board. I soldered in a simple right angle header instead, for the inevitable breadboarding this reader would experience. /Data is tied to Digital 3 on the Arduino, /Strobe to Digital 2. /Card Present is ignored, and I tied both the shield and ground cables together to the Arduino ground reference. The power line went directly to the Arduino 5VUSB. The following are the colours of the wires inside versus their function, though you'll probably want to crack it open and verify on the board:<br />
<br />
1 - Brown - /Data<br />
2 - White - /Card Present<br />
3 - green - /Strobe<br />
4 - Black - GND<br />
5 - Red - +5V<br />
6 - None - Cable Shield (should be pretty obvious)<br />
<br />
So, Track 2 has a whole lot of flux reversals before the actual data, interpreted as a whole load of "0" bits from the Mag-tek chip before the real data comes through. Thankfully, the "Start Sentinel" character that precedes any data has a whole lot of "1's," and is easy to identify, and use as a starting point to start counting bits into byte data. Track 2 uses 4 bits with 1 odd parity bit to represent base 10 numbers and a few control characters (field separators and the like). Thanks to an extremely helpful writeup <a href="http://stripesnoop.sourceforge.net/devel/magstripe-ala.pdf">from Acidus</a>, I was able to translate the codes. Unfortunately, I didn't bother with parity checks, and didn't implement all control characters, since it would be a waste to just present the characters without knowing what they mean anyways. Also, I don't use the LRC, which is another weakness, but I have yet to confirm any incorrect information. The code simply reads in the data, throwing out the parity bit, processes it, then displays it on the COM port.<br />
<br />
So here's where I throw the code at you:<br />
<br />
<pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>/* This sketch reads from a Mag-tek 21006505 Card Reader, which looks at track 2. It doesn't check the
parity bit, and is hard-coded to read up to 76 characters. This length is arbitrary and can be
changed by the user, but what is output is processed for field separators and end stops, which
in tests seemed to be a "?>", or a stop sentinel followed by a control signal (see below).
First it takes in data, with timeouts if the stream stops early, then it processes it and
writes it to the serial port at 9600 baud.
Here we present a table of the data bits received versus their char versus their meaning, taken
from the article "Magstripe Interfacing - A Lost Art" by Acidus (avidus@yak.net):
b0 b1 b2 b3 Char
0 0 0 0 0
1 0 0 0 1
0 1 0 0 2
.
.
.
0 0 0 1 8
1 0 0 1 9
0 1 0 1 : (Control)
1 1 0 1 ; (Start Sentinel)
0 0 1 1 < (Control)
1 0 1 1 - (Field Seperator)
0 1 1 1 > (Control)
1 1 1 1 ? (End Sentinel)
These correspond to to binary values, of course, and are treated as decimal values in the code.
Also, please bear in mind /Strobe and /Data are, in fact, inverted logic, so a "0" is effectively
a "1," and is treated as such.
*/
#define notstrobe 2
#define notdata 3
char data[80];
int i, imax, j, k, kmax, timeout, datastart[15], dataend[15];
void setup()
{
Serial.begin(9600);
pinMode(notstrobe, INPUT);
pinMode(notdata, INPUT);
digitalWrite(notdata, HIGH); //Activate Pullups
digitalWrite(notstrobe, HIGH);
// prints title with ending line break
Serial.println("Mag-tek 21006505 Card Reader Interface");
}
void loop()
{
data[0] = 0;
if (!digitalRead(notstrobe)) // If we see the strobe line come down, the data stream starts.
{
while(digitalRead(notdata)) {}; //Wait until leading 0's are gone.
for (j=0;j<76;j++) // Collect 76 characters, just in case
{
data[j] = 0;
for (i=0;i<4;i++) // Take in 4 bits!
{
data[j] |= !digitalRead(notdata)<<i; //Read data while strobe is low
// Serial.print(!digitalRead(notdata));
timeout = 0;
while(!digitalRead(notstrobe) && timeout<500) {timeout++;} // Let strobe go high...
timeout = 0;
while(digitalRead(notstrobe) && timeout<500) {timeout++;} // ...then low again before looping back
}
timeout = 0; // Ditch the parity bit for now by waiting another strobe.
while(!digitalRead(notstrobe) && timeout<500) {timeout++;}
timeout = 0;
while(digitalRead(notstrobe) && timeout<500) {timeout++;}
}
i = 0;
k = 0;
for(j=0;j<76;j++) // Print out the stream
{
if (data[j] == 11)
{
Serial.print("Start Sentinel!\n"); // This announces the start of the datastream
}
else if (data[j] == 13) Serial.print("-"); //This is a field separator, so we'll use a hyphen
else if (data[j] == 15) Serial.print("?"); //This is an End Sentinel
else if (data[j] == 14) Serial.print(">"); //This is a
else if (data[j-1] == 14 && data[j-2] == 15)
{
Serial.print("\nEnd of Card!\n"); //This is supposed to announce the end of the datastream
break;
}
else if (data[j] > 10) // These are not numbers, and can be debugged at the user's leisure
{
Serial.print("\n Not a Number!");
Serial.print(data[j], DEC);
Serial.println();
}
else Serial.print(data[j], DEC); //If it's actually a number, just print it! It's data!
}
}
}
</code></pre><br />
The code worked quite reliably, and I enjoyed pulling my wallet apart for the following minutes. Credit cards are pretty boring, as I expected, containing only confirmation codes after the codes written on the card (which are probably used by the bank to check remote transaction requests), but my BC Driver's License had some really interesting codes appended to it, besides the DL#, expiry, and my birthday, some coinciding possibly with my own personal data, like weight and height. I imagine Track 3 is even more interesting. Most membership cards (i.e. a Roger's Video card) are exactly what is written on the back, exactly the same as the bar code sometimes also found there. Translink Faresavers are pretty interesting, though I'm not sure what is junk and what is actual track data, given the complete mismatch of Track 2 data and what is written on the card itself. I'd like to check out some Translink U-Passes when I get the chance.<br />
<br />
If anybody else comes up with some interesting data, please post it here!<br />
<br />
Some obvious improvements to the current code would include parity checks, LRC checks, and full definition of control codes for those more familiar with them. Arguably less obvious improvements would include making a reader an object with mounted interrupt functions for when /Strobe goes low, to avoid cycles, but to store data that can be accessed when desired... Or perhaps a polling function with an automatic time out... Regardless, some kind of function definition, as opposed to everything vomited into "void loop()."<br />
<br />
If anybody really wants, I can probably make this a library, but I probably don't want to touch interrupts if that's the case, otherwise inexperienced users might get confused when their code has strange microsecond timing errors due to the hardware interrupt.<br />
<br />
Well, I hope somebody finds this code useful!<br />
<br />
Post Script: I apologize for the low quality of this post; I had written a much nicer instruction set prior, but Blogger decided to delete it for some reason during editting when I pressed "ctrl-z", then immediately autosaved and decided to forget its undo history, blocking any further recovery of the post. It was amazing. I now write up and save my posts in Gedit before putting them anywhere near Blogger. Just one more reason I don't trust this whole move to online applications/Operating Systems.mrvasshttp://www.blogger.com/profile/07293056727282181285noreply@blogger.com0tag:blogger.com,1999:blog-4315589350011383654.post-57698867412364983742009-11-24T13:48:00.000-08:002009-11-26T16:54:36.723-08:00Modding a PL-2303-based USB to RS-232 Adapter for TTL SerialSo a while back, user "tytower" on the Adafruit Forums needed a USB to Serial adapter to talk to his serial radio receiver, and was asking about <a href="http://forums.adafruit.com/viewtopic.php?f=25&t=12903">connecting the 5V level system directly to a USB to RS-232 adapter</a>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjB3Wg0uh0HKDTom5r2qnWCY877mMwVqfXOsUnLVYL2pyg_Ml4bZjGhNFx9SJ08UCIxDLzlQUqfIL7QK42akz_TE2rKqs6PgrevPLqqNrhPA1bWe8mHE6EQiPw5CCYgA6L8R1lvoezxSZ0/s1600/USBtoSerialWithCover.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjB3Wg0uh0HKDTom5r2qnWCY877mMwVqfXOsUnLVYL2pyg_Ml4bZjGhNFx9SJ08UCIxDLzlQUqfIL7QK42akz_TE2rKqs6PgrevPLqqNrhPA1bWe8mHE6EQiPw5CCYgA6L8R1lvoezxSZ0/s320/USBtoSerialWithCover.JPG" /></a><br />
</div><br />
<br />
I tried this for kicks on the receiver line of one to get information from an <a href="http://www.arduino.cc/">Arduino Diecimila</a> with the provided example "ASCII Table" sketch. It didn't work. Here's why, and how to hack a PL-2303 based USB to RS-232 adapter for TTL level serial:<br />
<a name='more'></a><br />
<br />
RS-232 is a pretty old standard, and requires transmissions of +12V/-12V for 0/1 binary signals (I've heard +15V/-15V quoted as well), and <a href="http://en.wikipedia.org/wiki/RS-232">can apparently receive as low as +3V/-3V</a>. A key point is that a negative voltage represents a "1," while a positive represents a "0." 0V doesn't technically mean anything, though there may be exceptions in existing hardware outside of RS-232 specification.<br />
<br />
Comparatively, many microcontrollers talk in what some people call "TTL Serial," or "Logic Level Serial," which is the same variations of patterns (5 to 8 bits, with optional start, stop, and parity bits, and optional flow control) in the voltage range of a typical microcontroller. In this case, a "1" is around 2.2-5V, and a "0" is around 0-0.8V. Usually systems output on their power rails for high and low signals for serial, so a 5V microcontroller will usually have 5V "1's" and 0V "0's." <br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnk5s4sBIcqLvcGXHPUvYQ4CQzN_zLK8bHSuddIzVkZV1YnEjMCAaT-TKBtH9N4rWJk5lin6F5h3t2dx_QgonoAu7KTMcJwUr5T9F9L4iXzyr85wG0pyW4DCXEKb0sialPTowF-lN85b66/s1600/Waveforms.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnk5s4sBIcqLvcGXHPUvYQ4CQzN_zLK8bHSuddIzVkZV1YnEjMCAaT-TKBtH9N4rWJk5lin6F5h3t2dx_QgonoAu7KTMcJwUr5T9F9L4iXzyr85wG0pyW4DCXEKb0sialPTowF-lN85b66/s320/Waveforms.png" /></a><br />
</div><br />
<br />
So, hooking up TTL Serial to an RS-232 receiver just doesn't work, since RS-232 expects a negative and positive voltage value for 1 and 0, and the TTL Serial transmitter puts out a positive and zero voltage value for 1 and 0. Conveniently, however, the USB bus itself is 5VDC, and USB to RS-232 adapters typically utilize two chips; one for USB host communication and 3.3V level Logic Level Serial communication, and another for converting those signals to RS-232 levels. This means we can just crack open the adapter and solder in some wires to directly access 3.3V level serial lines that we can use to talk directly to our microcontrollers, or tytower's radio receiver!<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgI9uP3F3E88-4pl8j7TkjKVz0ZArNB8-m2lRr2aX70RB7wxyQqsj1A-DKE6XqQQkz1AFdOdlpsgiYzZLLNxrjf-LPaL2CFyjEX8YDi66hka4fb1nNK8S4woz3bVftita0Q4hDn9JeQh0lM/s1600/USBtoSerialNaked.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgI9uP3F3E88-4pl8j7TkjKVz0ZArNB8-m2lRr2aX70RB7wxyQqsj1A-DKE6XqQQkz1AFdOdlpsgiYzZLLNxrjf-LPaL2CFyjEX8YDi66hka4fb1nNK8S4woz3bVftita0Q4hDn9JeQh0lM/s320/USBtoSerialNaked.JPG" /></a><br />
</div><br />
<br />
The USB to serial adapter we will talk about here is one I grabbed off <a href="http://www.dealextreme.com/details.dx/sku.24512">dealextreme </a>for about $3. You can just take out the screws and force/peel off the plastic housing, which should slide off once you defeat the weak glue holding it in place around the DB-9 connector. The adapter uses the <a href="http://www.prolific.com.tw/eng/Products.asp?ID=88">PL-2303HX,</a> sometimes the PL-2303X USB to serial converter chip. The level conversion chip changes from revision to revision, and we don't really care about it. The following is a diagram of the chip, taken from the <a href="http://www.prolific.com.tw/support/files/%5CIO%20Cable%5CPL-2303HX%5CDocuments%5CDatasheet%5Cds_pl2303HXD_v1.1.pdf">datasheet </a>made available by the manufacturer, <a href="http://www.prolific.com.tw/">Prolific Technology Inc</a>:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjk5Ww2OHrZ7zgUKf2jMHW2pWzQWv5b3HYiyddS-X-qVSF5KFkIDIh7l6fKCwuba-PmZu1iZfQyCIhP0gPPt8kxXP_J8jk1la9aaVmIKvIU2l8b9iJVbXugyA-wboBRieLD9J1UCVtWVNVE/s1600/ChipDiag.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjk5Ww2OHrZ7zgUKf2jMHW2pWzQWv5b3HYiyddS-X-qVSF5KFkIDIh7l6fKCwuba-PmZu1iZfQyCIhP0gPPt8kxXP_J8jk1la9aaVmIKvIU2l8b9iJVbXugyA-wboBRieLD9J1UCVtWVNVE/s320/ChipDiag.jpg" /></a><br />
</div><br />
<br />
<br />
So, from this diagram, it's obvious that we want to tap pins 1 and 5, TXD and RXD, for use in simple serial communication. It can also be wise to link in with the ground signal, so you can link that ground up with your circuit's ground to avoid floating references. Similarly, we can also tap DTR_N, RTS_N, RI_N, DSR_N, DCD_N, and CTS_N, or pins 2, 3, 6, 9, 10, and 11. The pins and contacts are often hard to solder, however, so I would recommend only soldering what you have to to avoid burning the chip or accidentally bridging pins.<br />
<br />
For now, we'll just talk about TX, RX, and GND. In the picture below, convenient (well, as convenient as they seem to get on this board) solder points are mapped out:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjy9r6UL-GtF8zYuTTJcE4icXrlmyFvyia1gSh5RIHgNt6TTKyeNwJ078qna87wrJrN55p8N8-5dqZQSwzlfkaLUnzSLWCTTCbHoFW0tMx0GIpoeLNtZVySns2fat7pWlUCFWchX6-z3llZ/s1600/SolderPointsSmall.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjy9r6UL-GtF8zYuTTJcE4icXrlmyFvyia1gSh5RIHgNt6TTKyeNwJ078qna87wrJrN55p8N8-5dqZQSwzlfkaLUnzSLWCTTCbHoFW0tMx0GIpoeLNtZVySns2fat7pWlUCFWchX6-z3llZ/s320/SolderPointsSmall.png" /></a><br />
</div><br />
For this task, I would recommend one use thin (<28 gage) stranded wire (solid core may not last as long, and be more prone to detach). Be sure to use a lower temperature on your soldering pencil (if you just have a crappy single-temp pencil and are on the cheap, I'd recommend <a href="http://www.adafruit.com/index.php?main_page=product_info&cPath=8&products_id=180">our friend here</a>), and the smallest tip you have. Also, pre-tinning the soldering pencil tip, the stranded wire, and the solder point (or chip pin/pad) are all good ideas, provided you go easy on the solder volume.<br />
<br />
There are plenty of good write-ups on the web on how to solder, and if you're looking for practice, I'd recommend getting some copper desoldering braid and an old VCR, and attempt to desolder various components from the board... It's a great way to learn and understand the liquid and surface tension properties of solder. It's something best learned with time and experience, and isn't easily explained properly.<br />
<br />
Test for connectivity using a multimeter, test to ensure you didn't accidentally create a solder bridge with nearby pins, and you should be good to go. You can grab the <a href="http://www.prolific.com.tw/eng/downloads.asp?ID=31">Windoze PL-2303 driver here</a>, and it should "just work" with the latest Ubuntu. Boot up your favourite 3.3V to 5V microcontroller or serial adapter, connect the "TXD" and "RXD" on the chip to your system's RX and TX (that's right, it's the typical crossover TXD->RX, RXD->TX), start up your favourite serial monitor (hyperterm, putty, gtkterm, realterm, etc.), and watch the magic happen*.<br />
<br />
You may wish to hot glue or epoxy your wires in place once you've verified that the system works, as they may experience a fair bit of abuse in future tinkering. Also, you can cut some holes to work the plastic case back on, but I skipped that step since I didn't really like it to begin with. Alternatively, you can just desolder or chop off the DB-9 connector if you need to fit the assembly into a project box.<br />
<br />
Since these USB to serial converters are cheaper than I can find <a href="http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=768-1007-1-ND">the chips alone in single quantity,</a> and the entire circuit is preconfigured, these may find their way into a few of my projects in the future.<br />
<br />
Good luck!<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6i3gsNG5H1SVt6OnzdzsrZ0XHa3kyM3DzGrZ_Qo_nPxlViISiHAYgCirZy-27QzOmixBqrjeCg_FpON0vrjgxFoaVofG45nN8Av1xvvBCwBXBqOPG67xbCBedlNROC7loB9s707Y_svaP/s1600/USBtoSerialWires.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6i3gsNG5H1SVt6OnzdzsrZ0XHa3kyM3DzGrZ_Qo_nPxlViISiHAYgCirZy-27QzOmixBqrjeCg_FpON0vrjgxFoaVofG45nN8Av1xvvBCwBXBqOPG67xbCBedlNROC7loB9s707Y_svaP/s320/USBtoSerialWires.JPG" /></a><br />
</div><br />
-------------------<br />
<br />
* If the magic does not happen, feel free to comment, and I'll see what I can do. Make sure everything's plugged in, that you can fully trust your other serially-communicating system, i.e. Arduino board, and that the communication bauds, stop bits, start bits, parity, and flow control options are set up correctly. Remember that accidentally reversing the pins should not kill the system, and might be the problem you're having.mrvasshttp://www.blogger.com/profile/07293056727282181285noreply@blogger.com2tag:blogger.com,1999:blog-4315589350011383654.post-34663625258862474922009-10-04T14:00:00.001-07:002009-10-04T21:49:56.003-07:00USB Hub + International Palm Charger = International USB Charger<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhY9wuhstiWQhsauIR7VoaRoGusTF1k1gEEegxD-wS_Y-olSc73zMZ0ZufAIYGYJlwuVqAbS6mGkoe4BqNXPzrbE_sSa1Haz5GzzK6kvvah4csaCwKcE6cvf0_XidUgaq7f76ByxJU3-mV2/s1600-h/Finished.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5388875037626182498" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhY9wuhstiWQhsauIR7VoaRoGusTF1k1gEEegxD-wS_Y-olSc73zMZ0ZufAIYGYJlwuVqAbS6mGkoe4BqNXPzrbE_sSa1Haz5GzzK6kvvah4csaCwKcE6cvf0_XidUgaq7f76ByxJU3-mV2/s320/Finished.jpg" style="cursor: pointer; display: block; height: 240px; margin: 0px auto 10px; text-align: center; width: 320px;" /></a><br />
So, I recently got one of those iThingies, and this, along with the following factors, prompted the creation of an international, multi-port USB charger:<br />
<a name='more'></a><br />
- Those little iKarps won't accept good ol' 5.0V @ 500mA like everything else with USB connectivity<br />
- I'm going to eastern Europe soon, and need a USB charger that works in all the countries I'm visiting<br />
- I try to make all my 5V-charging devices accept mini-B USB cables (Standards are a good thing, especially to a traveler)<br />
<br />
So, I realized that not only do I have a Palm 5.2V @ 500mA AC/DC converter (from a Zire 72s) with interchangeable AC connector heads for every country I'm visiting, but I also have some <a href="http://www.dealextreme.com/details.dx/sku.787">4-port USB hubs</a> from previous needs/projects. I also read on Ladyada's (very inspiring) <a href="http://www.ladyada.net/">website</a> that she was able to get these iParaphernalia to charge from her <a href="http://www.ladyada.net/make/mintyboost/index.html">Minty Boost</a> project using a set of <a href="http://www.ladyada.net/images/mintyboost/mintyboostv2sch.png">100k pullup resistors to the 3V battery input</a>. I'm not so sure this follows <a href="http://www.usb.org/developers/docs/">spec</a>, but if it works I'll go with it.<br />
<br />
So, a picture of the innards as I was working on them:<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYsetkOS_tmfLS8E9AbHSemP-ciYwJ-rbmpSHbILVM2Kpt-pD2i4pntYoooMNohXaTVQaRGwuqtWs1xlDVOobv6641WH3spL25mvcTroFcxgvgUXEw3E1jw586md4CDoxNAkac8Ta-wSQG/s1600-h/HubTop.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5388874893504371170" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYsetkOS_tmfLS8E9AbHSemP-ciYwJ-rbmpSHbILVM2Kpt-pD2i4pntYoooMNohXaTVQaRGwuqtWs1xlDVOobv6641WH3spL25mvcTroFcxgvgUXEw3E1jw586md4CDoxNAkac8Ta-wSQG/s320/HubTop.jpg" style="cursor: pointer; display: block; height: 320px; margin: 0px auto 10px; text-align: center; width: 240px;" /></a><br />
As you can (or perhaps cannot) see, I've simply removed the DC barrel header with some side cutters (I didn't have the correct mating part), cut and stripped the charger leads of the charger cable, and soldered them in to some pretty wide surface mount capacitor leads to provide 5.2V on the USB power bus and connect to the board ground. I used some heat shrink tubing on the cable and attached the cable to the board with some hot glue to try and prevent it from breaking on my trip.<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2PywIJeLTtq9Ww7x9VameAmMF6L5EzNTyyITP5bGkj1msNeOxjc6xrbx0Sn_hrihkJ-e4hK5A80JayWmwNETbFQS7m8QNbPiFos9S29RomsfYXXyyF54k3AGchK8hiQU50CMnhc3JSsek/s1600-h/HubBottom.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5388874768990204594" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2PywIJeLTtq9Ww7x9VameAmMF6L5EzNTyyITP5bGkj1msNeOxjc6xrbx0Sn_hrihkJ-e4hK5A80JayWmwNETbFQS7m8QNbPiFos9S29RomsfYXXyyF54k3AGchK8hiQU50CMnhc3JSsek/s320/HubBottom.jpg" style="cursor: pointer; display: block; height: 320px; margin: 0px auto 10px; text-align: center; width: 240px;" /></a><br />
This is the interesting part. First, I had to remove the hub chip, as it was holding the D+ and D- USB data lines at their typical voltages (0.3-0.7V), which for some reason the iTrash just wouldn't accept. I removed it by using a box cutter to cleave the legs from the surface mount chip. I decided to try the technique LadyAda mentioned for enabling iPod charging, pulling up the D+ and D- lines to 3.0 or so volts with an appropriate current limiting resistor between... Thus, a simple voltage divider was used between the 5V, D+/D-, and ground connections to introduce ~3.3V (which turned out more like 3.6V with the 5.2V input voltage). A simple schematic should explain:<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4QWlf7r4Q-zm0AhPPAtNCQnd9IAk5k9SdKBvl4d20rF0WQ1I5frf6ABjxd8u0k2mysQyhnENGgqC1ys2eRu-SLzs9ZiWHAA0mNAsN1bZaB8oQV40ZuhQ_zAsELgGn6T_YdDqDrNbdy12k/s1600-h/schem.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5388876581704029874" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4QWlf7r4Q-zm0AhPPAtNCQnd9IAk5k9SdKBvl4d20rF0WQ1I5frf6ABjxd8u0k2mysQyhnENGgqC1ys2eRu-SLzs9ZiWHAA0mNAsN1bZaB8oQV40ZuhQ_zAsELgGn6T_YdDqDrNbdy12k/s200/schem.png" style="cursor: pointer; display: block; height: 200px; margin: 0px auto 10px; text-align: center; width: 181px;" /></a><br />
For those who don't know how voltage dividers work, the basics are <a href="http://en.wikipedia.org/wiki/Voltage_divider">here</a>. The basic equation, where R1 is the resistor between the divided voltage and ground, and R2 is the resistance between the divided voltage and the input voltage, is.... Conveniently written on the piece of paper in the second picture above. Awesome!<br />
<br />
So, Vin = Voltage into the bridge = 5.2V, Vout = Voltage out to D+/D- = 3.3V, and I selected R2 as 470k because it's in the 100k region (to only allow a bit of current to carry the signal, just in case) and I have too many of them. Thus R1 ~ 270.6k. I selected 220k, because this is a common resistor value that I have kicking around, and it should bring the voltage to 3.65V max, which is acceptable. Below are some details on how the resistors were soldered in (this was the third set of resistor replacements during testing, so please forgive the poor solder job):<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNa4il0NfJYXmF4r1TApiotiAYeeo0-LK2JvUrnSWd431hyphenhyphengfEc5OrIEAMxA9xzPCoPWpNGTDrL77D9_kaSXoKUNFsglA8kvktGLbDUqfMx5EWiSI7rrz3y00Mt9ZwEdrzdoVflJdmv_QD/s1600-h/ResistorDetail.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5388878871102852002" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNa4il0NfJYXmF4r1TApiotiAYeeo0-LK2JvUrnSWd431hyphenhyphengfEc5OrIEAMxA9xzPCoPWpNGTDrL77D9_kaSXoKUNFsglA8kvktGLbDUqfMx5EWiSI7rrz3y00Mt9ZwEdrzdoVflJdmv_QD/s400/ResistorDetail.jpg" style="cursor: pointer; display: block; height: 350px; margin: 0px auto 10px; text-align: center; width: 400px;" /></a><br />
Currently I'm measuring around 2.95V and 3.02V with 220k resistors. Perhaps I should mention; I also tried 150k and 330k values to check limits, and at 330k (measured 2.55 and 2.44V) the iKvetch did not charge, and at the 3.8V from the 150k the iKarp did charge, but I did not trust the unusually voltages on my data lines.<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4R-2ilwxJX9aqUkgDgVVFmDaKM0iF4-qcnzNIPNUQhzFX6KF88802LvRZxe0POi6mFGMgbQ96fGiVZkM8dQX5S0cIqoIuZGXbyQQ_uPlD2kybbhFqGA-hUaUDMf1f9xw9LYk9lZ3WRkn6/s1600-h/FinishedAlone.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5388883320676545666" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4R-2ilwxJX9aqUkgDgVVFmDaKM0iF4-qcnzNIPNUQhzFX6KF88802LvRZxe0POi6mFGMgbQ96fGiVZkM8dQX5S0cIqoIuZGXbyQQ_uPlD2kybbhFqGA-hUaUDMf1f9xw9LYk9lZ3WRkn6/s400/FinishedAlone.jpg" style="cursor: pointer; display: block; height: 300px; margin: 0px auto 10px; text-align: center; width: 400px;" /></a><br />
The finished product looks OK, and can probably join me on the plane in case I need to charge my Nintendo DS, iKarp, or phone. Naturally, I tested it first with my crappy iShuffle or whatever it's called, then when I felt it worked safely, I moved up to the iHaveATouchScreenAndThinkI'mHotStuff. I hope the adapter works overseas like it claims!<br />
<br />
Oh, and I should note that only the port with the resistors actually works with the iParaphernalia. The other ports work with everything else I own [, which aren't programmed to be pompous jerks like my iSuck].mrvasshttp://www.blogger.com/profile/07293056727282181285noreply@blogger.com3tag:blogger.com,1999:blog-4315589350011383654.post-47838007317991643902009-10-04T13:18:00.000-07:002009-10-04T13:50:54.788-07:00Main Screen Turn On!!<span style="font-family: arial;"></span><span style="font-family: arial;">Well, this piece of karp was supposed to be named something more like "Pressure Drop," owing back to an old name I wanted to call my Nerf gun modding website way back when (as user "Zero Talent"... Ugh), and lending itself to the idea that I'm utilizing this site as a method to get rid of "</span><a style="font-family: arial;" href="http://www.zefrank.com/theshow/archives/2006/07/071106.html">braincrack</a><span style="font-family: arial;">" qua built up mental pressure... But it's probably just going to become overrun with half-baked plans, emo, and excessive ellipses... ... ...</span><br /><br /><span style="font-family: arial;">Aside from that, here's a picture of my camera's guts taking a picture of its own shell as I repair it in my hotel room prior to PAX 2009:</span><br /><br /><a style="font-family: arial;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgi-mHyAPDxXdmJnisihlwacRaQSOqoFFwZEtNKdOATJ2V3sD1nG0DSqyE3nS-8ydUzHXqU9FhcMhx6XaNbC-Zji1MNLJoERMll03myS9lf-1nptRmJm-BSFixAfuHspMLkCcGAr68Lw8g4/s1600-h/CameraGuts.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgi-mHyAPDxXdmJnisihlwacRaQSOqoFFwZEtNKdOATJ2V3sD1nG0DSqyE3nS-8ydUzHXqU9FhcMhx6XaNbC-Zji1MNLJoERMll03myS9lf-1nptRmJm-BSFixAfuHspMLkCcGAr68Lw8g4/s320/CameraGuts.jpg" alt="" id="BLOGGER_PHOTO_ID_5388847887920529842" border="0" /></a>mrvasshttp://www.blogger.com/profile/07293056727282181285noreply@blogger.com1