Triggering/Running a PC Program via BASIC Stamp Input
Krisc
Posts: 16
Triggering/Running a PC Program via BASIC Stamp Input
Hi,
I have a project where I want to be able to start or stop a program on a PC via a simple rocker switch. I was referred to use the BASIC stamp. I used one a long time ago but didn't really understand everything. I do have quite a bit of programming experience and understand the language for the stamp but do not know how to go about doing what I want.
Any ideas?
~Krisc
Edit: I have a feeling this went in the wrong forum now that I browsed around a bit. If it is supposed to be in the BASIC forum, I apologize!
Post Edited (Krisc) : 12/1/2005 10:22:46 PM GMT
Hi,
I have a project where I want to be able to start or stop a program on a PC via a simple rocker switch. I was referred to use the BASIC stamp. I used one a long time ago but didn't really understand everything. I do have quite a bit of programming experience and understand the language for the stamp but do not know how to go about doing what I want.
Any ideas?
~Krisc
Edit: I have a feeling this went in the wrong forum now that I browsed around a bit. If it is supposed to be in the BASIC forum, I apologize!
Post Edited (Krisc) : 12/1/2005 10:22:46 PM GMT
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
I have yet to buy a BS since I do not know which will best fit this application. I want multiple switches as well, how would I differ between them on the serial port?
I would send an 8 bit value each time a switch changes, say you have 3 switches that have an off and on position Id create a table like this:
$01 Switch 1 off
$02 Switch 1 on
$03 Switch 2 off
$04 Switch 2 on
$05 Switch 3 off
$06 Switch 3 on
nothing special about the values chosen or the order. Whenever the PC program receives the value $03 it knows that the second rocker switch has been turned off. The table can be expanded for more or less switches, or even multiple position switches.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
www.parallax.com/detail.asp?product_id=27290
http://www.parallax.com/detail.asp?product_id=27291
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
I came up with this wiring diagram. I think it should be correct...
It is relatively simple, and I haven't figured out power to the board yet. It is just the BS2 as well, not the full OEM board.
Post Edited (Krisc) : 12/2/2005 3:28:19 AM GMT
ugh!
Also check out some free schematic drawing programs, as a beginner I would go with http://www.expresspcb.com/·since it is fairly easy to use, and most people are happy with the PCBs the service produces (you dont need to do PCB designing, it also contains a schematic editor). At first it will take you longer laying out schematics using the program, as opposed to drawing them yourself, but with practice you'll find it faster and more legible. After you become more skilled and want to be making professional PCBs we can switch you to a more versatile program (also free) that is more powerful (but also more difficult to learn if you aren't familiar with electronic design).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
Post Edited (Paul Baker) : 12/2/2005 2:47:24 PM GMT
I haven't added the capacitors as I don't know where they go just yet. I am just trying to get used to the program. Pretty nifty it is...
http://www.fairchildsemi.com/ds/LM/LM7805.pdf
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
I am a tad confused about what that says to do... I copied the correct diagram into mine but do not understand if the wire between the capacitors crosses with the ground or if they don't touch it... I though that would cause a short circuit?
I also added an LED into the diagram so I can give some status from the program...
Also, is a 33pf capacitor a 0.33uf capacitor?
You need a current limiting resistor between the LED and P15 (330 - 1000 ohms, 680 would be good.)
Aw, dang. I have the wrong thing then. Here are what the capacitors say and what the container reads.
As for the LED, I didn't add it in...but the LED has a built in resistor and can take 12 volts.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
Maybe everyone will jump on my case for saying so, but you may find that you can go without.·
Ordinarily, on the input I go with a 0.1 uF (usually marked "104"), a 0.01 uF ("103")·will get you there, too; on the output use a 1 uF (electrolytic or tantalum).
[noparse][[/noparse]You'll have to make another trip to RadioShack.· If you decide to go without, I don't see you wrecking anything.]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
I don't understand why the external voltage reg is needed? Can't he just throw the 12V at the VIN pin and let the onboard regulator do it's thing? He wouldn't be supplying any external components with this method so it shouldn't be a high amperage draw.
Also, if the SIN SOUT VSS ATN pins are used to communicate with the computer you'll run into some echoing issues that will have to be dealt with on a PC software basis. I'm not sure if the BS2 sends something if it's echoed or not, I don't think so. But if you ever progress to sending something to the BS2 with the programming port, you'll need to be aware of this.
These switches being used, I would assume have lights on them to indicate status? (Hence the need for the ground, load and supply labels). If this is the case then why would the LED be needed? (No problem if you just want two, just reminding you of the light on the switch. [noparse];)[/noparse]
Also, this project doesn't require the power of a BS2. Depending on what language you are programming, you can get away with doing this all via a parallel port. However, if you ever upgrade to more than 8 switches, or want more power in your application, then you'll have to switch to the BS2, so if you're not going to change this in anyway, I'd suggest looking into the parallel port option. The only problem is that most newer computers don't have a parallel port. [noparse]:([/noparse] You can still purchase PCI cards to add a parallel port. If you're only needing one or two switches, you can actually get away with a serial port. Switching the status lines of the serial port is an option, but it only allows a few switches. I'm not sure offhand how many.
It's much easier to use the Basic Stamp, but cheaper to use the serial port or parallel port directly. It's also much safer to use the Basic Stamp, in terms of frying a parallel or serial port.
My $0.02,
Knight.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-
This message transmitted with 100% recycled electrons.
-=-=-=-=-=-
Gravity doesn't exist. The Earth sucks.
-=-=-=-=-=-
Make a man a fire, and he will be warm for the night.
Light the man on fire, and he will be warm for the rest of his life.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-
What is the problem with using an external regulator? The problem I will run into is that a car battery is dangerous for drawing power from as it fluctuates a lot in voltage and amperage apparently. I just don't want to risk frying the BS2.
It's imperative than you connect the Vss on the stamp with the ground on your PC serial port to communicate successfully.
Copied out of the BS2 FAQ:
You won't need a regulator for this application, as it stands. The BS2 has one built in. However, if you do something more with this project, at some point you will need to get a regulator, if you're going to be powering many other components. Hopefully this may have cleared something up?
Also note... if you do have a external regulator, that outputs at 5V, such as the 7805, then you'll need to power youre BS2 via the VDD pin and NOT the VIN pin. The VDD pin is for constant 5V ONLY... The VIN pin is for 6V to 15V current. If you feed the output of a 7805 into the VIN, it won't work, I don't know what'll happen, but it won't be pretty, probably it just won't work.
Knight.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-
This message transmitted with 100% recycled electrons.
-=-=-=-=-=-
Gravity doesn't exist. The Earth sucks.
-=-=-=-=-=-
Make a man a fire, and he will be warm for the night.
Light the man on fire, and he will be warm for the rest of his life.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
Just want to be sure before I do anything.
Thanks...
Basic Stamp Frequently Asked Questions document should answer all you questions - download it here www.parallax.com/detail.asp?product_id=27290
Hmmm... Ok, I got it all hooked up... but am having trouble getting the program to run. It keeps saying it cannot find the stamp. Any ideas?
edit: Nevermind, I hooked up to the wrong tab on the 12v female plug I think. I will go resolder now.
Ok, now I know the BS is getting power, but the program still says none found.
Post Edited (Krisc) : 12/10/2005 1:43:17 AM GMT
I am using this... http://www.parallax.com/detail.asp?product_id=800-00003
The 12V has to be connected to the VIN pin, NOT the VDD Pin!
Please send a schematic! [noparse]:)[/noparse]
Knight.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-
This message transmitted with 100% recycled electrons.
-=-=-=-=-=-
Gravity doesn't exist. The Earth sucks.
-=-=-=-=-=-
Make a man a fire, and he will be warm for the night.
Light the man on fire, and he will be warm for the rest of his life.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-