Pages: [1] 2   Go Down
Author Topic: Serial communication in first standalone project  (Read 1504 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 24
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm new to the Arduino world and am planning my first standalone project and am wondering how I can most cheaply enable serial communication with a desktop computer.  An FTDI board is out of my price range since I am a grad student and will be giving the end result to my fellow students without charge.

Background and Goal:
My university research lab has an electronic door lock.  Right now, we have a bypass for the lock connected to a push button on one of our desks so that we don't have to drop what we are doing and walk to the door to let visitors in.  Pushing the button closes one of the lock's circuits causing it to unlock.  This is great, but we would like to allow any staff in the lab to unlock the door from their workstation (in case no one is near the button).  I've figured out how to do this using a simple circuit in which a TIP122 NPN transistor closes the lock circuit.

The Problem:
The standalone Atmega328p will need to receive a signal from a PC telling it to raise the pin connected to the TIP122 base to high.  I was planning on following the tutorial for converting a Nokia USB cable (http://www.uchobby.com/index.php/2009/10/04/diy-usb-to-serial-cable-for-3/) for serial communication until I saw that it can only handle 100mA.  The TIP122 datasheet says it can draw 120mA on the base, so this is not an option. 

Are there any other well-known ways of doing cheap (less than $5-$10) PC communication?  Can I use a basic USB to RS232 adapter like this one http://www.ebay.com/itm/3Ft-Translucent-USB-2-0-DB9-RS232-Serial-Converter-Adapter-Cable-3-Feet-/140662645519?pt=LH_DefaultDomain_0&hash=item20c025a30f#ht_2053wt_1392?

Any advice will be greatly appreciated!
Logged

Offline Offline
Edison Member
*
Karma: 5
Posts: 1730
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Just because it can draw 120ma doesn't mean it should or that you have to let it, you should be adding a resistor anyway to limit the current
an arduino pin shouldnot be driven past 30ma anyway,  which enough to trigger a tip 122
mind you the ardunio itself draws about 40ma so you need to add that in there,
and the cheapest I've seen is on ebay so check that out for cables
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 24
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks.  In that case, does adding a resistor (and probably a fuse) seem like it would be a suitable solution?  I imagine  I should do that regardless of what solution I come across.
Logged

nr Bundaberg, Australia
Online Online
Tesla Member
***
Karma: 126
Posts: 8517
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You can use any USB-serial cable I would think. That one has RS232 voltage levels so you would have to deal with that. Otherwise get a standard FTDI cable that has 5v levels.

Another option is to do a stand-alone version of the new Leonardo Arduino, all that will need is a USB cable.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Offline Offline
Newbie
*
Karma: 0
Posts: 24
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks,  I've been thinking about the voltage issue.  I think that what I may do is get a USB to RS232 cable, open it up near the RS232 end, and splice out the USB +5v and ground wires to a JST connector so that I can use them to power the Arduino and TIP122.  My understanding is that the 3.3v the RS232 provides to the data wires will be sufficient for the RX and TX data lines even though it's not enough to power the Arduino or transistor.  Does that sound right?
Logged

0
Offline Offline
Tesla Member
***
Karma: 143
Posts: 9582
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It has been my experience with some of the cheap ebay USB to serial adapters is that they just use 0v-5v and not the spec -12v-+12v.
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

nr Bundaberg, Australia
Online Online
Tesla Member
***
Karma: 126
Posts: 8517
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I think that what I may do is get a USB to RS232 cable, open it up near the RS232 end, and splice out the USB +5v and ground wires to a JST connector
So why not just buy an FTDI cable, that's all done and they have a proper 5v supply.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Offline Offline
Newbie
*
Karma: 0
Posts: 24
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The main reason I haven't just bought an FTDI cable for this is my budget.  I will be donating a couple of these to my colleagues in my lab at school and I am currently on a grad student's income.  The cheapest FTDI cables I have seen are about $15, but these cheap USB to RS232 cables are about $3 shipped.
Logged

nr Bundaberg, Australia
Online Online
Tesla Member
***
Karma: 126
Posts: 8517
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

He he, sorry, I'm retired and not exactly flush but I'd forgotten what it's like to be that short of cash, it's been a while smiley

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Florida
Offline Offline
Sr. Member
****
Karma: 4
Posts: 431
hookedup!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Is the idea here to create a connection from each computer to the unlock mechanism? If so and the computers are on a network, you may consider an Ethernet shield or computer with web server.
Logged

0
Offline Offline
Tesla Member
***
Karma: 143
Posts: 9582
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
but these cheap USB to RS232 cables are about $3 shipped.

So order one.  smiley-roll-blue
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Offline Offline
Newbie
*
Karma: 0
Posts: 24
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I guess I will give one of the cheap ones a shot and see what voltage it's using.  Maybe I'll luck out, or can at least use it for something else.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 24
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is the idea here to create a connection from each computer to the unlock mechanism? If so and the computers are on a network, you may consider an Ethernet shield or computer with web server.

What I plan to do is have a single arduino in the room (or possibly each room) connected to one of the computers which will run a simple server that will authenticate connections from other computers in the room.  That server will then be the one that sends the signal over a serial connection to unlatch the door.
Logged

0
Offline Offline
Tesla Member
***
Karma: 143
Posts: 9582
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

All things considered you might want to consider an RF setup like below.

http://www.electronickits.com/remote_control/rf2.htm
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17294
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The main reason I haven't just bought an FTDI cable for this is my budget.  I will be donating a couple of these to my colleagues in my lab at school and I am currently on a grad student's income.  The cheapest FTDI cables I have seen are about $15, but these cheap USB to RS232 cables are about $3 shipped.

I've used several of the below USB to TTL voltage serial converter cable/modules and they work fine with the Arduino IDE with only a slight mod. Just wire a .1 mfd cap from the DTR pad to the base of the reset pin on the output connector. Then turn the board over and cut the trace that is going to the reset pin. That makes the arduino auto-reset function work and everything functions just fine, and you can't complain about the price.  smiley-wink If you don't require the auto-reset function then no mod at all is reqired.

http://www.ebay.com/itm/USB-2-0-UART-TTL-6PIN-Module-Serial-Converter-CP2102-/370532286388?pt=PCC_Drives_Storage_Internal&hash=item564571ffb4

Lefty
« Last Edit: December 22, 2011, 09:28:54 am by retrolefty » Logged

Pages: [1] 2   Go Up
Jump to: