Getting started
Bj
Posts: 22
Hi
I have now downloaded the editor.
I want my BS1 to connect and disconnect 2 cables
And I'm a beginner, and want to get started. [noparse]:)[/noparse]
I guess the code starts like this
' {$STAMP BS1}
' {$PBASIC 1.0}
and then a command to activate p0?
How to deactivate p0?
When p0 is activated, then cable 1 and 2 connect. Do I need a relay to do this? I guess so
How fast are a relay? Can it connect/disconnect a cable 10-15 times in a secound?
I have now downloaded the editor.
I want my BS1 to connect and disconnect 2 cables
And I'm a beginner, and want to get started. [noparse]:)[/noparse]
I guess the code starts like this
' {$STAMP BS1}
' {$PBASIC 1.0}
and then a command to activate p0?
How to deactivate p0?
When p0 is activated, then cable 1 and 2 connect. Do I need a relay to do this? I guess so
How fast are a relay? Can it connect/disconnect a cable 10-15 times in a secound?
Comments
RadioShack has a nice reed relay that will work: www.radioshack.com/product/index.jsp?productId=2062478&cp=2032058.2032230.2032277&accessories=accessories&custRatings=custRatings&support=support¤tTab=features&parentPage=family&features=features&summary=summary&techSpecs=techSpecs&tab=summary
There is 8 pairs of cables to connect and disconnect. Do I need 8 relays?
I aslo have a switch that connects 2 cables. Is it possible to use that switch to trigger the program?
I looked at this link now, and it looks like the relay have 5 pins. What does the 5.th pin? The 4 others is for ground, p0, cable1 and cable2. When there is voltage on p0, the relay will connect cable 1 and 2.
·
The BS1 only has 8 I/O pins, so it can directly control only 8 devices. There are also overall current limits that prevent you
from activating more than two relays at a time. You may need to use some kind of switching transistor to handle the current.
Look at the Nuts and Volts Column #6 for a discussion on controlling higher amounts of current and there are several columns
on using external devices to expand the number of effective I/O pins.
You probably will need to use something like a BS2 which has 16 I/O pins and quite a bit more program storage than the BS1.
You can use a switch (or several of them) to control the program. Each switch will usually require an I/O pin.
The "What's a Microcontroller?" tutorial downloadable from Parallax shows how to do this and provides coding examples.
Nuts & Volts: www.parallax.com/Resources/NutsVoltsColumns/tabid/272/Default.aspx
Tutorials: www.parallax.com/tabid/535/Default.aspx
The program I want to create will contain about 10 000 commands like HIGH, LOW and PAUSE. It will take about 5 minuttes to run. Does BS1 have good enought storage for that?
The BS1 is not adequate for your task. I suggest you use a BS2p or BS2pe which has much more memory.
The BS2p does not have quite enough memory for 10,000 commands, but would be able to hold your sequencing
information if it's encoded in table form. You may be able to represent one HIGH / LOW / PAUSE sequence in a single byte
depending on the details. You will need to activate the relays using switching transistors or a transistor array like the
ULN2803 described in the Nuts and Volts Column I mentioned.
I strongly suggest you download the tutorial I mentioned and have a look through it. There are other useful tutorials on those
pages. "Basic Analog and Digital" comes to mind. You will need to learn about the Stamps and how to use them effectively.
There's plenty of documentation and sample programs, but you should work through the examples.
http://www.kevinherron.com/images/tomhannu/hw4.jpg
http://www.kevinherron.com/index.php?p=tomhannu
It's not storing any of the command pattern information. That's all on the PC or Mac.
You're welcome to get whatever information you can about his system and try to duplicate
it. That's not what you originally asked.
What kind of relays do you think he use? For me it looks like a double relay.
The BS1 has the ability to transmit to the PC over the same serial link used for programming. There's a Nuts and Volts Column on that subject.
The data has a particular format used by the DEBUG statement. This serial link does not have the ability to transmit data back to the BS1 from
the PC. It's possible to use a separate USB to serial or RS232 to serial logic level converter for such a link. It would require some of the I/O pins
of the BS1 though. Any PC programming language that you're familiar with and supports a serial link (serial port) should be fine.
I don't really see relays in the pictures. Perhaps he's using some kind of solid-state relay, but I can't read the part numbers in the photos.
This deals with interpreting the DEBUG information sent to the PC over the programming serial link.
There's no article on other BS1 to PC links. Look at the Stamp Basic Manual in the chapters on the
SERIN / SEROUT statements for information on connecting I/O pins to an RS232 serial port.
Post Edited (Mike Green) : 8/29/2008 2:46:28 PM GMT
What is "IC"?
I have also just read that there is possible to controll atleast 8 relays with with a paralell cable (LPT-port). I think that will maybe be a better solution for my project.
Do you know how many volt and how many mA a paralellport kable can handle?
The Stamp can't handle more than 50mA total current for the I/O pins. By using a switching
transistor, the Stamp only has to provide enough current to control the transistor. A few mA
is enough for that.
"IC" is an abbreviation for Integrated Circuit
A parallel port interface usually works with 5V logic levels. You will need to get the specifications
for any parallel port interface you are considering to see what the current rating would be. Keep
in mind that there's a separate rating for each individual output and for all the outputs together
just like the Stamp ratings. If your printer port is a standard IEEE1284 port, it can supply 14mA
minimum on each output bit. This may or may not be enough for your relay. You could use a
switching transistor for each relay to handle the current just like on the Stamp.
Post Edited (Mike Green) : 8/30/2008 3:34:25 PM GMT
http://www.radioshack.com/product/index.jsp?productId=2062585
EDIT:
And how to connect a relay or transistor with a wire? Soldering or is there a more easy solution?
Post Edited (Bj
because those are PNP transistors and the ones normally used for this sort of use are NPN transistors (of opposite polarity).
These are essentially the same as shown in the Parallax examples: www.radioshack.com/product/index.jsp?productId=2062586&cp=2032058.2032230.2032279&parentPage=family
Do you know how to solder? If not, search the internet for tutorials on soldering and practice on some scrap wire.
It takes some practice and care to solder properly. I usually use a piece of perforated printed circuit board with
plated and tinned through holes (the holes are coated with copper, then solder or tin). I position the parts so that
I can use the leads to make the connections or I use a separate piece of wire. RadioShack and others sell boards
like this with some printed circuit traces between some of the holes so you can use those for interconnections
instead of wire. They even have one that duplicates the interconnections in a standard breadboard that they sell.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
Shipping costs and international handling fees are often prohibitive for small orders though. You should be able to find dealers
in most large cities who carry the basics.
And I have just painted a nice picture. This is a one button guitarcontroller (just to make it easy).
Here is a picture of the guitarcontrollers circuitry?
When I use my multimeter and put the red cable (connected to V/ohm/mA) to the UP or DN (Down) and the black cable (Connected to COM) to the 2pointed Noname field it shows 1,61v. If i put the red and black oposite, I gor -1,61v. I guess thats means that the 2pointed noname field is ground, so I'm afraid that I can just forget my last idea.
reed relays or sometimes an optocoupler like the 4N26 (www.fairchildsemi.com/ds/4N/4N26-M.pdf)
Since an optocoupler requires only about 10mA, you could run 4 or 5 of them at the same time from a series of I/O
ports. You might be able to run them at a lower current, depending on what has to be controlled.
Given that you don't know what you're connecting with, the reed relays would be the safest solution.
This one from Jameco (www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&storeId=10001&catalogId=10001&productId=1860088)
would work. It has a 5V coil, built in diode for reverse voltage suppression and costs $1 US. Other distributors would carry the
identical relay.
Here's a link to the manufacturer's Norwegian Sales Representative and Distributor: www.hamlin.com/contact-detail.cfm?regionid=12&Territory=Norway. Give them a call. Sometimes they'll send a few free samples to a hobbyist.
You'll still need some cheap NPN switching transistors like the 2N2222 and a 1K resistor for each (to go in series in the base lead).
There are several examples of the proper wiring. Nuts and Volts Column #6 is the best. Go to Parallax's main website, choose
the Resources tab, then choose Nuts and Volts Columns. Find #6 and download it.
Post Edited (Mike Green) : 9/1/2008 10:07:12 PM GMT
Could this transistor work?
https://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&storeId=10001&catalogId=10001&productId=924289&
Could this resistor work?
https://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&storeId=10001&catalogId=10001&productId=1849639&
How about the relays lifetime?
The resistor is exactly what I was intending.
The relay is rated for switching up to 200VDC at currents up to 500mA. The datasheet doesn't say anything about lifetime, but reed relays in general are designed for high speed switching, over 1KHz, and would last years at that rate as long as the current and voltage aren't exceeded.
I have bought a experimentalboard, parallel-cablel, and soldering equipment and I have now soldered everything to the experimentlboard. This is a newbie solderwork, but I think it is good enought and it will do the job.
I did a mistake with pin 17 and 18, because I soldering it together, but I don't need pin17, so I have just cut the wire. My other mistake where that I forget to take my wirestripper off the cable before I started to soldering.
You can see it at the pictures. pin1 to the right and 25 to the left. pin2 and 10 was soldered from the underside.
This picture shows my mistake with the wirestripper.
Thanks for your help and good answeres so far.
I misunderstood how a transistor works, but I think I now understand it.
I have drawn a exaple, and also have some questions.
"Relayground" is this the ground at the relay?
RB means resistor, and I will need to put my 1k resistor here?
Does the ground for the transistor have to be common for the stamp pin and the supply?
Will my example connect wire 1 and wire2?
And I guess this will work the same way if I connect a LPT-pin instead of stamp pin?
Post Edited (Bj